/* ============================================================
   akuikut — Halaman Belajar — REVISI SESI 18 (Drawer + Tab + Oranye)
   Selaras dengan layouts/akuikut.blade.php (mewarisi --line,--ink,--muted,--surface,--bg)
   Perubahan S18:
   - Palet oranye dominan via override --brand di scope .learn-wrap (tidak bocor ke halaman lain)
   - Kurikulum jadi DRAWER overlay (geser dari kiri) seragam desktop & mobile
   - Header lesson sticky dengan hamburger (tidak ikut scroll)
   - Tab Materi / Lampiran di bawah player
   - Bar navigasi diramping; black box dibersihkan
   ============================================================ */

/* ===== Palet halaman belajar: oranye dominan dari logo ===== */
/* Override --brand HANYA di dalam .learn-wrap. Halaman lain tetap default tenant. */
.learn-wrap {
    /* S49: warisi --brand global (dari Setting brand_color), turunan via color-mix */
    --brand-strong: color-mix(in srgb, var(--brand) 80%, black);   /* lebih gelap utk teks di atas putih */
    --brand-soft: color-mix(in srgb, var(--brand) 12%, white);     /* latar item aktif sangat lembut */
    --brand-ink: color-mix(in srgb, var(--brand) 75%, black);      /* teks di atas brand-soft */
    --accent-cyan: #19BEDC;      /* cyan logo — aksen sekunder, hemat */
    --done-green: #1D9E75;       /* hijau "selesai" — sengaja beda dari oranye aktif */
    --drawer-head: #2a1c12;      /* gelap hangat header drawer (bukan hitam pekat) */
    margin-left: -1rem;
    margin-right: -1rem;
    padding-bottom: 88px;
}

/* ===== Header lesson STICKY dengan hamburger (inti perbaikan S17) ===== */
.lesson-bar {
    position: sticky;
    top: var(--topbar-h, 72px); /* S23: di bawah topbar fixed */
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 1rem;
    background: var(--bg);
    /* backdrop-filter dihapus S23: stacking-context liar + tembus konten */
    border-bottom: 1px solid var(--line);
}
.lesson-bar-burger {
    flex-shrink: 0;
    width: 40px; height: 40px;
    border: 0; border-radius: 999px;
    background: var(--brand); color: #fff;
    font-size: 18px; line-height: 1;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.lesson-bar-burger:active { transform: scale(.95); }
.lesson-bar-meta { flex: 1; min-width: 0; }
.lesson-bar-eyebrow {
    margin: 0; font-size: 11px; font-weight: 700;
    color: var(--brand-strong); text-transform: uppercase; letter-spacing: .04em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lesson-bar-title {
    margin: 0; font-size: 14px; font-weight: 600; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ===== Video stage ===== */
.learn-stage { position: relative; z-index: 20; background: #000; }
.player-frame { position: relative; aspect-ratio: 16 / 9; width: 100%; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---- Watch progress bar ---- */
.watch-status { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 84px; text-align: right; }

/* ===== MATERI + LAMPIRAN (tanpa tab, selalu terlihat) ===== */
.lesson-body { background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 1rem 18px; }
.lesson-content + .downloads { margin-top: 18px; }
.lesson-text-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; margin: 0 0 6px; }
.prose { color: var(--ink); line-height: 1.7; }
/* S64: spasi paragraf konten lesson (scoped .prose) */
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.4em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin: .25em 0; }
.prose h2, .prose h3 { margin: 1.2em 0 .5em; line-height: 1.3; font-weight: 700; }
.prose h2 { font-size: 1.35rem; }
.prose h3 { font-size: 1.15rem; }
.prose a { color: var(--brand-strong); text-decoration: underline; }
.prose strong { font-weight: 700; }
.prose blockquote { margin: 0 0 1em; padding-left: 1em; border-left: 3px solid var(--brand); color: var(--ink); opacity: .9; }

/* === SESI70-TABLE: styling tabel konten lesson (scoped .prose) === */
.prose .tbl-wrap { overflow-x: auto; margin: 0 0 1.2em; -webkit-overflow-scrolling: touch; }
.prose table {
    border-collapse: collapse;
    width: 100%;
    font-size: .95rem;
    background: #fff;
    border: 1px solid var(--line, #eadfd5);
    border-radius: 8px;
    overflow: hidden;
}
.prose th,
.prose td {
    border: 1px solid var(--line, #eadfd5);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}
/* Baris pertama sebagai header (importer menaruh header di baris pertama tbody) */
.prose table tr:first-child td,
.prose table th {
    background: var(--brand-tint, #fff4ec);
    color: var(--brand-strong, #c85f16);
    font-weight: 700;
}
.prose table tr:nth-child(even) td { background: #faf8f5; }
.prose table tr:first-child:nth-child(even) td { background: var(--brand-tint, #fff4ec); }

/* Kotak unduhan menonjol — peserta tidak akan melewatkannya */
.downloads { border: 1px solid var(--brand); background: var(--brand-soft); border-radius: 12px; padding: 14px; }
.downloads-title { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--brand-ink); }
.downloads-list { display: flex; flex-direction: column; gap: 8px; }
.download-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; transition: border-color .15s ease; }
.download-card:hover { border-color: var(--brand); }
.download-ico { flex-shrink: 0; width: 36px; height: 36px; border-radius: 9px; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.download-meta { display: flex; flex-direction: column; min-width: 0; }
.download-name { font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.download-size { font-size: 12px; color: var(--muted); }

/* ============================================================
   DRAWER KURIKULUM (overlay, geser dari kiri) — S18
   Seragam desktop & mobile (Opsi 3 S17). Pakai Alpine x-show/transition.
   ============================================================ */
.kur-overlay {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(0,0,0,.45);
}
.kur-drawer {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 41;
    width: min(86vw, 320px);
    background: var(--bg);
    display: flex; flex-direction: column;
    box-shadow: 2px 0 24px rgba(0,0,0,.18);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .24s cubic-bezier(.4,0,.2,1), visibility 0s linear .24s;
    will-change: transform;
}
.kur-drawer.is-open { transform: translateX(0); visibility: visible; transition: transform .24s cubic-bezier(.4,0,.2,1); }
.kur-drawer-head {
    padding: 16px 16px 14px;
    background: var(--drawer-head); color: #fff;
    padding-top: calc(16px + env(safe-area-inset-top));
}
.kur-drawer-toprow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kur-drawer-heading { font-size: 15px; font-weight: 700; font-family: var(--font-display); }
.kur-drawer-close { background: none; border: 0; color: rgba(255,255,255,.75); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.kur-drawer-close:hover { color: #fff; }
.kur-progress { display: flex; align-items: center; gap: 8px; }
.kur-progress-track { flex: 1; height: 6px; border-radius: 999px; background: rgba(255,255,255,.18); overflow: hidden; }
.kur-progress-fill { height: 100%; background: var(--brand); border-radius: 999px; transition: width .4s ease; }
.kur-progress-pct { font-size: 12px; color: #f0c9ad; white-space: nowrap; min-width: 32px; text-align: right; }

.kur-drawer-body { flex: 1; overflow-y: auto; padding: 6px 0 calc(12px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }

/* ---- Kurikulum list (di dalam drawer) ---- */
.kur-section { padding: 4px 0 8px; }
.kur-section-title {
    font-size: 11px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .04em;
    padding: 10px 16px 6px; margin: 0;
    position: sticky; top: 0; background: var(--bg); z-index: 1;
}
.kur-list { list-style: none; margin: 0; padding: 0; }
.kur-item { }
.kur-link { display: flex; align-items: center; gap: 10px; padding: 9px 16px; text-decoration: none; color: var(--ink); font-size: 13px; border-left: 3px solid transparent; }
.kur-link:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.kur-ico { width: 18px; text-align: center; flex-shrink: 0; color: var(--muted); font-size: 14px; }
.kur-label { flex: 1; min-width: 0; }
.kur-done { color: var(--done-green); font-weight: 700; flex-shrink: 0; }

.kur-item.is-current .kur-link { background: var(--brand-soft); border-left-color: var(--brand); }
.kur-item.is-current .kur-label { font-weight: 600; color: var(--brand-ink); }
.kur-item.is-current .kur-ico { color: var(--brand); }

.kur-item.is-locked .kur-locked-link { color: var(--muted); cursor: not-allowed; opacity: .7; }

/* ===== Bar navigasi prev/next (diramping, dua tombol sama besar) ===== */
.learn-nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 10px; padding: 12px 1rem; padding-bottom: calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); z-index: 30; max-width: 720px; margin: 0 auto; }
.btn-prev, .btn-next { flex: 1; text-align: center; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 15px; text-decoration: none; font-family: var(--font-body); }
.btn-prev { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-next { background: var(--brand); color: #fff; }
.btn-next[disabled], .btn-next.opacity-50 { background: var(--muted); }
.opacity-50 { opacity: .55; }
.cursor-not-allowed { cursor: not-allowed; }

/* ---- Kontrol kustom player ---- */
.ctrl-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 999px; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 16px; cursor: pointer; line-height: 1; }
.ctrl-btn:active { transform: scale(.95); }
.ctrl-time { margin-left: auto; font-size: 12px; color: rgba(255,255,255,.8); font-variant-numeric: tabular-nums; }

/* ===== Preview banner ===== */
.preview-banner { background: #fffbeb; border-bottom: 1px solid #fde68a; color: #92400e; font-size: 13px; padding: 8px 1rem; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.preview-banner a { color: var(--brand-strong); font-weight: 600; }

/* ===== Quiz (tetap dari sebelumnya, hanya warna ikut --brand oranye) ===== */
.quiz-stage { background: var(--surface); padding: 20px 1rem 28px; }
.quiz-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--ink); margin: 0 0 14px; }
.quiz-note { text-align: center; padding: 24px 0; }
.quiz-note .quiz-icon { font-size: 34px; }
.quiz-banner { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.quiz-banner-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.quiz-result { text-align: center; padding: 20px 0; }
.quiz-result-score { font-family: var(--font-display); font-size: 46px; font-weight: 700; color: var(--ink); }
.quiz-result-score span { font-size: 24px; color: var(--muted); }
.quiz-result.is-pass .quiz-result-score { color: var(--done-green); }
.quiz-result.is-fail .quiz-result-score { color: #dc2626; }
.quiz-result-status { font-weight: 600; margin: 6px 0; }
.quiz-result-meta { font-size: 14px; }
.quiz-retry-btn { display: inline-block; margin-top: 12px; padding: 11px 20px; background: var(--brand); color: #fff; border-radius: 10px; font-weight: 600; text-decoration: none; }
.quiz-attempts-info { font-size: 13px; margin-bottom: 12px; }
.quiz-q { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.quiz-q-num { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 4px; }
.quiz-q-hint { font-weight: 500; color: var(--brand-strong); }
.quiz-q-prompt { margin-bottom: 12px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-option { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 14px; }
.quiz-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.quiz-option input { margin-top: 2px; accent-color: var(--brand); }
.quiz-submit-btn { width: 100%; padding: 14px; background: var(--brand); color: #fff; border: 0; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: var(--font-body); }
.quiz-submit-btn:disabled { opacity: .6; }
.muted { color: var(--muted); }

/* ===== Drip badge (Sesi 14) — di drawer ===== */
.kur-section-title .drip-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: 0.68rem; font-weight: 600; white-space: nowrap; vertical-align: middle; text-transform: none; letter-spacing: 0; }
.kur-section-title .drip-badge .drip-date { font-weight: 500; opacity: 0.85; }
.kur-section.is-drip-locked .kur-section-title { color: var(--muted); }

/* ===== Sertifikat (Sesi 15) — cyan diselaraskan ke cyan logo ===== */
.cert-banner { margin: 16px 1rem 0; padding: 16px 18px; background: #e1f5f9; border: 1px solid var(--accent-cyan); border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.cert-banner-text { display: flex; align-items: center; gap: 12px; }
.cert-ico { font-size: 28px; }
.cert-title { font-weight: 600; color: #0e7490; margin: 0; }
.cert-sub { font-size: 13px; margin: 2px 0 0; }
.btn-cert { display: inline-block; padding: 11px 20px; background: var(--accent-cyan); color: #fff; border-radius: 10px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn-cert:hover { background: #15a7c2; }
.btn-next-cert { background: var(--brand) !important; color: #fff !important; }
.btn-next-cert:hover { background: var(--brand-strong) !important; }

/* ===== Akses berakhir / expired (kalau dipakai) ===== */
.learn-stage:empty { display: none; }

/* ============================================================
   DESKTOP (>=1024px): kurikulum jadi SIDEBAR PERMANEN di kiri.
   Drawer overlay & hamburger hanya untuk mobile.
   ============================================================ */
@media (min-width: 1024px) {
    /* Lebarkan .shell HANYA di halaman yang memuat .learn-wrap. */
    body:has(.learn-wrap) main.shell { max-width: 1140px; padding-top: 16px !important; padding-bottom: 0 !important; }

    /* Pola dua-panel: tinggi dikunci ke viewport. Sidebar DIAM total,
       hanya kolom kanan (konten) yang scroll. Halaman utama tidak scroll
       di area ini → tidak ada keanehan sticky/non-sticky. */
    .learn-wrap {
        margin-left: 0;
        margin-right: 0;
        display: grid;
        grid-template-columns: 320px 1fr;
        grid-template-rows: 1fr auto;
        grid-template-areas:
            "kur content"
            "kur nav";
        gap: 0 28px;
        height: calc(100vh - var(--topbar-h, 64px) - 16px);
        padding: 0 1rem 0;
        padding-bottom: 0;
        overflow: hidden;
    }

    /* Kolom kanan = wrapper scroll. Semua konten lesson masuk sini. */
    .learn-content-col {
        grid-area: content;
        overflow-y: auto;
        min-height: 0;
        padding-right: 4px;
    }

    .learn-nav    { grid-area: nav; position: static; left: auto; right: auto; bottom: auto; border-top: 1px solid var(--line); padding: 12px 0; max-width: none; margin: 0; background: var(--surface); }

    /* Hamburger tidak perlu di desktop */
    .lesson-bar-burger { display: none; }
    .lesson-bar { position: static; background: transparent; backdrop-filter: none; border-bottom: 1px solid var(--line); padding-left: 0; padding-right: 0; }
    .learn-stage { border-radius: 12px; overflow: hidden; }
    .cert-banner { margin-left: 0; margin-right: 0; }

    /* Drawer jadi sidebar DIAM (tidak sticky, tidak scroll halaman). */
    .kur-overlay { display: none !important; }
    .kur-drawer {
        grid-area: kur;
        position: static;
        transform: none !important;
        visibility: visible !important;
        box-shadow: none;
        border: 1px solid var(--line);
        border-radius: 12px;
        height: 100%;
        min-height: 0;
        width: auto;
    }
    .kur-drawer-body { overflow-y: auto; min-height: 0; }
    .kur-drawer-close { display: none; }
    .kur-drawer-head { border-radius: 12px 12px 0 0; padding-top: 16px; }
}





/* ============================================================
   SESI 19 — Bar kontrol player GABUNGAN (strict) — v2
   Satu baris: durasi + bar-warna-status + fullscreen.
   Bar penuh = 100% (relatif durasi). Warna = status:
   oranye (--brand) sebelum ambang, hijau setelah (.is-passed).
   Tanpa angka persen. Warna --surface natural, menyatu dgn video.
   ============================================================ */

.player-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

/* Durasi (kiri) — tetap tampil, info berguna untuk peserta */
.player-bar .ctrl-time {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    margin: 0;
    flex: 0 0 auto;
}

/* Bar progress (tengah, melar) */
.player-bar .watch-bar-track {
    flex: 1;
    min-width: 0;
    height: 6px;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}
/* Warna status: default oranye brand */
.player-bar .watch-bar-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 999px;
    transition: width .3s ease, background-color .3s ease;
}
/* Lewat ambang → hijau (boleh lanjut) */
.player-bar .watch-bar-fill.is-passed {
    background: #1D9E75;
}

/* Tombol fullscreen (kanan) — kecil, garis halus */
.player-bar .ctrl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 15px;
    cursor: pointer;
    line-height: 1;
    flex: 0 0 auto;
}
.player-bar .ctrl-btn:active { transform: scale(.95); }

/* Satukan sudut: video lurus di bawah, bar membulat → satu unit. */
.learn-stage { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.player-bar { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }

/* Mobile (<1024px): rapatkan sedikit, tetap muat (durasi + bar + fullscreen) */
@media (max-width: 1023px) {
    .player-bar { gap: 10px; padding: 9px 12px; }
}

@media (max-width: 1023px) {
    .player-bar { display: flex !important; flex-wrap: nowrap !important; align-items: center !important; gap: 10px !important; }
    .player-bar .ctrl-time { flex: 0 0 auto !important; }
    .player-bar .watch-bar-track { flex: 1 1 auto !important; min-width: 0 !important; }
    .player-bar .ctrl-btn { flex: 0 0 auto !important; }
}

/* SESI 19 — Persen aktual (watch-status) di bar, ringkas */
.player-bar .watch-status {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    min-width: 34px;
    text-align: right;
}

/* ===== S20: ikon tipe + radio status ===== */
.kur-ico { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.kur-ico svg { display: block; }
.kur-ico--video { color: var(--brand); }
.kur-ico--quiz  { color: var(--accent-cyan); }
.kur-item.is-current .kur-ico { color: var(--brand); }
.kur-radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; box-sizing: border-box; transition: background .15s, border-color .15s; }
.kur-radio.is-done { border-color: var(--done-green); background: var(--done-green); box-shadow: inset 0 0 0 3px var(--surface); }

/* ===== S20b: koreksi overlap — pastikan box-sizing grid ===== */
@media (min-width: 1024px) {
    body:has(.learn-wrap) .learn-wrap { box-sizing: border-box; }
}

/* ===== S23: Topbar fixed di halaman belajar MOBILE (anti-celah & anti-tutup) ===== */
@media (max-width: 1023px) {
    body:has(.learn-wrap) .topbar {
        position: fixed;
        top: 0; left: 0; right: 0;
    }
    body:has(.learn-wrap) main.shell {
        padding-top: 72px !important; /* kompensasi tinggi topbar fixed */
    }
    /* lesson-bar sticky menempel tepat di bawah topbar fixed (top = --topbar-h = 72px) */
}
