/* CSS Variables for Light Mode */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent: #2c5aa0;
    --accent-hover: #234780;
    --border: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.1);
    --tag-bg: #e7f0ff;
    --tag-text: #2c5aa0;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e9ecef;
    --text-secondary: #adb5bd;
    --accent: #5b9dd9;
    --accent-hover: #7db5e3;
    --border: #495057;
    --shadow: rgba(0, 0, 0, 0.3);
    --tag-bg: #2d3e50;
    --tag-text: #7db5e3;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navigation */
.navbar {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.nav-logo:hover {
    color: var(--accent);
}

.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.theme-toggle:hover {
    color: var(--accent);
}

.sun-icon,
.moon-icon {
    transition: opacity 0.3s ease;
}

[data-theme="light"] .moon-icon,
[data-theme="dark"] .sun-icon {
    display: none;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 3px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem 2rem 2rem;
    background-color: var(--bg-primary);
    min-height: calc(100vh - 200px);
}

/* Bio Section */
.bio-section {
    margin-bottom: 2.5rem;
}

.bio-header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2rem;
    align-items: flex-end;
    margin-bottom: 2rem;
}

.bio-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: flex-end;
    height: 100%;
}

.profile-image {
    width: 250px;
    height: 250px;
    border-radius: 8px;
    object-fit: cover;
}

.bio-intro {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bio-intro h1 {
    font-size: 2.125rem;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
    color: var(--text-primary);
}

.bio-intro p {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    text-align: justify;
    font-size: 0.8125rem;
    line-height: 1.5;
}

/* Research Section */
.research-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.research-section h2 {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.research-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-width: 280px;
}

.topic {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    line-height: 1.3;
}

.topic:hover {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Home Content Grid */
.home-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1rem;
}

/* Sections */
.highlighted-section,
.recent-talks-section {
    margin-bottom: 0;
}

h1, h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

.highlighted-section h2,
.recent-talks-section h2 {
    margin-bottom: 0.5rem;
}

.bio-intro h1 {
    font-size: 1.75rem;
}

/* See More Button */
.see-more-container {
    margin-top: 1rem;
    text-align: center;
}

.see-more-button {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 400;
    transition: all 0.3s ease;
}

.see-more-button:hover {
    background-color: var(--border);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* Publications and Talks Lists */
.publication-list,
.talks-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 900px;
}

.publication-item,
.talk-item {
    background-color: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    border-left: 2px solid var(--accent);
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px var(--shadow);
    position: relative;
}

.publication-item:hover,
.talk-item:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 4px var(--shadow);
}

.publication-item h3,
.talk-item h3 {
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
    padding-right: 2.5rem;
    line-height: 1.3;
}

.authors,
.talk-venue {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    padding-right: 3.5rem;
}

.description,
.date,
.talk-date {
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.description {
    padding-right: 3.5rem;
}

.date,
.talk-date {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.8rem;
}

/* Date and Tags Line */
.date-tags-line {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.tag {
    background-color: var(--tag-bg);
    color: var(--tag-text);
    padding: 0.15rem 0.45rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* PDF Button/Icon */
.pdf-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background-color: transparent;
    color: var(--accent);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.pdf-button:hover {
    color: var(--accent-hover);
    transform: scale(1.15);
}

.pdf-button::before {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c5aa0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'%3E%3C/path%3E%3Cpolyline points='14 2 14 8 20 8'%3E%3C/polyline%3E%3Cline x1='16' y1='13' x2='8' y2='13'%3E%3C/line%3E%3Cline x1='16' y1='17' x2='8' y2='17'%3E%3C/line%3E%3Cpolyline points='10 9 9 9 8 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* PDF icon in dark mode */
html[data-theme="dark"] .pdf-button::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'%3E%3C/path%3E%3Cpolyline points='14 2 14 8 20 8'%3E%3C/polyline%3E%3Cline x1='16' y1='13' x2='8' y2='13'%3E%3C/line%3E%3Cline x1='16' y1='17' x2='8' y2='17'%3E%3C/line%3E%3Cpolyline points='10 9 9 9 8 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* DOI Button/Icon */
.doi-button {
    position: absolute;
    top: 3.5rem;
    right: 0.75rem;
    background-color: transparent;
    color: var(--accent);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.doi-button:hover {
    color: var(--accent-hover);
    transform: scale(1.15);
}

.doi-button::before {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    background-image: url("pictures/doi_light.png");
    background-size: contain;
    background-repeat: no-repeat;
}

/* DOI icon in dark mode */
html[data-theme="dark"] .doi-button::before {
    background-image: url("pictures/doi_dark.png");
}

/* Preprint Badge */
.preprint-badge {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background-color: rgba(255, 165, 0, 0.15);
    color: #d97706;
    padding: 0.15rem 0.4rem;
    border-radius: 2px;
    font-size: 0.6rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    z-index: 1;
    border: 1px solid rgba(255, 165, 0, 0.3);
}

html[data-theme="dark"] .preprint-badge {
    background-color: rgba(255, 140, 0, 0.15);
    color: #fb923c;
    border: 1px solid rgba(255, 140, 0, 0.3);
}

/* Filter Wrapper and Container */
.filter-wrapper {
    margin-bottom: 1.5rem;
    max-width: 900px;
}

.filter-label {
    display: block;
    font-weight: 600;
    margin: 0 0 0.2rem 1rem;
    color: var(--text-primary);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-container {
    background-color: var(--bg-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    box-shadow: 0 1px 2px var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tag-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.search-box {
    width: 100%;
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.search-box:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.1);
}

.search-box::placeholder {
    color: var(--text-secondary);
}

.tag-filter-button {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.tag-filter-button:hover {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

.tag-filter-button.active {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

.tag-filter-button.clear-all {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--border);
    font-weight: 400;
    text-transform: lowercase;
}

.tag-filter-button.clear-all:hover {
    background-color: var(--text-secondary);
    color: var(--bg-primary);
}

/* Legacy filter select (hidden by default) */
#tagFilter {
    display: none;
}

/* Contact Section */
.contact-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    max-width: 900px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background-color: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    box-shadow: 0 1px 2px var(--shadow);
}

.info-icon {
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 0.15rem;
    width: 18px;
    height: 18px;
}

.info-item p {
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.info-item a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.85rem;
}

.info-item a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.map-container {
    grid-row: 1 / -1;
    grid-column: 2;
}

.map-container iframe {
    width: 100%;
    height: 100%;
    min-height: 300px;
    border-radius: 4px;
    border: none;
}

/* Links Section */
.links-section {
    background-color: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    box-shadow: 0 1px 2px var(--shadow);
}

.links-section h2 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.home-links-section {
    margin-bottom: 0.75rem;
}

.social-links-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

/* Smaller social links for home page */
.home-social-link {
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
    border-radius: 12px;
}

.home-social-link .link-icon {
    width: 10px;
    height: 10px;
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 20px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-size: 0.75rem;
}

.social-link:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border);
    transform: translateY(-1px);
    box-shadow: 0 2px 3px var(--shadow);
}

.social-link svg,
.social-link img {
    color: var(--text-primary);
    fill: var(--text-primary);
}

.link-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.social-link img.link-icon {
    object-fit: contain;
}

/* Theme-based icon switching for IT and ResearchGate icons */
/* Light mode - show light icons, hide dark icons */
html[data-theme="light"] .it-icon-dark,
html[data-theme="light"] .rg-icon-dark {
    display: none;
}

html[data-theme="light"] .it-icon-light,
html[data-theme="light"] .rg-icon-light {
    display: inline-block;
}

/* Dark mode - show dark icons, hide light icons */
html[data-theme="dark"] .it-icon-dark,
html[data-theme="dark"] .rg-icon-dark {
    display: inline-block;
}

html[data-theme="dark"] .it-icon-light,
html[data-theme="dark"] .rg-icon-light {
    display: none;
}

/* Default state (no theme attribute or light theme) */
html:not([data-theme]) .it-icon-dark,
html:not([data-theme]) .rg-icon-dark {
    display: none;
}

html:not([data-theme]) .it-icon-light,
html:not([data-theme]) .rg-icon-light {
    display: inline-block;
}

/* Footer */
footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 4rem;
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        left: 0;
        top: 70px;
        flex-direction: column;
        background-color: var(--bg-secondary);
        width: 100%;
        text-align: center;
        box-shadow: 0 10px 27px var(--shadow);
        padding: 2rem 0;
        gap: 1rem;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .nav-menu.active {
        opacity: 1;
        pointer-events: auto;
    }

    .nav-link.active::after {
        display: none;
    }

    .bio-header {
        grid-template-columns: 1fr;
        text-align: center;
        align-items: center;
        gap: 0.5rem;
    }

    .bio-content {
        grid-template-columns: 1fr;
        align-items: center;
        gap: 1.5rem;
    }

    .home-content-grid {
        grid-template-columns: 1fr;
    }

    .profile-image {
        width: 65%;
        max-width: 65%;
        height: auto;
        margin: 0 auto;
    }

    .bio-intro {
        order: 1;
    }

    .research-section {
        order: 2;
        width: 100%;
    }

    .research-topics {
        max-width: 100%;
    }

    .bio-intro p {
        text-align: left;
    }

    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .social-links {
        grid-template-columns: 1fr;
    }

    .contact-section {
        gap: 2rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .nav-container {
        padding: 1rem;
    }

    .container {
        padding: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    footer,
    .theme-toggle,
    .pdf-button,
    .doi-button,
    .filter-container {
        display: none;
    }

    body {
        background-color: white;
        color: black;
    }

    .publication-item,
    .talk-item,
    .info-item {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
