/* Global Styles */
:root {
    --primary-color: #6c5ce7;
    --secondary-color: #74b9ff;
    --accent-color: #fd79a8;
    --paper-color: #e17055;
    --code-color: #0984e3;
    --model-color: #a29bfe;
    --demo-color: #fdcb6e;
    --cite-color: #74b9ff;
    --results-color: #00b894;
    --text-color: #2d3436;
    --light-gray: #f8f9fa;
    --border-color: #dfe6e9;
    --success-color: #5f9ea0;
    --improvement-color: #74b9ff;
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --nav-bg: rgba(255, 255, 255, 0.98);
    --equation-bg-start: #f5f7fa;
    --equation-bg-end: #c3cfe2;
}

[data-theme="dark"] {
    --text-color: #dfe6e9;
    --light-gray: #2d3436;
    --border-color: #636e72;
    --bg-color: #1e1e1e;
    --card-bg: #2d3436;
    --nav-bg: rgba(30, 30, 30, 0.98);
    --equation-bg-start: #2d3436;
    --equation-bg-end: #34495e;
    --primary-color: #a29bfe;
    --secondary-color: #74b9ff;
    --gradient-start: #7c3aed;
    --gradient-end: #a855f7;
}

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

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

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

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.title {
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 2.8em;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.venue {
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.4em;
    color: #ecf0f1;
    margin-bottom: 30px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.authors {
    margin-bottom: 30px;
}

.author-group {
    margin-bottom: 15px;
}

.author {
    display: inline-block;
    margin: 0 15px;
    font-size: 1.1em;
}

.author sup {
    font-size: 0.8em;
    margin-left: 2px;
}

.affiliations {
    margin-top: 10px;
    font-size: 0.95em;
    color: #ecf0f1;
}

.affiliation {
    margin: 0 20px;
    display: inline-block;
}

.footnote {
    margin-top: 10px;
    font-size: 0.9em;
    color: #bdc3c7;
}

.equal-contribution {
    font-style: italic;
}

/* Author Links and Emails */
.author-link {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.author-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.author-emails {
    margin-top: 10px;
    font-size: 0.9em;
    color: #bdc3c7;
}

.email {
    margin: 0 10px;
    display: inline-block;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.95em;
}

[data-theme="dark"] .author-link {
    color: white;
}

[data-theme="dark"] .author-emails {
    color: #95a5a6;
}

/* Links/Buttons */
.links {
    margin-top: 30px;
}

.btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    margin: 5px;
    background: white;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.btn i {
    margin-right: 8px;
    font-size: 1.1em;
}

.btn span {
    position: relative;
    z-index: 1;
}

/* Specific button colors */
.btn-paper {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-code {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-model {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
}

.btn-demo {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.btn-results {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
}

.btn-cite {
    background: linear-gradient(135deg, #1abc9c, #16a085);
    color: white;
}

/* Navigation */
.sticky-nav {
    position: sticky;
    top: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: background-color 0.3s ease;
}

.sticky-nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 15px 0;
}

.sticky-nav li {
    margin: 0 20px;
}

.sticky-nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.sticky-nav a:hover {
    color: var(--secondary-color);
}

/* Main Content */
main {
    padding: 40px 0;
}

.section {
    padding: 40px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.section h2 {
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 2.2em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 30px;
    text-align: center;
    letter-spacing: -0.01em;
}

.subsection h3 {
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.6em;
    font-weight: 700;
    color: var(--primary-color);
    margin: 30px 0 20px;
    letter-spacing: -0.01em;
}

.content-box {
    background: var(--light-gray);
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    transition: background-color 0.3s ease;
}

.content-box p {
    margin-bottom: 15px;
    line-height: 1.8;
}

/* Figures */
.figure-container {
    text-align: center;
    margin: 30px 0;
}

.main-figure {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.figure-row {
    display: flex;
    gap: 30px;
    margin: 40px 0;
    align-items: flex-start;
}

.figure-half {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.method-figure {
    width: auto;
    height: 250px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .figure-row {
        flex-direction: column;
    }
    
    .figure-half {
        width: 100%;
        margin-bottom: 20px;
    }
}

.caption {
    margin-top: 15px;
    font-size: 0.95em;
    color: #666;
    font-style: italic;
}

/* Equations */
.equation {
    background: linear-gradient(135deg, var(--equation-bg-start) 0%, var(--equation-bg-end) 100%);
    padding: 25px;
    border-left: 4px solid var(--primary-color);
    margin: 30px 0;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: background 0.3s ease;
}

.equation p {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.math-display {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.2em;
    text-align: center;
    color: var(--text-color);
    overflow-x: auto;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
    transition: background-color 0.3s ease;
}

.equation pre {
    overflow-x: auto;
    font-family: 'Source Code Pro', monospace;
}

/* Experiment Details */
.experiment-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.detail-card {
    background: var(--light-gray);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.detail-card h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1em;
}

.detail-card h4 i {
    margin-right: 8px;
}

.detail-card ul {
    list-style: none;
    padding: 0;
}

.detail-card li {
    padding: 5px 0;
    font-size: 0.95em;
    line-height: 1.6;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.result-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--light-gray) 100%);
    border: 2px solid transparent;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.result-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.result-card h3 {
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.4em;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.metric-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.metric {
    text-align: center;
}

.metric-value {
    display: block;
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
}

.metric-label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.metric-improvement {
    display: block;
    font-size: 0.85em;
    color: var(--success-color);
    margin-top: 5px;
    font-weight: 500;
}

.card-note {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
    color: var(--text-color);
    opacity: 0.8;
    font-style: italic;
}

/* Findings List */
.findings-list {
    list-style: none;
    padding-left: 0;
}

.findings-list li {
    padding: 10px 0;
    padding-left: 30px;
    position: relative;
}

.findings-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.2em;
}

/* Demo Section */
.demo-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.demo-input, .demo-output {
    background: var(--light-gray);
    padding: 25px;
    border-radius: 10px;
}

.demo-input h3, .demo-output h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 15px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--model-color));
    color: white;
    border: none;
    padding: 14px 35px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(108, 92, 231, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

#output-display {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 5px;
    min-height: 200px;
    transition: background-color 0.3s ease;
}

.placeholder {
    color: #999;
    font-style: italic;
}

/* Code Blocks */
pre[class*="language-"] {
    border-radius: 5px;
    margin: 15px 0;
}

/* Footer */
footer {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 60px;
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        padding: 40px 0;
    }
    
    .title {
        font-size: 1.5em;
        padding: 0 10px;
    }
    
    .venue {
        font-size: 1.1em;
    }
    
    .author {
        display: block;
        margin: 8px 0;
        font-size: 1em;
    }
    
    .affiliations {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .affiliation {
        margin: 5px 0;
    }
    
    .author-emails {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 15px;
    }
    
    .email {
        margin: 3px 0;
        font-size: 0.85em;
    }
    
    .links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        padding: 0 10px;
    }
    
    .btn {
        margin: 5px;
        padding: 10px 20px;
        font-size: 0.9em;
    }
    
    .btn span {
        display: none;
    }
    
    .btn i {
        margin: 0;
        font-size: 1.2em;
    }
    
    .sticky-nav {
        padding: 0;
    }
    
    .sticky-nav ul {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 0;
        white-space: nowrap;
    }
    
    .sticky-nav li {
        flex-shrink: 0;
        margin: 0 15px;
    }
    
    .sticky-nav a {
        font-size: 0.9em;
    }
    
    .section {
        padding: 30px 0;
    }
    
    .section h2 {
        font-size: 1.6em;
        margin-bottom: 20px;
    }
    
    .subsection h3 {
        font-size: 1.3em;
    }
    
    .content-box {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .math-display {
        font-size: 0.95em;
        padding: 15px 10px;
        overflow-x: auto;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .result-card {
        padding: 20px;
    }
    
    .metric-value {
        font-size: 1.8em;
    }
    
    .demo-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .demo-input, .demo-output {
        padding: 20px;
    }
    
    textarea {
        font-size: 14px;
    }
    
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    footer {
        padding: 20px 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .title {
        font-size: 1.3em;
    }
    
    .author {
        font-size: 0.9em;
    }
    
    .content-box {
        padding: 15px;
    }
    
    .math-display {
        font-size: 0.85em;
    }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .sticky-nav a {
        padding: 10px;
    }
    
    textarea {
        min-height: 120px;
    }
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.theme-toggle i {
    font-size: 1.3em;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.theme-toggle:hover i {
    transform: rotate(20deg);
}

[data-theme="dark"] .theme-toggle {
    background: var(--card-bg);
    border-color: var(--border-color);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}