/* ═══════════════════════════════════════════════════
   mobile.css — Responsive & mobile-first overrides
   Masri.Cloud Dashboard
   ═══════════════════════════════════════════════════ */

@media (max-width: 700px) {

  /* ── Reset sidebar width on mobile ─────────────── */
  :root {
    --sidebar: 0px;
  }

  /* ── Sidebar: off-canvas drawer ─────────────────── */
  aside {
    position: fixed;
    top: 50px;
    left: 0;
    bottom: 0;
    width: 220px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    padding-top: 10px;
    padding-bottom: 10px;
  }

  aside.open {
    transform: translateX(0);
  }

  /* ── Show hamburger ──────────────────────────────── */
  .ham {
    display: flex;
    width: 36px;
    height: 36px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: hamHintPulse 2.8s ease-in-out infinite;
  }

  .ham::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 12px;
    border: 1px solid rgba(74,222,128,0.18);
    opacity: 0;
    transform: scale(0.95);
    animation: hamHintRing 2.8s ease-in-out infinite;
    pointer-events: none;
  }

  .aside-open .nav-section,
  aside.open .nav-section {
    animation: sidebarSectionIn 0.32s ease both;
  }

  aside.open .nav-section:nth-of-type(1) { animation-delay: 0.02s; }
  aside.open .nav-section:nth-of-type(2) { animation-delay: 0.06s; }
  aside.open .nav-section:nth-of-type(3) { animation-delay: 0.10s; }
  aside.open .nav-section:nth-of-type(4) { animation-delay: 0.14s; }
  aside.open .nav-section:nth-of-type(5) { animation-delay: 0.18s; }

  /* ── Adjust main padding ─────────────────────────── */
  main {
    padding: 16px;
    padding-bottom: 50px;
    overflow-y: auto;
    height: 100vh;
  }

  /* ── Overlay backdrop when sidebar open ─────────── */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(0, 0, 0, 0.5);
  }

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

  /* ── Stack grids on small screens ────────────────── */
  .grid2,
  .grid3 {
    grid-template-columns: 1fr;
  }

  .nav-section {
    padding-bottom: 4px;
  }

  .nav-group-label {
    padding: 8px 14px 6px;
  }

  .nav-item {
    padding: 8px 14px;
    font-size: 13px;
  }

  .nav-divider {
    margin: 6px 14px;
  }

  .sidebar-footer {
    padding: 10px 10px 0;
  }

  .sidebar-footer-card {
    padding: 8px 2px 2px;
  }

  /* ── Billing plan cards stack ────────────────────── */
  .plan-card {
    margin-bottom: 12px;
  }

  /* ── Topup grid: 2 columns on mobile ─────────────── */
  .topup-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ── Modals full-width on small screens ──────────── */
  .modal {
    width: 95%;
    padding: 20px 16px;
  }
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 6px);
  transition: transform 0.25s ease, opacity 0.2s ease;
}

/* 5-item bottom nav */
#bottom-nav .nav-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  cursor: pointer;
  font-size: 10px;
  color: var(--text-2);
  border-radius: 0;
  background: none;
  transition: color var(--t-fast);
  overflow: hidden;
  white-space: nowrap;
}

#bottom-nav .nav-item .bn-icon {
  font-size: 19px;
  line-height: 1;
  transition: transform var(--t-fast);
}

#bottom-nav .nav-item .bn-label {
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  color: inherit;
}

#bottom-nav .nav-item.active {
  color: var(--accent);
  background: none;
  font-weight: 600;
}

#bottom-nav .nav-item.active .bn-icon {
  transform: scale(1.15);
}

#bottom-nav .nav-item:active {
  transform: scale(0.92);
  opacity: 0.7;
}

#bottom-nav .nav-item::before { display: none; }

#bottom-nav.hide {
  transform: translateY(100%);
  opacity: 0;
}
  /* ── Toast: bottom center on mobile ─────────────── */
  #toast {
    bottom: 60px;
    right: 16px;
    left: 16px;
    max-width: none;
  }

  /* ── Affiliate stats stack ───────────────────────── */
  #aff-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ── Ref box wraps on mobile ─────────────────────── */
  .ref-box {
    flex-direction: column;
    align-items: flex-start;
  }

  .ref-box .btn-sm {
    align-self: flex-end;
  }

  /* ── Full-bleed iframe pages: shrink for bottom nav ── */
  #page-academy,
  #page-kepsekai,
  #page-mentor,
  #page-content,
  #page-ai,
  #page-game,
  #page-quiz,
  #page-creator,
  #page-library,
  #page-mitra,
  #page-mitraadmin {
    height: calc(100dvh - var(--header-h) - 55px) !important;
  }

  /* ── Smaller section headers ─────────────────────── */
  .sec-title {
    font-size: 15px;
  }

  .sec-head {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* ── Settings card full width ────────────────────── */
  .card[style*="max-width:480px"] {
    max-width: 100% !important;
  }

  /* ── Billing plan cards full width ──────────────── */
  .grid2[style*="max-width:620px"] {
    max-width: 100% !important;
  }
}

@media (max-width: 700px) and (prefers-reduced-motion: reduce) {
  .ham,
  .ham::after,
  aside.open .nav-section {
    animation: none !important;
  }
  aside {
    transition: transform 0.01s linear;
  }
}

@keyframes hamHintPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}

@keyframes hamHintRing {
  0%   { opacity: 0; transform: scale(0.94); }
  35%  { opacity: 1; }
  70%  { opacity: 0; transform: scale(1.12); }
  100% { opacity: 0; transform: scale(1.12); }
}

@keyframes sidebarSectionIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Tablet adjustments (701–1024px) ─────────────── */
@media (min-width: 701px) and (max-width: 1024px) {

  .grid2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .topup-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── PWA / standalone mode ────────────────────────── */
@media (display-mode: standalone) {

  header {
    padding-top: env(safe-area-inset-top, 12px);
  }

  #status-bar {
    padding-bottom: env(safe-area-inset-bottom, 6px);
  }
}
