:root {
    --primary-color: #1a365d;
    --accent-color: #c289c3;
    --text-color: #2d3748;
    --text-light: #4a5568;
    --bg-color: #ffffff;
    --sidebar-bg: #f7fafc;
    --border-color: #e2e8f0;
    --link-color: #2b6cb0;
    --sidebar-width: 500px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--bg-color);
}

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

a:hover {
    text-decoration: underline;
}

/* ========== Layout ========== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ========== Left Sidebar ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    /* Background image support */
    --sidebar-bg-image: none;
    --sidebar-overlay-opacity: 0.7;
}

/* Sidebar with background image */
.sidebar.has-bg-image {
    background: none;
    position: fixed;
}

.sidebar.has-bg-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--sidebar-bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
    transition: background-image 0.5s ease-in-out;
}

.sidebar.has-bg-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, var(--sidebar-overlay-opacity));
    z-index: -1;
}

/* Adjust text colors when background image is present */
.sidebar.has-bg-image .profile h1,
.sidebar.has-bg-image .profile .name-cn,
.sidebar.has-bg-image .profile .title,
.sidebar.has-bg-image .contact-item,
.sidebar.has-bg-image .contact-item i,
.sidebar.has-bg-image .contact-item a,
.sidebar.has-bg-image .contact-item span,
.sidebar.has-bg-image .sidebar-nav a {
    color: rgba(255, 255, 255, 0.95);
}

.sidebar.has-bg-image .contact-item a:hover,
.sidebar.has-bg-image .sidebar-nav a:hover {
    color: #fef3c7;
}

.sidebar.has-bg-image .social-links a {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
}

.sidebar.has-bg-image .social-links a:hover {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
}

.sidebar.has-bg-image .sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar.has-bg-image .sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.sidebar.has-bg-image .profile-photo {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.sidebar.has-bg-image .profile-photo-placeholder {
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.5);
}

/* Background Toggle Button */
.bg-toggle {
    position: absolute;
    top: 0.8rem;
    left: 0.8rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.15);
    color: var(--text-light);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    opacity: 0.5;
}

.bg-toggle:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.25);
}

.sidebar.has-bg-image .bg-toggle {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.15);
}

.sidebar.has-bg-image .bg-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.bg-toggle.bg-off {
    opacity: 0.4;
}

.bg-toggle.bg-off:hover {
    opacity: 0.8;
}

.profile {
    text-align: center;
    margin-bottom: 1.5rem;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 3px solid var(--border-color);
    transition: transform 0.3s;
}

.profile-photo:hover {
    transform: scale(1.05);
}

.profile-photo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2c5282 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    font-weight: 600;
    margin: 0 auto 1rem;
}

.profile h1 {
    font-family: 'Oswald', sans-serif;
    letter-spacing: 0.02em;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
}

.profile .name-cn {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.profile .title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-light);
    line-height: 1.4;
}

/* Contact Info */
.contact-info {
    margin-bottom: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-color);
}

.contact-item i {
    width: 20px;
    text-align: center;
    color: var(--text-light);
}

.contact-item a {
    color: var(--text-color);
}

.contact-item a:hover {
    color: var(--link-color);
}

/* Social Links */
.social-links {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    padding: 0;
    margin-top: 0.3rem;
    margin-bottom: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--sidebar-bg);
    color: var(--text-light);
    font-size: 1.6rem;
    transition: all 0.2s;
}

.social-links a:hover {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
}

/* Sidebar Navigation */
.sidebar-nav {
    margin-top: auto;
}

.sidebar-nav a {
    display: block;
    padding: 0.7rem 1rem;
    margin: 0.4rem 0;
    color: var(--text-color);
    font-size: 1.3rem;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    color: var(--link-color);
    background: rgba(43, 108, 176, 0.1);
    text-decoration: none;
}

.sidebar-nav a.active {
    color: var(--link-color);
    background: rgba(43, 108, 176, 0.15);
    font-weight: 600;
}

/* ========== Main Content ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem;
    max-width: 900px;
}

section {
    margin-bottom: 2.5rem;
}

h2 {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-color);
}

/* Simple Mode Toggle */
.simple-mode-toggle {
    float: right;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    padding: 0.6rem 1.4rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    vertical-align: middle;
}

.simple-mode-toggle:hover {
    border-color: var(--link-color);
    color: var(--link-color);
}

.simple-mode-toggle.active {
    background: var(--link-color);
    color: white;
    border-color: var(--link-color);
}

.simple-mode-toggle i {
    margin-right: 0.3rem;
}

/* Simple Mode Effects */
body.simple-mode .pub-image {
    display: none;
}

body.simple-mode .publication.has-image {
    display: block;
}

/* About Section */
.about-content {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.about-photo {
    flex-shrink: 0;
    width: 150px;
    height: 150px;
    position: relative;
    cursor: pointer;
}

.about-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: filter 0.3s ease;
}

.about-photo:hover img {
    filter: blur(3px);
}

.about-photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
}

.about-photo:hover .about-photo-overlay {
    opacity: 1;
}

.about-photo-view-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.about-photo-view-btn:hover {
    background: #1e4a7a;
}

.about-photo-view-btn i {
    font-size: 0.8rem;
}

.about-photo-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2c5282 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.about-text {
    flex: 1;
    min-width: 0;
}

.about-text p {
    margin-bottom: 1rem;
}

.highlight {
    background: linear-gradient(120deg, #9aca95 0%, #9aca95 100%);
    padding: 0 0.2rem;
}

/* News Section */
.news-list {
    list-style: none;
}

.news-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.6rem;
    padding: 0.4rem 0;
}

.news-date {
    flex-shrink: 0;
    width: 90px;
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.85rem;
}

.news-content {
    flex: 1;
    font-size: 0.95rem;
}

/* News collapse - hide items after the 4th */
.news-list:not(.expanded) .news-item:nth-child(n+5) {
    display: none;
}

.news-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
    padding: 0.4rem 0.8rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.news-toggle:hover {
    border-color: var(--link-color);
    color: var(--link-color);
}

.news-toggle .toggle-icon {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.news-list.expanded + .news-toggle .toggle-icon {
    transform: rotate(180deg);
}

/* Research Interests */
.filter-hint {
    margin-top: 0.8rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.research-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

/* Publication Filter */
.pub-filter {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.pub-filter .research-tags {
    margin-top: 0;
    flex: 1;
}

.pub-filter .clear-filter {
    margin-left: 0;
}

.research-tag {
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-color);
    transition: all 0.2s;
}

.research-tag:hover {
    border-color: var(--link-color);
    color: var(--link-color);
    cursor: pointer;
}

.research-tag.active {
    background: var(--link-color);
    color: white;
    border-color: var(--link-color);
}

/* Publication highlight effect */
.publication.highlighted {
    background: linear-gradient(135deg, #ebf8ff 0%, #fef3c7 100%);
    border-left: 4px solid var(--accent-color);
    padding-left: calc(1.2rem - 4px);
    margin-left: -1.2rem;
    padding-right: 1.2rem;
    margin-right: -1.2rem;
    animation: highlightPulse 0.6s ease-out;
}

@keyframes highlightPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.01); }
    100% { transform: scale(1); }
}

.publication.dimmed {
    opacity: 0.4;
}

/* Publication tags */
.pub-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.pub-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    background: var(--sidebar-bg);
    color: var(--text-light);
    border: 1px solid var(--border-color);
}

.pub-tag.matched {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Clear filter button */
.clear-filter {
    display: none;
    margin-left: 0.5rem;
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    background: var(--text-light);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-filter.visible {
    display: inline-block;
}

.clear-filter:hover {
    background: var(--accent-color);
}

/* Publications */
.publication {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.publication.has-image {
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
}

.pub-image {
    position: relative;
    flex-shrink: 0;
    width: 140px;
    height: 140px;
    overflow: hidden;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--sidebar-bg);
}

.pub-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pub-image:hover img {
    transform: scale(1.05);
}


.pub-content {
    flex: 1;
    min-width: 0;
}

.publication:last-child {
    border-bottom: none;
}

.pub-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--primary-color);
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.pub-title a {
    color: inherit;
}

.pub-title a:hover {
    color: var(--link-color);
}

.pub-authors {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}

.pub-authors .me {
    font-weight: 600;
    color: var(--text-color);
    text-decoration: underline;
}

.pub-venue {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.pub-venue .award {
    color: var(--accent-color);
    font-weight: 600;
    font-style: normal;
}

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

.pub-link {
    font-size: 0.8rem;
    color: var(--link-color);
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--link-color);
    border-radius: 3px;
    transition: all 0.2s;
}

.pub-link:hover {
    background: var(--link-color);
    color: white;
    text-decoration: none;
}

/* Education & Experience */
.timeline-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.2rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--border-color);
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-date {
    flex-shrink: 0;
    width: 120px;
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
}

.timeline-content h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.2rem;
}

.timeline-content p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.1rem;
}

/* Misc Section */
.misc-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.misc-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.misc-icon {
    font-size: 1.3rem;
    color: var(--accent-color);
    width: 30px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.misc-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.misc-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
}

.misc-desc {
    font-size: 0.9rem;
    color: var(--text-light);
}

.friend-gate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid var(--accent-color);
    border-radius: 20px;
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
    transition: all 0.2s;
}

.friend-gate-btn:hover {
    background: var(--accent-color);
    color: white;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    font-size: 0.85rem;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
    .wrapper {
        flex-direction: column;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .news-item {
        flex-direction: column;
        gap: 0.2rem;
    }

    .news-date {
        width: auto;
    }

    .timeline-item {
        flex-direction: column;
        gap: 0.3rem;
    }

    .publication.has-image {
        flex-direction: column;
    }

    .pub-image {
        width: 100%;
        height: 160px;
    }

    .timeline-date {
        width: auto;
    }

    .about-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .about-photo {
        width: 120px;
        height: 120px;
    }

    .about-text {
        text-align: left;
    }

    .research-tags {
        justify-content: center;
    }
}

/* ========== Animation ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.main-content section {
    animation: fadeIn 0.5s ease-out;
}

.main-content section:nth-child(1) { animation-delay: 0.1s; }
.main-content section:nth-child(2) { animation-delay: 0.15s; }
.main-content section:nth-child(3) { animation-delay: 0.2s; }
.main-content section:nth-child(4) { animation-delay: 0.25s; }
