/* CSS Variables for Theme Support */
:root {
    /* Light theme colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --accent-color: #007bff;
    --link-color: #0056b3;
    --code-bg: #f8f9fa;
    --code-border: #e9ecef;
    --logo-filter: none;

    --main-logo-filter: none;
}

/* Dark theme colors */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e9ecef;
    --text-secondary: #adb5bd;
    --text-muted: #6c757d;
    --border-color: #495057;
    --accent-color: #4dabf7;
    --link-color: #74c0fc;
    --code-bg: #2d2d2d;
    --code-border: #495057;
    --logo-filter: brightness(0) invert(1);

    --main-logo-filter: brightness(0) invert(1);
}

/* Base Styles */
* {
    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-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Header */
.header {
    text-align: center;
    padding: 60px 0 40px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px;
    position: relative;
}

/* Main Logo */
.logo-container-main {
    margin-bottom: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-logo {
    height: 90px;
    width: auto;
    object-fit: contain;
    filter: var(--main-logo-filter);
    transition: transform 0.3s ease, filter 0.3s ease;
}

.main-logo:hover {
    transform: scale(1.05);
}

/* Dark mode adjustments for main logo */
[data-theme="dark"] .main-logo {
    filter: brightness(0) invert(1);
}

.title {
    font-size: 3.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.5;
}

.authors {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.authors a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

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

.equal-contrib {
    color: var(--accent-color);
    font-weight: 600;
    margin-left: 2px;
}

.corresponding {
    color: #dc3545;
    font-weight: 600;
    margin-left: 2px;
}

.author-notes {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.note-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.note-item a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

.affiliations {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.4;
}

/* Institutional Logos */
.institutional-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.institution-logo {
    max-height: 60px;
    width: auto;
    object-fit: contain;
    filter: var(--logo-filter);
    transition: opacity 0.3s ease;
}

.institution-logo:hover {
    opacity: 0.8;
}

/* Specific logo adjustments for different sizes */
.polyu-logo {
    max-height: 50px;
}

.ucl-logo {
    max-height: 60px;
}

.conference {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 20px;
}

.conference a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

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

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
}

#theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

#theme-toggle:hover {
    background: var(--bg-secondary);
}

/* Links Section */
.links {
    margin-bottom: 40px;
}

.link-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.link-item:hover:not([disabled]) {
    background: var(--accent-color);
    color: white;
    transform: translateY(-1px);
}

.link-item[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    color: var(--text-muted);
}

.link-icon {
    font-size: 1.1rem;
}

/* Sections */
section {
    margin-bottom: 40px;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 8px;
}

/* Abstract */
.abstract p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.abstract p:last-child {
    margin-bottom: 0;
}

/* Video Player */
.youtube-container {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: var(--bg-secondary);
}

.youtube-container iframe {
    display: block;
    border-radius: 8px;
}

/* Trailer */
.trailer-container {
    text-align: center;
}

.trailer-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.trailer-image:hover {
    transform: scale(1.02);
}

/* Expandable Image Styles */
.expandable-image {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.expandable-image:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Image Modal Styles */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    max-width: 1200px;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #f1f1f1;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.3s ease;
}

.close-modal:hover,
.close-modal:focus {
    color: #bbb;
    text-decoration: none;
}

/* Modal open state */
.image-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Method */
.method {
    margin-bottom: 40px;
}

.method-overview {
    margin-bottom: 30px;
}

.method-overview p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    font-weight: 500;
}

.method-components {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.component {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.component:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.component h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 8px;
}

.component p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0;
}

.method-performance {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    border-left: 4px solid var(--accent-color);
}

.method-performance h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.method-performance p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0;
}

/* Results */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.result-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
}

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.result-placeholder .placeholder-icon {
    font-size: 2.5rem;
    opacity: 0.5;
}

.result-placeholder p {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.coming-soon {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 8px;
    opacity: 0.7;
}

/* BibTeX */
.bibtex-code {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 6px;
    padding: 20px;
    overflow-x: auto;
}

.bibtex-code pre {
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.bibtex-code code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

.footer p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

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

/* Cursor Credit */
.cursor-credit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cursor-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.cursor-link:hover {
    color: var(--accent-color);
    text-decoration: none;
}

.cursor-logo {
    height: 20px;
    width: auto;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.cursor-link:hover .cursor-logo {
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .authors {
        font-size: 0.9rem;
    }
    
    .affiliations {
        font-size: 0.85rem;
    }
    
    .author-notes {
        font-size: 0.8rem;
        gap: 15px;
        justify-content: center;
        text-align: center;
    }
    
    .link-grid {
        flex-direction: column;
        align-items: center;
    }
    
    .link-item {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .method-components {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .component {
        padding: 20px;
    }
    
    .method-performance {
        padding: 20px;
    }
    
    .institutional-logos {
        gap: 30px;
    }
    
    .institution-logo {
        max-height: 50px;
    }
    
    .polyu-logo {
        max-height: 45px;
    }
    
    .ucl-logo {
        max-height: 50px;
    }
    
    .cursor-credit {
        font-size: 0.85rem;
        gap: 6px;
    }
    
    .cursor-logo {
        height: 18px;
    }
    
    .main-logo {
        height: 80px;
    }
    
    .theme-toggle {
        position: static;
        margin-top: 20px;
    }
    
    .youtube-container iframe {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 40px 0 30px;
    }
    
    .title {
        font-size: 2.2rem;
    }
    
    .authors,
    .affiliations {
        font-size: 0.8rem;
    }
    
    .author-notes {
        font-size: 0.75rem;
        flex-direction: column;
        gap: 8px;
        justify-content: center;
        text-align: center;
    }
    
    .conference {
        font-size: 0.9rem;
    }
    
    .main-logo {
        height: 70px;
    }
    
    .youtube-container iframe {
        height: 200px;
    }
}

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

/* Focus styles for accessibility */
#theme-toggle:focus,
.link-item:focus,
.conference a:focus,
.authors a:focus,
.note-item a:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
