/* ============================================================================
   NAVIGASI BAWAH — BILAH PIL MENGAMBANG + GELEMBUNG TERANGKAT
   ----------------------------------------------------------------------------
   Gaya mengikuti referensi yang Anda kirim:

     - bilah putih bersih berbentuk pil, membulat besar, mengambang di atas konten;
     - ikon garis tipis (stroke), tanpa label, berjarak lega;
     - satu gelembung bulat berwarna tema yang TERANGKAT KELUAR dari bilah,
       berisi ikon menu yang sedang aktif;
     - saat pindah menu, gelembung itu meloncat dan meluncur ke posisi baru.

   Warna tetap ditarik dari --c-primary-* supaya fitur Ganti Tema bekerja penuh,
   jadi aksennya mengikuti warna pilihan Anda, bukan magenta seperti referensi.

   Ikon dibuat sebagai SVG stroke, bukan Font Awesome. Font Awesome Free tidak
   punya bobot tipis, dan justru ketipisan garis itulah yang membuat gaya ini
   terbaca — memakai ikon solid akan langsung terlihat seperti template lain.
   ============================================================================ */

:root {
    --nb-bar:        255 255 255;     /* permukaan bilah, mode terang */
    --nb-bar-edge:   15 23 42;
    --nb-icon:       51 65 85;        /* ikon tidak aktif */
    --nb-shadow:     15 23 42;
    --nb-bubble-a:   var(--c-primary-400);
    --nb-bubble-b:   var(--c-primary-600);
    --nb-bubble-ink: 255 255 255;
    --nb-plus-ring:  176 150 95;      /* kuningan tua, aksen ikon aplikasi */
}

html.dark {
    --nb-bar:        23 34 52;
    --nb-bar-edge:   255 255 255;
    --nb-icon:       148 163 184;
    --nb-shadow:     2 6 14;
    --nb-bubble-a:   var(--c-primary-300);
    --nb-bubble-b:   var(--c-primary-600);
    --nb-bubble-ink: 10 26 43;
    --nb-plus-ring:  201 179 133;
}

/* ------------------------------------------------------------- KERANGKA --- */

#nb-root {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    padding: 0 14px calc(14px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
}

.nb-bar {
    position: relative;
    pointer-events: auto;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: center;
    height: 64px;
    border-radius: 32px;
    background: rgb(var(--nb-bar) / .985);
    /* PERFORMA: latar 98% pekat — blur kaca tidak terlihat, jadi tidak dihitung. */
    border: 1px solid rgb(var(--nb-bar-edge) / .07);
    box-shadow:
        0 16px 34px -14px rgb(var(--nb-shadow) / .40),
        0 2px 6px -2px rgb(var(--nb-shadow) / .12);
}

html.dark .nb-bar {
    border-color: rgb(var(--nb-bar-edge) / .09);
    box-shadow: 0 16px 36px -14px rgb(var(--nb-shadow) / .85);
}

/* ------------------------------------------------------- TOMBOL / IKON --- */

.nb-btn {
    position: relative;
    display: grid;
    place-items: center;
    height: 100%;
    min-width: 0;
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
    color: rgb(var(--nb-icon));
    -webkit-tap-highlight-color: transparent;
    transition: color .2s ease;
}

.nb-btn svg {
    width: 23px; height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: opacity .18s ease, transform .3s cubic-bezier(.34, 1.4, .5, 1);
}

.nb-btn:active svg { transform: scale(.86); }

/* Ikon menu yang sedang aktif disembunyikan — yang terlihat adalah salinannya
   di dalam gelembung terangkat. Inilah yang membuat gelembung terasa benar-benar
   mengangkat ikon itu keluar dari bilah, bukan sekadar lingkaran yang menimpa. */
.nb-btn.is-active svg { opacity: 0; transform: scale(.7); }

.nb-btn:focus-visible {
    outline: 2px solid rgb(var(--c-primary-500));
    outline-offset: -6px;
    border-radius: 24px;
}

/* Label mati secara bawaan, mengikuti referensi. Nyalakan dengan menambahkan
   class "nb-label" pada <body> bila wali asrama merasa perlu teks bantu. */
.nb-btn b {
    display: none;
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1;
    margin-top: 5px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.nb-label .nb-btn { grid-auto-flow: row; align-content: center; }
body.nb-label .nb-btn b { display: block; }
body.nb-label .nb-btn.is-active b { opacity: 0; }

/* Lencana angka, mis. untuk Notification Center nanti. */
.nb-badge {
    position: absolute;
    top: 12px;
    left: calc(50% + 8px);
    min-width: 16px; height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #DC2626;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px rgb(var(--nb-bar));
}

/* --------------------------------------------------- GELEMBUNG AKTIF ----- */

.nb-bubble {
    position: absolute;
    top: -15px;
    left: 0;
    width: 48px; height: 48px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%);
    background: linear-gradient(152deg, rgb(var(--nb-bubble-a)), rgb(var(--nb-bubble-b)));
    color: rgb(var(--nb-bubble-ink));
    box-shadow:
        0 10px 20px -8px rgb(var(--c-primary-600) / .75),
        inset 0 1px 0 rgb(255 255 255 / .28);
    transition:
        left .52s cubic-bezier(.34, 1.30, .40, 1),
        opacity .22s ease;
}

.nb-bubble.is-on { opacity: 1; }

.nb-bubble svg {
    width: 21px; height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Loncatan: gelembung naik lebih tinggi di tengah perjalanan, lalu mendarat
   dengan sedikit pegas. Dipisahkan dari transisi `left` supaya kedua gerakan
   berjalan bersamaan dan membentuk busur, bukan geser datar. */
.nb-bubble.is-hop { animation: nbHop .52s cubic-bezier(.34, 1.3, .4, 1); }

@keyframes nbHop {
      0% { transform: translateX(-50%) translateY(0)     scale(1); }
     30% { transform: translateX(-50%) translateY(-11px) scale(1.07); }
     62% { transform: translateX(-50%) translateY(3px)   scale(.96); }
    100% { transform: translateX(-50%) translateY(0)     scale(1); }
}

/* Muncul pertama kali (baru masuk / ganti peran): membesar di tempat. */
.nb-bubble.is-pop { animation: nbPop .46s cubic-bezier(.34, 1.5, .45, 1); }

@keyframes nbPop {
      0% { transform: translateX(-50%) scale(.3);  opacity: 0; }
     60% { transform: translateX(-50%) scale(1.10); opacity: 1; }
    100% { transform: translateX(-50%) scale(1);   opacity: 1; }
}

/* ------------------------------------------------------ TOMBOL TAMBAH ---- */

.nb-plus-slot { position: relative; display: grid; place-items: center; height: 100%; }

.nb-plus {
    position: absolute;
    top: -21px;
    width: 56px; height: 56px;
    border-radius: 20px;                     /* squircle — sengaja beda bentuk dari gelembung */
    border: 0;
    padding: 0;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
    background: linear-gradient(150deg, rgb(var(--c-primary-500)), rgb(var(--c-primary-800)));
    box-shadow:
        0 0 0 1.5px rgb(var(--nb-plus-ring) / .80),
        0 0 0 5px rgb(var(--nb-bar) / .97),
        0 14px 26px -10px rgb(var(--c-primary-700) / .70),
        inset 0 1px 0 rgb(255 255 255 / .30);
    transition:
        transform .44s cubic-bezier(.34, 1.4, .45, 1),
        border-radius .44s cubic-bezier(.34, 1.4, .45, 1);
}

.nb-plus svg {
    width: 24px; height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.nb-plus:active { transform: scale(.92); }

.nb-plus:focus-visible {
    outline: 2px solid rgb(var(--nb-plus-ring));
    outline-offset: 4px;
}

/* Terbuka: berputar 135° sehingga + menjadi ×, sudut melunak jadi lingkaran. */
#nb-root.is-open .nb-plus {
    transform: rotate(135deg);
    border-radius: 28px;
}

/* Gelombang saat ditekan. */
.nb-wave {
    position: absolute;
    top: -21px;
    width: 56px; height: 56px;
    border-radius: 999px;
    border: 2px solid rgb(var(--nb-plus-ring));
    opacity: 0;
    pointer-events: none;
}
.nb-wave.go { animation: nbWave .6s cubic-bezier(.22, .8, .3, 1) forwards; }

@keyframes nbWave {
      0% { opacity: .7; transform: scale(.8); border-width: 2.5px; }
    100% { opacity: 0;  transform: scale(2.3); border-width: .5px; }
}

/* ------------------------------------------------------- AKSI RADIAL ----- */

.nb-scrim {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgb(2 6 14 / .48);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s;
}
.nb-scrim.is-open { opacity: 1; visibility: visible; }

.nb-actions {
    position: absolute;
    left: 50%;
    bottom: 50px;
    width: 1px; height: 1px;
    pointer-events: none;
}

.nb-act {
    position: absolute;
    left: 0; bottom: 0;
    width: 78px;
    margin-left: -39px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    opacity: 0;
    transform: translate(0, 0) scale(.4);
    pointer-events: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform .46s cubic-bezier(.34, 1.4, .4, 1), opacity .3s ease;
}

#nb-root.is-open .nb-act {
    opacity: 1;
    transform: translate(var(--dx), var(--dy)) scale(1);
    pointer-events: auto;
}

#nb-root.is-open .nb-act:nth-child(1) { transition-delay: .03s; }
#nb-root.is-open .nb-act:nth-child(2) { transition-delay: .07s; }
#nb-root.is-open .nb-act:nth-child(3) { transition-delay: .11s; }
#nb-root.is-open .nb-act:nth-child(4) { transition-delay: .15s; }

.nb-act-icon {
    width: 50px; height: 50px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: rgb(var(--c-primary-700));
    background: rgb(var(--nb-bar));
    border: 1px solid rgb(var(--nb-plus-ring) / .38);
    box-shadow: 0 10px 20px -10px rgb(var(--nb-shadow) / .6);
    transition: transform .2s ease;
}
html.dark .nb-act-icon { color: rgb(var(--c-primary-200)); }

.nb-act-icon svg {
    width: 21px; height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nb-act:active .nb-act-icon { transform: scale(.9); }

.nb-act-label {
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
    color: #fff;
    text-shadow: 0 1px 6px rgb(0 0 0 / .65);
}

/* ------------------------------------------------- PENYESUAIAN LAYAR ----- */

body.nb-active nav[aria-label="Navigasi Bawah Mobile"] { display: none !important; }
body.nb-active #fab-absen { display: none !important; }

@media (max-width: 767px) {
    body.nb-active main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

@media (min-width: 768px) {
    #nb-root, .nb-scrim { display: none !important; }
}

@media (max-width: 340px) {
    .nb-bar { height: 60px; border-radius: 30px; }
    .nb-btn svg { width: 21px; height: 21px; }
    .nb-bubble { width: 44px; height: 44px; top: -13px; }
    .nb-plus, .nb-wave { width: 52px; height: 52px; top: -19px; }
}

@media print {
    #nb-root, .nb-scrim { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .nb-bubble, .nb-plus, .nb-act, .nb-btn svg, .nb-act-icon {
        transition-duration: .01ms !important;
        transition-delay: 0s !important;
    }
    .nb-bubble.is-hop, .nb-bubble.is-pop, .nb-wave.go { animation: none !important; }
    .nb-bubble.is-on { opacity: 1; }
}
