/* ==========================================================================
   OS Practical Hub - Professional Stylesheet
   ========================================================================== */

:root {
    /* Color Palette - Dark Navy Theme (Default) */
    --bg-base: #0a0e17;
    --bg-surface: #111827;
    --bg-surface-elevated: #1a2234;
    --bg-surface-hover: #222d42;
    --border-color: #243048;
    --border-focus: #3b82f6;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-link: #38bdf8;

    /* Brand / Accent Colors */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.25);

    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-purple: #8b5cf6;
    --accent-rose: #f43f5e;

    /* Code View Colors */
    --code-bg: #0d121f;
    --code-header-bg: #131a29;
    --code-text: #e2e8f0;
    --code-gutter-bg: #0d121f;
    --code-gutter-text: #475569;
    --code-gutter-border: #1e293b;

    /* Badges & Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5);

    --sidebar-width: 280px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'Fira Code', 'Cascadia Code', Menlo, Consolas, Monaco, monospace;
}

/* Light Theme Variables */
[data-theme="light"] {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-surface-hover: #e2e8f0;
    --border-color: #cbd5e1;
    --border-focus: #2563eb;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-link: #0284c7;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-glow: rgba(37, 99, 235, 0.18);

    --code-bg: #ffffff;
    --code-header-bg: #f8fafc;
    --code-text: #0f172a;
    --code-gutter-bg: #f8fafc;
    --code-gutter-text: #94a3b8;
    --code-gutter-border: #e2e8f0;

    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.12);
}

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

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Layout Structure */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ==========================================================================
   Sidebar Component
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 1.25rem 1.25rem 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    transition: opacity 0.2s;
}

.sidebar-brand:hover {
    opacity: 0.85;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.brand-tag {
    font-size: 0.72rem;
    color: var(--accent-cyan);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Sidebar Search */
.sidebar-search-box {
    margin: 1rem 1.25rem 0.5rem 1.25rem;
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-search-box svg {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
}

.sidebar-search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.2rem;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.825rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sidebar-search-box input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.sidebar-search-box input::placeholder {
    color: var(--text-muted);
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.75rem;
}

.nav-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem 0.35rem 0.75rem;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    position: relative;
}

.nav-item:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--bg-surface-elevated);
    color: var(--text-link);
    font-weight: 600;
    border-left: 3px solid var(--primary);
}

.nav-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background-color: var(--bg-surface-hover);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
}

.nav-item.active .nav-number {
    background-color: var(--primary);
    color: #ffffff;
}

.nav-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.nav-footer-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.nav-footer-btn.active {
    background-color: var(--bg-surface-elevated);
    border-color: var(--border-color);
    color: var(--primary);
}

/* ==========================================================================
   Main Wrapper & Top Navigation Bar
   ========================================================================== */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.top-nav {
    height: var(--header-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.top-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.crumb-root {
    color: var(--text-muted);
    font-weight: 500;
}

.crumb-separator {
    color: var(--border-color);
}

.crumb-current {
    color: var(--text-primary);
    font-weight: 600;
}

/* Center Search */
.top-center {
    flex: 1;
    max-width: 480px;
    margin: 0 1.5rem;
}

.header-search {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.header-search .search-icon {
    position: absolute;
    left: 0.85rem;
    color: var(--text-muted);
    pointer-events: none;
}

.header-search input {
    width: 100%;
    padding: 0.55rem 2.2rem 0.55rem 2.4rem;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.header-search input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background-color: var(--bg-surface);
}

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

.clear-search-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-search-btn:hover {
    color: var(--text-primary);
}

/* Top Right Controls */
.top-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
    text-decoration: none;
    user-select: none;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 1px 3px var(--primary-glow);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 2px 6px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-focus);
    color: var(--text-link);
}

.btn-exam {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #ffffff;
    padding: 0.45rem 0.95rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.btn-exam:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 3px 12px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.exam-dot {
    width: 8px;
    height: 8px;
    background-color: #fef08a;
    border-radius: 50%;
    box-shadow: 0 0 6px #fef08a;
    animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.icon-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.mobile-menu-btn {
    display: none;
}

.mobile-only {
    display: none;
}

/* ==========================================================================
   Content Container & Views
   ========================================================================== */
.content-container {
    flex: 1;
    padding: 1.75rem 2rem 3rem 2rem;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

.view-panel {
    display: none;
}

.view-panel.active {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

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

/* ==========================================================================
   DASHBOARD VIEW
   ========================================================================== */
.dashboard-hero {
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-surface-elevated) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.25rem 2.25rem 2rem 2.25rem;
    margin-bottom: 2.25rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.dashboard-hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 70%);
    pointer-events: none;
}

.hero-header {
    margin-bottom: 1.75rem;
}

.hero-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    background-color: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-full);
    color: var(--accent-cyan);
    font-size: 0.725rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 0.65rem;
}

.hero-title {
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-focus);
}

.stat-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-wrapper.blue { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.stat-icon-wrapper.emerald { background-color: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon-wrapper.purple { background-color: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.stat-icon-wrapper.amber { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.stat-meta {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.775rem;
    font-weight: 500;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.725rem;
    color: var(--text-secondary);
}

/* Section Header */
.section-container {
    margin-top: 1rem;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.section-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.filter-status {
    font-size: 0.825rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Practicals Grid */
.practicals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

/* Practical Card */
.practical-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.practical-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg), 0 0 12px var(--primary-glow);
}

.card-top {
    margin-bottom: 1.15rem;
}

.card-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.card-num-badge {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #60a5fa;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    letter-spacing: 0.04em;
}

[data-theme="light"] .card-num-badge {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.card-file-tag {
    font-family: var(--font-mono);
    font-size: 0.725rem;
    color: var(--text-muted);
    background-color: var(--bg-surface-elevated);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.card-action-btn {
    width: 100%;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    background-color: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    margin-top: 1.5rem;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.empty-state h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

/* ==========================================================================
   CODE VIEWER
   ========================================================================== */
.viewer-header {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.viewer-title-group {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

.btn-back {
    padding: 0.5rem 0.85rem;
    flex-shrink: 0;
}

.viewer-headings {
    display: flex;
    flex-direction: column;
}

.viewer-badge-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.practical-tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #60a5fa;
    background-color: rgba(59, 130, 246, 0.15);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
}

.filename-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: var(--bg-surface-elevated);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.viewer-practical-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
}

.viewer-practical-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.viewer-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.action-btn {
    padding: 0.55rem 0.95rem;
}

/* Code Editor Card */
.code-editor-card {
    background-color: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.code-card-topbar {
    background-color: var(--code-header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.65rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.terminal-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.dot.red { background-color: #ef4444; }
.dot.yellow { background-color: #f59e0b; }
.dot.green { background-color: #10b981; }

.editor-file-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.825rem;
    color: var(--text-primary);
    font-weight: 500;
}

.editor-status-tag {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
}

.code-stats {
    font-family: var(--font-mono);
    font-size: 0.775rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.stats-sep {
    opacity: 0.5;
}

/* Code Loader */
.code-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 4rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

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

/* Error Banner */
.error-banner {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 1.5rem;
    margin: 1.5rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.error-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.error-heading {
    color: #f87171;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.error-message {
    color: var(--text-primary);
    font-size: 0.875rem;
}

.error-path {
    margin-top: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Code Scroll & Line Numbers */
.code-scroll-wrapper {
    display: flex;
    overflow-x: auto;
    position: relative;
    min-height: 250px;
    max-height: 72vh;
}

.line-gutter {
    background-color: var(--code-gutter-bg);
    border-right: 1px solid var(--code-gutter-border);
    padding: 1rem 0.85rem 1rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--code-gutter-text);
    text-align: right;
    user-select: none;
    flex-shrink: 0;
}

.code-pre {
    flex: 1;
    margin: 0;
    padding: 1rem 1.5rem;
    background-color: var(--code-bg);
    overflow-x: visible;
}

.code-text {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--code-text);
    white-space: pre;
    tab-size: 4;
    display: block;
}

/* Viewer Pagination */
.viewer-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.25rem;
    padding: 0 0.5rem;
}

.pagination-indicator {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

#paginationCurrent {
    color: var(--text-primary);
    font-weight: 600;
}

/* ==========================================================================
   EXAM MODE (Distraction-Free)
   ========================================================================== */
body.exam-mode {
    --header-height: 48px;
}

body.exam-mode .dashboard-hero {
    display: none !important;
}

body.exam-mode .top-nav {
    background-color: #050811;
    border-bottom: 2px solid #d97706;
}

[data-theme="light"] body.exam-mode .top-nav {
    background-color: #fffbeb;
    border-bottom: 2px solid #f59e0b;
}

body.exam-mode .content-container {
    max-width: 100%;
    padding: 1rem 1.25rem;
}

body.exam-mode .viewer-header {
    padding: 0.85rem 1.25rem;
    margin-bottom: 0.85rem;
}

body.exam-mode .code-scroll-wrapper {
    max-height: 82vh;
}

body.exam-mode .exam-mode-pill {
    display: flex !important;
}

.exam-mode-pill {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background-color: #1c1917;
    border: 1px solid #d97706;
    color: #fef3c7;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    font-size: 0.825rem;
    font-weight: 600;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.exam-status-dot {
    width: 8px;
    height: 8px;
    background-color: #f59e0b;
    border-radius: 50%;
    box-shadow: 0 0 8px #f59e0b;
}

.exit-exam-btn {
    background-color: #d97706;
    color: #ffffff;
    border: none;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s;
}

.exit-exam-btn:hover {
    background-color: #b45309;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast-notification {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background-color: #1e293b;
    color: #ffffff;
    border: 1px solid #334155;
    padding: 0.75rem 1.4rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-xl);
    pointer-events: none;
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-notification.success {
    background-color: #064e3b;
    border-color: #059669;
    color: #a7f3d0;
}

.toast-notification.error {
    background-color: #7f1d1d;
    border-color: #dc2626;
    color: #fecaca;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(2px);
        z-index: 99;
    }

    .sidebar-backdrop.active {
        display: block;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .mobile-only {
        display: inline-flex;
    }

    .top-center {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        padding: 1.5rem;
    }

    .hero-title {
        font-size: 1.65rem;
    }

    .content-container {
        padding: 1.25rem 1rem;
    }

    .viewer-header {
        flex-direction: column;
        align-items: stretch;
    }

    .viewer-actions {
        width: 100%;
        justify-content: stretch;
    }

    .action-btn {
        flex: 1;
    }
}
