/* ============================================================
   Plotrixx — mobile-nav.css  (v3 — Slide-Up Command Centre)
   Mobile bottom tab bar + mobile header + full-screen drawer.
   Import AFTER navbar.css on every page.
   ============================================================ */

/* ── Hidden on desktop ──────────────────────────────────────── */
.mobile-bottom-nav,
.mobile-header-icons,
.mob-drawer-overlay,
.mob-drawer {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE  ≤ 900px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {

  /* ── Hide desktop nav links & right cluster ─────────────── */
  .nav-links,
  .nav-right {
    display: none !important;
  }

  /* ── Slim navbar ─────────────────────────────────────────── */
  .navbar {
    height: 58px;
    padding: 0 16px;
    justify-content: space-between;
  }
  .nav-logo img  { height: 38px; }
  .nav-logo-text { font-size: 1.25rem; }

  /* ── Mobile header icons (right side of top bar) ─────────── */
  .mobile-header-icons {
    display: flex !important;
    align-items: center;
    gap: 8px;
  }

  /* ── Mobile icon button base ─────────────────────────────── */
  .mob-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    text-decoration: none;
    color: var(--ink2);
    background: var(--card, rgba(255,255,255,0.06));
    border: 1px solid var(--border2, rgba(255,255,255,0.1));
    cursor: pointer;
    transition: background 0.18s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    position: relative;
  }
  .mob-icon-btn:active { transform: scale(0.92); }
  html.light-theme .mob-icon-btn {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.1);
  }

  /* Avatar button variant */
  .mob-avatar-btn {
    padding: 0;
    overflow: visible;
    background: transparent !important;
    border: none !important;
  }

  /* ── Push page content above the bottom nav ──────────────── */
  body {
    padding-bottom: 80px;
  }

  /* ═══════════════════════════════════════════════════════════
     BOTTOM TAB BAR
     ═══════════════════════════════════════════════════════════ */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1000;
    height: 64px;
    background: var(--nav-bg, rgba(10,15,12,0.97));
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--border, rgba(255,255,255,0.08));
    align-items: stretch;
    justify-content: space-around;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mob-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    text-decoration: none;
    color: var(--ink3, rgba(255,255,255,0.4));
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 6px 4px;
    border-radius: 12px;
    transition: color 0.2s ease, background 0.2s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-tab:active { background: rgba(255,255,255,0.05); }
  .mob-tab.active { color: var(--gold, #d4a030); }

  .mob-tab.active::before {
    content: '';
    position: absolute;
    top: 6px;
    width: 20px;
    height: 3px;
    border-radius: 2px;
    background: var(--gold, #d4a030);
    opacity: 0.85;
  }
  .mob-tab:not(.active)::before { display: none; }

  .mob-tab-icon {
    font-size: 22px;
    line-height: 1;
    transition: transform 0.2s ease;
  }
  .mob-tab.active .mob-tab-icon { transform: translateY(-1px); }
  .mob-tab-label { font-family: var(--sans, sans-serif); font-size: 10px; line-height: 1; }

  /* ── Light theme overrides ───────────────────────────────── */
  html.light-theme .mobile-bottom-nav {
    background: rgba(250,248,244,0.97);
    border-top-color: rgba(0,0,0,0.09);
  }
  html.light-theme .mob-tab         { color: rgba(0,0,0,0.35); }
  html.light-theme .mob-tab.active  { color: var(--gold, #b8892a); }
  html.light-theme .mob-tab.active::before { background: var(--gold, #b8892a); }

  /* ═══════════════════════════════════════════════════════════
     SLIDE-UP COMMAND CENTRE DRAWER
     ═══════════════════════════════════════════════════════════ */

  /* Dim overlay */
  .mob-drawer-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .mob-drawer-overlay.mob-drawer-open {
    opacity: 1;
    pointer-events: all;
  }

  /* Drawer panel */
  .mob-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    z-index: 1100;
    max-height: 92dvh;
    background: var(--surface, #12100a);
    border-radius: 24px 24px 0 0;
    border-top: 1px solid var(--border, rgba(255,255,255,0.1));
    box-shadow: 0 -24px 64px rgba(0,0,0,0.5);
    transform: translateY(102%);
    transition: transform 0.38s cubic-bezier(0.34,1.12,0.64,1);
    padding-bottom: env(safe-area-inset-bottom);
    overflow: hidden;
  }
  .mob-drawer.mob-drawer-open {
    transform: translateY(0);
  }

  html.light-theme .mob-drawer {
    background: var(--surface, #faf8f4);
    border-top-color: rgba(0,0,0,0.08);
    box-shadow: 0 -24px 64px rgba(0,0,0,0.15);
  }

  /* Drag handle */
  .mob-drawer-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border2, rgba(255,255,255,0.2));
    margin: 12px auto 0;
    flex-shrink: 0;
  }
  html.light-theme .mob-drawer-handle { background: rgba(0,0,0,0.15); }

  /* ── Drawer Header: user identity ────────────────────────── */
  .mob-drawer-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px 16px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
    flex-shrink: 0;
    position: relative;
  }

  .mob-drawer-avatar-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
  }
  .mob-drawer-avatar-ring {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    z-index: 0;
  }
  .mob-drawer-avatar-gap {
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    background: var(--surface);
    z-index: 1;
  }
  .mob-drawer-avatar-circle {
    position: relative;
    z-index: 2;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg,var(--gold,#d4a843),#b8892a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #1a0e00;
    overflow: hidden;
  }
  .mob-drawer-avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
  }
  .mob-drawer-tier-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 3;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
  }

  .mob-drawer-user-info { flex: 1; min-width: 0; }
  .mob-drawer-username {
    font-family: var(--serif, Georgia, serif);
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mob-drawer-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace, sans-serif;
    margin-top: 2px;
  }
  .mob-drawer-coins {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gold, #d4a843);
    font-family: var(--sans, sans-serif);
  }

  .mob-drawer-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--card, rgba(255,255,255,0.06));
    border: 1px solid var(--border2, rgba(255,255,255,0.1));
    color: var(--ink3);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-drawer-close:active { transform: scale(0.9); }
  html.light-theme .mob-drawer-close {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.1);
  }

  /* ── Drawer scrollable body ──────────────────────────────── */
  .mob-drawer-body {
    overflow-y: auto;
    flex: 1;
    padding: 12px 14px;
    scrollbar-width: none;
  }
  .mob-drawer-body::-webkit-scrollbar { display: none; }

  /* ── Section label inside drawer ─────────────────────────── */
  .mob-drawer-section-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink3, #a0916a);
    font-family: var(--sans, sans-serif);
    padding: 10px 10px 6px;
  }

  /* ── Nav link rows ───────────────────────────────────────── */
  .mob-drawer-nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 12px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--ink2);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--sans, sans-serif);
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 2px;
  }
  .mob-drawer-nav-link:active,
  .mob-drawer-nav-link:hover {
    background: var(--hover, rgba(212,168,67,0.08));
    color: var(--ink);
  }
  .mob-drawer-nav-link.active-page {
    background: var(--gold-subtle, rgba(212,168,67,0.12));
    color: var(--gold, #d4a843);
    font-weight: 600;
  }
  .mob-drawer-link-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    background: var(--card, rgba(255,255,255,0.05));
    flex-shrink: 0;
    transition: background 0.15s;
  }
  html.light-theme .mob-drawer-link-icon { background: rgba(0,0,0,0.04); }
  .mob-drawer-nav-link.active-page .mob-drawer-link-icon {
    background: var(--gold-subtle, rgba(212,168,67,0.15));
  }
  .mob-drawer-link-text { flex: 1; }
  .mob-drawer-link-arrow {
    font-size: 12px;
    color: var(--ink3);
    opacity: 0.5;
  }

  /* ── Divider ─────────────────────────────────────────────── */
  .mob-drawer-divider {
    height: 1px;
    background: var(--border, rgba(255,255,255,0.07));
    margin: 8px 10px;
    border: none;
  }
  html.light-theme .mob-drawer-divider { background: rgba(0,0,0,0.07); }

  /* ── Theme toggle row ────────────────────────────────────── */
  .mob-drawer-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 12px;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 2px;
  }
  .mob-drawer-theme-row:active { background: var(--hover, rgba(255,255,255,0.05)); }

  .mob-drawer-theme-left {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink2);
    font-family: var(--sans, sans-serif);
  }
  .mob-drawer-theme-track {
    width: 42px;
    height: 24px;
    border-radius: 12px;
    background: var(--border2, rgba(255,255,255,0.15));
    position: relative;
    transition: background 0.3s;
    flex-shrink: 0;
  }
  html.light-theme .mob-drawer-theme-track { background: var(--gold, #d4a843); }
  .mob-drawer-theme-track::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ink3, rgba(255,255,255,0.7));
    top: 3px;
    left: 3px;
    transition: transform 0.3s, background 0.3s;
  }
  html.light-theme .mob-drawer-theme-track::after {
    transform: translateX(18px);
    background: #fff;
  }

  /* ── Logout button ───────────────────────────────────────── */
  .mob-drawer-logout {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 13px 12px;
    border-radius: 14px;
    border: none;
    background: none;
    color: #e05555;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--sans, sans-serif);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
    margin-top: 2px;
  }
  .mob-drawer-logout:active {
    background: rgba(224,85,85,0.1);
  }
  .mob-drawer-logout-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(224,85,85,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
  }

  /* ── Drawer footer padding (safe area) ───────────────────── */
  .mob-drawer-footer {
    height: 8px;
    flex-shrink: 0;
  }

} /* end @media (max-width: 900px) */