/* Modern Portfolio Styles */
:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
    position: relative;
}

/* Animated bifurcation diagram background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('img/logistic_bifurcation.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.1;
    z-index: -1;
    animation: bifurcation-reveal 20s linear infinite;
    clip-path: inset(0 100% 0 0);
}

@keyframes bifurcation-reveal {
    0% { 
        clip-path: inset(0 100% 0 0);
        opacity: 0.08;
    }
    40% { 
        clip-path: inset(0 0% 0 0);
        opacity: 0.15;
    }
    60% { 
        clip-path: inset(0 0% 0 0);
        opacity: 0.15;
    }
    100% { 
        clip-path: inset(0 100% 0 0);
        opacity: 0.08;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading animation */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Sidebar */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 160;
    transition: var(--transition);
    overflow-y: auto;
}

#author_img {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1.5rem;
    border: 4px solid var(--primary-color);
    transition: var(--transition);
    animation: fadeInUp 0.8s ease-out;
}

#author_img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

#sidebar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

#sidebar p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    text-align: center;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

#sidebar ul {
    list-style: none;
    width: 100%;
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

#sidebar ul li {
    margin-bottom: 0.5rem;
}

#sidebar ul li a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    border-radius: 8px;
    transition: var(--transition);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

#sidebar ul li a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.1), transparent);
    transition: left 0.5s;
}

#sidebar ul li a:hover::before {
    left: 100%;
}

#sidebar ul li a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(5px);
}

#sidebar ul li a.active {
    background: var(--primary-color);
    color: white;
}

#social-links {
    display: flex;
    gap: 1rem;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

#social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 1.2rem;
}

#social-links a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Theme toggle */
.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    animation: fadeInUp 0.8s ease-out 0.5s both;
}

.theme-toggle:hover {
    color: var(--primary-color);
    transform: rotate(180deg);
}

/* Main content */
#content {
    margin-left: 300px;
    padding: 2rem 3rem;
    min-height: 100vh;
    animation: fadeIn 1s ease-out 0.5s both;
}

section {
    margin-bottom: 4rem;
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition);
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 0.5rem;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    color: var(--text-primary);
}

section p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

section a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    border-bottom: 1px solid transparent;
}

section a:hover {
    border-bottom-color: var(--primary-color);
}

/* Publication cards */
.publication-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.publication-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.publication-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.publication-card p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.publication-card .authors {
    font-weight: 500;
    color: var(--text-primary);
}

.publication-card .journal {
    font-style: italic;
    color: var(--text-secondary);
}

.publication-card .status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.pub-year {
    float: right;
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 1rem;
    margin-top: 0.2rem;
}

.publication-card::after {
    content: "";
    display: block;
    clear: both;
}

/* Poster and talk cards */
.research-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.research-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.research-item:hover::before {
    transform: scaleY(1);
}

.research-item:hover {
    transform: translateX(10px);
    box-shadow: var(--shadow-md);
}

.research-item h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.research-item .venue {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.research-item .link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 500;
    transition: var(--transition);
}

.research-item .link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.poster-links {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.poster-links .link {
    flex: 0 1 auto;
    min-width: 120px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Dark mode */
[data-theme="dark"] {
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-card: #374151;
    --border-color: #4b5563;
}

/* Responsive design */
@media (max-width: 1024px) {
    #sidebar {
        width: 250px;
        padding: 1.5rem;
    }
    
    #content {
        margin-left: 250px;
        padding: 1.5rem 2rem;
    }
}

@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
        width: 280px;
        transition: transform 0.3s ease-in-out;
    }
    
    #sidebar.open {
        transform: translateX(0);
    }
    
    #sidebar ul li a {
        pointer-events: auto;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
    }
    
    #sidebar #social-links a {
        pointer-events: auto;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
    }
    
    #content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .mobile-menu-toggle {
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 200;
        background: var(--primary-color);
        color: white;
        border: none;
        padding: 0.75rem;
        border-radius: 8px;
        cursor: pointer;
        display: block;
        font-size: 1.2rem;
        min-width: 44px;
        min-height: 44px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        transition: all 0.3s ease;
    }
    
    .mobile-menu-toggle:hover {
        background: var(--secondary-color);
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }
    
    .mobile-menu-toggle.hidden {
        display: none;
    }
    
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 150;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    
    .overlay.open {
        opacity: 1;
        pointer-events: all;
    }

    .poster-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .poster-links .link {
        min-width: auto;
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    section h2 {
        font-size: 2rem;
    }
    
    .publication-card,
    .research-item {
        padding: 1rem;
    }
    
    #author_img {
        width: 170px;
        height: 170px;
    }
    
    /* Mobile-specific sidebar improvements */
    #sidebar {
        width: 100%;
        max-width: 320px;
        padding: 1.5rem;
    }
    
    #sidebar ul li a {
        padding: 1rem;
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    #sidebar ul li a:hover {
        transform: translateX(3px);
    }
    
    .mobile-menu-toggle {
        top: 0.75rem;
        left: 0.75rem;
        padding: 0.8rem;
        font-size: 1.3rem;
    }
}

/* Scroll indicator */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    z-index: 1000;
    transition: width 0.1s ease;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-3px);
}

.journal-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white !important;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.5rem;
    text-decoration: none;
    transition: background 0.2s;
}
.journal-badge:hover {
    background: var(--secondary-color);
    color: #fff;
}

.press-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--accent-color);
    color: white !important;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.5rem;
    margin-left: 0.5rem;
    text-decoration: none;
    transition: background 0.2s;
}
.press-badge:hover {
    background: var(--secondary-color);
    color: #fff;
}

.award-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white !important;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 0.5rem;
    text-decoration: none;
    transition: background 0.2s;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.award-badge:hover {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
}

.status-upcoming {
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-upcoming i {
    color: var(--accent-color);
    font-size: 1rem;
}

/* Highlight for Mindemory link in sidebar */
.mindemory-highlight {
    background: linear-gradient(90deg, #6ec1e4 0%, #b388ff 100%);
    color: #181818 !important;
    font-weight: bold;
    border-radius: 1.2em;
    padding: 0.3em 1em;
    margin-top: 0.5em;
    box-shadow: 0 2px 8px rgba(110,193,228,0.15);
    transition: background 0.2s, color 0.2s;
}
.mindemory-highlight:hover {
    background: linear-gradient(90deg, #b388ff 0%, #6ec1e4 100%);
    color: #fff !important;
}

.mindemory-title-font {
    font-family: 'Pacifico', cursive !important;
    font-size: 1.25em;
    letter-spacing: 0.5px;
}