/* ══════════════════════════════════════════════════════════════
   mobile-tabbar.css — Dashboard HP ala aplikasi (2026-11-15)
   Gaya disamakan dengan prompt.masri.cloud: bottom tab bar 5 tombol,
   tombol Menu bulat besar di tengah, menu sebagai panel dari bawah.
   - #dash-tabbar   : tab bar (hanya ≤768px)
   - aside#sidebar  : di HP menjadi bottom sheet berisi grid ikon
                      (item, badge & status aktif tetap dari navigation.js)
   - --dtab-h       : tinggi tab bar, dipakai prompt-bar.css untuk jarak
   Dimuat paling akhir, setelah mobile.css dan prompt-bar.css.
══════════════════════════════════════════════════════════════ */
:root { --dtab-h: 0px; }
.dash-tabbar, aside .sheet-head { display: none; }

@media (max-width: 768px) {
  :root { --dtab-h: calc(64px + env(safe-area-inset-bottom, 0px)); }

  /* hamburger digantikan tombol Menu di tengah */
  #ham-btn { display: none !important; }

  /* ── Tab bar ─────────────────────────────────────────── */
  .dash-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 2550;
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    height: var(--dtab-h); box-sizing: border-box;
    padding: 4px 6px env(safe-area-inset-bottom, 0px);
    background: rgba(11, 15, 40, 0.94);
    backdrop-filter: blur(18px) !important; -webkit-backdrop-filter: blur(18px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
  }
  .dash-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px;
    min-width: 0; height: 58px; padding: 4px 0 6px; border: 0; background: none; cursor: pointer;
    color: rgba(255, 255, 255, 0.55); font: 600 10.5px/1.1 inherit; letter-spacing: .02em;
    -webkit-tap-highlight-color: transparent;
  }
  .dash-tab i { font-size: 23px; line-height: 1; }
  .dash-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dash-tab.on { color: #4ade80; }
  .dash-tab:active { transform: scale(.94); }
  .dash-tab[data-tab-page="promptai"] i { color: #7DE3FF; }
  .dash-tab[data-tab-page="promptai"].on, .dash-tab[data-tab-page="promptai"].on i { color: #00D4FF; }

  .dash-tab-main { color: #e5e7eb; }
  .dash-tab-main .fab {
    width: 62px; height: 62px; margin-top: -32px; border-radius: 50%;
    display: grid; place-items: center; color: #04101C;
    background: conic-gradient(from 180deg, #00D4FF, #8B5CF6, #10B981, #F5A623, #00D4FF);
    box-shadow: 0 12px 28px -8px rgba(0, 212, 255, 0.6), 0 0 0 6px #0b0f28;
    transition: transform .22s ease;
  }
  .dash-tab-main .fab i { font-size: 27px; color: #04101C; }
  .dash-tab-main[aria-expanded="true"] .fab { transform: rotate(45deg); }
  .dash-tab-main:active { transform: none; }
  .dash-tab-main:active .fab { transform: scale(.94); }

  /* ── Sidebar → bottom sheet ──────────────────────────── */
  aside#sidebar {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain;
    padding: 0 14px calc(var(--dtab-h) + 18px);
    border-radius: 24px 24px 0 0; border-top: 1px solid rgba(255, 255, 255, 0.10);
    background: #0b0f28; box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.55);
    transform: translateY(105%); transition: transform .3s cubic-bezier(.2, .9, .3, 1);
    z-index: 2500;
  }
  aside#sidebar.open { transform: translateY(0); }
  aside .sheet-head {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 3; margin: 0 -14px 4px; padding: 10px 14px 8px;
    background: linear-gradient(#0b0f28 75%, rgba(11, 15, 40, 0));
  }
  .sheet-handle { width: 44px; height: 5px; border-radius: 9px; background: rgba(255, 255, 255, 0.22); }
  .sheet-title { align-self: flex-start; font-size: 17px; font-weight: 800; color: #fff; letter-spacing: -.2px; }

  aside#sidebar .nav-divider { display: none; }
  aside#sidebar .nav-section {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 0 6px;
  }
  aside#sidebar .nav-group-label { grid-column: 1 / -1; padding: 12px 2px 2px; color: rgba(255, 255, 255, 0.4); }
  aside#sidebar .nav-item {
    flex-direction: column; justify-content: center; gap: 6px;
    min-height: 80px; padding: 10px 4px;
    border: 1px solid rgba(255, 255, 255, 0.07); border-left-width: 1px; border-radius: 16px;
    background: rgba(255, 255, 255, 0.035);
    color: rgba(255, 255, 255, 0.82); font-size: 11px; line-height: 1.2;
    white-space: normal; text-align: center; overflow: visible;
    -webkit-tap-highlight-color: transparent;
  }
  aside#sidebar .nav-item:active { transform: scale(.97); }
  aside#sidebar .nav-item.active {
    border-color: rgba(74, 222, 128, 0.5); background: rgba(74, 222, 128, 0.10); color: #4ade80;
  }
  aside#sidebar .nav-item-main { flex-direction: column; gap: 7px; min-width: 0; max-width: 100%; }
  aside#sidebar .nav-item-main i { font-size: 23px; }
  aside#sidebar .nav-item-main span {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; white-space: normal; word-break: break-word;
  }
  aside#sidebar .nav-item[data-page="promptai"] { border-color: rgba(0, 212, 255, 0.4); background: rgba(0, 212, 255, 0.07); }
  aside#sidebar .nav-item[data-page="promptai"] i { color: #7DE3FF; }
  aside#sidebar .nav-badge {
    position: absolute; top: 5px; right: 5px; min-width: 0; height: auto;
    padding: 1px 5px; font-size: 8px; line-height: 1.4;
  }
  aside#sidebar .sidebar-footer { margin-top: 14px; }

  /* latar gelap menutupi prompt bar & widget melayang saat menu terbuka */
  .sidebar-overlay { z-index: 2400; }

  /* ruang bawah: ganti cadangan #bottom-nav lama (tidak ada markup) dengan tinggi tab bar */
  main { padding-bottom: calc(var(--dtab-h) + 16px); }
}
@media (max-width: 360px) {
  aside#sidebar .nav-section { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  aside#sidebar, .dash-tab-main .fab { transition: none; }
}
