/* ============================================================
   ChETL Layout & Utility Classes
   ============================================================
   Section 4.2 — Utility Classes
   Section 4.3 — Layout & Navigation
   Must load AFTER theme.css.
   ============================================================ */

/* =============================================
   4.2 Utility Classes
   ============================================= */
/* --- Surfaces --- */
.surface-base { background: var(--surface-base); }
.surface-elevated { background: var(--surface-elevated); }
.surface-subtle { background: var(--surface-subtle); }

/* --- Semantic text --- */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-accent { color: var(--accent-primary) !important; }
.text-accent:hover { opacity: 0.85; }

/* --- Semantic background --- */
.bg-accent-soft { background: var(--accent-soft) !important; }

/* --- Semantic border --- */
.border-muted { border-color: var(--border-muted) !important; }
.border-accent { border-color: var(--accent-primary) !important; }
.border-hidden { border-color: transparent !important; }

/* --- Icons --- */
.icon-accent { color: var(--accent-primary) !important; }
.icon-muted { color: var(--text-secondary) !important; }
.icon-warning { color: var(--note) !important; }

/* --- Hover --- */
.hover-surface:hover { background: var(--surface-subtle) !important; }
.hover-accent:hover { color: var(--accent-primary) !important; }

/* --- Composite (badges, placeholders, dividers, buttons, panels) --- */
.badge-muted {
    background: var(--surface-subtle) !important;
    color: var(--text-secondary) !important;
}
.placeholder-box {
    background: var(--surface-subtle);
    border: 1px dashed var(--border-muted);
}
.header-divider {
    border-top: 2px solid var(--text-primary);
}

/* Divider utility classes */
.divider-muted {
    width: 100%;
    height: 1px;
    background: var(--divider-color);
}
.divider-strong {
    width: 100%;
    height: 2px;
    background: var(--divider-color);
}
.divider-vertical {
    width: 1px;
    align-self: stretch;
    background: var(--divider-color);
}

/* Info table (info cards) */
.info-table { color: var(--text-primary); }
.info-card-highlight, .info-card-math { color: var(--text-primary); }
.info-table thead tr { background: var(--surface-subtle); }
.info-table tbody tr { border-bottom: 1px solid var(--border-muted); }

/* Contents link hover */
.contents-title { color: var(--text-secondary); }
.contents-link:hover .contents-title { color: var(--accent-primary) !important; }

/* Section headings — text-primary in all themes (accent reserved for tabs/buttons) */
.section-heading { color: var(--text-primary) !important; }

/* --- Panel elevation & buttons --- */
.card-elevated { box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

/* calculate + solution buttons */
.calculate-btn {
    background: var(--accent-primary);
    color: #ffffff;
}

.solution-btn {
    background: var(--accent-success);
    color: #ffffff;
}

/* =============================================
   4.3 Layout & Navigation
   ============================================= */
html { scroll-behavior: smooth; overflow-x: hidden; }
body { overflow-x: hidden; max-width: 100vw; background: var(--surface-base); }

*, *::before, *::after { box-sizing: border-box; }
.nicegui-content { overflow-x: hidden; max-width: 100%; }

/* --- Small-screen advisory (desktop-first workspace) --- */
.chetl-mobile-advisory { display: none; }
@media (max-width: 820px) {
    .chetl-mobile-advisory {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 9999;
        align-items: center;
        justify-content: center;
        padding: 24px;
        background: var(--surface-base, #f4f6fa);
    }
    .chetl-mobile-advisory__card {
        max-width: 420px;
        text-align: center;
        background: var(--surface-elevated, #fff);
        border: 1px solid var(--border-muted, #dbe1ea);
        border-radius: 12px;
        padding: 28px 24px;
        box-shadow: 0 12px 32px rgba(36, 52, 71, .14);
    }
    .chetl-mobile-advisory__card strong {
        display: block;
        font-size: 1.15rem;
        color: var(--text-primary, #1e2a38);
        margin-bottom: 8px;
    }
    .chetl-mobile-advisory__card p {
        color: var(--text-secondary, #3a4658);
        line-height: 1.5;
        margin: 0;
    }
}

/* --- Floating "Back to Top" button --- */
#chetl-back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1200;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    color: var(--accent-primary);
    background: var(--surface-elevated);
    border: 1px solid var(--border-muted);
    box-shadow: 0 4px 14px rgba(36, 52, 71, 0.16);
    cursor: pointer;
    /* Hidden until scrolled: fade/slide in, and stay out of the tab order. */
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease,
                color 0.15s ease, border-color 0.15s ease;
}
#chetl-back-to-top.visible {
    opacity: 0.9;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
}
#chetl-back-to-top:hover {
    opacity: 1;
    color: #ffffff;
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}
#chetl-back-to-top:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    #chetl-back-to-top { transition: opacity 0.2s ease; transform: none; }
    #chetl-back-to-top.visible { transform: none; }
}

/* --- Brand mark (inline SVG logo) --- */
.brand-mark { display: inline-flex; line-height: 0; }
.brand-mark svg { display: block; height: auto; }
.brand-mark--lg svg { width: 84px; height: 84px; }
.brand-mark--sm svg { width: 40px; height: 40px; }

/* Brand wordmark — navy to match the website lockup. Doubled class raises
   specificity above Quasar's own .text-primary utility (which is !important
   and would otherwise force its --q-primary blue). */
.brand-wordmark.brand-wordmark { color: var(--text-primary) !important; }

/* --- Navigation --- */
.nav-item-active {
    background-color: var(--accent-soft) !important;
    border-left: 3px solid var(--accent-primary) !important;
}

/* Disabled ("Coming soon") course rows — muted, non-interactive */
.nav-item-disabled {
    pointer-events: none;
}
.nav-soon-chip {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border: 1px solid var(--border-muted);
    border-radius: 9999px;
    padding: 1px 6px;
    line-height: 1.4;
}
