/* ========================================
   Structures de Données en C - Styles
   Luxueux & Minimal — Responsive + Thème
   ======================================== */

/* ── Thème Clair ── */
:root,
[data-theme="light"] {
    --bg-primary: #fafaf9;
    --bg-secondary: #f5f5f4;
    --bg-tertiary: #e7e5e4;
    --bg-code: #f5f5f4;
    --bg-sidebar: #fafaf9;
    --bg-card: #ffffff;
    --bg-hover: #f5f5f4;
    --bg-exercise: #fafaf9;
    
    --text-primary: #1c1917;
    --text-secondary: #57534e;
    --text-muted: #a8a29e;
    --text-code: #1c1917;
    
    --accent: #34d399;
    --accent-subtle: #d1fae5;
    --accent-success: #34d399;
    --accent-warning: #fbbf24;
    --accent-danger: #f87171;
    --accent-info: #67e8f9;
    
    --border-color: #e7e5e4;
    --border-light: #f5f5f4;
    
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.04);
    --shadow-md: 0 4px 12px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.08);
    
    --topbar-bg: rgba(250,250,249,0.85);
    --topbar-border: #e7e5e4;
    
    --code-keyword: #7c3aed;
    --code-type: #0891b2;
    --code-function: #2563eb;
    --code-string: #059669;
    --code-number: #dc2626;
    --code-comment: #6b7280;
    --code-preproc: #db2777;
    --code-operator: #64748b;
}

/* ── Thème Sombre ── */
[data-theme="dark"] {
    --bg-primary: #0c0a09;
    --bg-secondary: #1c1917;
    --bg-tertiary: #292524;
    --bg-code: #1c1917;
    --bg-sidebar: #0c0a09;
    --bg-card: #1c1917;
    --bg-hover: #292524;
    --bg-exercise: #1c1917;
    
    --text-primary: #fafaf9;
    --text-secondary: #a8a29e;
    --text-muted: #78716c;
    --text-code: #e7e5e4;
    
    --accent: #34d399;
    --accent-subtle: #292524;
    --accent-success: #34d399;
    --accent-warning: #fbbf24;
    --accent-danger: #f87171;
    --accent-info: #67e8f9;
    
    --border-color: #292524;
    --border-light: #1c1917;
    
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.2);
    --shadow-md: 0 4px 12px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.4);
    
    --topbar-bg: rgba(12,10,9,0.85);
    --topbar-border: #292524;
    
    --code-keyword: #c4b5fd;
    --code-type: #67e8f9;
    --code-function: #93c5fd;
    --code-string: #6ee7b7;
    --code-number: #fca5a5;
    --code-comment: #78716c;
    --code-preproc: #fda4af;
    --code-operator: #57534e;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
    font-family: 'Outfit', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background 0.4s, color 0.4s;
    -webkit-font-smoothing: antialiased;
}

/* ── Scroll Progress Bar ── */
.scroll-progress {
    position: fixed; top: 56px; left: 0; right: 0;
    height: 2px;
    background: var(--border-light);
    z-index: 999;
}
.scroll-progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.1s ease-out;
}

/* ── Topbar ── */
.topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--topbar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 1000;
    transition: background 0.4s, border-color 0.4s;
}

.topbar-left { display: flex; align-items: center; gap: 0.75rem; overflow: hidden; flex: 1; }

.topbar-center { display: none; align-items: center; justify-content: center; }

.site-title {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 1.1rem; font-weight: 600; color: var(--text-primary);
    letter-spacing: -0.02em;
    white-space: nowrap; overflow-x: auto;
    scrollbar-width: none;
}
.site-title::-webkit-scrollbar { display: none; }
.site-title i { color: var(--accent); font-size: 0.95rem; flex-shrink: 0; }

.menu-toggle {
    height: 36px; border: none; background: transparent;
    color: var(--text-secondary); font-size: 0.85rem; cursor: pointer;
    border-radius: 8px; display: flex; align-items: center; gap: 0.5rem;
    padding: 0 0.75rem; transition: all 0.2s;
}
.menu-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.menu-toggle-text { font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

.author-top {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

@media (max-width: 1023px) {
    .author-top { display: none; }
}

.scroll-btn {
    width: 32px; height: 32px; border: none; background: transparent;
    color: var(--text-secondary); font-size: 0.85rem; cursor: pointer;
    border-radius: 6px; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.scroll-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.theme-toggle {
    height: 36px; border: none; background: transparent;
    color: var(--text-secondary); font-size: 0.85rem; cursor: pointer;
    border-radius: 8px; display: flex; align-items: center; gap: 0.5rem;
    padding: 0 0.5rem; transition: all 0.2s;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.theme-label { font-weight: 500; }
.theme-dropdown-icon { font-size: 0.7rem; transition: transform 0.2s; }
.theme-dropdown.open .theme-dropdown-icon { transform: rotate(180deg); }

.theme-dropdown {
    position: relative;
}

.theme-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    min-width: 140px;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.theme-dropdown.open .theme-dropdown-menu {
    display: flex;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    text-align: left;
}

.theme-option:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.theme-option.active {
    background: var(--accent);
    color: #fff;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed; top: 56px; left: 0;
    width: 260px; height: calc(100vh - 56px);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    overflow-y: auto; z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), background 0.4s, border-color 0.4s;
}
.sidebar.active { transform: translateX(0); }

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-sidebar);
    position: sticky; top: 0; z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.sidebar-header h2 {
    font-size: 1rem; font-weight: 600; color: var(--text-primary);
    margin: 0; display: flex; align-items: center; gap: 0.5rem;
}
.sidebar-scroll-buttons {
    display: flex;
    gap: 0.25rem;
}
.sidebar-scroll-btn {
    width: 28px; height: 28px; border: none; background: transparent;
    color: var(--text-secondary); font-size: 0.75rem; cursor: pointer;
    border-radius: 6px; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.sidebar-scroll-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Progression de lecture ── */
.sidebar-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.sidebar-progress span {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}
.reset-btn {
    width: 22px; height: 22px; border: none; background: transparent;
    color: var(--text-muted); font-size: 0.7rem; cursor: pointer;
    border-radius: 4px; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.reset-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Barre de recherche ── */
.sidebar-search {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}
.sidebar-search i {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
}
.sidebar-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s;
}
.sidebar-search input:focus {
    border-color: var(--accent);
    background: var(--bg-card);
}
.sidebar-search input::placeholder {
    color: var(--text-muted);
}
.nav-item.hidden {
    display: none;
}

/* ── Checkbox de lecture ── */
.nav-link-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem 0.4rem 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    border-radius: 0 8px 8px 0;
    justify-content: space-between;
}
.nav-link-label:hover { background: var(--bg-hover); }
.nav-read-check {
    width: 18px; height: 18px;
    accent-color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    margin-left: auto;
    order: 2;
}
.nav-link-label:has(.nav-read-check:checked) .nav-link {
    color: var(--text-muted);
    text-decoration: line-through;
    opacity: 0.7;
}
.nav-link-label:has(.nav-read-check:checked) .nav-num {
    background: var(--accent);
    color: white;
}

.nav-list { list-style: none; padding: 0.5rem 0; }
.nav-item { margin: 1px 0; }

.nav-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.2rem 0;
    color: var(--text-secondary); text-decoration: none;
    font-size: 0.85rem; font-weight: 450;
    transition: all 0.15s;
    flex: 1;
}
.nav-link:hover {
    background: var(--bg-hover); color: var(--text-primary);
}
.nav-link.active {
    background: var(--accent-subtle); color: var(--accent);
}
.nav-link i { width: 18px; text-align: center; font-size: 0.8rem; }

/* ── Sub Navigation ── */
.nav-sub-list {
    list-style: none;
    padding: 0 0 0 2.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.nav-item.open .nav-sub-list {
    max-height: 500px;
}
.nav-sub-link {
    display: block;
    padding: 0.4rem 1.25rem 0.4rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.15s;
}
.nav-sub-link:hover {
    color: var(--text-primary);
}
.nav-sub-link.active {
    color: var(--accent);
}

.nav-num {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px;
    font-size: 0.7rem; font-weight: 600;
    color: var(--text-muted);
    border-radius: 4px;
    background: var(--bg-hover);
}

/* ── Overlay ── */
.overlay {
    position: fixed; top: 56px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 998;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.overlay.active { opacity: 1; visibility: visible; }

/* ── Main Content ── */
.main-content {
    margin-top: 56px; margin-left: 0;
    min-height: calc(100vh - 56px);
    transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
}

/* ── Sections ── */
.section {
    padding: 1.5rem 1rem;
    max-width: 860px;
    margin: 0 auto;
}

@media (max-width: 1023px) {
    .section { padding: 1.5rem 0; }
}

.section-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.section-header h2 {
    font-size: 1.4rem; font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* ── Content Boxes ── */
.concept-box,
.info-box,
.warning-box,
.code-example,
.exercise-box,
.syntax-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    transition: background 0.4s, border-color 0.4s;
}

.concept-box h3,
.info-box h4,
.warning-box h4,
.code-example h4,
.exercise-box h4,
.syntax-box h4 {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.95rem; font-weight: 600;
    margin-bottom: 0.75rem; color: var(--text-primary);
}

.concept-box h3 i { color: var(--accent); }
.info-box h4 i { color: var(--accent-info); }
.warning-box h4 i { color: var(--accent-warning); }
.code-example h4 i { color: var(--accent-success); }
.exercise-box h4 i { color: var(--accent); }

.concept-box p,
.info-box p,
.warning-box p {
    color: var(--text-secondary); margin-bottom: 0.75rem; font-size: 0.92rem;
}
.concept-box ul, .info-box ul { margin-left: 1.25rem; color: var(--text-secondary); }
.concept-box li, .info-box li { margin-bottom: 0.4rem; font-size: 0.92rem; }

/* ── Code Blocks ── */
pre {
    background: var(--bg-code);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0;
    overflow-x: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem; line-height: 1.7;
    margin: 0.75rem 0;
    color: var(--text-code);
    transition: background 0.4s, border-color 0.4s;
    tab-size: 4;
    position: relative;
}

pre > code {
    display: block;
    padding: 1rem 3rem 1rem 1.25rem;
}

/* ── Copy Button ── */
.copy-btn {
    position: absolute; top: 0.5rem; right: 0.5rem;
    width: 28px; height: 28px; border: none;
    background: var(--bg-hover); color: var(--text-muted);
    border-radius: 4px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; transition: all 0.2s;
    z-index: 10;
}
.copy-btn:hover {
    background: var(--accent);
    color: white;
}
.copy-btn.copied {
    background: var(--accent-success);
    color: white;
}

code {
    font-family: 'Fira Code', monospace;
    font-size: 0.88em;
}
:not(pre) > code {
    background: var(--accent-subtle);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
    color: var(--accent);
}

/* ── Syntax Highlighting Classes ── */
.kw { color: var(--code-keyword); font-weight: 500; }
.tp { color: var(--code-type); }
.fn { color: var(--code-function); }
.st { color: var(--code-string); }
.nm { color: var(--code-number); }
.cm { color: var(--code-comment); font-style: italic; }
.pp { color: var(--code-preproc); }
.op { color: var(--code-operator); }

/* ── Tables ── */
.operators-table,
.ops-table,
.comparison-table {
    overflow-x: auto; margin-bottom: 1.25rem;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; }
th, td { padding: 0.65rem 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
th { border-bottom: 2px solid var(--border-color); }
tr:last-child td { border-bottom: none; }
th {
    background: var(--bg-secondary); font-weight: 600;
    color: var(--text-primary); text-transform: uppercase;
    font-size: 0.7rem; letter-spacing: 0.06em;
}
td { color: var(--text-secondary); }
tr:hover td { background: var(--bg-hover); }

/* ── Memory Diagrams ── */
.memory-table, .code-diagram {
    background: var(--bg-code); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 1rem; margin: 1rem 0;
    color: var(--text-code);
}
.memory-table h4, .code-diagram h4 {
    font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem;
}
.mem-row {
    display: flex; align-items: center; gap: 1rem;
    padding: 0.4rem 0; font-family: 'Fira Code', monospace; font-size: 0.82rem;
}
.mem-row.header { font-weight: 600; color: var(--text-code); border-bottom: 1px solid var(--border-color); margin-bottom: 0.5rem; }
.mem-row .addr { color: var(--accent); min-width: 80px; }
.mem-row .val { color: var(--accent-success); min-width: 60px; }
.mem-row .comment { color: var(--code-comment); }

/* ── Pointer Diagram ── */
.pointer-diagram, .memory-diagram {
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 10px; padding: 1.5rem; margin: 1.25rem 0;
}
.mem-visual { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.mem-block {
    display: flex; flex-direction: column; align-items: center;
    background: var(--bg-code); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 0.75rem 1rem; min-width: 100px;
}
.mem-block .addr-label { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.mem-block .val-content { font-family: 'Fira Code', monospace; font-size: 1.1rem; font-weight: 600; color: var(--accent); }
.mem-block .var-name { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; }
.arrow { font-size: 1.25rem; color: var(--text-muted); }
.diagram-caption { text-align: center; color: var(--text-muted); font-size: 0.82rem; margin-top: 1rem; }

/* ── Memory Layers ── */
.mem-layers { display: flex; align-items: center; justify-content: center; gap: 2rem; flex-wrap: wrap; }
.stack-layer, .heap-layer { text-align: center; }
.stack-layer h5, .heap-layer h5 { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.mem-box {
    background: var(--bg-code); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 1rem; min-width: 120px; color: var(--text-code);
}
.mem-box span { display: block; font-family: 'Fira Code', monospace; }
.mem-box .addr { font-size: 0.72rem; color: var(--text-muted); }
.arrow-big { font-size: 1.5rem; color: var(--text-muted); }
.mem-label { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.5rem; }

/* ── List Diagram ── */
.list-diagram {
    display: flex; align-items: center; justify-content: center;
    gap: 0.4rem; flex-wrap: wrap; padding: 1.25rem;
    background: var(--bg-code); border-radius: 8px; margin: 1rem 0;
    font-family: 'Fira Code', monospace; font-size: 0.82rem; color: var(--text-code);
}
.node { display: flex; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 4px; overflow: hidden; }
.node .data { padding: 0.4rem 0.6rem; background: var(--accent-subtle); color: var(--accent); font-weight: 600; }
.node .ptr { padding: 0.4rem 0.6rem; color: var(--text-muted); }
.arrow-left, .arrow-right { color: var(--text-muted); font-size: 0.9rem; }

/* ── Stack Visual ── */
.stack-visual { display: flex; flex-direction: column; gap: 1rem; }
.stack-container { display: flex; flex-direction: column; gap: 0.25rem; max-width: 180px; margin: 0 auto; }
.stack-item {
    background: var(--accent-subtle); color: var(--accent);
    padding: 0.6rem 1rem; border-radius: 6px; text-align: center;
    font-weight: 500; display: flex; justify-content: space-between; align-items: center;
    font-size: 0.85rem;
}
.stack-item .label { font-size: 0.7rem; opacity: 0.7; }
.stack-ops { background: var(--bg-secondary); padding: 1rem; border-radius: 8px; font-size: 0.85rem; }
.stack-ops p { margin-bottom: 0.4rem; color: var(--text-secondary); }

/* ── Queue Visual ── */
.queue-visual { display: flex; flex-direction: column; gap: 1rem; }
.queue-container { display: flex; justify-content: center; gap: 0.4rem; flex-wrap: wrap; }
.queue-item {
    background: var(--accent-subtle); color: var(--accent);
    padding: 0.6rem 1rem; border-radius: 6px; font-weight: 500;
    display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
    font-size: 0.85rem;
}
.queue-item .label { font-size: 0.7rem; opacity: 0.7; }
.queue-ops { background: var(--bg-secondary); padding: 1rem; border-radius: 8px; font-size: 0.85rem; }
.queue-ops p { margin-bottom: 0.4rem; color: var(--text-secondary); }

/* ── Tree Visual ── */
.tree-visual {
    display: flex; flex-direction: column; align-items: center; gap: 1.5rem;
    padding: 1.5rem; background: var(--bg-secondary); border-radius: 8px; margin: 1rem 0;
}
.tree-node { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; position: relative; }
.tree-node span:first-child {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; background: var(--accent-subtle);
    color: var(--accent); border: 2px solid var(--accent); border-radius: 50%; font-weight: 600; font-size: 0.85rem;
}
.tree-node .label { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; }
.tree-children { display: flex; gap: 3rem; position: relative; }
.tree-children::before {
    content: '';
    position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    width: 2px; height: 20px; background: var(--border-color);
}
.tree-branch { display: flex; flex-direction: column; align-items: center; gap: 1rem; position: relative; }
.tree-branch::before {
    content: '';
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 2px; height: 100%; background: var(--border-color);
}
.tree-grandchildren { display: flex; gap: 1.5rem; position: relative; }
.tree-grandchildren::before {
    content: '';
    position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    width: 2px; height: 20px; background: var(--border-color);
}

/* ── Exercise Box ── */
.exercise-box {
    background: var(--bg-exercise);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 0; margin: 1.5rem 0;
}

.solution {
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 1rem 0; margin-top: 1rem;
}
.solution h5 {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.82rem; color: var(--accent-success); margin-bottom: 0.75rem; font-weight: 600;
}
.output-box {
    background: var(--bg-tertiary); border: 1px solid var(--border-color);
    border-radius: 6px; padding: 1rem 0; margin-top: 1rem;
}
.output-box h5 {
    font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.06em; margin-bottom: 0.5rem;
}
.output-box pre { background: transparent; border: none; padding: 0; font-size: 0.78rem; color: var(--text-secondary); }

/* ── Code Example ── */
.code-example {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.25rem 0; margin: 1.5rem 0;
}

/* ── Info Box ── */
.info-box {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.25rem 0; margin: 1.5rem 0;
}

/* ── Warning Box ── */
.warning-box {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.25rem 0; margin: 1.5rem 0;
}

/* ── Syntax Box ── */
.syntax-box {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.25rem 0; margin: 1.5rem 0;
}

/* ── Ops Table ── */
.ops-table {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.25rem 0; margin: 1.5rem 0;
}

/* ── Memory Diagram ── */
.memory-diagram {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.25rem 0; margin: 1.5rem 0;
}

/* ── Pointer Diagram ── */
.pointer-diagram {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.25rem 0; margin: 1.5rem 0;
}

/* ── List Diagram ── */
.list-diagram {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.25rem 0; margin: 1.5rem 0;
}

.code-example, .exercise-box, .solution, .output-box, .final-exercise, .checklist, .concept-box, .info-box, .warning-box, .syntax-box, .ops-table, .memory-diagram, .pointer-diagram, .list-diagram {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}
.final-exercise h3 {
    font-size: 1rem; font-weight: 600; color: var(--text-primary);
    margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem;
}
/* ... */
.exercise-content { margin-bottom: 1.25rem; }
.exercise-content h4 { font-size: 0.92rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.75rem; }
.exercise-content ol { margin-left: 1.25rem; color: var(--text-secondary); }
.exercise-content li { margin-bottom: 0.4rem; font-size: 0.9rem; }

/* ── Intro Text ── */
.intro-text { color: var(--text-secondary); font-size: 0.92rem; margin-bottom: 1.5rem; }

/* ── Recap ── */
.recap-section { background: var(--bg-secondary); border-radius: 10px; margin-top: 2rem; }
.comparison-table {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.5rem; margin: 1.5rem 0; overflow-x: auto;
}
.comparison-table table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.comparison-table th, .comparison-table td { padding: 0.65rem 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.comparison-table th { background: var(--bg-secondary); font-weight: 600; color: var(--text-primary); }
.comparison-table tr:last-child td { border-bottom: none; }

.checklist {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.5rem 0.5rem; margin: 1.5rem 0;
}
.checklist h3 {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 1rem;
    padding-left: 0.5rem;
}
.checklist ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.checklist li { margin-bottom: 0.75rem; }
.check-item {
    display: flex; align-items: flex-start; gap: 0.75rem;
    cursor: pointer; font-size: 0.9rem; color: var(--text-secondary);
    line-height: 1.5;
}
.check-item input[type="checkbox"] {
    margin-top: 0.25rem; width: 18px; height: 18px;
    accent-color: var(--text-muted); cursor: pointer;
    flex-shrink: 0;
}
.check-item input:checked + span {
    text-decoration: line-through; color: var(--text-muted);
}

/* ── Footer ── */
.site-footer {
    background: var(--bg-secondary); border-top: 1px solid var(--border-color);
    padding: 2rem 1.5rem; text-align: center; margin-top: 3rem;
}
.site-footer p { color: var(--text-muted); font-size: 0.82rem; }
.site-footer .author-footer { color: var(--text-muted); font-size: 0.72rem; margin-top: 0.4rem; }

/* ── Responsive ── */
@media (min-width: 768px) {
    .section { padding: 3rem 2.5rem; }
    .section-header h2 { font-size: 1.6rem; }
    .topbar { padding: 0 2rem; }
}

@media (min-width: 1024px) {
    .menu-toggle { display: none; }
    .mobile-bottom-nav { display: none; }
    .sidebar { transform: translateX(0); width: 250px; }
    .main-content { margin-left: 250px; }
    .overlay { display: none !important; }
    .section { max-width: 920px; padding: 3rem 3rem; }
}

@media (max-width: 1023px) {
    .mobile-bottom-nav { display: none !important; }
    .scroll-btn { display: none; }
    .main-content { padding-bottom: 0; }
}

@media (min-width: 1280px) {
    .section { max-width: 960px; }
    .sidebar { width: 270px; }
    .main-content { margin-left: 270px; }
}

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

/* ── Mobile Bottom Navigation ── */
.mobile-bottom-nav {
    display: none;
}

::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Selection ── */
::selection { background: var(--accent); color: white; }

/* ── Focus ── */
button:focus-visible, a:focus-visible, input:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ── Print ── */
@media print {
    .topbar, .sidebar, .menu-toggle, .theme-toggle, .overlay { display: none !important; }
    .main-content { margin-left: 0 !important; margin-top: 0 !important; }
    .section { page-break-inside: avoid; }
    pre { border: 1px solid #ddd; }
}
