/* ============================================================================
   Prometheus LMS — design system (Sprint 8A).
   Clean, professional, and fully driven by the --lms-* brand tokens emitted by
   the Theme view component from tenant.config.json (decisions A6/B6/A14), so a
   per-tenant re-brand is a token change, not a code change.
   Layered over Bootstrap 5 (bundled locally). Presentation only.
   ============================================================================ */

/* Lexend — a readability-tuned sans (SIL Open Font License; bundled locally per B4, no CDN).
   Variable font: one file covers all weights. License: wwwroot/lib/lexend/LICENSE.txt. */
@font-face {
    font-family: 'Lexend Variable';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('/lib/lexend/lexend-variable.woff2') format('woff2-variations');
}

:root {
    /* Neutral surfaces + lines (brand-independent). */
    --app-bg: #f5f7fa;
    --app-surface: #ffffff;
    --app-border: #e4e8ee;
    --app-muted: #6b7280;
    --app-heading: #1f2733;

    /* Elevation + shape. */
    --app-radius: 0.6rem;
    --app-radius-sm: 0.4rem;
    --app-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.05);
    --app-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);

    --app-sidebar-w: 248px;

    /* Tinted brand surfaces derived from the token. */
    --lms-primary-050: rgba(var(--lms-primary-rgb), 0.06);
    --lms-primary-100: rgba(var(--lms-primary-rgb), 0.12);
}

/* ---- Base ---------------------------------------------------------------- */
body {
    font-family: 'Lexend Variable', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--app-bg);
    color: #2b333f;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--app-heading);
    font-weight: 600;
    letter-spacing: -0.01em;
}

a {
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

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

/* ---- Buttons: take the brand color (compiled Bootstrap btns don't follow --bs-primary) ---- */
.btn {
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: var(--app-radius-sm);
    --bs-btn-padding-x: 1rem;
}
.btn-primary {
    --bs-btn-bg: var(--lms-primary);
    --bs-btn-border-color: var(--lms-primary);
    --bs-btn-hover-bg: color-mix(in srgb, var(--lms-primary) 88%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--lms-primary) 85%, #000);
    --bs-btn-active-bg: color-mix(in srgb, var(--lms-primary) 80%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--lms-primary) 78%, #000);
    --bs-btn-disabled-bg: var(--lms-primary);
    --bs-btn-disabled-border-color: var(--lms-primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--lms-primary);
    --bs-btn-border-color: var(--lms-primary);
    --bs-btn-hover-bg: var(--lms-primary);
    --bs-btn-hover-border-color: var(--lms-primary);
    --bs-btn-active-bg: var(--lms-primary);
    --bs-btn-active-border-color: var(--lms-primary);
}
.progress-bar {
    background-color: var(--lms-primary);
}

/* ---- Cards --------------------------------------------------------------- */
.card {
    --bs-card-border-color: var(--app-border);
    --bs-card-border-radius: var(--app-radius);
    --bs-card-cap-bg: transparent;
    box-shadow: var(--app-shadow-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card.card-hover:hover,
a.card:hover {
    box-shadow: var(--app-shadow-md);
    transform: translateY(-2px);
}

/* ---- Tables -------------------------------------------------------------- */
.table {
    --bs-table-hover-bg: var(--lms-primary-050);
    vertical-align: middle;
}
.table > thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--app-muted);
    font-weight: 600;
    border-bottom-width: 1px;
}
.table-in-card { margin-bottom: 0; }

/* ---- Badges (keep semantic colors; soften the neutral one) --------------- */
.badge {
    font-weight: 600;
    padding: 0.4em 0.65em;
}

/* ---- Forms --------------------------------------------------------------- */
.form-control, .form-select {
    border-color: var(--app-border);
    border-radius: var(--app-radius-sm);
    padding: 0.5rem 0.75rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--lms-primary);
    box-shadow: 0 0 0 0.2rem var(--lms-primary-100);
}
.form-label { font-weight: 500; margin-bottom: 0.35rem; }

/* ---- Page header pattern ------------------------------------------------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.page-header h1, .page-header .h1 { margin: 0; font-size: 1.6rem; }

/* ---- Learner top navbar -------------------------------------------------- */
.navbar.app-navbar {
    background-color: var(--app-surface) !important;
    box-shadow: var(--app-shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1020;
}
.navbar.app-navbar .navbar-brand {
    font-weight: 700;
    color: var(--app-heading);
}
.navbar.app-navbar .nav-link {
    font-weight: 500;
    color: #4b5563 !important;
    border-radius: var(--app-radius-sm);
    padding: 0.4rem 0.7rem;
}
.navbar.app-navbar .nav-link:hover {
    color: var(--lms-primary) !important;
    background-color: var(--lms-primary-050);
}

/* ---- Admin app shell + sidebar ------------------------------------------ */
.app-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}
.app-sidebar {
    width: var(--app-sidebar-w);
    flex: 0 0 var(--app-sidebar-w);
    background: #141b2b;
    color: #c7cede;
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem;
}
.app-sidebar .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    font-weight: 700;
    padding: 0.5rem 0.6rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0.75rem;
}
.app-sidebar .sidebar-brand .badge { font-size: 0.6rem; }
.app-sidebar .nav-link {
    color: #c7cede;
    border-radius: var(--app-radius-sm);
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.15rem;
    font-weight: 500;
}
.app-sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
}
.app-sidebar .nav-link.active {
    color: #fff;
    background: var(--lms-primary);
}
.app-sidebar .sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.75rem;
    font-size: 0.9rem;
}
.app-sidebar .sidebar-footer .nav-link { padding: 0.4rem 0.7rem; }
.app-sidebar .sidebar-user {
    padding: 0.25rem 0.7rem 0.5rem;
    color: #8b93a7;
    font-size: 0.8rem;
}
.app-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.75rem 2rem;
}

/* Small screens: sidebar becomes an offcanvas (see _AdminLayout). */
@media (max-width: 991.98px) {
    .app-sidebar.app-sidebar-static { display: none; }
    .app-main { padding: 1.25rem 1rem; }
}

/* ---- Auth card ----------------------------------------------------------- */
.auth-wrap {
    max-width: 26rem;
    margin: 3rem auto;
}
.auth-card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-md);
    padding: 2rem;
}
.auth-card .auth-logo {
    width: 40px;
    height: 40px;
    margin-bottom: 0.75rem;
}

/* ---- Landing hero -------------------------------------------------------- */
.hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(120% 120% at 85% 0%, rgba(255, 255, 255, 0.18), transparent 45%),
        linear-gradient(151deg,
            var(--lms-primary) 0%,
            color-mix(in srgb, var(--lms-primary) 65%, var(--lms-secondary)) 55%,
            var(--lms-secondary) 100%);
    color: #fff;
    border-radius: var(--app-radius);
    padding: 4rem 2rem;
    text-align: center;
    box-shadow: var(--app-shadow-md);
}
.hero h1 { color: #fff; font-size: 2.4rem; margin-bottom: 0.75rem; }
.hero p { font-size: 1.15rem; opacity: 0.92; max-width: 40rem; margin: 0 auto 1.5rem; }
.hero .btn-light { color: var(--lms-primary); font-weight: 600; }
.feature-icon {
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--lms-primary-100);
    color: var(--lms-primary);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* ---- Footer -------------------------------------------------------------- */
.footer {
    background: var(--app-surface);
    border-top: 1px solid var(--app-border);
    color: var(--app-muted);
    font-size: 0.9rem;
}

/* ---- Accent chips (soft, tinted pills for status/category) ---------------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.32em 0.62em;
    border-radius: 999px;
    white-space: nowrap;
}
.chip-brand  { background: var(--lms-primary-100); color: var(--lms-primary); }
.chip-coral  { background: rgba(251, 104, 113, 0.14); color: #d63d48; }
.chip-orange { background: rgba(254, 149, 79, 0.16);  color: #d9701f; }
.chip-amber  { background: rgba(249, 178, 58, 0.18);  color: #b07d10; }
.chip-teal   { background: rgba(0, 144, 127, 0.14);   color: #00786a; }
.chip-blue   { background: rgba(114, 145, 255, 0.16); color: #3f5fd6; }
.chip-muted  { background: #eef1f5; color: var(--app-muted); }

/* ---- Course card (catalog) ---------------------------------------------- */
.course-card .course-thumb {
    position: relative;
    background: linear-gradient(135deg, var(--lms-primary-100), var(--lms-primary-050));
    height: 160px;
}
.course-card .course-thumb img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}
.course-card .course-thumb .chip {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    background: #fff;
    box-shadow: var(--app-shadow-sm);
    color: var(--lms-primary);
}
.course-card .course-thumb .thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 2rem;
    color: var(--lms-primary);
    opacity: 0.6;
}
.course-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    font-size: 0.8rem;
    color: var(--app-muted);
}
.course-meta .meta {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
