/* ==========================================================================
   DOV MEDIA — Theme layer on top of Bootstrap 5.3
   The only custom stylesheet in the app. Views use Bootstrap utilities;
   this file adds brand tokens + a few reusable components.
   ========================================================================== */

/* ---------- 1. Tokens & Bootstrap overrides ---------- */
:root {
    --brand: #0056d2;
    --brand-600: #004bb8;
    --brand-700: #003e9c;
    --brand-900: #0b1f44;
    --brand-50: #eef4ff;
    --brand-100: #dbe7fd;

    --ink: #1f2937;
    --ink-muted: #5b6474;
    --ink-subtle: #8a94a6;
    --line: #e3e7ee;
    --line-strong: #cfd5df;
    --canvas: #f5f7fa;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 12px 24px -12px rgba(16, 24, 40, .18);
    --shadow-lg: 0 24px 48px -16px rgba(16, 24, 40, .24);

    --bs-primary: #0056d2;
    --bs-primary-rgb: 0, 86, 210;
    --bs-primary-text-emphasis: #003e9c;
    --bs-primary-bg-subtle: #eef4ff;
    --bs-primary-border-subtle: #c7dafc;
    --bs-link-color: #0056d2;
    --bs-link-color-rgb: 0, 86, 210;
    --bs-link-hover-color: #003e9c;
    --bs-link-hover-color-rgb: 0, 62, 156;
    --bs-body-font-family: 'Inter', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-color: #1f2937;
    --bs-body-color-rgb: 31, 41, 55;
    --bs-secondary-color: #5b6474;
    --bs-secondary-color-rgb: 91, 100, 116;
    --bs-emphasis-color: #111827;
    --bs-border-color: #e3e7ee;
    --bs-tertiary-bg: #f5f7fa;
    --bs-border-radius: .5rem;
    --bs-border-radius-sm: .375rem;
    --bs-border-radius-lg: .75rem;
    --bs-border-radius-xl: 1rem;
    --bs-focus-ring-color: rgba(0, 86, 210, .25);
}

[dir="rtl"] {
    --bs-body-font-family: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif;
}

body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--bs-emphasis-color);
    font-weight: 700;
    letter-spacing: -.01em;
}

[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] .h1, [dir="rtl"] .h2 {
    letter-spacing: 0;
}

.text-muted, .text-secondary { color: var(--ink-muted) !important; }
.text-subtle { color: var(--ink-subtle) !important; }
.bg-canvas { background-color: var(--canvas) !important; }
.fw-semibold { font-weight: 600 !important; }
.fs-7 { font-size: .8125rem !important; }
.min-w-0 { min-width: 0 !important; }
.ltr { direction: ltr; unicode-bidi: embed; }
.search-box { width: 280px; max-width: 100%; }

/* Buttons */
.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-padding-x: 1rem;
    --bs-btn-padding-y: .5rem;
    --bs-btn-font-size: .9375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
}

.btn-sm {
    --bs-btn-padding-x: .7rem;
    --bs-btn-padding-y: .3rem;
    --bs-btn-font-size: .8125rem;
    gap: .35rem;
}

.btn-lg {
    --bs-btn-padding-x: 1.5rem;
    --bs-btn-padding-y: .75rem;
    --bs-btn-font-size: 1rem;
}

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700);
    --bs-btn-active-border-color: var(--brand-700);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: 0, 86, 210;
}

.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-700);
    --bs-btn-active-border-color: var(--brand-700);
    --bs-btn-focus-shadow-rgb: 0, 86, 210;
}

.btn-white {
    --bs-btn-bg: #fff;
    --bs-btn-color: var(--ink);
    --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-bg: #f3f5f9;
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-border-color: var(--line-strong);
    --bs-btn-active-bg: #eceff4;
    --bs-btn-active-border-color: var(--line-strong);
    box-shadow: var(--shadow-xs);
}

.btn-soft-danger {
    --bs-btn-bg: #fff;
    --bs-btn-color: #c0262d;
    --bs-btn-border-color: #f3c5c7;
    --bs-btn-hover-bg: #fdf0f0;
    --bs-btn-hover-color: #a11d23;
    --bs-btn-hover-border-color: #eaa3a7;
    --bs-btn-active-bg: #fbe2e3;
    --bs-btn-active-color: #a11d23;
}

.btn-icon {
    --bs-btn-padding-x: .45rem;
    --bs-btn-padding-y: .3rem;
    line-height: 1;
}

/* Forms */
.form-label {
    font-weight: 600;
    font-size: .875rem;
    margin-bottom: .4rem;
    color: var(--ink);
}

.form-control, .form-select {
    border-color: var(--line-strong);
    padding: .6rem .85rem;
    font-size: .9375rem;
}

.form-control::placeholder { color: #a0a8b8; }

.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(0, 86, 210, .18);
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.input-group-text {
    background: #fff;
    border-color: var(--line-strong);
    color: var(--ink-subtle);
}

/* Cards, tables, badges, alerts */
.card {
    --bs-card-border-color: var(--line);
    --bs-card-border-radius: .75rem;
    --bs-card-inner-border-radius: calc(.75rem - 1px);
    --bs-card-cap-bg: #fff;
    --bs-card-cap-padding-y: 1rem;
    --bs-card-cap-padding-x: 1.25rem;
    --bs-card-spacer-x: 1.25rem;
    --bs-card-spacer-y: 1.25rem;
    box-shadow: var(--shadow-xs);
}

.card-title { font-weight: 700; }

.table {
    --bs-table-hover-bg: #f8fafc;
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: .85rem 1.1rem;
    border-bottom-color: #edf0f4;
}

.table thead th {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-muted);
    background: #f8fafc;
    white-space: nowrap;
}

[dir="rtl"] .table thead th { letter-spacing: 0; }

.badge { font-weight: 600; }

.alert {
    --bs-alert-border-radius: .625rem;
    font-size: .9375rem;
}

.dropdown-menu {
    --bs-dropdown-border-color: var(--line);
    --bs-dropdown-link-active-bg: var(--brand);
    --bs-dropdown-item-padding-y: .5rem;
    --bs-dropdown-font-size: .9rem;
    box-shadow: var(--shadow-md);
    padding: .375rem;
}

.dropdown-item {
    border-radius: .375rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.dropdown-item .bi { color: var(--ink-subtle); }
.dropdown-item.text-danger .bi { color: inherit; }

.modal {
    --bs-modal-border-color: var(--line);
    --bs-modal-border-radius: .875rem;
    --bs-modal-header-border-color: var(--line);
    --bs-modal-footer-border-color: var(--line);
}

.modal-title { font-weight: 700; font-size: 1.1rem; }
.modal-footer { background: #fafbfc; }

.nav-tabs {
    --bs-nav-tabs-border-color: var(--line);
    --bs-nav-tabs-link-active-color: var(--brand);
    --bs-nav-tabs-link-active-border-color: transparent transparent var(--brand);
}

.nav-underline .nav-link {
    color: var(--ink-muted);
    font-weight: 600;
    padding-bottom: .85rem;
}

.nav-underline .nav-link.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

.pagination {
    --bs-pagination-color: var(--ink);
    --bs-pagination-active-bg: var(--brand);
    --bs-pagination-active-border-color: var(--brand);
    margin-bottom: 0;
}

/* ---------- 2. Shared building blocks ---------- */
.brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    text-decoration: none;
    color: var(--ink);
    min-width: 0;
}

.brand:hover { color: var(--ink); }

.brand-mark {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--brand-700), var(--brand));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.05rem;
}

.auth-aside .brand-mark { background: #fff; color: var(--brand); }
.brand-mark-sm { width: 28px; height: 28px; font-size: .85rem; border-radius: 7px; }

.brand-name {
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.15;
    letter-spacing: .02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-sub {
    display: block;
    font-size: .7rem;
    font-weight: 500;
    color: var(--ink-subtle);
    letter-spacing: 0;
}

.icon-box {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    font-size: 1.15rem;
    background: var(--brand-50);
    color: var(--brand);
}

.icon-box-lg { width: 52px; height: 52px; border-radius: 14px; font-size: 1.5rem; }
.icon-box-success { background: #e8f7ef; color: #0f7a43; }
.icon-box-warning { background: #fff5e0; color: #a35d00; }
.icon-box-purple { background: #f1edfd; color: #5b3cc4; }
.icon-box-danger { background: #fdeeee; color: #c0262d; }
.icon-box-neutral { background: #f1f3f7; color: var(--ink-muted); }

.avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-weight: 700;
    font-size: .875rem;
    color: #fff;
    background: var(--brand);
    text-transform: uppercase;
}

.avatar-sm { width: 26px; height: 26px; font-size: .7rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.35rem; }
.avatar-success { background: #12925a; }
.avatar-purple { background: #6a4ad9; }

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    border: 1px dashed var(--line-strong);
    border-radius: .75rem;
    background: #fafbfc;
}

.empty-state .icon-box { margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.empty-state p { color: var(--ink-muted); margin: 0 auto; max-width: 420px; font-size: .9375rem; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .3rem .8rem;
    border-radius: 999px;
    background: var(--brand-50);
    border: 1px solid var(--bs-primary-border-subtle);
    color: var(--brand-700);
    font-size: .78rem;
    font-weight: 600;
}

.eyebrow .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand);
}

.code-inline {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .8125rem;
    background: #f1f4f9;
    border: 1px solid var(--line);
    border-radius: .375rem;
    padding: .15rem .45rem;
    color: var(--brand-700);
    direction: ltr;
    unicode-bidi: embed;
}

/* ---------- 3. Public site ---------- */
.site-navbar {
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
    min-height: 64px;
}

.site-navbar .nav-link {
    color: var(--ink-muted);
    font-weight: 500;
    font-size: .9375rem;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link.active { color: var(--ink); }

.hero {
    position: relative;
    padding: 5rem 0 4.5rem;
    background:
        radial-gradient(60% 60% at 85% 0%, rgba(0, 86, 210, .08), transparent 70%),
        linear-gradient(180deg, #f4f8ff 0%, #fff 100%);
    overflow: hidden;
}

.hero-title {
    font-size: clamp(2.1rem, 4.6vw, 3.4rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.025em;
}

[dir="rtl"] .hero-title { line-height: 1.4; letter-spacing: 0; }

.hero-title .accent { color: var(--brand); }

.hero-lead {
    font-size: 1.125rem;
    color: var(--ink-muted);
    line-height: 1.7;
    max-width: 580px;
}

/* Product mock in hero — purely decorative */
.mock-player {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.mock-player-bar {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--line);
    background: #fafbfc;
}

.mock-player-bar span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dfe3ea;
}

.mock-screen {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #0b1f44 0%, #123a7a 55%, #0056d2 100%);
    display: grid;
    place-items: center;
    color: #fff;
}

.mock-screen .play {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .95);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-size: 1.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}

.mock-watermark {
    position: absolute;
    top: 14px;
    inset-inline-start: 14px;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .72rem;
    font-weight: 600;
    padding: .25rem .65rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .2);
}

.mock-watermark i { color: #34d399; }

.mock-progress {
    position: absolute;
    inset-inline: 14px;
    bottom: 14px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .25);
}

.mock-progress::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 38%;
    border-radius: 4px;
    background: #fff;
}

.mock-chip {
    position: absolute;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: .75rem;
    box-shadow: var(--shadow-md);
    padding: .65rem .85rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .8125rem;
    font-weight: 600;
}

.mock-wrap { position: relative; padding: 1rem; }
.mock-chip-a { bottom: -.5rem; inset-inline-start: -.25rem; }
.mock-chip-b { top: 22%; inset-inline-end: -.5rem; }

@media (max-width: 575.98px) {
    .mock-chip { display: none; }
}

.section { padding: 4.5rem 0; }
.section-sm { padding: 3rem 0; }

.section-heading {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 800;
    margin-bottom: .6rem;
}

.section-lead {
    color: var(--ink-muted);
    font-size: 1.05rem;
    max-width: 640px;
    margin-inline: auto;
}

.feature-card {
    height: 100%;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: .875rem;
    background: #fff;
    transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}

.feature-card:hover {
    border-color: var(--bs-primary-border-subtle);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feature-card h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
.feature-card p { color: var(--ink-muted); font-size: .9375rem; margin: 0; line-height: 1.65; }

.step-card {
    position: relative;
    height: 100%;
    padding: 1.5rem;
    border-radius: .875rem;
    background: #fff;
    border: 1px solid var(--line);
}

.step-num {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: .875rem;
    margin-bottom: 1rem;
}

.step-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.step-card p { color: var(--ink-muted); font-size: .9375rem; margin: 0; line-height: 1.65; }

.stats-band {
    background: var(--brand-900);
    background-image: radial-gradient(60% 120% at 100% 0%, rgba(0, 86, 210, .55), transparent 60%);
    color: #fff;
    border-radius: 1.25rem;
    padding: 2.5rem;
}

.stats-band .stat-num { font-size: 2.25rem; font-weight: 800; line-height: 1.1; }
.stats-band .stat-label { color: rgba(255, 255, 255, .72); font-size: .9rem; margin-top: .35rem; }

.site-footer {
    background: #fff;
    border-top: 1px solid var(--line);
    padding: 2rem 0;
    font-size: .875rem;
    color: var(--ink-muted);
}

.site-footer a { color: var(--ink-muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand); }

/* Course cards (academy + student) */
.course-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: .875rem;
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
}

.course-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.course-cover {
    position: relative;
    aspect-ratio: 16 / 8;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #003e9c, #0056d2 60%, #3d8bfd);
    overflow: hidden;
}

.course-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, .07) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, .07) 1px, transparent 1px);
    background-size: 26px 26px;
}

.course-cover .bi { font-size: 2.25rem; position: relative; z-index: 1; opacity: .95; }
.course-cover.cover-2 { background: linear-gradient(135deg, #0b5c4a, #0f8a6a 60%, #2bc29a); }
.course-cover.cover-3 { background: linear-gradient(135deg, #3b1d8f, #5b3cc4 60%, #8b6cf0); }
.course-cover.cover-4 { background: linear-gradient(135deg, #8a3b00, #c55a00 60%, #f19234); }
.course-cover.cover-5 { background: linear-gradient(135deg, #7a1b3c, #b02a59 60%, #e2558a); }
.course-cover.cover-6 { background: linear-gradient(135deg, #0b3b5c, #0c6e99 60%, #29a8d8); }

.course-card .card-body { flex: 1; display: flex; flex-direction: column; }
.course-card h3 { font-size: 1.05rem; margin-bottom: .35rem; }

.course-desc {
    color: var(--ink-muted);
    font-size: .9rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Auth */
.auth-wrap {
    min-height: calc(100vh - 64px - 90px);
    display: flex;
    align-items: center;
    padding: 3rem 0;
    background: var(--canvas);
}

.auth-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.auth-aside {
    background: linear-gradient(160deg, #0b1f44 0%, #003e9c 55%, #0056d2 100%);
    color: #fff;
    padding: 2.5rem;
    position: relative;
}

.auth-aside h2 { color: #fff; font-size: 1.5rem; }
.auth-aside p { color: rgba(255, 255, 255, .78); }

.auth-aside .bullet {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, .9);
    font-size: .9375rem;
}

.auth-aside .bullet .bi {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    display: grid;
    place-items: center;
}

.auth-form { padding: 2.5rem; }
.auth-form h1 { font-size: 1.6rem; margin-bottom: .35rem; }

@media (max-width: 575.98px) {
    .auth-form { padding: 1.75rem 1.25rem; }
}

/* Legal */
.legal-toc { position: sticky; top: 84px; }
.legal-toc .list-group-item { font-size: .875rem; border: 0; border-radius: .5rem !important; padding: .45rem .75rem; color: var(--ink-muted); }
.legal-toc .list-group-item:hover { background: #f3f5f9; color: var(--ink); }
.legal-section { scroll-margin-top: 90px; padding-bottom: 1.75rem; margin-bottom: 1.75rem; border-bottom: 1px solid var(--line); }
.legal-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.legal-section h2 { font-size: 1.2rem; display: flex; align-items: center; gap: .65rem; }
.legal-section p { color: #3d4757; line-height: 1.85; margin: 0; }

/* ---------- 4. Dashboard shell (admin / creator / student course) ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--canvas);
}

.app-sidebar {
    --bs-offcanvas-width: 272px;
    background: #fff;
}

@media (min-width: 992px) {
    .app-sidebar {
        width: 264px;
        flex-shrink: 0;
        position: sticky;
        top: 0;
        height: 100vh;
        border-inline-end: 1px solid var(--line);
    }

    .app-sidebar.app-sidebar-wide { width: 340px; }

    /* Bootstrap makes .offcanvas-lg transparent on desktop */
    .app-sidebar.offcanvas-lg { background-color: #fff !important; }
}

.app-sidebar .offcanvas-body {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    height: 100%;
}

.sidebar-brand {
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--line);
}

.sidebar-label {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ink-subtle);
    padding: 1.25rem 1.5rem .5rem;
}

[dir="rtl"] .sidebar-label { letter-spacing: 0; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .85rem;
    margin: 0 .75rem 2px;
    border-radius: .5rem;
    color: #3d4757;
    font-weight: 500;
    font-size: .9375rem;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.sidebar-link .bi { font-size: 1.1rem; color: var(--ink-subtle); }
.sidebar-link:hover { background: #f3f5f9; color: var(--ink); }
.sidebar-link.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.sidebar-link.active .bi { color: var(--brand); }
.sidebar-link .badge { margin-inline-start: auto; }

.sidebar-footer {
    margin-top: auto;
    padding: 1rem;
    border-top: 1px solid var(--line);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem;
    border-radius: .625rem;
    background: var(--canvas);
    margin-bottom: .75rem;
    min-width: 0;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
}

.app-topbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-content {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 3rem;
}

@media (max-width: 575.98px) {
    .app-content { padding: 1.25rem 1rem 2.5rem; }
    .app-topbar { padding: 0 1rem; }
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header > :first-child { flex: 1 1 360px; }
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--ink-muted); margin: .3rem 0 0; font-size: .9375rem; }

.stat-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    height: 100%;
}

.stat-card .stat-label { color: var(--ink-muted); font-size: .8125rem; font-weight: 500; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--bs-emphasis-color); }

.welcome-card {
    background: linear-gradient(120deg, #fff 40%, var(--brand-50) 100%);
}

/* ---------- 5. Creator: content editor ---------- */
.editor-grid {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 991.98px) {
    .editor-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 992px) {
    .editor-sidebar {
        position: sticky;
        top: 84px;
        max-height: calc(100vh - 104px);
        display: flex;
        flex-direction: column;
    }

    .editor-sidebar .card-body { overflow-y: auto; }
}

.section-tree { list-style: none; margin: 0; padding: 0; }

.section-tree .section-tree {
    margin-inline-start: .85rem;
    padding-inline-start: .6rem;
    border-inline-start: 1px dashed var(--line-strong);
}

.nested-dropzone.is-empty { min-height: 8px; }
.root-dropzone { min-height: 48px; }

.section-row {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .4rem;
    border-radius: .5rem;
    margin-bottom: 2px;
}

.section-row:hover { background: #f3f5f9; }
.section-row.active { background: var(--brand-50); }

.section-link {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
    font-size: .875rem;
    padding: .2rem 0;
}

.section-link .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-row.active .section-link { color: var(--brand); }

.section-actions { display: flex; opacity: 0; transition: opacity .15s ease; }
.section-row:hover .section-actions,
.section-row.active .section-actions,
.section-row:focus-within .section-actions { opacity: 1; }

@media (hover: none) { .section-actions { opacity: 1; } }

.drag-handle,
.section-drag-handle {
    cursor: grab;
    color: #b0b7c4;
    display: inline-flex;
    padding: .15rem;
}

.drag-handle:hover,
.section-drag-handle:hover { color: var(--ink-muted); }

.sortable-ghost { opacity: .4; }

.video-row {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .7rem .9rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: .625rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.video-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

.video-thumb {
    width: 112px;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
    border-radius: .4rem;
    overflow: hidden;
    background: linear-gradient(135deg, #1f2937, #111827);
}

.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 575.98px) {
    .video-thumb { width: 84px; }
}

.subsection-card {
    display: block;
    height: 100%;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: .625rem;
    background: #fff;
    text-decoration: none;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.subsection-card:hover { border-color: var(--bs-primary-border-subtle); box-shadow: var(--shadow-sm); color: var(--brand); }

/* Uppy inside Bootstrap modal */
.uppy-Dashboard-inner { border-radius: .75rem !important; border-color: var(--line-strong) !important; }

/* ---------- 6. Creator: API docs ---------- */
.doc-section {
    border: 1px solid var(--line);
    border-radius: .75rem;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    background: #fff;
}

.doc-section-header { display: flex; align-items: center; gap: .65rem; margin-bottom: .75rem; flex-wrap: wrap; }
.doc-section-title { font-size: 1.05rem; margin: 0; }
.doc-text { color: var(--ink-muted); font-size: .9375rem; line-height: 1.7; }
.doc-subheading { font-size: .875rem; font-weight: 700; margin: 1.25rem 0 .5rem; }

.doc-text code, .doc-table code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .82em;
    color: var(--brand-700);
    background: var(--brand-50);
    padding: .1rem .35rem;
    border-radius: .3rem;
}

.doc-endpoint-box {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    border-radius: .5rem;
    background: #f8fafc;
}

.method-tag {
    font-size: .7rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: .3rem;
    color: #fff;
    flex-shrink: 0;
}

.method-tag.post { background: #0f7a43; }
.method-tag.get { background: var(--brand); }

.endpoint-url {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .875rem;
    word-break: break-all;
}

.doc-code-box {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: .5rem;
    padding: 1rem 1.1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .82rem;
    line-height: 1.65;
    white-space: pre;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.doc-code-curl { color: #c4b5fd; }
.doc-code-json { color: #6ee7b7; }
.doc-code-html { color: #fde68a; }
.doc-code-php { color: #93c5fd; }

.code-tab-container { border-radius: .5rem; overflow: hidden; margin-bottom: 1.25rem; background: #0f172a; }
.code-tab-header { display: flex; gap: .25rem; padding: .3rem .5rem 0; background: #1e293b; }

.code-tab-btn {
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: #94a3b8;
    padding: .45rem .85rem;
    font-size: .8rem;
    font-weight: 600;
}

.code-tab-btn:hover { color: #fff; }
.code-tab-btn.active { color: #fff; border-bottom-color: #60a5fa; }
.code-tab-content { display: none; }
.code-tab-content.active { display: block; }
.code-tab-content .doc-code-box { border-radius: 0; margin: 0; }

.doc-table-wrapper { border: 1px solid var(--line); border-radius: .5rem; overflow-x: auto; margin-bottom: 1.25rem; }
.doc-table { width: 100%; font-size: .875rem; }
.doc-table th { background: #f8fafc; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); padding: .65rem 1rem; border-bottom: 1px solid var(--line); }
.doc-table td { padding: .65rem 1rem; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
.doc-table tr:last-child td { border-bottom: 0; }

.badge-req, .badge-opt {
    font-size: .68rem;
    font-weight: 700;
    padding: .15rem .45rem;
    border-radius: .3rem;
    text-transform: uppercase;
}

.badge-req { background: #fdeeee; color: #b4232a; }
.badge-opt { background: #f1f3f7; color: var(--ink-muted); }

/* ---------- 7. Student course player ---------- */
.video-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: .75rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.video-stage iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.outline-section-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .85rem 1.25rem;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #fafbfc;
    font-weight: 700;
    font-size: .9rem;
    color: var(--ink);
    text-align: start;
}

.outline-section-btn .bi { transition: transform .2s ease; color: var(--ink-subtle); }
.outline-section-btn[aria-expanded="true"] .bi { transform: rotate(180deg); }

.lesson-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.25rem;
    text-decoration: none;
    color: var(--ink);
    font-size: .875rem;
    font-weight: 500;
    border-inline-start: 3px solid transparent;
}

.lesson-link:hover { background: #f5f7fa; color: var(--ink); }
.lesson-link.active { background: var(--brand-50); border-inline-start-color: var(--brand); color: var(--brand-700); font-weight: 600; }

.lesson-thumb {
    position: relative;
    width: 72px;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
    border-radius: .35rem;
    overflow: hidden;
    background: #111827;
}

.lesson-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.lesson-thumb .bi {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(0, 0, 0, .3);
    font-size: .9rem;
}

.outline-subsection { padding-inline-start: 1rem; }

.outline-subsection-title {
    font-size: .78rem;
    font-weight: 700;
    color: var(--ink-muted);
    padding: .65rem 1.25rem .25rem;
}

/* ---------- 8. Accessibility ---------- */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
