/**
 * Web Test Engine - Exam Interface Styles
 * Adapted from VTSimu for web browser
 */

:root {
    /* Light Theme (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e8e8e8;
    --bg-hover: #d4d4d4;
    --bg-active: #cce5ff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent: #0078d4;
    --accent-hover: #106ebe;
    --danger: #d32f2f;
    --danger-hover: #b71c1c;
    --success: #4caf50;
    --success-hover: #388e3c;
    --warning: #ff9800;
    --border: #d4d4d4;
    --shadow: rgba(0, 0, 0, 0.1);
    --toolbar-height: 48px;
    --bottombar-height: 56px;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #1e1e1e;
    --bg-secondary: #252526;
    --bg-tertiary: #2d2d30;
    --bg-hover: #3c3c3c;
    --bg-active: #094771;
    --text-primary: #cccccc;
    --text-secondary: #858585;
    --text-muted: #6e6e6e;
    --accent: #0e639c;
    --accent-hover: #1177bb;
    --danger: #f14c4c;
    --danger-hover: #d32f2f;
    --success: #4caf50;
    --success-hover: #45a049;
    --warning: #ffb74d;
    --border: #3c3c3c;
    --shadow: rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    transition: background-color 0.2s, color 0.2s;
}

button:focus,
button:active,
button:focus-visible {
    outline: none !important;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Fallback for old browsers */
    height: calc(var(--vh, 1vh) * 100); /* JS-calculated viewport height for mobile */
    height: 100dvh; /* Dynamic viewport height - modern browsers */
}

.hidden { display: none !important; }

/* ========== TOOLBAR ========== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--toolbar-height);
    padding: 0 16px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-left { flex: 1; justify-content: flex-start; }
.toolbar-center { justify-content: center; }
.toolbar-right { flex: 1; justify-content: flex-end; }

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    background-color: transparent;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background-color: var(--bg-hover);
}

.toolbar-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.toolbar-btn-icon {
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    justify-content: center;
}

.toolbar-btn-icon .toolbar-icon {
    width: 18px;
    height: 18px;
}

.toolbar-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Theme toggle icons */
.theme-icon-dark { display: block; }
.theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: block; }

.question-counter {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Timer */
.timer-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
}

.timer-icon {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.timer-label {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.timer-label.warning,
.timer-icon.warning {
    color: var(--danger);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== MAIN CONTENT ========== */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.question-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-primary);
}

/* Tab Bar */
.tab-bar {
    display: flex;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 12px;
    flex-shrink: 0;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Webview Containers */
.question-webview-container,
.casestudy-webview-container {
    flex: 1;
    overflow: hidden;
}

.question-webview-container iframe,
.casestudy-webview-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: var(--bg-primary);
}

/* Loading Panel */
.loading-panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-primary);
    gap: 16px;
    z-index: 10;
}

.loading-panel.hidden { display: none; }

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.loading-subtext {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Begin Overlay */
.begin-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background-color: var(--bg-primary);
    z-index: 10;
    overflow-y: auto;
    padding: 24px 0;
}

.begin-content {
    text-align: center;
    padding: 48px;
    width: 100%;
    max-width: 800px;
    margin: auto 0;
}

.begin-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 28px;
    color: var(--accent);
}

.begin-logo svg {
    width: 100%;
    height: 100%;
}

.begin-website {
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .begin-website {
    background: linear-gradient(135deg, #a78bfa 0%, #c084fc 50%, #f0abfc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.begin-exam-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.begin-exam-desc {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.begin-exam-version {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.begin-sections-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    text-align: left;
}

.begin-sections-list {
    text-align: left;
    margin-bottom: 28px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
}

.begin-section-item {
    padding: 14px 18px;
    font-size: 15px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
}

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

.begin-section-item:hover {
    background-color: var(--bg-hover);
}

.begin-section-overview {
    display: none;
    margin-top: 12px;
    padding: 18px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    border-radius: 6px;
    text-align: left;
    max-height: 400px;
    overflow-y: auto;
    word-wrap: break-word;
}

.begin-section-overview p {
    margin: 0 0 12px 0;
}

.begin-section-overview p:last-child {
    margin-bottom: 0;
}

.begin-section-item.expanded .begin-section-overview {
    display: block;
}

.btn-begin {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 40px;
    border: none;
    border-radius: 8px;
    background-color: var(--success);
    color: white;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-begin:hover {
    background-color: var(--success-hover);
    transform: translateY(-1px);
}

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

.btn-begin svg {
    width: 20px;
    height: 20px;
}

/* Notes Panel */
.notes-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border);
    transform: translateY(100%);
    transition: transform 0.25s ease;
    z-index: 5;
    max-height: 240px;
    display: flex;
    flex-direction: column;
}

.notes-panel.visible {
    transform: translateY(0);
}

.notes-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-tertiary);
}

.notes-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notes-close-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notes-close-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.notes-textarea {
    flex: 1;
    min-height: 140px;
    padding: 14px 16px;
    border: none;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
}

.notes-textarea::placeholder {
    color: var(--text-muted);
}

/* ========== QUESTION SIDEBAR ========== */
.question-sidebar {
    width: 220px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
    background-color: var(--bg-secondary);
    transition: width 0.2s, border 0.2s;
    flex-shrink: 0;
}

.question-sidebar.collapsed {
    width: 0;
    border-left: none;
    overflow: hidden;
}

.sidebar-header {
    display: grid;
    grid-template-columns: 42px 1fr;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-tertiary);
}

/* Review mode: 4 columns */
.question-sidebar.review-mode .sidebar-header {
    grid-template-columns: 42px 1fr 32px 32px;
}

.sidebar-header span {
    text-align: center;
}

.sidebar-icon-header {
    font-size: 11px;
}

.question-list {
    flex: 1;
    overflow-y: auto;
}

.question-list-item {
    display: grid;
    grid-template-columns: 42px 1fr;
    padding: 7px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.1s;
    border-bottom: 1px solid var(--border);
}

/* Review mode: 4 columns */
.question-sidebar.review-mode .question-list-item {
    grid-template-columns: 42px 1fr 32px 32px;
}

.question-list-item span {
    text-align: center;
}

.question-list-item:nth-child(odd) {
    background-color: var(--bg-primary);
}

.question-list-item:nth-child(even) {
    background-color: var(--bg-secondary);
}

.question-list-item:hover {
    background-color: var(--bg-hover);
}

.question-list-item.selected {
    background-color: var(--bg-active);
    font-weight: 600;
}

.question-list-item.disabled {
    opacity: 0.4;
    cursor: default;
}

.q-marked {
    color: var(--success);
    font-weight: 700;
}

.q-noted {
    color: var(--accent);
    font-weight: 700;
}

/* Sidebar icon headers and cells */
.sidebar-icon-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.sidebar-icon-cell {
    text-align: center;
    font-size: 14px;
}

/* Result indicators */
.result-indicator {
    font-size: 16px;
    line-height: 1;
}

.result-indicator.correct {
    color: var(--success);
}

.result-indicator.incorrect {
    color: var(--danger);
}

.result-indicator.unanswered {
    color: var(--text-muted);
}

/* ========== BOTTOM BAR ========== */
.bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--bottombar-height);
    padding: 0 14px;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.bottom-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bottom-left { justify-content: flex-start; }
.bottom-center { flex: 1; justify-content: center; gap: 10px; }
.bottom-right { justify-content: flex-end; }

.bottom-divider {
    width: 1px;
    height: 28px;
    background-color: var(--border);
    margin: 0 10px;
}

.zoom-controls {
    display: flex;
    gap: 4px;
}

/* ========== ACTION BUTTONS ========== */
.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.15s, opacity 0.15s;
    white-space: nowrap;
}

.action-btn:hover {
    background-color: var(--bg-hover);
}

.action-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.action-btn:disabled:hover {
    background-color: var(--bg-tertiary);
}

.action-btn .btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.action-btn-icon {
    padding: 10px;
}

.action-btn-icon span {
    display: none;
}

.action-btn-danger {
    color: var(--danger);
}

.action-btn-danger:hover {
    background-color: rgba(211, 47, 47, 0.12);
}

[data-theme="dark"] .action-btn-danger:hover {
    background-color: rgba(241, 76, 76, 0.15);
}

/* Fixed width buttons to prevent size change on toggle */
#btn-prev,
#btn-next {
    min-width: 100px;
    justify-content: center;
}

#btn-show-answer {
    min-width: 140px;
    justify-content: center;
}

#btn-toggle-list {
    min-width: 115px;
    justify-content: center;
}

/* Review Dropdown */
.review-dropdown-wrapper {
    position: relative;
}

.review-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 190px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 -4px 16px var(--shadow);
    z-index: 100;
    padding: 6px 0;
    margin-bottom: 8px;
    animation: slideUp 0.15s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.review-dropdown.open {
    display: block;
}

.review-dropdown-item {
    padding: 12px 18px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background-color 0.1s;
}

.review-dropdown-item:hover {
    background-color: var(--accent);
    color: white;
}

.review-dropdown-item.disabled {
    opacity: 0.4;
    cursor: default;
}

.review-dropdown-item.disabled:hover {
    background-color: transparent;
    color: var(--text-primary);
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========== CUSTOM MODAL ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.2s ease;
}

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

.modal-dialog {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px 36px;
    min-width: 340px;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 8px 32px var(--shadow);
    transform: scale(1);
    transition: transform 0.2s ease;
}

.modal-overlay.hidden .modal-dialog {
    transform: scale(0.95);
}

.modal-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon svg {
    width: 34px;
    height: 34px;
}

.modal-icon-timer {
    color: var(--warning);
}

.modal-icon-warning {
    color: var(--danger);
}

.modal-icon-success {
    color: var(--success);
}

.modal-icon.icon-timer {
    background-color: rgba(255, 152, 0, 0.12);
}

.modal-icon.icon-warning {
    background-color: rgba(211, 47, 47, 0.12);
}

.modal-icon.icon-success {
    background-color: rgba(76, 175, 80, 0.12);
}

[data-theme="dark"] .modal-icon.icon-timer {
    background-color: rgba(255, 183, 77, 0.15);
}

[data-theme="dark"] .modal-icon.icon-warning {
    background-color: rgba(241, 76, 76, 0.15);
}

[data-theme="dark"] .modal-icon.icon-success {
    background-color: rgba(76, 175, 80, 0.15);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 10px;
}

.modal-message {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0 0 28px;
    line-height: 1.6;
    white-space: pre-line;
}

.modal-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 30px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.modal-btn-primary {
    background-color: var(--accent);
    color: white;
}

.modal-btn-primary:hover {
    background-color: var(--accent-hover);
}

.modal-btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.modal-btn-secondary:hover {
    background-color: var(--bg-hover);
}

.modal-btn-danger {
    background-color: var(--danger);
    color: white;
}

.modal-btn-danger:hover {
    background-color: var(--danger-hover);
}

/* ========== RESULT MODAL ========== */
.result-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.result-modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.result-modal {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.result-modal-overlay.hidden .result-modal {
    transform: scale(0.9);
}

.result-modal-header {
    text-align: center;
    padding: 32px 32px 24px;
    border-bottom: 1px solid var(--border);
}

.result-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.result-modal-exam-title {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
}

.result-modal-content {
    padding: 28px 32px;
}

/* Result Info Grid */
.result-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.result-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.result-info-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.result-info-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.result-info-value.result-correct {
    color: var(--correct);
}

.result-info-value.result-incorrect {
    color: var(--incorrect);
}

/* Score Display */
.result-score-container {
    text-align: center;
    margin-bottom: 20px;
}

.result-score-label {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.result-score-value {
    font-size: 56px;
    font-weight: 800;
    line-height: 1;
    margin: 0;
}

.result-score-value.pass {
    color: var(--correct);
}

.result-score-value.fail {
    color: var(--incorrect);
}

.result-score-total {
    font-size: 24px;
    color: var(--text-secondary);
    font-weight: 600;
}

.result-grade {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 24px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 24px;
}

.result-grade.pass {
    background-color: rgba(76, 175, 80, 0.15);
    color: var(--correct);
}

.result-grade.fail {
    background-color: rgba(244, 67, 54, 0.15);
    color: var(--incorrect);
}

/* Progress Bar */
.result-progress-bar {
    height: 28px;
    background-color: var(--bg-secondary);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.result-progress-fill {
    height: 100%;
    transition: width 0.8s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 14px;
    font-size: 13px;
    font-weight: 700;
    color: white;
}

.result-progress-fill.pass {
    background: linear-gradient(90deg, #4caf50 0%, #66bb6a 100%);
}

.result-progress-fill.fail {
    background: linear-gradient(90deg, #f44336 0%, #ef5350 100%);
}

/* Sections */
.result-sections {
    max-height: 250px;
    overflow-y: auto;
}

.result-section-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
}

.result-section-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.result-section-stats {
    font-size: 12px;
    color: var(--text-secondary);
}

.result-section-score {
    font-size: 20px;
    font-weight: 700;
}

.result-section-score.pass {
    color: var(--correct);
}

.result-section-score.fail {
    color: var(--incorrect);
}

/* Result Modal Footer */
.result-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 32px 28px;
    border-top: 1px solid var(--border);
}

.result-modal-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.result-modal-btn-primary {
    background-color: var(--accent);
    color: white;
}

.result-modal-btn-primary:hover {
    background-color: var(--accent-hover);
}

.result-modal-btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.result-modal-btn-secondary:hover {
    background-color: var(--border);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
    .question-sidebar {
        width: 180px;
    }

    .bottom-center {
        gap: 6px;
    }

    .action-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    #btn-prev,
    #btn-next {
        min-width: 85px;
    }

    #btn-show-answer {
        min-width: 120px;
    }

    #btn-toggle-list {
        min-width: 100px;
    }
}

@media (max-width: 768px) {
    .question-sidebar {
        display: none;
    }

    .question-sidebar.collapsed {
        display: none;
    }

    #btn-toggle-list {
        display: none;
    }

    .zoom-controls {
        display: none;
    }

    .bottom-divider {
        display: none;
    }

    .bottom-bar {
        padding: 0 10px;
    }

    .action-btn span {
        display: none;
    }

    .action-btn {
        padding: 10px;
        min-width: auto !important;
    }

    #btn-show-answer span,
    #btn-take-note span,
    #btn-review span,
    #btn-end-exam span {
        display: none;
    }

    #btn-prev span,
    #btn-next span {
        display: inline;
    }
}

/* ========== DEMO PAGE STYLES ========== */
.demo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.demo-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.demo-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    letter-spacing: 0.05em;
}

.demo-exam-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.demo-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.demo-back-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.action-btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
    color: white !important;
    border-color: transparent !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
    text-decoration: none;
}

.action-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4) !important;
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%) !important;
    color: white !important;
}

.action-btn-pdf {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    color: white !important;
    border-color: transparent !important;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    text-decoration: none;
}

.action-btn-pdf:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4) !important;
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%) !important;
    color: white !important;
}

.demo-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.demo-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    color: white;
}

.demo-result-cta {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
    border-radius: 0.5rem;
    text-align: center;
}

.demo-result-cta p {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ========== DEMO PAGE MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {
    .demo-header {
        padding: 0.5rem 0.75rem;
    }

    .demo-title {
        gap: 0.5rem;
    }

    .demo-exam-name {
        font-size: 0.8rem;
    }

    .demo-badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }

    .demo-back-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .question-counter {
        display: none;
    }

    /* Hide download button text on mobile, show only icons */
    .action-btn-pdf strong,
    .action-btn-primary strong {
        display: none;
    }

    .action-btn-pdf,
    .action-btn-primary {
        padding: 10px !important;
        min-width: auto !important;
    }

    /* Hide End Demo text on mobile */
    #btn-end-demo span {
        display: none;
    }
}

@media (max-width: 480px) {
    .demo-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .demo-title {
        flex: 1;
        min-width: 0;
    }

    .demo-exam-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }

    .demo-back-btn span {
        display: none;
    }

    .demo-back-btn {
        padding: 0.4rem;
    }

    .bottom-bar {
        gap: 4px;
        padding: 0 6px;
    }

    .bottom-section {
        gap: 4px !important;
    }

    .action-btn {
        padding: 8px !important;
    }

    .action-btn .btn-icon {
        width: 18px;
        height: 18px;
    }
}
