/* =====================================================================
   THEMANUAL.CC — DESIGN SYSTEM
   All values reference tokens. Do not hardcode colours, radii, or shadows.
   ===================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
    /* Color Palette */
    --color-brand-50:   #f5f3ff;
    --color-brand-100:  #ede9fe;
    --color-brand-200:  #ddd6fe;
    --color-brand-500:  #8b5cf6;
    --color-brand-600:  #7c3aed;
    --color-brand-700:  #6d28d9;
    --color-brand-800:  #5b21b6;
    --color-brand-900:  #4c1d95;

    --color-surface-0:  #ffffff;
    --color-surface-1:  #fafafa;
    --color-surface-2:  #f4f4f5;
    --color-surface-3:  #e4e4e7;

    --color-text-primary:   #0f0f10;
    --color-text-secondary: #52525b;
    --color-text-tertiary:  #71717a;

    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-error:   #dc2626;

    /* Border Radius */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --radius-xl:  20px;
    --radius-2xl: 28px;

    /* Shadows */
    --shadow-1:     0 1px 2px rgba(0,0,0,0.05);
    --shadow-2:     0 4px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-3:     0 12px 24px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
    --shadow-brand: 0 8px 20px rgba(124,58,237,0.18), 0 2px 6px rgba(124,58,237,0.10);

    /* Transitions */
    --t-fast:    120ms ease;
    --t-base:    150ms ease;
    --t-slide:   280ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-expand:  350ms ease-in;
    --t-card:    200ms ease-out;
}

/* ==========================================================================
   2. BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-surface-1);
    color: var(--color-text-primary);
    -webkit-tap-highlight-color: transparent;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* ==========================================================================
   3. OVERLAY
   ========================================================================== */
#overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.4);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-fast);
    backdrop-filter: blur(2px);
}
.sidebar-open #overlay {
    opacity: 1;
    pointer-events: auto;
}
@media (min-width: 1024px) {
    #overlay { display: none; }
}

/* ==========================================================================
   4. SIDEBAR — SHELL
   ========================================================================== */
#sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 288px;
    z-index: 50;
    background: var(--color-surface-0);
    border-right: 1px solid var(--color-surface-3);
    display: flex;
    flex-direction: column;
}

@media (max-width: 1023px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform var(--t-slide);
        box-shadow: none;
    }
    .sidebar-open #sidebar {
        transform: translateX(0);
        box-shadow: 24px 0 40px rgba(0,0,0,0.12);
    }
}
@media (min-width: 1024px) {
    #sidebar {
        position: static;
        flex-shrink: 0;
        transform: translateX(0) !important;
    }
}

.sidebar-scroll::-webkit-scrollbar       { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--color-surface-3); border-radius: 10px; }

/* ==========================================================================
   5. SIDEBAR — HEADER / LOGOMARK
   ========================================================================== */
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--color-surface-2);
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

#sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
}

.sidebar-logomark {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-brand-600), var(--color-brand-800));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-logomark span {
    color: white;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    font-family: 'Inter', sans-serif;
}

.sidebar-wordmark { display: flex; flex-direction: column; }
.sidebar-wordmark-name {
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.04em;
    color: var(--color-text-primary);
    line-height: 1.3;
}
.brand-dot { color: var(--color-brand-600); }
.sidebar-wordmark-sub {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    margin-top: 2px;
}

.sidebar-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-tertiary);
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-close-btn:hover {
    background: var(--color-surface-2);
    color: var(--color-text-primary);
}
@media (min-width: 1024px) { .sidebar-close-btn { display: none; } }

/* ==========================================================================
   6. SIDEBAR — SEARCH
   ========================================================================== */
.search-wrapper {
    padding: 16px;
    flex-shrink: 0;
}
.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 12px;
    display: flex;
    align-items: center;
    color: var(--color-text-tertiary);
    pointer-events: none;
    z-index: 1;
}
#guide-search {
    width: 100%;
    padding: 10px 44px 10px 36px;
    background: var(--color-surface-0);
    border: 1.5px solid var(--color-surface-3);
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: var(--color-text-primary);
    outline: none;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
#guide-search::placeholder { color: var(--color-text-tertiary); }
#guide-search:focus {
    border-color: var(--color-brand-600);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}
.search-kbd {
    position: absolute;
    right: 10px;
    padding: 2px 5px;
    background: var(--color-surface-2);
    color: var(--color-text-tertiary);
    border: 1px solid var(--color-surface-3);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    pointer-events: none;
    line-height: 1.4;
}

/* ==========================================================================
   7. SIDEBAR — NAVIGATION
   ========================================================================== */
#nav-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Category trigger */
.nav-category-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: color var(--t-fast);
}
.nav-category-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    transition: color var(--t-fast);
    font-family: 'Inter', sans-serif;
}
.nav-category-btn:hover .nav-category-label { color: var(--color-brand-600); }
.nav-category-btn.is-active .nav-category-label { color: var(--color-brand-700); }

.nav-category-chevron {
    color: var(--color-text-tertiary);
    flex-shrink: 0;
    transition: transform 250ms ease, color var(--t-fast);
}
.nav-category-btn.is-active .nav-category-chevron { color: var(--color-brand-600); }
.nav-category-chevron.expanded { transform: rotate(180deg); }

/* Accordion */
.category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--t-expand);
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
}
.category-content.expanded {
    max-height: 1000px;
}

/* Guide links */
.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px 9px 32px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    border-radius: var(--radius-lg);
    text-decoration: none;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background var(--t-base), color var(--t-base), border-color var(--t-base);
}
.nav-link:hover {
    background: var(--color-brand-50);
    color: var(--color-brand-700);
}
.nav-link.active-nav {
    background: var(--color-brand-50);
    color: var(--color-brand-700);
    font-weight: 600;
    border-left-color: var(--color-brand-600);
}
.nav-link-arrow {
    opacity: 0;
    transform: translateX(0);
    color: var(--color-brand-600);
    flex-shrink: 0;
    transition: opacity var(--t-base), transform var(--t-base);
}
.nav-link:hover .nav-link-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* ==========================================================================
   8. SIDEBAR — FOOTER BADGE
   ========================================================================== */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--color-surface-2);
    flex-shrink: 0;
}
.sidebar-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-badge-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--color-brand-600);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}
.sidebar-badge-text { display: flex; flex-direction: column; gap: 3px; }
.sidebar-badge-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-primary);
}
.sidebar-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-success);
    flex-shrink: 0;
}
.sidebar-badge-secondary {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-tertiary);
    letter-spacing: 0.04em;
}

/* ==========================================================================
   9. HEADER
   ========================================================================== */
#main-header {
    height: 60px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 30;
    flex-shrink: 0;
    gap: 12px;
}
@media (max-width: 1023px) {
    #main-header { height: 56px; padding: 0 16px; }
}
@media (min-width: 1024px) {
    #btn-menu { display: none; }
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.header-breadcrumb-text { display: flex; flex-direction: column; min-width: 0; }

#header-category-el {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-brand-600);
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    font-family: 'Inter', sans-serif;
    transition: color var(--t-fast);
    line-height: 1.5;
    text-align: left;
    white-space: nowrap;
}
#header-category-el:hover { color: var(--color-brand-700); }

.header-title-row {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
}
#current-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (min-width: 1024px) {
    #current-title {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
}

/* Loading dot — appears next to title while a guide is loading */
#loading-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-brand-600);
    margin-left: 8px;
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}
#loading-dot.active {
    animation: dot-pulse 1s ease-in-out infinite;
}
@keyframes dot-pulse {
    0%, 100% { opacity: 0.7; }
    50%       { opacity: 0.25; }
}

/* Header controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.header-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}
.header-btn:hover:not(:disabled) {
    background: var(--color-surface-2);
    color: var(--color-brand-600);
}
.header-btn:disabled { cursor: default; }
.header-divider {
    width: 1px;
    height: 20px;
    background: var(--color-surface-3);
    margin: 0 2px;
}

/* ==========================================================================
   10. PROGRESS BAR (replaces spinner)
   ========================================================================== */
#progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--color-brand-600);
    width: 0%;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    border-radius: 0 2px 2px 0;
}

/* ==========================================================================
   11. VIEWPORT & DASHBOARD
   ========================================================================== */
#viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--color-surface-1);
}

#dashboard {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: var(--color-surface-1);
    overflow-y: auto;
    padding: 24px;
}
@media (min-width: 1024px) { #dashboard { padding: 48px; } }

/* ==========================================================================
   12. HERO BANNER
   ========================================================================== */
.hero-banner {
    background: linear-gradient(135deg, var(--color-brand-600), var(--color-brand-800));
    border-radius: var(--radius-xl);
    padding: 40px;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 32px;
}
@media (max-width: 1023px) { .hero-banner { padding: 28px; } }

.hero-dot-pattern {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.5) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.05;
    pointer-events: none;
}
.hero-circle-1 {
    position: absolute;
    top: -60px;
    right: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: white;
    opacity: 0.07;
    pointer-events: none;
}
.hero-circle-2 {
    position: absolute;
    bottom: -40px;
    left: -40px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: white;
    opacity: 0.05;
    pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }

.hero-title {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: white;
}
@media (max-width: 1023px) { .hero-title { font-size: 26px; } }

.hero-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-top: 10px;
    max-width: 480px;
    line-height: 1.7;
}
.hero-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    flex-wrap: wrap;
}
.hero-stat-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

/* ==========================================================================
   13. MODULE CARDS
   ========================================================================== */
.section-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
}

.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding-bottom: 96px;
}
@media (min-width: 640px)  { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }

.module-card {
    background: var(--color-surface-0);
    padding: 28px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-surface-3);
    box-shadow: var(--shadow-1);
    cursor: pointer;
    transition: box-shadow var(--t-card), transform var(--t-card);
    display: flex;
    flex-direction: column;
}
.module-card:hover { box-shadow: var(--shadow-brand); transform: translateY(-3px); }
.module-card:active { transform: scale(0.98); }

.module-card-icon {
    width: 48px;
    height: 48px;
    background: var(--color-brand-50);
    color: var(--color-brand-600);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-brand-100);
    margin-bottom: 20px;
    flex-shrink: 0;
    transition: background var(--t-card), color var(--t-card), border-color var(--t-card);
}
.module-card:hover .module-card-icon {
    background: var(--color-brand-600);
    color: white;
    border-color: transparent;
}

.module-card-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.5;
}
.module-card-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-top: 8px;
    flex: 1;
}
.module-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-surface-2);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-brand-600);
}
.module-card-arrow {
    flex-shrink: 0;
    transition: transform var(--t-card);
}
.module-card:hover .module-card-arrow { transform: translateX(4px); }

/* ==========================================================================
   14. CATEGORY DETAIL VIEW
   ========================================================================== */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-brand-600);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background var(--t-fast), color var(--t-fast);
    margin-bottom: 32px;
}
.back-btn:hover { background: var(--color-brand-50); color: var(--color-brand-700); }
.back-btn-arrow { transition: transform var(--t-fast); }
.back-btn:hover .back-btn-arrow { transform: translateX(-3px); }

.category-icon-box {
    width: 64px;
    height: 64px;
    background: var(--color-brand-600);
    color: white;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-brand);
    flex-shrink: 0;
}

.guide-list { display: flex; flex-direction: column; gap: 8px; }

.guide-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
    background: var(--color-surface-0);
    border: 1px solid var(--color-surface-2);
    border-radius: var(--radius-lg);
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: 'Inter', sans-serif;
    position: relative;
    transition: border-color var(--t-base), box-shadow var(--t-base);
}
.guide-list-item:hover {
    border-color: var(--color-brand-200);
    box-shadow: var(--shadow-2);
}

.guide-list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--color-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-tertiary);
    flex-shrink: 0;
    transition: background var(--t-base), color var(--t-base);
}
.guide-list-item:hover .guide-list-item-icon {
    background: var(--color-brand-50);
    color: var(--color-brand-600);
}

.guide-list-item-body { flex: 1; min-width: 0; }
.guide-list-item-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.4;
}
.guide-list-item-tag {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    margin-top: 4px;
}

.guide-list-item-number {
    position: absolute;
    top: 14px;
    right: 52px;
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-tertiary);
    opacity: 0.4;
    line-height: 1;
}

.guide-list-item-arrow {
    color: var(--color-text-tertiary);
    flex-shrink: 0;
    transition: transform var(--t-base), color var(--t-base);
}
.guide-list-item:hover .guide-list-item-arrow {
    transform: translateX(4px);
    color: var(--color-brand-600);
}

/* ==========================================================================
   15. IFRAME
   ========================================================================== */
#content-frame {
    width: 100%;
    height: 100%;
    border: none;
    transition: opacity 0.2s ease;
}

/* ==========================================================================
   16. ERROR STATE
   ========================================================================== */
.error-container {
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
    padding: 80px 24px;
}
.error-icon {
    width: 64px;
    height: 64px;
    background: var(--color-surface-2);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: var(--color-text-tertiary);
}
.error-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-primary);
}
.error-body {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 8px;
    line-height: 1.6;
}
.error-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
    flex-wrap: wrap;
}

/* ==========================================================================
   17. BUTTONS
   ========================================================================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--color-brand-600);
    color: white;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background var(--t-fast);
}
.btn-primary:hover { background: var(--color-brand-700); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    color: var(--color-brand-600);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--color-brand-200);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.btn-ghost:hover {
    background: var(--color-brand-50);
    color: var(--color-brand-700);
    border-color: var(--color-brand-300, var(--color-brand-200));
}

/* ==========================================================================
   18. FOOTER
   ========================================================================== */
#main-footer {
    height: 40px;
    border-top: 1px solid var(--color-surface-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    flex-shrink: 0;
    background: var(--color-surface-0);
}
@media (max-width: 1023px) { #main-footer { padding: 0 16px; } }

.footer-wordmark {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
}
.footer-center {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: var(--color-text-tertiary);
}
.footer-center .dot { opacity: 0.4; }
.footer-right {
    font-size: 10px;
    color: var(--color-text-tertiary);
}
@media (max-width: 1023px) { .footer-center { display: none; } }

/* ==========================================================================
   19. MOBILE FAB
   ========================================================================== */
#mobile-fab {
    display: none;
}
@media (max-width: 1023px) {
    #mobile-fab {
        display: flex;
        position: fixed;
        bottom: 24px;
        right: 24px;
        height: 48px;
        padding: 0 16px;
        background: var(--color-brand-600);
        color: white;
        border-radius: var(--radius-2xl);
        box-shadow: var(--shadow-brand);
        align-items: center;
        gap: 8px;
        z-index: 30;
        border: none;
        cursor: pointer;
        font-family: 'Inter', sans-serif;
        transition: transform 80ms ease-in;
    }
    #mobile-fab:active { transform: scale(0.95); }
    #mobile-fab .fab-label { font-size: 11px; font-weight: 600; }
}
@media (max-width: 374px) {
    #mobile-fab { padding: 0 14px; }
    #mobile-fab .fab-label { display: none; }
}

/* ==========================================================================
   20. ACCESSIBILITY — FOCUS RINGS
   ========================================================================== */
:focus-visible {
    outline: 2px solid var(--color-brand-600);
    outline-offset: 2px;
}
/* Override any Tailwind focus rings on our interactive elements */
.nav-link:focus-visible,
.nav-category-btn:focus-visible,
.module-card:focus-visible,
.guide-list-item:focus-visible,
.header-btn:focus-visible,
.back-btn:focus-visible,
.btn-primary:focus-visible,
.btn-ghost:focus-visible {
    outline: 2px solid var(--color-brand-600);
    outline-offset: 2px;
}

/* ==========================================================================
   21. SEARCH EMPTY STATE
   ========================================================================== */
#search-empty {
    text-align: center;
    padding: 32px 16px;
}
.search-empty-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-tertiary);
}
.search-empty-hint {
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-top: 4px;
}

/* ==========================================================================
   22. LAYOUT — MAIN CONTENT
   ========================================================================== */
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    background: var(--color-surface-1);
}

/* ==========================================================================
   23. UTILITIES
   ========================================================================== */
.hidden { display: none !important; }
.opacity-0 { opacity: 0; }

/* ==========================================================================
   24. COMPONENT CLASSES — JS TEMPLATE STYLES
   ========================================================================== */
.dashboard-container {
    max-width: 1100px;
    margin: 0 auto;
}
.category-container {
    max-width: 800px;
    margin: 0 auto;
}
.category-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-surface-2);
}
.category-title {
    font-size: 28px;
    font-weight: 900;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.category-desc {
    font-size: 15px;
    color: var(--color-text-secondary);
    margin-top: 6px;
    line-height: 1.6;
}
.procedures-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-tertiary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* ==========================================================================
   25. DARK MODE
   ========================================================================== */
[data-theme="dark"] {
    color-scheme: dark;

    --color-brand-50:  rgba(139, 92, 246, 0.08);
    --color-brand-100: rgba(139, 92, 246, 0.15);
    --color-brand-200: rgba(139, 92, 246, 0.25);

    --color-surface-0:  #0f0f12;
    --color-surface-1:  #18181b;
    --color-surface-2:  #27272a;
    --color-surface-3:  #3f3f46;

    --color-text-primary:   #fafafa;
    --color-text-secondary: #a1a1aa;
    --color-text-tertiary:  #71717a;

    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-error:   #ef4444;

    --shadow-1:     0 1px 2px rgba(0,0,0,0.3);
    --shadow-2:     0 4px 8px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-3:     0 12px 24px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.3);
    --shadow-brand: 0 8px 20px rgba(124,58,237,0.3), 0 2px 6px rgba(124,58,237,0.15);
}

[data-theme="dark"] #main-header {
    background: rgba(15, 15, 18, 0.85);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] #overlay {
    background: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .sidebar-open #sidebar {
    box-shadow: 24px 0 40px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] #guide-search {
    background: var(--color-surface-1);
}

[data-theme="dark"] .search-kbd {
    background: var(--color-surface-2);
    border-color: var(--color-surface-3);
}

[data-theme="dark"] .hero-banner {
    background: linear-gradient(135deg, var(--color-brand-700), var(--color-brand-900));
}

[data-theme="dark"] .module-card {
    border-color: var(--color-surface-2);
}

[data-theme="dark"] .guide-list-item {
    border-color: var(--color-surface-2);
}

/* ==========================================================================
   26. PRINT STYLES
   ========================================================================== */
@media print {
    body {
        height: auto;
        overflow: visible;
        display: block;
    }
    #sidebar,
    #main-header,
    #main-footer,
    #mobile-fab,
    #overlay,
    #progress-bar { display: none !important; }

    #main-content {
        position: static;
        overflow: visible;
    }
    #viewport {
        position: static;
        overflow: visible;
    }
    #dashboard {
        position: static;
        overflow: visible;
        padding: 0;
    }
    #content-frame {
        position: static;
        width: 100%;
        height: auto;
        min-height: 100vh;
        opacity: 1 !important;
    }
    .hero-banner {
        background: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .module-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    .guide-list-item {
        break-inside: avoid;
    }
}
