/*
 * mob-nav.css
 *
 * Mobile topbar + bottom nav styles, injected into every page
 * (including game pages) via buildHeadInjectionHTML() in
 * config/site-settings.js. This runs alongside each page's own CSS,
 * so all classes here are self-contained using only CSS variables
 * already defined by the site-settings-vars <style> block.
 */

/* ── Hamburger button (hidden on desktop) ─────────────────── */
.mob-menu-btn {
  display: none;
  background: none;
  border: none;
  color: #b05030;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  transition: color .18s ease;
}
.mob-menu-btn:hover { color: #fff; }

/* ── Sidebar drawer overlay ───────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ── Mobile bottom nav ────────────────────────────────────── */
.mob-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--r7);
  border-top: 1px solid #2a0a00;
  z-index: 150;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mbn-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: #7a3820;
  cursor: pointer;
  font-family: var(--font-body, 'Barlow', sans-serif);
  padding: 6px 0;
  transition: color .18s ease;
  position: relative;
}
.mbn-btn:hover, .mbn-btn.active { color: var(--r); }
.mbn-icon-wrap { position: relative; font-size: 22px; line-height: 1; }
.mbn-label { font-size: 9px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }

.mbn-centre { flex: 1.2; }
.mbn-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--r4);
  border: 2px solid var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; font-weight: 700;
  text-transform: uppercase;
  overflow: hidden;
  transition: border-color .18s ease, background .18s ease;
}
.mbn-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mbn-btn.active .mbn-avatar { background: var(--r); border-color: #fff; }

.mbn-badge {
  position: absolute;
  top: -4px; right: -6px;
  min-width: 16px; height: 16px;
  background: var(--r);
  color: #fff;
  font-size: 9px; font-weight: 700;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 1.5px solid var(--r7);
}
.mbn-coin-badge { top: -2px; right: -4px; background: #c8a000; color: #3a2000; }

.mbn-popover {
  position: fixed;
  bottom: 68px; right: 16px;
  background: var(--r5);
  border: 1px solid #3a1000;
  border-radius: 10px;
  padding: 6px;
  min-width: 160px;
  z-index: 160;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  opacity: 0;
  transform: translateY(8px) scale(.97);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.mbn-popover.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.mbn-pop-arrow {
  position: absolute;
  bottom: -6px; right: 18px;
  width: 10px; height: 10px;
  background: var(--r5);
  border-right: 1px solid #3a1000;
  border-bottom: 1px solid #3a1000;
  transform: rotate(45deg);
}
.mbn-pop-item {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  background: none; border: none;
  color: #ff8060;
  font-family: var(--font-body, 'Barlow', sans-serif);
  font-size: 13px; font-weight: 600;
  padding: 10px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
  text-align: left;
}
.mbn-pop-item:hover { background: var(--r3); color: #fff; }

.mbn-backdrop { display: none; position: fixed; inset: 0; z-index: 155; }
.mbn-backdrop.open { display: block; }

/* ════════════════════════════════════════════════
   BREAKPOINTS
════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Show hamburger, show bottom nav */
  .mob-menu-btn { display: flex; align-items: center; }
  .mob-bottom-nav { display: flex; }

  /* Topbar: compact */
  .topbar { gap: 8px; padding: 8px 12px; flex-wrap: nowrap; }
  .logo-sub { display: none; }
  .logo-name { font-size: 17px; letter-spacing: 1px; }

  /* Hide desktop auth/user on mobile — bottom nav handles it */
  .topbar-btns { display: none !important; }
  .user-chip   { display: none !important; }
  .btn-logout  { display: none !important; }

  /* Coin chip stays, compact */
  .coin-chip { padding: 4px 8px 4px 5px; font-size: 11px; }
  .coin-label { display: none; }

  /* Bottom padding so content clears the nav bar */
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }

  /* Toast floats above bottom nav */
  .toast { bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }

  /* Sidebar → off-canvas drawer */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    width: 260px !important;
    transform: translateX(-100%);
    transition: transform .32s cubic-bezier(.4,0,.2,1);
    z-index: 200 !important;
    overflow-y: auto;
    padding-top: 56px;
    min-height: 100vh !important;
    scrollbar-width: thin;
    scrollbar-color: var(--r3) transparent;
  }
  .sidebar::-webkit-scrollbar { width: 4px; }
  .sidebar::-webkit-scrollbar-track { background: transparent; }
  .sidebar::-webkit-scrollbar-thumb { background: var(--r3); border-radius: 4px; }
  .sidebar::-webkit-scrollbar-thumb:hover { background: var(--r); }
  .sidebar.mob-open { transform: translateX(0); }
  .sidebar .slabel,
  .sidebar .sitem-label,
  .sidebar .stag { opacity: 1 !important; }

  /* Disable hover-expand — drawer only */
  .sidebar:hover { width: 260px !important; }
  .sidebar.mob-open { width: 260px !important; }

  .main { width: 100%; }
}

@media (max-width: 600px) {
  .topbar { padding: 8px 10px; gap: 6px; }
  .logo-name { font-size: 15px; }
  .toast {
    left: 12px; right: 12px;
    transform: translateX(0) translateY(80px);
    white-space: normal; text-align: center;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }
  .toast.show { transform: translateX(0) translateY(0); }
}

@media (max-width: 480px) {
  .logo-name { font-size: 14px; }
  .search-wrap { min-width: 0; }
  .user-info { display: none; }
}
