/**
 * DudExam - CSS Styles
 * Elegant, Minimal, Sophisticated Design
 * Primary: Navy Blue | Accent: Cool Tones
 */

/* =====================================================
   CSS Variables - Navy & Cool Color Palette
   ===================================================== */
:root {
    /* Primary Navy Colors */
    --primary-color: #1e3a5f;
    --primary-light: #2d4a6f;
    --primary-dark: #0f2540;
    --primary-hover: #15304d;
    
    /* Accent Colors - Cool Tones */
    --accent-blue: #4a90a4;
    --accent-teal: #5ba3a0;
    --accent-slate: #64748b;
    --accent-ice: #8cb4c5;
    
    /* Secondary */
    --secondary-color: #475569;
    --secondary-hover: #334155;
    
    /* Semantic Colors */
    --success-color: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --success-border: rgba(16, 185, 129, 0.3);
    --danger-color: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --danger-border: rgba(220, 38, 38, 0.2);
    --warning-color: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.1);
    --warning-border: rgba(217, 119, 6, 0.3);
    
    /* Neutral Palette - Cool Grays */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Surfaces */
    --surface-bg: #f0f4f8;
    --surface-card: #ffffff;
    --surface-elevated: #ffffff;
    --surface-overlay: rgba(15, 37, 64, 0.5);
    
    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    
    /* Layout */
    --header-height: 64px;
    --border-radius: 6px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    
    /* Shadows - Subtle & Elegant */
    --shadow-xs: 0 1px 2px rgba(30, 58, 95, 0.04);
    --shadow-sm: 0 2px 4px rgba(30, 58, 95, 0.06);
    --shadow: 0 4px 12px rgba(30, 58, 95, 0.08);
    --shadow-lg: 0 8px 24px rgba(30, 58, 95, 0.12);
    --shadow-xl: 0 16px 48px rgba(30, 58, 95, 0.16);
    
    /* Borders */
    --border-light: rgba(30, 58, 95, 0.08);
    --border-default: rgba(30, 58, 95, 0.12);
    --border-strong: rgba(30, 58, 95, 0.2);
    
    /* Transitions */
    --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================
   Reset & Base Styles
   ===================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8eef3 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    letter-spacing: -0.01em;
}

/* =====================================================
   Layout
   ===================================================== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =====================================================
   Header - Elegant Navy Bar
   ===================================================== */
.app-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 0 2rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Compact header when in practice mode */
.app-container.practice-mode .app-header {
    display: none;
}

.app-container.practice-mode .tagline {
    display: none;
}

.logo {
    font-size: 1.375rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tagline {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 0.75rem;
}

/* =====================================================
   Buttons - Sophisticated & Minimal
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    letter-spacing: 0.01em;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-color) 100%);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #ef4444 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #b91c1c 0%, var(--danger-color) 100%);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
    transform: translateY(-1px);
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
}

.btn-text:hover {
    color: var(--primary-color);
    background: rgba(30, 58, 95, 0.05);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-large {
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

/* Ghost button variant */
.btn-ghost {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

/* =====================================================
   Main Content
   ===================================================== */
.main-content {
    flex: 1;
    padding: 2rem 2.5rem;
}

.app-container.practice-mode .main-content {
    padding: 0.35rem 0.5rem;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* =====================================================
   Exam List View - Clean Grid
   ===================================================== */
.exam-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.exam-list-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

.filter-controls {
    display: flex;
    gap: 0.75rem;
}

.filter-select, .filter-input {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    background: var(--surface-card);
    color: var(--text-primary);
    transition: all var(--transition);
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.filter-input {
    min-width: 220px;
}

.filter-input::placeholder {
    color: var(--text-muted);
}

.exam-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.25rem;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 2rem;
    background: var(--surface-card);
    border-radius: var(--border-radius-xl);
    color: var(--text-muted);
    border: 1px dashed var(--border-default);
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Exam Card - Elegant & Minimal */
.exam-card {
    background: var(--surface-card);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.exam-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-blue) 100%);
    opacity: 0;
    transition: opacity var(--transition);
}

.exam-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: transparent;
    transform: translateY(-3px);
}

.exam-card:hover::before {
    opacity: 1;
}

.exam-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.875rem;
}


.exam-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
    letter-spacing: -0.01em;
}

.exam-card-badge {
    display: inline-flex;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-left: 0.5rem;
    letter-spacing: 0.03em;
}

.badge-type {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-blue) 100%);
    color: white;
}

.exam-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.exam-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.exam-card-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.status-ready {
    background: var(--success-color);
}

.status-pending {
    background: var(--warning-color);
}

.exam-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.exam-card-actions .actions-left {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.exam-card-actions .btn {
    flex: 0 1 auto;
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
}

/* =====================================================
   Practice View - Clean Layout
   ===================================================== */
.practice-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--surface-card);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

#btn-back {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

#btn-back:hover {
    color: var(--primary-color);
}

#practice-title {
    font-size: 0.85rem;
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.practice-timer {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.2);
}

.practice-container {
    display: flex;
    gap: 0.75rem;
    height: calc(100vh - 50px);
}

/* PDF Panel - Minimal */
.pdf-panel {
    flex: 1;
    background: var(--surface-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.pdf-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-light);
}

.pdf-controls .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}

.pdf-controls .btn-sm:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#pdf-page-info, #pdf-zoom-level {
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 50px;
    text-align: center;
}

.pdf-controls-divider {
    color: var(--border-default);
    font-size: 0.8rem;
}

.pdf-container {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0.5rem;
    background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-300) 100%);
}

#pdf-canvas {
    box-shadow: var(--shadow-xl);
    background: white;
}

/* Answer Panel - Sophisticated */
.answer-panel {
    width: 340px;
    min-width: 340px;
    background: var(--surface-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
}

.answer-header {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--surface-card) 100%);
}

.answer-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
}

.answer-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.answer-grid {
    flex: 1;
    overflow-y: auto;
    padding: 0.625rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    align-content: start;
}

.answer-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    background: var(--gray-50);
    border-radius: 6px;
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}

.answer-item.answered {
    background: rgba(30, 58, 95, 0.06);
    border-color: var(--primary-color);
}

.answer-item.correct {
    background: var(--success-bg);
    border-color: var(--success-border);
}

.answer-item.wrong {
    background: var(--danger-bg);
    border-color: var(--danger-border);
}

.answer-number {
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--text-secondary);
    min-width: 22px;
}

.answer-options {
    display: flex;
    gap: 3px;
}

.answer-option {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: white;
    color: var(--text-secondary);
}

.answer-option:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(30, 58, 95, 0.04);
}

.answer-option.selected {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 6px rgba(30, 58, 95, 0.25);
}

.answer-option.correct-answer {
    background: linear-gradient(135deg, var(--success-color) 0%, #34d399 100%);
    border-color: var(--success-color);
    color: white;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.answer-option.wrong-answer {
    background: linear-gradient(135deg, var(--danger-color) 0%, #f87171 100%);
    border-color: var(--danger-color);
    color: white;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.answer-option:disabled {
    cursor: not-allowed;
}

.answer-actions {
    padding: 0.625rem 0.875rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--surface-card) 100%);
}

.answer-actions .btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

/* =====================================================
   Results View - Elegant Score Display
   ===================================================== */
.results-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface-card);
    border-radius: var(--border-radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.results-container h2 {
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2.5rem;
}

.score-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-blue) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 1.25rem;
    box-shadow: 0 12px 40px rgba(30, 58, 95, 0.3);
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#score-value {
    font-size: 3.25rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.score-total {
    font-size: 1.25rem;
    opacity: 0.8;
    font-weight: 500;
}

.score-percentage {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.02em;
}

.results-summary {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-light);
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.summary-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.summary-item.correct .summary-icon {
    background: var(--success-bg);
    color: var(--success-color);
    border: 1px solid var(--success-border);
}

.summary-item.wrong .summary-icon {
    background: var(--danger-bg);
    color: var(--danger-color);
    border: 1px solid var(--danger-border);
}

.summary-item.unanswered .summary-icon {
    background: var(--gray-100);
    color: var(--text-muted);
    border: 1px solid var(--border-default);
}

.results-detail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.result-item {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    font-weight: 600;
    transition: transform var(--transition-fast);
}

.result-item:hover {
    transform: scale(1.05);
}

.result-item.correct {
    background: var(--success-bg);
    color: var(--success-color);
    border: 1px solid var(--success-border);
}

.result-item.wrong {
    background: var(--danger-bg);
    color: var(--danger-color);
    border: 1px solid var(--danger-border);
}

.result-item.unanswered {
    background: var(--gray-100);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
}

.result-item .question-num {
    font-size: 0.875rem;
    font-weight: 700;
}

.result-item .answer-text {
    font-size: 0.7rem;
    opacity: 0.8;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* =====================================================
   Modals - Elegant Overlays
   ===================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--surface-card);
    border-radius: var(--border-radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--surface-card) 100%);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: -0.01em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color var(--transition-fast);
}

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

.modal-body {
    padding: 1.75rem;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--gray-50);
}

/* =====================================================
   Forms - Clean & Refined
   ===================================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group.hidden {
    display: none;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-default);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--surface-card);
    transition: all var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input[type="file"] {
    display: none;
}

.form-group label[for$="-file"] {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    border: 2px dashed var(--border-default);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--gray-50);
    color: var(--text-secondary);
}

.form-group label[for$="-file"]:hover {
    border-color: var(--primary-color);
    background: rgba(30, 58, 95, 0.03);
    color: var(--primary-color);
}

.file-name {
    display: block;
    margin-top: 0.625rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.filename-preview {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
}

.filename-preview code {
    display: block;
    font-size: 0.8rem;
    color: var(--primary-color);
    word-break: break-all;
    margin-top: 0.5rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.form-actions-spread {
    justify-content: space-between;
}

.form-actions-right {
    display: flex;
    gap: 0.75rem;
}

/* =====================================================
   Toast Notifications - Refined Alerts
   ===================================================== */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 1.25rem);
    right: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 2000;
}

.toast {
    background: var(--surface-card);
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 320px;
    max-width: 450px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-light);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.removing {
    animation: slideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast.info {
    border-left: 4px solid var(--primary-color);
}

/* =====================================================
   Utility Classes
   ===================================================== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

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

/* =====================================================
   Annotation Toolbar - Floating Panel
   ===================================================== */
.annotation-toolbar {
    position: fixed;
    top: 100px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition), visibility var(--transition);
}

.annotation-toolbar.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.toolbar-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toolbar-toggle:hover {
    background: var(--surface-card);
    color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.annotation-toolbar.expanded .toolbar-toggle {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(30, 58, 95, 0.3);
}

.toolbar-panel {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    background: var(--surface-card);
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.annotation-toolbar.expanded .toolbar-panel {
    display: flex;
}

.toolbar-tools {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tool-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.tool-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.tool-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.2);
}

.toolbar-divider {
    width: 100%;
    height: 1px;
    background: var(--border-light);
    margin: 6px 0;
}

.toolbar-actions {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--gray-100);
    color: var(--text-secondary);
}

.action-btn.inactive {
    opacity: 0.4;
}

.toolbar-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 100px;
    justify-content: center;
}

.color-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
}

.color-btn:hover {
    transform: scale(1.15);
}

.color-btn.active {
    border-color: var(--primary-color);
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.2);
}

.export-btn {
    width: auto;
    height: auto;
    padding: 8px 14px;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    background: transparent;
    transition: all var(--transition);
}

.export-btn:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.2);
}

/* Annotation Canvas Layer */
.pdf-page-container {
    position: relative;
}

.annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    pointer-events: auto;
    z-index: 10;
}

/* When no tool is selected, allow touch scrolling */
.annotation-canvas.no-tool {
    pointer-events: none;
}

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

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
    transition: background var(--transition);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* =====================================================
   Selection Colors
   ===================================================== */
::selection {
    background: rgba(30, 58, 95, 0.2);
    color: var(--text-primary);
}

/* =====================================================
   Responsive Adjustments
   ===================================================== */
@media (max-width: 1200px) {
    .practice-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 50px);
    }
    
    .pdf-panel {
        height: 60vh;
        min-height: 400px;
        flex-shrink: 0;
    }
    
    .pdf-container {
        min-height: 0;
        height: 100%;
    }
    
    .answer-panel {
        width: 100%;
        max-height: 40vh;
        overflow-y: auto;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 0 1.25rem;
        flex-wrap: wrap;
        height: auto;
        padding: 1rem 1.25rem;
        gap: 0.875rem;
    }
    
    .tagline {
        display: none;
    }
    
    .header-actions {
        width: 100%;
        margin-left: 0;
    }
    
    .header-actions .btn {
        flex: 1;
    }
    
    .main-content {
        padding: 1.25rem;
    }
    
    .exam-list {
        grid-template-columns: 1fr;
    }
    
    .filter-controls {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .filter-select, .filter-input {
        flex: 1;
        min-width: 120px;
    }
    
    .practice-header {
        flex-wrap: wrap;
    }
    
    #practice-title {
        order: 3;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .answer-grid {
        grid-template-columns: 1fr;
    }
    
    .results-summary {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Annotation toolbar on mobile/tablet */
    .annotation-toolbar {
        left: 8px;
    }
    
    .toolbar-toggle {
        width: 44px;
        height: 44px;
    }
    
    .tool-btn {
        width: 40px;
        height: 40px;
    }
}

/* iPad specific adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .annotation-toolbar {
        left: 16px;
    }
    
    .toolbar-toggle {
        width: 52px;
        height: 52px;
    }
    
    .tool-btn {
        width: 48px;
        height: 48px;
    }
    
    .toolbar-panel {
        padding: 16px;
    }
    
    .practice-container {
        flex-direction: column;
        height: auto;
    }
    
    .pdf-panel {
        height: 65vh;
        min-height: 500px;
    }
    
    .pdf-container {
        -webkit-overflow-scrolling: touch;
        overflow: auto;
    }
    
    .answer-panel {
        width: 100%;
        max-height: 35vh;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .pdf-panel {
        height: 60vh;
        min-height: 400px;
    }
    
    .pdf-container {
        -webkit-overflow-scrolling: touch;
    }
    
    .practice-container {
        min-height: -webkit-fill-available;
    }
}

/* Touch-friendly adjustments for pen/stylus devices */
@media (pointer: coarse) {
    .annotation-toolbar .tool-btn,
    .annotation-toolbar .action-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .color-btn {
        width: 28px;
        height: 28px;
    }
}

/* =====================================================
   Focus States - Accessibility
   ===================================================== */
.btn:focus-visible,
.filter-select:focus-visible,
.filter-input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* =====================================================
   Print Styles
   ===================================================== */
@media print {
    .app-header,
    .annotation-toolbar,
    .answer-actions,
    .results-actions {
        display: none !important;
    }
    
    .results-container {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}
