body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    display: flex;
    height: 100vh;
    background: #ffffff;
    color: #111827;
    overflow: hidden;
}

/* Login Screen */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-box {
    background: #ffffff;
    padding: 40px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    text-align: center;
    width: 300px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

.login-box h1 {
    color: #1d4ed8;
    margin-bottom: 10px;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin: 20px 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #111827;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
}

.login-box button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    background: #2563eb;
    color: white;
    transition: background 0.2s;
}

.login-box button:hover {
    background: #1e40af;
}

/* Sidebar Styles */
aside {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: margin-left 0.3s ease;
}

aside.collapsed {
    margin-left: -280px;
}

.sidebar-toggle {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 50;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #374151;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: #f3f4f6;
    color: #111827;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.sidebar-header h1 {
    margin: 0;
    font-size: 1.2rem;
    color: #1d4ed8;
}

.back-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #6b7280;
    text-decoration: none;
    cursor: pointer;
}

.back-link:hover {
    color: #111827;
}

.nav-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

/* Navigation Items (Shared) */
.nav-group {
    border-bottom: 1px solid #e5e7eb;
}

.nav-item-title {
    padding: 8px 15px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #374151;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

.nav-item-title:hover {
    background: #f9fafb;
    color: #111827;
}

.nav-sublist {
    display: none;
    background: #ffffff;
}

.nav-sublist.open {
    display: block;
}

.sub-item-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 15px 6px 25px;
    background: transparent;
    border: none;
    color: #374151;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    font-weight: 600;
    border-bottom: 1px solid #f3f4f6;
    white-space: normal;
    line-height: 1.3;
}

.sub-item-btn:hover {
    background: #f9fafb;
    color: #111827;
}

.sub-item-btn.active {
    background: #eef2ff;
    color: #1d4ed8;
    border-left: 3px solid #ef4444;
    padding-left: 22px;
}

/* Main Content Area */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    position: relative;
}

/* Dashboard */
.dashboard {
    padding: 60px 40px 40px 40px; /* Added top padding for toggle button */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

.dashboard-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    border-color: #1d4ed8;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.card-desc {
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.5;
}

/* Content Header */
.content-header {
    padding: 20px 40px 20px 60px; /* Left padding for toggle button space */
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.content-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #111827;
}

/* Content Viewers */
.content-viewer {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    position: relative;
}

.text-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #111827;
}

/* Question Viewer specific */
#question-viewer {
    display: flex;
    flex-direction: column;
    align-items: center; /* Centers content horizontally */
    justify-content: center; /* Centers content vertically if possible */
    min-height: 0; /* Important for nested flex scrolling */
}

.question-container {
    max-width: 900px;
    margin: auto; /* Centers in the flex container (horizontal + vertical) */
    width: 100%;
    padding-bottom: 20px;
}

.question-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px; /* Increased radius */
    padding: 32px; /* Increased padding */
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03); /* Added soft shadow */
}

.btn {
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Question Controls */
.controls-container {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Added for safety on smaller desktop screens */
}

.controls-left, .controls-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (max-width: 768px) {
    .controls-container {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .controls-left, .controls-right {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .controls-left button, .controls-right button {
        width: 100% !important;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
    }
}

.btn-primary {
    background: #1d4ed8;
    color: #ffffff;
}

.btn-primary:hover {
    background: #1e40af;
}

.btn-secondary {
    background: #ffffff;
    color: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-secondary:hover {
    background: #eef2ff;
}

.btn-next {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.btn-next:hover {
    background: #1e40af;
    border-color: #1e40af;
}

.btn-transcription {
    background: #ffffff;
    color: #ef4444;
    border-color: #ef4444;
}

.btn-transcription:hover {
    background: #fee2e2;
}

.question-media {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.question-media img {
    display: block;
    max-width: clamp(280px, 70vw, 800px);
    height: auto;
    margin: 0 auto;
}

.question-media audio {
    width: 85%;
    max-width: 900px;
    margin: 0 auto;
    display: block;
}

/* When sidebar is collapsed, allow a wider content area */
aside.collapsed + main .question-container {
    max-width: 1100px;
}

.question-text {
    font-size: 1.25rem; /* Increased font size */
    margin-bottom: 24px;
    font-weight: 500;
    color: #111827;
    white-space: pre-wrap;
    line-height: 1.6; /* Improved line height */
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Increased gap */
}

.option-btn {
    text-align: left;
    padding: 20px; /* Increased padding */
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px; /* Rounded corners */
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.05rem; /* Slightly larger text */
    position: relative;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.option-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

/* Control Buttons */
.btn-control {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-control:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

.btn-primary {
    background: #2563eb;
    color: white;
}
.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #64748b;
    color: white;
}
.btn-secondary:hover {
    background: #475569;
}

.btn-success {
    background: #10b981;
    color: white;
}
.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}
.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: #ef4444;
    color: white;
}
.btn-danger:hover {
    background: #dc2626;
}

/* Controls Container Refinement */
.controls-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
    gap: 20px;
    flex-wrap: wrap;
}

.controls-left, .controls-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .question-container {
        padding-bottom: 20px;
    }
    
    .question-card {
        padding: 20px;
        margin-bottom: 16px;
    }

    .controls-container {
        flex-direction: column;
        gap: 16px;
        margin-top: 24px;
        border-top: none;
    }

    .controls-left, .controls-right {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .btn-control {
        width: 100%;
        padding: 16px; /* Larger touch target */
        font-size: 1.1rem;
    }
}

.option-btn.selected {
    border-color: #1d4ed8;
    background: #eef2ff;
}

.option-btn.correct {
    background: #065f46;
    border-color: #059669;
    color: #fff;
}

.option-btn.incorrect {
    background: #7f1d1d;
    border-color: #dc2626;
    color: #fff;
}

/* Question Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 10px;
}

.transcription-box {
    margin-top: 20px;
    padding: 15px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #ef4444;
    border-radius: 8px;
    color: #111827;
    font-size: 0.95rem;
    line-height: 1.6;
    display: none;
    animation: fadeIn 0.3s ease;
}

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

/* Formatted Body (EE/EO) */
.formatted-body {
    margin-top: 20px;
}

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 1.1rem;
}

/* Expression specific */
.task-section {
    background: #ffffff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
}

.task-section h3 {
    margin-top: 0;
    color: #1d4ed8;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.task-text {
    white-space: pre-wrap;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #ffffff;
}

::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}

/* Results Report */
.results-report {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.summary-card {
    display: flex;
    justify-content: space-around;
    background: #f8fafc;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.summary-label {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
}

.level-badge {
    color: #2563eb;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-item {
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid transparent;
}

.stat-item.correct {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.stat-item.incorrect {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.stat-item.skipped {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #475569;
}

.stat-count {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.table-container {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.results-table th,
.results-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.results-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.results-table tr:last-child td {
    border-bottom: none;
}

.status-correct td {
    background: #f0fdf4;
    color: #166534;
}

.status-incorrect td {
    background: #fef2f2;
    color: #991b1b;
}

.status-skipped td {
    background: #f8fafc;
    color: #64748b;
    font-style: italic;
}