/* --- Root Variables (for easy themeing) --- */
:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --border-color: #dee2e6;
    --card-bg: #ecedee;
    --shadow: 0 2px 4px rgba(0,0,0,0.05);
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --primary-color: #00aaff;
    --secondary-color: #a0a0a0;
    --border-color: #444444;
    --card-bg: #2b2b2b;
    --shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* --- Global Styles --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding-top: 60px; /* Space for the fixed navbar */
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

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

h1, h2, h3 {
    margin-top: 0;
    color: var(--text-color);
}
b {
    color: var(--primary-color);
}

h2 {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-top: 40px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}
/* --- Global Styles --- */

/* ADD THIS RULE */
html {
    overflow-y: scroll;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /* ...rest of body style... */
}

.image-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr; /* Creates three equal columns */
    gap: 10px;                          /* Optional: Adds 10px of space between images */
  }

  /* Optional: This makes the images fit their grid cell */
  .image-grid img {
    width: 100%;  /* Makes the image fill the column */
    height: auto; /* Maintains the aspect ratio */
  }

/* --- Navbar --- */
.navbar {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}
.navbar .container {
    display: flex;
    justify-content: space-between; /* This separates left/right groups */
    align-items: center;
    height: 60px;
}
.nav-brand {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-color);
}
.nav-brand:hover {
    text-decoration: none;
}

/* Groups for left and right */
.nav-left {
    display: flex;
    align-items: center;
    gap: 20px; /* Space between Brand and Links */
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px; /* Space between Desktop Toggle and Hamburger */
}

/* Desktop Links */
.nav-links {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}
.nav-links li {
    margin-left: 20px;
}
.nav-links a {
    color: var(--secondary-color);
    font-weight: 500;
}
.nav-links a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

/* Toggles (Desktop vs Mobile) */
.theme-toggle-btn,
.nav-toggle { /* Common style for ALL toggles */
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
}

.theme-toggle-mobile-container {
    display: none; /* Hide mobile toggle by default */
}

.nav-toggle {
    display: none; /* Hide hamburger by default */
}

/* --- About / Profile Section --- */
.about-section {
    margin-top: 40px;
    margin-bottom: 40px;
}
.profile-header {
    display: flex;
    align-items: center;
    gap: 30px;
}
.profile-pic {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
}
.profile-info h1 {
    font-size: 2.5rem;
    margin-bottom: 5px;
}
.subtitle {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin: 0;
}
.affiliation {
    font-size: 1.1rem;
    margin: 5px 0 15px;
}
.social-links a {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-right: 15px;
}
.social-links a:hover {
    color: var(--primary-color);
}
.bio-content {
    margin-top: 30px;
}
.interests-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.interests-list li {
    background: var(--card-bg);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}



/* --- Content Sections (Papers, Projects) --- */
.content-section {
    margin-bottom: 40px;
}
.content-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.content-card h3 {
    margin-bottom: 5px;
}
.authors {
    font-style: italic;
    color: var(--secondary-color);
}
.conference {
    font-size: 0.95rem;
    margin-bottom: 15px;
}
.card-links .btn-link {
    display: inline-block;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 5px;
    margin-right: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}
.card-links .btn-link:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    text-decoration: none;
}

/* --- Experience Timeline --- */
.timeline {
    position: relative;
    padding-left: 30px;
    border-left: 2px solid var(--border-color);
}
.timeline-item {
    position: relative;
    margin-bottom: 30px;
}
.timeline-dot {
    position: absolute;
    left: -38px;
    top: 5px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid var(--bg-color);
}
.timeline-content h3 {
    margin-bottom: 5px;
}
.timeline-details {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

/* --- New Rule for Education Timeline Icons --- */
#education .timeline-dot {
    /* Hide the original dot */
    background: transparent;
    border: none; 
}

#education .timeline-dot::before {
    /* Add the grad cap icon */
    content: "\f19d"; /* Font Awesome's grad cap */
    font-family: "Font Awesome 6 Free";
    font-weight: 900; /* Solid 'fas' icon */
    color: var(--primary-color);
    font-size: 1.3rem;
    
    /* Positioning */
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    
    /* This creates the "knockout" effect */
    background: var(--bg-color);
}

/* --- Footer --- */
footer {
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-top: 40px;
}

/* --- Contact Section --- */
.contact-list {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}
.contact-list li {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.05rem;
}
.contact-list i {
    font-size: 1.2rem;
    color: var(--primary-color);
    width: 30px; /* Aligns icons */
    text-align: center;
    margin-right: 15px;
}
.contact-list span {
    color: var(--text-color);
}
.contact-list a {
    color: var(--primary-color);
    font-weight: 500;
}

/* --- New 'View Project' Button Style --- */
.card-links .btn-view {
    background-color: var(--primary-color);
    color: var(--bg-color); /* This will be white in light mode */
}
.card-links .btn-view:hover {
    background-color: #0056b3; /* A darker shade of blue */
    border-color: #0056b3;
}


/* --- Project Page Styles (for project1.html) --- */
.project-header {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
}
.project-header h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
}
/* We can re-use the .subtitle class from the main page */

.project-content {
    margin-top: 30px;
}
.project-content img {
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 10px 0 30px 0;
    width: 100%;
}
.project-content p, .project-content li {
    font-size: 1.1rem;
    line-height: 1.7;
}
.back-link {
    display: inline-block;
    margin-top: 40px;
    font-weight: 500;
}
.back-link i {
    margin-right: 5px;
}

/* --- View All Projects Button (on homepage) --- */
.view-all-container {
    text-align: center;
    margin-top: 30px;
}
.btn-view-all {
    padding: 10px 25px;
    font-size: 1.1rem;
    font-weight: 500;
    background-color: var(--card-bg);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}
.btn-view-all:hover {
    background-color: var(--primary-color);
    color: var(--bg-color);
    text-decoration: none;
}


/* --- All Projects Page (projects.html) --- */
.page-header {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
}
.page-header h1 {
    font-size: 2.8rem;
}

/* This creates the new grid layout */
.project-grid {
    display: grid;
    /* This makes it responsive: it creates columns that are at 
       least 300px wide, and fits as many as possible */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

/* --- New 'Cite' Button Style --- */
.btn-cite {
    font-style: italic;
    color: var(--secondary-color);
    border-color: var(--border-color);
}
.btn-cite:hover {
    background: var(--card-bg);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* --- Citation Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex; /* Changed from 'none' to 'flex' when active */
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal-content {
    background: var(--bg-color);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 700px;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    color: var(--secondary-color);
    background: none;
    border: none;
    cursor: pointer;
}
.modal-close:hover {
    color: var(--text-color);
}
.modal-content h3 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}
.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}
.modal-tab-btn {
    padding: 10px 15px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: var(--secondary-color);
}
.modal-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}
.modal-tab-panel {
    display: none; /* Hidden by default */
}
.modal-tab-panel.active {
    display: block; /* Shown when active */
}
.modal-tab-panel pre {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 15px;
    white-space: pre-wrap;     /* Wraps the text */
    word-wrap: break-word;     /* Breaks long words */
    max-height: 300px;
    overflow-y: auto;
}
.modal-tab-panel code {
    font-family: "Courier New", Courier, monospace;
    font-size: 0.9rem;
}
/* --- New 'Copy' Button in Modal --- */
.btn-copy-cite {
    display: block;
    margin-left: auto; /* Aligns button to the right */
    margin-top: 10px;
    background: var(--card-bg);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 5px 15px;
    border-radius: 5px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.btn-copy-cite:hover {
    background: var(--primary-color);
    color: var(--bg-color);
}
.btn-copy-cite:active {
    transform: translateY(1px);
}

/* The .content-card style we already wrote will apply to the grid items! */

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    /* Hide desktop nav links */
    .nav-links {
        display: none; 
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 60px;
        left: 0;
        background: var(--bg-color);
        border-bottom: 1px solid var(--border-color);
    }
    /* Show mobile menu when active */
    .nav-links.active {
        display: flex;
    }
    .nav-links li {
        margin: 0;
        text-align: center;
    }
    .nav-links a {
        display: block;
        padding: 15px;
    }

    /* Toggle Swapping Logic */
    #theme-toggle-desktop {
        display: none; /* Hide desktop toggle on mobile */
    }

    .theme-toggle-mobile-container {
        display: flex; /* Show mobile toggle IN THE MENU */
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px;
        border-bottom: 1px solid var(--border-color);
    }
    .theme-toggle-mobile-container label {
        color: var(--secondary-color);
        font-weight: 500;
    }
    
    .nav-toggle {
        display: block; /* Show hamburger icon on mobile */
    }
    /* --- Mobile Profile Layout --- */
    .profile-header {
        flex-direction: column; /* Stacks the picture on top of the info */
        gap: 20px;
    }

    .profile-info {
        /* This centers the text and icons under the picture */
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .profile-pic {
        /* Make the picture a bit smaller on mobile */
        width: 200px;
        height: 200px;
    }
}