/* Reset and base styles */
:root {
    /* Color Palette */
    --color-primary: #0f172a;
    /* Deep Navy */
    --color-primary-light: #1e293b;
    --color-accent: #b45309;
    /* Bronze/Gold */
    --color-accent-light: #d97706;
    --color-bg: #faf9f6;
    /* Paper White */
    --color-surface: #ffffff;
    --color-text-main: #334155;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;

    /* Typography */
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Shadows */
    --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);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--color-text-main);
    background: var(--color-bg);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: hidden;
    /* Disable scrolling by default */
}

/* Enable scrolling only for specific pages */
body.scrollable {
    overflow-y: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
.header {
    text-align: center;
    padding: 1rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(250, 249, 246, 0.85);
    /* Glassmorphism base */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    height: auto;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    transition: all 0.3s ease;
}

.site-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 auto;
    line-height: 1.3;
    text-align: center;
    letter-spacing: -0.01em;
    width: 100%;
    max-width: 800px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.site-title:hover {
    opacity: 0.75;
}

.site-title .title-break {
    display: block;
}

.site-authors {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 0.5rem;
    letter-spacing: 0.01em;
}

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 140px 0 2rem 0;
    min-height: calc(100vh - 140px);
    width: 100%;
}

/* Content Pages */
.content-page {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

.content-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary);
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 3rem;
}

.content-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    margin-top: 0.5rem;
}

.content-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 1rem 1.5rem;
    background: var(--color-surface);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: auto;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    gap: 1.5rem;
}

/* Download buttons specific styling - space between Download and CSV/XLSX */
.content-item:has(.item-number-swapped) {
    justify-content: space-between;
    gap: 0;
}

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

.content-item:hover {
    transform: translateX(8px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent-light);
}

.content-item:hover::before {
    opacity: 1;
}

.item-number {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 0;
    opacity: 1;
    min-width: 3rem;
}

.item-text {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-primary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: visible;
    text-overflow: ellipsis;
}

/* Dataset Section */
.dataset-separator {
    margin: 1.5rem 0 1rem 0;
    border-top: 1px solid var(--color-border);
    position: relative;
}

.dataset-label {
    position: absolute;
    top: -0.8rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-bg);
    padding: 0 1rem;
    color: var(--color-text-muted);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dataset-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    cursor: pointer;
    color: white;
}

.dataset-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.dataset-item .item-number {
    color: var(--color-accent);
    font-size: 1.5rem;
}

.dataset-item .item-text {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Swapped styling for Full Dataset page */
.item-number-swapped {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.2;
}

.item-text-swapped {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
    line-height: 1.2;
}

/* PDF Section */
.pdf-section {
    background: var(--color-surface);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-top: 1rem;
    border: 1px solid var(--color-border);
    width: 100%;
}

.pdf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 1rem;
}

.pdf-header h3,
.pdf-section-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary);
    margin: 0;
}

.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    gap: 0.6rem;
}

.pdf-tile {
    background: #f1f5f9;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    padding: 0.2rem;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3/4;
    /* Document aspect ratio */
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.pdf-tile::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent #cbd5e1 transparent transparent;
    transition: all 0.3s ease;
}

.pdf-tile:hover {
    border-color: var(--color-accent);
    background: white;
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-md);
}

.pdf-tile:hover::after {
    border-color: transparent var(--color-accent) transparent transparent;
}

.pdf-year {
    font-family: var(--font-serif);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.1;
}

/* Buttons */
.download-all-btn,
.download-btn,
.back-btn,
.compare-btn,
.close-comparison-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}

.download-all-btn,
.download-btn,
.compare-btn {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.download-all-btn:hover,
.download-btn:hover,
.compare-btn:hover {
    background: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.back-btn {
    background: white;
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
}

.back-btn:hover {
    background: #f8fafc;
    border-color: var(--color-text-muted);
}

.close-comparison-btn {
    background: #ef4444;
    color: white;
}

.close-comparison-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Fullscreen PDF Viewer & Comparison */
.pdf-fullscreen-container,
.comparison-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.pdf-controls,
.comparison-controls {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    gap: 2rem;
    backdrop-filter: blur(8px);
    flex-wrap: nowrap;
}

.comparison-navigation,
.pdf-navigation {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.comparison-info {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.pdf-actions,
.comparison-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-top: 0.5rem;
}

.pdf-filename,
.comparison-filename {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--color-text-muted);
    background: #f1f5f9;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.nav-btn {
    background: white;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.nav-btn:hover:not(:disabled) {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f1f5f9;
}

.pdf-counter {
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--color-text-main);
    min-width: 100px;
    text-align: center;
}

/* Comparison Content */
.comparison-content {
    flex: 1;
    display: flex;
    height: 100%;
    overflow: hidden;
}

.pdf-side,
.llm-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--color-border);
    background: white;
}

.llm-side {
    border-right: none;
}

.pdf-side-header,
.llm-side-header {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    padding-bottom: 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    height: 60px;
    box-sizing: border-box;
}

.pdf-side-header h3,
.llm-side-header h3 {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    line-height: 1.2;
    display: flex;
    align-items: center;
}

.pdf-side-content,
.llm-side-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.comparison-pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
    min-height: 0;
    touch-action: manipulation; /* Enable pinch-to-zoom on mobile */
}

.pdf-fullscreen-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.pdf-fullscreen-iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
    min-height: 0;
}

.llm-transcription-data {
    height: 100%;
    overflow-y: auto;
    padding: 2rem;
    background: white;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--color-text-main);
}

.llm-transcription-only {
    height: 100%;
    overflow-y: auto;
    padding: 2rem;
    background: white;
}

/* Highlighting styles for LLM transcriptions */
.llm-transcription-only .diff-highlight-perfect {
    background-color: #ffeb3b;
    padding: 2px 0;
    border-radius: 2px;
    display: inline;
    font-weight: 500;
}

.llm-transcription-only .diff-highlight-llm {
    background-color: #ffeb3b;
    padding: 2px 0;
    border-radius: 2px;
    display: inline;
    font-weight: 500;
}

.llm-transcription-only .diff-highlight-student {
    background-color: #f44336;
    color: white;
    padding: 2px 0;
    border-radius: 2px;
    display: inline;
    font-weight: 500;
}

/* Font Controls */
.font-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.25rem;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

.font-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.font-btn:hover {
    background: #f1f5f9;
    color: var(--color-primary);
}

.font-size-display {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    min-width: 3rem;
    text-align: center;
}

/* Mobile line breaks - hidden on desktop, shown on mobile */
.mobile-break {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    /* Show mobile line breaks */
    .mobile-break {
        display: inline;
    }

    .container {
        padding: 1rem;
    }

    .header {
        padding: 1rem 0;
        min-height: 120px;
    }

    .site-title {
        font-size: 1.25rem;
        padding: 0 1rem;
    }

    .site-title .title-break {
        display: inline;
    }

    .main-content {
        padding: 140px 0 2rem 0;
        min-height: calc(100vh - 140px);
    }

    .content-items {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .content-item {
        min-height: auto;
        padding: 1.5rem;
    }

    .pdf-section {
        padding: 1.5rem;
    }

    .pdf-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .pdf-controls,
    .comparison-controls {
        flex-direction: column;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .comparison-navigation {
        width: 100%;
        justify-content: center;
    }

    .comparison-info {
        order: -1;
        width: 100%;
        text-align: center;
    }

    .comparison-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .pdf-info {
        order: -1;
        width: 100%;
        text-align: center;
    }

    .pdf-filename,
    .comparison-filename {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .comparison-content {
        flex-direction: column;
    }

    .pdf-side,
    .llm-side {
        height: 50%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    
    .pdf-side-header,
    .llm-side-header {
        padding: 0.5rem 1rem;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .pdf-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .pdf-actions,
    .comparison-actions {
        flex-direction: column;
        width: 100%;
    }

    .download-btn,
    .back-btn,
    .compare-btn,
    .close-comparison-btn {
        width: 100%;
    }
}

/* Utilities */
.clickable {
    cursor: pointer;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}