/* CSS Variables for Theme */
:root {
    /* Light Theme (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --accent-primary: #2563eb;
    --accent-secondary: #3b82f6;
    --accent-hover: #1d4ed8;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --timeline-line: #dee2e6;
    --timeline-dot: #2563eb;
    --publication-bg: #f8f9fa;
    --link-color: #2563eb;
    --link-hover: #1d4ed8;
    --quote-bg: #f0f7ff;
    --quote-border: #2563eb;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-primary: #60a5fa;
    --accent-secondary: #3b82f6;
    --accent-hover: #93c5fd;
    --border-color: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --card-bg: #1e293b;
    --timeline-line: #475569;
    --timeline-dot: #60a5fa;
    --publication-bg: #1e293b;
    --link-color: #60a5fa;
    --link-hover: #93c5fd;
    --quote-bg: #1e3a5f;
    --quote-border: #60a5fa;
}

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

html {
    scroll-behavior: smooth;
}

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

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    padding-top: 5rem;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 999;
    box-shadow: 0 2px 10px var(--shadow-color);
}

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

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

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

.nav-link {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--accent-primary);
    background-color: var(--bg-secondary);
}

.nav-link.active {
    color: var(--accent-primary);
    background-color: var(--bg-secondary);
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.theme-toggle:hover {
    transform: scale(1.1);
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

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

/* Header Section */
.header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

.profile-info {
    flex: 1;
}

.name {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.name-cn {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.title {
    font-size: 1.25rem;
    color: var(--accent-primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

.affiliation {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.affiliation a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.affiliation a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.email {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.email a {
    color: var(--link-color);
    text-decoration: none;
}

.email a:hover {
    text-decoration: underline;
}

/* Social Links */
.social-links {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.social-link:hover {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
}

.social-link svg {
    width: 20px;
    height: 20px;
}

/* Quote */
.quote {
    font-style: italic;
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    background-color: var(--quote-bg);
    border-left: 4px solid var(--quote-border);
    border-radius: 0 8px 8px 0;
    margin-top: 1rem;
}

/* Profile Photo */
.profile-photo {
    flex-shrink: 0;
}

.photo {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow-color);
    transition: transform 0.3s ease;
}

.photo:hover {
    transform: scale(1.02);
}

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

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-primary);
}

.section-content {
    padding-left: 0.5rem;
}

.subsection-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 1rem 0;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

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

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.5rem;
    width: 10px;
    height: 10px;
    background-color: var(--timeline-dot);
    border-radius: 50%;
    transform: translateX(-4px);
}

.timeline-content {
    padding-left: 0.5rem;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timeline-title {
    font-weight: 500;
    color: var(--text-primary);
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Research List */
.research-list {
    list-style: none;
    padding-left: 0;
}

.research-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.research-list li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
}

/* Publication Item */
.publication-item {
    background-color: var(--publication-bg);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.publication-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.publication-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.publication-authors {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.publication-venue {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.75rem;
}

.publication-links {
    display: flex;
    gap: 0.75rem;
}

.pub-link {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--accent-primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pub-link:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.pub-link.disabled {
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Research Area */
.research-area {
    margin-bottom: 2rem;
}

.research-item {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border-color);
}

.research-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.research-item p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.research-details {
    list-style: none;
    padding-left: 0;
}

.research-details li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.research-details li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: bold;
}

/* Awards List */
.awards-list {
    list-style: none;
    padding-left: 0;
}

.awards-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.awards-list li::before {
    content: '🏆';
    position: absolute;
    left: 0;
}

/* Teaching */
.teaching-course {
    margin-bottom: 0.5rem;
}

.teaching-list {
    list-style: none;
    padding-left: 0;
}

.teaching-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.teaching-list li::before {
    content: '📅';
    position: absolute;
    left: 0;
}

/* Professional */
.professional-item {
    margin-bottom: 1.5rem;
}

.professional-list {
    list-style: none;
    padding-left: 0;
}

.professional-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.professional-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
}

.reviewer-section {
    margin-top: 1rem;
}

.reviewer-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Footer */
.footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
        padding-top: 4.5rem;
    }

    .nav-container {
        padding: 0.5rem 1rem;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-link {
        padding: 0.4rem 0.75rem;
        font-size: 0.9rem;
    }

    .header-content {
        flex-direction: column-reverse;
        gap: 2rem;
        text-align: center;
    }

    .profile-photo {
        display: flex;
        justify-content: center;
    }

    .photo {
        width: 150px;
        height: 150px;
    }

    .name {
        font-size: 2rem;
    }

    .name-cn {
        display: block;
        margin-left: 0;
        margin-top: 0.25rem;
    }

    .social-links {
        justify-content: center;
        flex-wrap: wrap;
    }

    .quote {
        text-align: center;
    }

    .timeline-header {
        flex-direction: column;
    }

    .timeline-date {
        white-space: normal;
    }

    .theme-toggle {
        top: 3.5rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .publication-item {
        padding: 1rem;
    }

    .publication-links {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .name {
        font-size: 1.75rem;
    }

    .name-cn {
        font-size: 1.25rem;
    }

    .social-link span {
        display: none;
    }

    .social-link {
        padding: 0.5rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section {
    animation: fadeIn 0.5s ease forwards;
}

/* Print Styles */
@media print {
    .theme-toggle {
        display: none;
    }

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

    .publication-item,
    .research-item {
        break-inside: avoid;
    }
}