/* ========================================================
   RESPONSIVE CSS: MOBILE FIRST BREAKPOINTS
   320px, 360px, 375px, 390px, 414px, 768px, 1024px
   ======================================================== */

/* Fixed Bottom Navigation (Mobile < 768px) */
@media (max-width: 768px) {
  .desktop-sidebar {
    display: none !important;
  }

  .app-main {
    padding-bottom: 80px !important;
  }

  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--surface);
    border-top: 1px solid var(--surface-border);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    text-align: center;
    z-index: 50;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
  }

  .mobile-bottom-nav a,
  .mobile-bottom-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    padding: 6px 0;
  }

  .mobile-bottom-nav a .nav-icon,
  .mobile-bottom-nav button .nav-icon {
    font-size: 18px;
    margin-bottom: 2px;
  }

  .mobile-bottom-nav a.active {
    color: var(--primary);
    font-weight: 800;
  }

  /* Bottom Drawer */
  .mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 99;
  }

  .mobile-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
  }

  .mobile-drawer-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 20px 16px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
  }

  .drawer-handle {
    width: 48px;
    height: 5px;
    background: var(--surface-border);
    border-radius: 999px;
    margin: 0 auto 16px auto;
  }

  .drawer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 16px 0;
  }

  .drawer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
  }
}

/* Desktop Navigation (>= 769px) */
@media (min-width: 769px) {
  .mobile-bottom-nav {
    display: none !important;
  }

  .mobile-drawer-overlay {
    display: none !important;
  }
}

/* Drawer: item aktif, tombol footer, animasi */
@media (max-width: 768px) {
  .drawer-header { display: flex; justify-content: space-between; align-items: center; }
  .drawer-header h4 { font-size: 14px; font-weight: 800; }
  .drawer-close { border: none; background: rgba(0,0,0,.06); color: var(--text); width: 32px; height: 32px; border-radius: 50%; font-size: 14px; cursor: pointer; }
  .drawer-item .d-icon { font-size: 20px; }
  .drawer-footer-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .drawer-row-link { display: block; width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--surface-border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer; }
  .drawer-row-link.text-danger { color: var(--danger); }
  .mobile-drawer-content { animation: sheetUp .22s ease-out; }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .mobile-bottom-nav .more-nav-btn.active, .mobile-bottom-nav button:focus-visible { color: var(--primary); }
}

/* ========================================================
   v1.2 — Bottom navigation modern (mobile)
   ======================================================== */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    height: auto;
    min-height: 62px;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.08);
  }
  .mobile-bottom-nav a,
  .mobile-bottom-nav button {
    position: relative;
    gap: 2px;
    min-height: 48px;
    padding: 4px 0;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-bottom-nav .nav-icon {
    display: flex; align-items: center; justify-content: center;
    width: 52px; height: 28px; margin: 0 0 2px 0; border-radius: 999px;
    transition: background .18s ease, color .18s ease;
  }
  .mobile-bottom-nav .nav-svg { width: 22px; height: 22px; }
  .mobile-bottom-nav .nav-label { font-size: 10.5px; line-height: 1.1; }
  .mobile-bottom-nav a.active .nav-icon,
  .mobile-bottom-nav button.active .nav-icon { background: rgba(37, 99, 235, 0.14); color: var(--primary); }
  .mobile-bottom-nav button.active { color: var(--primary); font-weight: 800; }
  .mobile-bottom-nav a:active .nav-icon,
  .mobile-bottom-nav button:active .nav-icon { background: rgba(37, 99, 235, 0.2); }
  .mobile-bottom-nav a.is-danger { color: var(--danger); }

  /* Header lebih ringkas di HP */
  .app-header { height: 56px; padding: 0 12px; }
  .brand-logo { width: 34px; height: 34px; font-size: 16px; }
  .timer-pill { top: 62px; }
}
@media (max-width: 360px) {
  .mobile-bottom-nav .nav-icon { width: 44px; }
  .mobile-bottom-nav .nav-label { font-size: 10px; }
}
/* Tablet: sidebar tetap tersembunyi, konten dibatasi agar nyaman dibaca */
@media (min-width: 481px) and (max-width: 768px) {
  .app-main { max-width: 680px; margin: 0 auto; width: 100%; }
}
/* Landscape HP: nav lebih pendek */
@media (max-width: 900px) and (max-height: 430px) and (orientation: landscape) {
  .mobile-bottom-nav { min-height: 48px; padding-top: 2px; padding-bottom: calc(2px + env(safe-area-inset-bottom, 0px)); }
  .mobile-bottom-nav .nav-label { display: none; }
  .mobile-bottom-nav .nav-icon { height: 32px; margin: 0; }
}

/* v2: ikon aktif bergradasi (menimpa aturan v1.2) */
@media (max-width: 768px) {
  .mobile-bottom-nav a.active .nav-icon,
  .mobile-bottom-nav button.active .nav-icon { background: var(--grad); color: #fff; box-shadow: 0 6px 14px -4px rgba(79,70,229,.6); }
  .mobile-bottom-nav a.active, .mobile-bottom-nav button.active { color: var(--primary); }
}
