/* ============================================================
   28. BAR NAVIGASI BAWAH 1.20.0 (HP dan tablet kecil, <= 992px)
   Dibuat oleh js/core/bar-bawah.js di dalam #dashboard-admin / -guru / -siswa.
   Warna aktif mengikuti warna merek (--primary-*). Di layar lebar tidak tampil.
   ============================================================ */
.bb, .bb-sheet { display: none; }

@media (max-width: 992px) {
    .app-layout .bb {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 950;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        background: var(--bg-surface); border-top: 1px solid var(--border-color);
        box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.06);
    }
    /* Ruang agar isi halaman tidak tertutup bar */
    .app-layout .main-content::after { content: ""; display: block; height: calc(76px + env(safe-area-inset-bottom)); }
    .pwa-banner { bottom: calc(84px + env(safe-area-inset-bottom)); }

    .app-layout .bb .bb-item {
        flex: 1 1 0; min-width: 0; width: auto; margin: 0; padding: 2px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        background: transparent; border: 0; border-radius: 12px; box-shadow: none; transform: none;
        color: var(--text-muted); font-family: inherit; font-size: 11px; font-weight: 500; line-height: 1.2; cursor: pointer;
        -webkit-tap-highlight-color: transparent; transition: color 0.15s;
    }
    .app-layout .bb .bb-item:hover { transform: none; box-shadow: none; }
    .app-layout .bb .bb-item.on { color: var(--primary-dark); font-weight: 700; }
    .app-layout .bb .bb-item:focus-visible { outline: 3px solid rgba(var(--primary-rgb), 0.55); outline-offset: -2px; }
    .bb-pil { position: relative; width: 54px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
    .bb-item.on .bb-pil { background: rgba(var(--primary-rgb), 0.13); }
    .bb-item:active .bb-pil { background: rgba(var(--primary-rgb), 0.18); }
    .bb-label { max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .bb-ik { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    .bb-lainnya .bb-ik { fill: currentColor; stroke: none; }
    .bb-badge, .bb-badge-baris { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; box-sizing: border-box; }
    .bb-badge { position: absolute; top: -5px; right: 3px; border: 2px solid var(--bg-surface); line-height: 13px; }
    .bb-badge.hidden, .bb-badge-baris.hidden { display: none; }

    /* Lembar "Lainnya": daftar menu penuh layar */
    .bb-sheet { display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 1900; background: var(--bg-surface); animation: bb-naik 0.22s ease-out; }
    .bb-sheet.hidden { display: none; }
    .bb-sheet-kepala { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 16px 10px 20px; border-bottom: 1px solid var(--border-color); min-height: 56px; }
    .bb-sheet-kepala h2 { margin: 0; font-size: 18px; font-weight: 800; color: var(--text-main); }
    .bb-sheet .bb-tutup { width: 38px; height: 38px; min-width: 38px; margin: 0; padding: 0; border-radius: 50%; background: var(--primary-light); color: var(--primary-dark); box-shadow: none; transform: none; font-size: 16px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
    .bb-daftar { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 12px calc(20px + env(safe-area-inset-bottom)); }
    .bb-sheet .bb-baris { display: flex; align-items: center; gap: 14px; width: 100%; margin: 0; padding: 14px 12px; border-radius: 14px; background: transparent; border: 0; box-shadow: none; transform: none; text-align: left; color: var(--text-main); font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .bb-sheet .bb-baris:hover { transform: none; box-shadow: none; background: rgba(var(--primary-rgb), 0.06); }
    .bb-sheet .bb-baris .bb-ik { stroke: var(--primary); }
    .bb-sheet .bb-baris.on { background: rgba(var(--primary-rgb), 0.12); color: var(--primary-dark); }
    .bb-baris-label { flex: 1; min-width: 0; }
    .bb-badge-baris { margin-left: auto; }
    .bb-pisah { height: 1px; background: var(--border-color); margin: 8px 10px; }
    .bb-sheet .bb-keluar, .bb-sheet .bb-keluar .bb-ik { color: var(--danger); stroke: var(--danger); }
    .bb-sheet .bb-baris:focus-visible, .bb-sheet .bb-tutup:focus-visible { outline: 3px solid rgba(var(--primary-rgb), 0.55); outline-offset: -2px; }

    body.bb-mengetik .app-layout .bb { display: none; }
    body.bb-sheet-buka { overflow: hidden; }

    /* Mode gelap */
    body.dark-mode .app-layout .bb, body.dark-mode .bb-sheet { background: #1e293b; border-color: #334155; }
    body.dark-mode .app-layout .bb .bb-item.on, body.dark-mode .bb-sheet .bb-baris.on { color: var(--primary-bright); }
    body.dark-mode .bb-badge { border-color: #1e293b; }
    body.dark-mode .bb-sheet-kepala { border-color: #334155; }
    body.dark-mode .bb-sheet-kepala h2, body.dark-mode .bb-sheet .bb-baris { color: #e2e8f0; }
    body.dark-mode .bb-sheet .bb-tutup { background: #334155; color: #e2e8f0; }
    body.dark-mode .bb-sheet .bb-baris .bb-ik { stroke: var(--primary-bright); }
    body.dark-mode .bb-pisah { background: #334155; }
    body.dark-mode .bb-sheet .bb-keluar, body.dark-mode .bb-sheet .bb-keluar .bb-ik { color: #f87171; stroke: #f87171; }
}
@keyframes bb-naik { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bb-sheet { animation: none; } .bb-item, .bb-pil { transition: none; } }
