/* =========================================================
   SIKOM E-LEARNING — Design tokens
   Palet   : navy (struktur/inti sistem) + teal (aksi/interaktif)
             + amber (status/perhatian)
   Tipografi: Sora (heading, tegas & teknis) / Inter (body, jernih)
             / JetBrains Mono (label status, kode, angka)
========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
    --navy-950: #0B1526;
    --navy-900: #101E36;
    --navy-800: #16294A;
    --navy-700: #1F3660;
    --teal-600: #0D7C77;
    --teal-500: #159A90;
    --teal-100: #E3F5F2;
    --amber-500: #E5A33D;
    --amber-100: #FCF0DC;
    --bg: #F3F6FA;
    --surface: #FFFFFF;
    --border: #E3E8F0;
    --text: #182233;
    --text-muted: #5C6B7F;
    --success: #1E9E5A;
    --success-bg: #E6F7EE;
    --danger: #D64545;
    --danger-bg: #FCEAEA;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16, 30, 54, .06);
    --shadow-md: 0 8px 24px rgba(16, 30, 54, .10);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, Segoe UI, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
}

h1,
h2,
h3,
h4 {
    font-family: 'Sora', sans-serif;
    color: var(--navy-900);
    margin: 0 0 6px;
    letter-spacing: -.01em;
}

a {
    color: var(--teal-600);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

img {
    max-width: 100%;
}

/* ---------- Utility ---------- */
.muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.mt-0 {
    margin-top: 0;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: .15s ease;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--teal-600);
    color: #fff;
}

.btn-primary:hover {
    background: var(--teal-500);
}

.btn-navy {
    background: var(--navy-800);
    color: #fff;
}

.btn-navy:hover {
    background: var(--navy-700);
}

.btn-outline {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--teal-600);
    color: var(--teal-600);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
}

.btn-block {
    width: 100%;
}

.btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

/* ---------- Forms ---------- */
label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--navy-900);
}

input[type=text],
input[type=password],
input[type=date],
input[type=datetime-local],
input[type=number],
input[type=email],
input[type=url],
input[type=file],
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--teal-600);
    box-shadow: 0 0 0 3px var(--teal-100);
}

.form-group {
    margin-bottom: 18px;
}

textarea {
    resize: vertical;
    min-height: 90px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

.card+.card {
    margin-top: 18px;
}

/* ---------- Badges / status ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--amber-100);
    color: #9A6B0E;
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-neutral {
    background: #EEF1F6;
    color: var(--text-muted);
}

.badge-teal {
    background: var(--teal-100);
    color: var(--teal-600);
}

/* ---------- Alerts ---------- */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 14px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: #166534;
    border-color: #bfe8cf;
}

.alert-danger {
    background: var(--danger-bg);
    color: #8a1f1f;
    border-color: #f2c6c6;
}

.alert-info {
    background: var(--teal-100);
    color: var(--teal-600);
    border-color: #bfe3df;
}

/* ---------- Tables ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-family: 'Sora', sans-serif;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: #FAFBFD;
}

tbody tr:hover {
    background: #FAFCFD;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.table-wrap table {
    border: none;
}

.table-wrap .card {
    box-shadow: none;
}

/* =========================================================
   LOGIN PAGE
========================================================= */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: stretch;
    background: var(--navy-950);
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.login-visual {
    flex: 1.1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0;
    color: #fff;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 20%, rgba(21, 154, 144, .35), transparent 40%),
        radial-gradient(circle at 85% 75%, rgba(229, 163, 61, .18), transparent 45%),
        linear-gradient(160deg, var(--navy-950) 0%, var(--navy-900) 60%, #0C1930 100%);
}

.login-school-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .65;
    animation: kenburns 22s ease-in-out infinite alternate;
    z-index: 0;
}

.login-photo-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(11, 21, 38, .25) 0%, rgba(11, 21, 38, .55) 55%, rgba(9, 17, 32, .94) 100%),
        radial-gradient(circle at 20% 15%, rgba(21, 154, 144, .28), transparent 45%);
}

.login-visual .circuit {
    position: absolute;
    inset: 0;
    opacity: .22;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: screen;
}

.login-visual-content {
    position: relative;
    z-index: 2;
    padding: 64px 60px 56px;
}

.login-visual .eyebrow {
    font-family: 'JetBrains Mono', monospace;
    color: var(--teal-500);
    font-size: 12.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    margin-bottom: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.login-visual .eyebrow::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--teal-500);
    box-shadow: 0 0 0 4px rgba(21, 154, 144, .25);
}

.login-visual h1 {
    color: #fff;
    font-size: 38px;
    line-height: 1.22;
    max-width: 480px;
    margin-bottom: 10px;
}

.login-visual .school-name {
    color: #CBD6E6;
    font-size: 16px;
    font-weight: 500;
    max-width: 440px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, .15);
    margin-top: 6px;
    display: inline-block;
}

@keyframes kenburns {
    from {
        transform: scale(1) translate(0, 0);
    }

    to {
        transform: scale(1.09) translate(-1%, -1%);
    }
}

.login-form-wrap {
    width: 460px;
    max-width: 100%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow-y: auto;
}

.login-box {
    width: 100%;
    max-width: 360px;
}

.login-box h2 {
    font-size: 22px;
}

.login-box .login-desc {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 13.5px;
}

.login-box .login-footer-text {
    font-size: 12.5px;
}

.login-box .logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 34px;
}

.logo-mark {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--navy-900);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal-500);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 15px;
}

.login-box .logo-row b {
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    color: var(--navy-900);
}

.login-box .logo-row small {
    display: block;
    color: var(--text-muted);
    font-size: 11.5px;
}

.role-switch {
    display: flex;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 24px;
}

.role-switch label {
    flex: 1;
    text-align: center;
    padding: 9px 0;
    border-radius: 7px;
    font-size: 13.5px;
    cursor: pointer;
    margin: 0;
    color: var(--text-muted);
    font-weight: 600;
}

.role-switch input {
    display: none;
}

.role-switch input:checked+label {
    background: var(--navy-900);
    color: #fff;
}

/* =========================================================
   APP SHELL (sidebar + topbar)
========================================================= */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 246px;
    flex-shrink: 0;
    background: var(--navy-950);
    color: #C9D3E2;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.sidebar .brand b {
    color: #fff;
    font-family: 'Sora', sans-serif;
    font-size: 14.5px;
    display: block;
}

.sidebar .brand small {
    color: #7C8CA6;
    font-size: 10.5px;
}

.sidebar nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar .nav-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: #5B6B85;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 14px 12px 6px;
}

.sidebar a.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 9px;
    color: #B7C2D6;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    text-decoration: none;
}

.sidebar a.nav-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.sidebar a.nav-link.active {
    background: var(--teal-600);
    color: #fff;
}

.sidebar .nav-link .ic {
    width: 18px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    opacity: .9;
}

.sidebar .user-box {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.sidebar .user-box .who {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.sidebar .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--teal-600);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    font-family: 'Sora', sans-serif;
    overflow: hidden;
}

.sidebar .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar .who b {
    color: #fff;
    font-size: 13.5px;
    display: block;
    line-height: 1.3;
}

.sidebar .who span {
    color: #7C8CA6;
    font-size: 11.5px;
}

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

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 16px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar h2 {
    font-size: 19px;
    margin: 0;
}

.topbar .breadcrumb {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: var(--text-muted);
    letter-spacing: .03em;
}

.content {
    padding: 28px 30px 60px;
    max-width: 1180px;
    width: 100%;
}

/* ---------- Dashboard stat cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-ic {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--teal-100);
    color: var(--teal-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
}

.stat-card b {
    font-family: 'Sora', sans-serif;
    font-size: 26px;
    color: var(--navy-900);
}

.stat-card span {
    font-size: 12.5px;
    color: var(--text-muted);
}

/* ---------- Grid list (materi / buku) ---------- */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.file-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Kartu materi bertipe tautan — border aksen tipis di kiri */
.file-card--link {
    border-left: 3px solid #7B5CE0;
}

.file-card .file-ic {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 11px;
    color: #fff;
}

.file-ic.pdf {
    background: #D64545;
}

.file-ic.doc {
    background: #2F6FED;
}

.file-ic.ppt {
    background: #E5A33D;
}

.file-ic.video {
    background: var(--navy-800);
}

.file-ic.lainnya {
    background: #6B7280;
}

.file-card h4 {
    font-size: 14.5px;
    margin: 0;
}

.file-card p {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0;
    flex: 1;
}

.file-card .file-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Chip tipe konten di badan kartu (mis. YouTube, TAUTAN, PDF) */
.content-type-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    padding: 3px 9px;
    border-radius: 20px;
    line-height: 1.4;
}

.content-type-chip.chip-youtube {
    background: #FEE2E2;
    color: #C0392B;
    border: 1px solid #FECACA;
}

.content-type-chip.chip-link {
    background: #EDE9FE;
    color: #6D28D9;
    border: 1px solid #DDD6FE;
}

.content-type-chip.chip-file {
    background: var(--teal-100);
    color: var(--teal-600);
    border: 1px solid #B2E8E3;
}

/* Badge tipe pada kartu buku */
.book-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 3px 9px;
    border-radius: 20px;
    margin-bottom: 2px;
    line-height: 1.4;
}

.book-type-badge.badge-youtube {
    background: #FEE2E2;
    color: #C0392B;
    border: 1px solid #FECACA;
}

.book-type-badge.badge-link {
    background: #EDE9FE;
    color: #6D28D9;
    border: 1px solid #DDD6FE;
}

.book-type-badge.badge-file {
    background: var(--teal-100);
    color: var(--teal-600);
    border: 1px solid #B2E8E3;
}

/* Kartu buku bertipe tautan — border aksen ungu */
.book-card--link {
    border-left: 3px solid #7B5CE0;
}


/* ---------- Quiz ---------- */
.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 14.5px;
    background: #fff;
}

.quiz-option:hover {
    border-color: var(--teal-600);
}

.quiz-option input {
    margin: 0;
}

.quiz-option.correct {
    border-color: var(--success);
    background: var(--success-bg);
}

.quiz-option.wrong {
    border-color: var(--danger);
    background: var(--danger-bg);
}

.timer-badge {
    font-family: 'JetBrains Mono', monospace;
    background: var(--navy-900);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: .03em;
}

.score-ring {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: conic-gradient(var(--teal-600) calc(var(--pct)*1%), #E9EEF4 0);
    margin: 0 auto 16px;
}

.score-ring .inner {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Sora', sans-serif;
}

.score-ring .inner b {
    font-size: 26px;
    color: var(--navy-900);
}

.score-ring .inner span {
    font-size: 11px;
    color: var(--text-muted);
}

/* ---------- Misc ---------- */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state .ic {
    font-size: 32px;
    margin-bottom: 10px;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

.pill-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.pill-tabs a {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 13.5px;
    color: var(--text);
    font-weight: 600;
    background: #fff;
}

.pill-tabs a.active {
    background: var(--navy-900);
    color: #fff;
    border-color: var(--navy-900);
}

@media (max-width:900px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        z-index: 20;
        transition: transform .25s ease, box-shadow .25s ease;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-md);
    }

    .content {
        padding: 20px 16px 50px;
    }

    .topbar {
        padding: 14px 16px;
    }

    /* Login: layar dibagi 2 tanpa scroll — gambar/branding di atas,
       kolom form di bawah, semua konten pas dalam satu layar (100dvh). */
    .login-page {
        flex-direction: column;
        height: 100dvh;
        height: 100vh;
        overflow: hidden;
    }

    .login-visual {
        flex: 0 0 34%;
        height: 34%;
        justify-content: center;
        border-radius: 0 0 24px 24px;
    }

    .login-visual-content {
        padding: 0 24px;
        text-align: center;
    }

    .login-visual .eyebrow {
        font-size: 10.5px;
        margin: 0 auto 8px;
        justify-content: center;
    }

    .login-visual h1 {
        font-size: 19px;
        line-height: 1.25;
        max-width: 100%;
        margin: 0;
        text-shadow: 0 2px 10px rgba(0, 0, 0, .5);
    }

    .login-visual .school-name {
        display: inline-block;
        font-size: 11.5px;
        margin-top: 8px;
        padding-top: 8px;
        text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
    }

    .login-school-photo {
        opacity: .85;
        animation: none;
    }

    .login-photo-overlay {
        background:
            linear-gradient(180deg, rgba(11, 21, 38, .15) 0%, rgba(11, 21, 38, .35) 55%, rgba(9, 17, 32, .75) 100%),
            radial-gradient(circle at 20% 15%, rgba(21, 154, 144, .2), transparent 45%);
    }

    .login-form-wrap {
        flex: 1;
        width: 100%;
        min-height: 0;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding: 14px 20px;
        overflow-y: auto;
    }

    .login-box {
        width: 100%;
        max-width: 420px;
    }

    .login-box .logo-row {
        margin-bottom: 14px;
    }
}

/* =========================================================
   ANIMASI & TRANSISI HALUS
========================================================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(.96) translateY(6px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(.9);
    }

    70% {
        opacity: 1;
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }

    100% {
        background-position: 200px 0;
    }
}

.content>* {
    animation: fadeInUp .35s ease both;
}

.content>*:nth-child(2) {
    animation-delay: .03s;
}

.content>*:nth-child(3) {
    animation-delay: .06s;
}

.content>*:nth-child(4) {
    animation-delay: .09s;
}

.card,
.stat-card,
.file-card {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card:hover,
.file-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #CFE0E8;
}

.stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(120deg, transparent 40%, rgba(21, 154, 144, .06) 50%, transparent 60%);
    background-size: 220% 100%;
    background-position: 120% 0;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
}

.stat-card:hover::after {
    opacity: 1;
    background-position: -20% 0;
    transition: background-position .7s ease, opacity .2s;
}

.btn {
    transition: background .16s ease, color .16s ease, transform .12s ease, box-shadow .16s ease, border-color .16s ease;
}

.btn:active {
    transform: scale(.97);
}

.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(13, 124, 119, .28);
    transform: translateY(-1px);
}

.btn-navy:hover {
    box-shadow: 0 4px 14px rgba(22, 41, 74, .28);
    transform: translateY(-1px);
}

.btn-outline:hover {
    transform: translateY(-1px);
}

.btn-danger:hover {
    transform: translateY(-1px);
}

.sidebar a.nav-link {
    transition: background .15s ease, color .15s ease, padding-left .15s ease;
    position: relative;
}

.sidebar a.nav-link:hover {
    padding-left: 16px;
}

.sidebar a.nav-link.active {
    position: relative;
}

.sidebar a.nav-link .ic {
    transition: transform .15s ease;
}

.sidebar a.nav-link:hover .ic {
    transform: scale(1.12);
}

tbody tr {
    transition: background .12s ease;
}

.quiz-option {
    transition: border-color .14s ease, background .14s ease, transform .1s ease;
}

.quiz-option:hover {
    transform: translateX(2px);
}

input,
select,
textarea {
    transition: border-color .15s ease, box-shadow .15s ease;
}

a {
    transition: color .12s ease;
}

.logo-mark {
    transition: transform .25s ease;
}

.login-box:hover .logo-mark {
    transform: rotate(-6deg) scale(1.05);
}

.badge {
    transition: transform .12s ease;
}

.stat-card:hover .stat-ic,
.file-card:hover .file-ic {
    transform: scale(1.06);
}

.stat-ic,
.file-ic {
    transition: transform .15s ease;
}

/* ---------- Modal (untuk form Edit) ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 21, 38, .55);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 20px;
    animation: fadeIn .18s ease;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: var(--radius);
    max-width: 520px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(11, 21, 38, .35);
    animation: scaleIn .2s cubic-bezier(.2, .9, .3, 1.2);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.modal-head h3 {
    margin: 0;
    font-size: 17px;
}

.modal-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: #F0F3F8;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px 22px 22px;
}

/* Tombol icon kecil (edit) di dalam tabel/kartu */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    transition: .15s ease;
}

.icon-btn:hover {
    border-color: var(--teal-600);
    color: var(--teal-600);
    background: var(--teal-100);
    transform: translateY(-1px);
}

/* Toast notifikasi kecil (opsional dipakai lewat JS) */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--navy-900);
    color: #fff;
    padding: 13px 20px;
    border-radius: 10px;
    font-size: 13.5px;
    box-shadow: var(--shadow-md);
    z-index: 60;
    animation: popIn .25s ease;
}

/* Spinner kecil untuk tombol loading (opsional) */
.spin {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: spin .6s linear infinite;
}

/* Progress bar indikator upload (opsional dekoratif) */
.skeleton {
    background: linear-gradient(90deg, #EEF1F6 25%, #F7F9FC 37%, #EEF1F6 63%);
    background-size: 400px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: 6px;
}

/* ---------- Upload Foto Profil ---------- */
.photo-upload-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.photo-preview {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--teal-600);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 30px;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px var(--border);
    position: relative;
    transition: transform .18s ease;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-upload-actions {
    flex: 1;
    min-width: 220px;
}

.photo-upload-actions input[type=file] {
    margin-bottom: 6px;
}

.photo-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* Badge status Draft / Dipublikasi untuk Kuis & Tugas */
.badge-draft {
    background: #EEF1F6;
    color: #5C6B7F;
}

.badge-live {
    background: var(--success-bg);
    color: var(--success);
}

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- Avatar inline (foto/inisial di samping nama, tabel & daftar) ---------- */
.avatar-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--teal-600);
    color: #fff;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 9px;
    flex-shrink: 0;
}

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

.name-with-avatar {
    display: inline-flex;
    align-items: center;
}

/* ---------- Thumbnail file (materi/tugas/buku) ---------- */
.thumb-box {
    width: 100%;
    height: 130px;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    position: relative;
    background: #EEF1F6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.thumb-box canvas {
    object-fit: contain;
    background: #fff;
}

.thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
}

.thumb-fallback .thumb-ext {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .04em;
    background: rgba(255, 255, 255, .18);
    padding: 4px 12px;
    border-radius: 20px;
}

.thumb-pdf .thumb-fallback {
    background: linear-gradient(135deg, #E4595A, #B23636);
}

.thumb-doc .thumb-fallback {
    background: linear-gradient(135deg, #4C86F0, #1E54C4);
}

.thumb-ppt .thumb-fallback {
    background: linear-gradient(135deg, #F0B65D, #C9860F);
}

.thumb-video .thumb-fallback {
    background: linear-gradient(135deg, #26406B, #0B1526);
}

.thumb-image .thumb-fallback {
    background: linear-gradient(135deg, #3EAFA6, #0D7C77);
}

.thumb-lainnya .thumb-fallback {
    background: linear-gradient(135deg, #8A93A3, #5C6B7F);
}

.thumb-link .thumb-fallback {
    background: linear-gradient(135deg, #7B5CE0, #4A2FB0);
    position: relative;
    overflow: hidden;
}

.thumb-link .thumb-fallback::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Ccircle cx='30' cy='30' r='28' fill='none' stroke='rgba(255,255,255,0.07)' stroke-width='1'/%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='rgba(255,255,255,0.05)' stroke-width='1'/%3E%3C/svg%3E") center/60px;
    pointer-events: none;
}

/* ============================================================
   YOUTUBE THUMBNAIL — thumbnail asli dengan play button overlay
   ============================================================ */
.thumb-youtube {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: #0b1526;
}

.thumb-youtube img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease, filter .35s ease;
    filter: brightness(.92);
}

.thumb-youtube:hover img {
    transform: scale(1.06);
    filter: brightness(.78);
}

/* Gradien bawah gelap supaya label terbaca */
.thumb-youtube::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,.65) 0%, transparent 100%);
    z-index: 1;
    pointer-events: none;
}

.thumb-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background .2s ease;
}

.thumb-youtube:hover .thumb-play-overlay {
    background: rgba(0, 0, 0, .15);
}

.thumb-play-btn {
    width: 48px;
    height: 48px;
    background: #FF0000;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    padding-left: 3px;
    box-shadow: 0 4px 20px rgba(255,0,0,.45), 0 2px 8px rgba(0,0,0,.35);
    transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .22s ease;
    backdrop-filter: blur(2px);
}

.thumb-youtube:hover .thumb-play-btn {
    transform: scale(1.18);
    box-shadow: 0 6px 26px rgba(255,0,0,.6), 0 2px 12px rgba(0,0,0,.4);
}

/* Badge YOUTUBE di pojok kiri atas */
.thumb-youtube-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    background: #FF0000;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 3px 7px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
    box-shadow: 0 1px 6px rgba(0,0,0,.3);
}

.thumb-youtube-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    animation: ytPulse 1.8s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes ytPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .5; transform: scale(.7); }
}

/* ============================================================
   LINK THUMBNAIL (non-YouTube) — glassmorphism premium
   ============================================================ */
.thumb-link {
    cursor: pointer;
    transition: filter .2s ease;
}

.thumb-link:hover {
    filter: brightness(1.08);
}

.thumb-link .thumb-fallback {
    /* Override dari atas — pastikan posisinya relative untuk pseudo-elements */
    gap: 6px;
}

/* Ikon link besar di tengah */
.thumb-link-icon {
    font-size: 30px;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
    transition: transform .2s ease;
    line-height: 1;
}

.thumb-link:hover .thumb-link-icon {
    transform: scale(1.15) rotate(-5deg);
}

/* Badge domain di pojok kiri atas (mirip badge YouTube) */
.thumb-link-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    background: rgba(255,255,255,.22);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 3px 8px;
    border-radius: 4px;
    line-height: 1.4;
    box-shadow: 0 1px 6px rgba(0,0,0,.25);
}

/* ============================================================
   THUMB-BOX di dalam BOOK-COVER: isi penuh, cover buku link
   ============================================================ */
.book-cover .thumb-box-cover.thumb-youtube {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.book-cover .thumb-box-cover.thumb-link {
    position: absolute;
    inset: 0;
    border-radius: 0;
}

/* Badge khusus untuk buku link */
.book-cover .thumb-link-badge,
.book-cover .thumb-youtube-badge {
    top: 10px;
    left: 10px;
}

/* Ikon link di cover buku lebih besar */
.book-cover .thumb-link-icon {
    font-size: 40px;
}

/* Teks domain di bawah ikon di cover buku */
.book-cover .thumb-ext {
    font-size: 11px;
    opacity: .85;
}

/* Animasi shimmer ringan pada thumb-link saat idle */
@keyframes linkShimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.thumb-link .thumb-fallback::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg,
        transparent 30%,
        rgba(255,255,255,.08) 50%,
        transparent 70%
    );
    background-size: 200% 100%;
    animation: linkShimmer 3.5s linear infinite;
    pointer-events: none;
}

.thumb-box-sm {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    flex-shrink: 0;
}

.thumb-box-sm .thumb-fallback {
    gap: 0;
}

.thumb-box-sm .thumb-fallback .thumb-ext {
    font-size: 9px;
    padding: 2px 6px;
}

.thumb-box-cover {
    width: 100%;
    height: 100%;
    border-radius: 0;
    position: absolute;
    inset: 0;
}

/* Kartu file: thumbnail penuh di atas, konten di bawah */
.file-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.file-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.file-card-body h4 {
    margin: 0;
}

.file-card-body p {
    margin: 0;
    flex: 1;
}

.file-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-inline .thumb-box-sm {
    margin-top: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* =========================================================
   RESPONSIF — layout adaptif otomatis (auto-fit) + mobile polish
========================================================= */
.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    align-items: start;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.burger-btn {
    display: none;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 21, 38, .55);
    z-index: 18;
    animation: fadeIn .18s ease;
}

.sidebar-backdrop.show {
    display: block;
}

@media (max-width:900px) {
    .burger-btn {
        display: inline-flex;
    }

    .content>* {
        animation: none;
    }
}

@media (max-width:768px) {

    table.table-responsive-mobile,
    table.table-responsive-mobile tbody,
    table.table-responsive-mobile tr,
    table.table-responsive-mobile td {
        display: block;
        width: 100%;
    }

    table.table-responsive-mobile thead {
        display: none;
    }

    table.table-responsive-mobile tr {
        margin-bottom: 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        overflow: hidden;
    }

    table.table-responsive-mobile td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        border-bottom: 1px solid var(--border);
        padding: 8px 12px;
        white-space: normal;
    }

    table.table-responsive-mobile td::before {
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        margin-right: 12px;
        font-size: 11.5px;
        text-transform: uppercase;
        color: var(--text-muted);
    }

    table.table-responsive-mobile td:last-child {
        border-bottom: none;
    }

    table.table-responsive-mobile td.actions-cell {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    table.table-responsive-mobile td.actions-cell::before {
        display: none;
    }

    table.table-responsive-mobile td.actions-cell .flex {
        flex-wrap: wrap;
        justify-content: center;
    }

    table.table-responsive-mobile td.actions-cell .flex a,
    table.table-responsive-mobile td.actions-cell .flex button {
        flex: 1;
        text-align: center;
        font-size: 12px;
        padding: 8px 4px;
    }
}

@media (max-width:640px) {
    .topbar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .topbar h2 {
        font-size: 16.5px;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card b {
        font-size: 21px;
    }

    .grid-3 {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .card {
        padding: 16px;
    }

    table {
        font-size: 13px;
    }

    th,
    td {
        padding: 9px 10px;
    }

    .btn {
        padding: 9px 14px;
        font-size: 13.5px;
    }

    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }

    .flex.gap-8,
    .flex-between {
        flex-wrap: wrap;
    }

    .modal-box {
        max-height: 92vh;
    }

    /* Login: padding lebih rapat + hindari auto-zoom Safari di input + tombol lebih nyaman disentuh */
    .login-form-wrap {
        padding: 12px 16px;
    }

    input[type=text],
    input[type=password] {
        font-size: 16px;
        padding: 9px 12px;
    }

    .btn-block {
        min-height: 46px;
        font-size: 14.5px;
    }

    .login-box h2 {
        font-size: 17px;
        margin-bottom: 3px;
    }

    .login-box .login-desc {
        margin-bottom: 14px;
        font-size: 11.5px;
    }

    .form-group {
        margin-bottom: 10px;
    }

    label {
        margin-bottom: 4px;
        font-size: 12.5px;
    }

    .divider {
        margin: 12px 0;
    }

    .login-box .login-footer-text {
        font-size: 11px;
        line-height: 1.4;
    }

    .pill-tabs a {
        padding: 7px 12px;
        font-size: 12.5px;
    }

    .login-visual {
        flex-basis: 26%;
        height: 26%;
    }

    .login-visual h1 {
        font-size: 16px;
    }

    .login-visual .eyebrow {
        display: none;
    }

    .login-form-wrap {
        padding-top: 10px;
    }
}

@media (max-width:400px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .sidebar {
        width: 82vw;
        max-width: 280px;
    }

    .login-visual {
        flex-basis: 22%;
        height: 22%;
    }

    .login-visual h1 {
        font-size: 14px;
    }

    .login-visual .school-name {
        font-size: 10.5px;
        margin-top: 6px;
        padding-top: 6px;
    }
}

/* ---------- Sampul Buku (mode "book cover" untuk halaman Rekomendasi Buku) ---------- */
.book-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: #CFE0E8;
}

.book-cover {
    width: 100%;
    aspect-ratio: 3/4;
    background: linear-gradient(150deg, var(--navy-800), var(--navy-950));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

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

.book-cover .book-placeholder {
    color: rgba(255, 255, 255, .85);
    text-align: center;
    padding: 18px;
    font-family: 'Sora', sans-serif;
}

.book-cover .book-placeholder .spine {
    width: 34px;
    height: 46px;
    border: 2px solid rgba(255, 255, 255, .5);
    border-radius: 3px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
}

.book-cover .book-placeholder span {
    display: block;
    font-size: 11px;
    line-height: 1.3;
    opacity: .85;
    max-width: 130px;
}

.book-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.book-body h4 {
    font-size: 14.5px;
    margin: 0;
}

.book-body p {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0;
    flex: 1;
}

.book-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.grid-books {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 18px;
}