:root {
    /* Light mode colors */
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #3498db;
    --background-color: #f5f7fa;
    --card-background: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --timeline-color: #3498db;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --hover-color: #f0f0f0;
}

.dark-mode {
    /* Dark mode colors */
    --primary-color: #f0f0f0;
    --secondary-color: #2980b9;
    --accent-color: #3498db;
    --background-color: #121212;
    --card-background: #1e1e1e;
    --text-color: #f0f0f0;
    --text-light: #b0b0b0;
    --border-color: #333333;
    --timeline-color: #2980b9;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --hover-color: #2c2c2c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Language Toggle */
.language-toggle {
    position: fixed;
    top: 30px;
    right: 80px;
    z-index: 1000;
    display: flex;
    background-color: var(--card-background);
    border-radius: 20px;
    box-shadow: 0 2px 10px var(--shadow-color);
    overflow: hidden;
}

.language-toggle button {
    border: none;
    background: none;
    padding: 8px 15px;
    cursor: pointer;
    font-weight: bold;
    color: var(--text-color);
    transition: background-color 0.3s;
}

.language-toggle button.active {
    background-color: var(--secondary-color);
    color: white;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 30px;
    right: 25px;
    z-index: 1000;
}

#theme-toggle-btn {
    background-color: var(--card-background);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px var(--shadow-color);
    color: var(--text-color);
    transition: background-color 0.3s;
}

#theme-toggle-btn:hover {
    background-color: var(--hover-color);
}


.light-mode .fa-sun {
    display: block;
}

.light-mode .fa-moon {
    display: none;
}

.dark-mode .fa-moon {
    display: block;
}

.dark-mode .fa-sun {
    display: none;
}

/* Language Display */
.lang-en {
    display: none;
}

body.en .lang-en {
    display: block;
}

body.en .lang-vi {
    display: none;
}

/* Header */
header {
    margin-bottom: 30px;
    padding: 30px;
    background-color: var(--card-background);
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.profile-container {
    display: flex;
    align-items: center;
    gap: 30px;
}

.profile-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid var(--secondary-color);
}

.profile-image {
    display: block !important;
    visibility: visible !important;
    width: 150px;
    height: 150px;
}

.profile-image img {
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    height: auto !important;
    opacity: 1 !important;
}


.profile-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--secondary-color);
    color: white;
    font-size: 60px;
}

.profile-info h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.job-title {
    font-size: 1.5rem;
    color: var(--secondary-color);
    font-weight: 500;
}

/* Sections */
section {
    margin-bottom: 40px;
    padding: 25px;
    background-color: var(--card-background);
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

section h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

section h2 i {
    color: var(--secondary-color);
}

.content {
    padding: 0 10px;
}

.content p {
    margin-bottom: 15px;
}

/* Personal Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.info-item i {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-top: 5px;
}

.info-item h3 {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.info-item p {
    font-size: 1.1rem;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 2px;
    background-color: var(--timeline-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
}

.timeline-dot {
    position: absolute;
    left: -39px;
    top: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    border: 3px solid var(--card-background);
}

.timeline-content {
    padding-bottom: 20px;
}

.timeline-content h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 500;
    margin-bottom: 10px;
}

.timeline-content ul {
    margin-top: 10px;
    padding-left: 20px;
}

.timeline-content li {
    margin-bottom: 5px;
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.skill-category h3 {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
}

.skill-category ul {
    list-style-type: none;
}

.skill-category li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
}

.skill-category li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--secondary-color);
}

/* References */
.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.reference-item {
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    background-color: var(--hover-color);
    transition: transform 0.3s;
}

.reference-item:hover {
    transform: translateY(-5px);
}

.reference-item h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.reference-item p {
    margin-bottom: 5px;
}

.reference-item i {
    color: var(--secondary-color);
    margin-right: 5px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 50px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .profile-container {
        flex-direction: column;
        text-align: center;
    }

    .info-grid,
    .skills-grid,
    .reference-grid {
        grid-template-columns: 1fr;
    }

    .language-toggle,
    .theme-toggle {
        /* Ensure they remain fixed to float */
        /* position: fixed; is inherited, no need to redeclare unless changing from another value */
        top: 15px;
        /* Adjusted for smaller screens */
        /* z-index: 1000; is also inherited */
    }

    .language-toggle {
        right: 65px;
        /* Adjusted for smaller screens, e.g., 15px (theme) + 35px (theme width) + 15px (gap) */
    }

    .theme-toggle {
        right: 15px;
        /* Adjusted for smaller screens */
    }

    .container {
        padding: 10px;
    }

    section {
        padding: 15px;
    }
}

/* Print Styles */
@media print {
    body {
        background-color: white;
        color: black;
    }

    .language-toggle,
    .theme-toggle {
        display: none;
    }

    section {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .container {
        max-width: 100%;
    }
}

/* === Projects Section Enhancement === */
.projects {
    margin-bottom: 30px;
}

.projects h2 {
    margin-bottom: 25px;
    /* color: var(--heading-color, #333); */
    /* Optional: if you have a specific heading color */
}

.project-item.card {
    background-color: var(--card-background, #fff);
    /* Fallback to white if --card-background is not defined */
    border: 1px solid var(--border-color, #e0e0e0);
    /* Fallback to light gray */
    border-radius: 8px;
    padding: 20px 25px;
    /* More padding */
    margin-bottom: 30px;
    /* Increased space between cards */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    /* Softer, more modern shadow */
    transition: box-shadow 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.project-item.card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-5px);
    /* Slightly more lift on hover */
}

.project-header {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    /* Vertically align title and status */
    gap: 10px;
    /* Space between title and status if they are on the same line */
}

.project-title {
    font-size: 1.35em;
    /* Adjusted for balance */
    font-weight: 600;
    /* Bolder title */
    color: var(--secondary-color);
    /* A strong but not overly bright color */
    margin: 0;
    /* Reset margin */
    flex-grow: 1;
    /* Allow title to take available space */
}

/* Ensure VI and EN titles are displayed correctly based on language toggle */
.project-title.lang-vi,
.project-title.lang-en {
    margin-bottom: 0;
    /* Remove bottom margin if any from h3 default */
}


.project-status {
    font-size: 0.85em;
    font-style: italic;
    color: var(--secondary-text-color, #7f8c8d);
    background-color: var(--subtle-highlight-bg, #f4f6f7);
    padding: 4px 10px;
    border-radius: 12px;
    /* Pill shape */
    font-weight: 500;
}

.project-description {
    font-size: 0.95em;
    /* Slightly smaller for balance */
    line-height: 1.65;
    color: var(--text-color, #34495e);
    margin-bottom: 18px;
}

.project-features {
    margin-bottom: 20px;
}

.project-features .features-title {
    font-size: 1.05em;
    /* Slightly smaller than project title */
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 12px;
    display: block;
    border-left: 3px solid var(--secondary-color);
    /* Accent line */
    padding-left: 10px;
}

/* Ensure VI and EN titles are displayed correctly based on language toggle */
.project-features .features-title .lang-vi,
.project-features .features-title .lang-en {
    display: inline;
}


.project-features ul {
    list-style-type: none;
    /* Remove default bullets */
    padding-left: 5px;
    /* Align with title's padding-left */
    margin-top: 0;
}

.project-features ul li {
    margin-bottom: 8px;
    font-size: 0.9em;
    position: relative;
    padding-left: 20px;
    /* Space for custom bullet */
}

.project-features ul li::before {
    content: "▹";
    /* Custom bullet, or use FontAwesome icon */
    position: absolute;
    left: 0;
    top: 0;
    color: var(--accent-color, #3498db);
    /* Accent color for bullet */
    font-weight: bold;
}

.project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color-light, #ecf0f1);
}

.action-btn,
.action-note {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    /* Slightly larger buttons */
    border-radius: 6px;
    /* Softer corners */
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.25s ease-in-out;
    border: 1px solid transparent;
    /* For consistent sizing and hover effects */
}

.action-btn i,
.action-note i {
    margin-right: 8px;
    font-size: 1.1em;
    /* Slightly larger icons */
}

.action-btn.github {
    background-color: #24292e;
    /* Official GitHub dark */
    color: #ffffff;
    border-color: #24292e;
}

.action-btn.github:hover {
    background-color: #3e444a;
    border-color: #3e444a;
    transform: translateY(-2px);
}

.action-btn.video {
    background-color: #3498db;
    /* YouTube Red */
    color: #ffffff;
    border-color: #3498db;
}

.action-btn.video:hover {
    background-color: #3498db;
    border-color: #3498db;
    transform: translateY(-2px);
}

.action-note.closed-source {
    color: var(--secondary-text-color, #7f8c8d);
    background-color: var(--subtle-bg-color, #f8f9fa);
    border: 1px solid var(--border-color, #e0e0e0);
    padding: 9px 16px;
}

.action-note.closed-source i {
    color: var(--secondary-text-color, #7f8c8d);
}