/* ════════════════════════════════════════════════════════════════════════
   NeuroArsho — mobile bottom tab bar (5 items)
   ────────────────────────────────────────────────────────────────────────
   Phone (≤900px, the site's existing mobile breakpoint): app-style bottom
   navigation with safe-area handling for iPhone's home indicator.
   Desktop (>900px): nothing is rendered — the site stays a normal website.

   Uses only the brand tokens so it matches the rest of the design system:
     --nm-bg #050B18 · text #E9F3FF · muted #8CA3C8 · danger #FF5A76
     gradient #19D3F3 → #3B6BFF (135deg) · Vazirmatn/Inter
   ════════════════════════════════════════════════════════════════════════ */

:root {
  --nm-tabbar-height: 56px;
}

.nm-tabbar,
.nm-tabbar-spacer { display: none; }

@media (max-width: 900px) {
  /* ── The bar itself ─────────────────────────────────────────────────── */
  .nm-tabbar {
    display: flex;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 50; /* above page content, below the slide-in menus (55/60) */
    direction: rtl;
    padding-inline: 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(var(--nm-tabbar-height) + env(safe-area-inset-bottom, 0px));
    background: rgba(5, 11, 24, 0.92);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
  }

  /* ── A tab ──────────────────────────────────────────────────────────── */
  .nm-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px 5px;
    text-decoration: none;
    color: #8CA3C8; /* --nm-muted */
    font-family: 'Vazirmatn', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 0.7rem;   /* matches the 0.66–0.84rem label range used across the site */
    font-weight: 600;
    line-height: 1;
    transition: color 0.18s ease;
  }

  .nm-tab__ico {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 30px;
    border-radius: 999px;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  }

  .nm-tab__ico svg {
    display: block;
    width: 21px;
    height: 21px;
  }

  .nm-tab__lbl {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nm-tab:active .nm-tab__ico { transform: scale(0.94); }

  /* ── Active state: gradient capsule, like a native tab bar ──────────── */
  .nm-tab.is-active { color: #E9F3FF; /* --nm-text */ }

  .nm-tab.is-active .nm-tab__ico {
    background: linear-gradient(135deg, #19D3F3 0%, #3B6BFF 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(0, 180, 255, 0.35);
  }

  /* ── Unread count on the notifications tab ──────────────────────────── */
  .nm-tab__ico .np-notif-badge {
    position: absolute;
    top: -3px;
    inset-inline-start: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border: 1.5px solid #050B18;
    border-radius: 999px;
    background: #FF5A76;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    line-height: 1;
    font-style: normal;
  }

  /* ── Bottom padding so nothing hides behind the fixed bar ───────────── */
  body.has-tabbar { padding-bottom: calc(var(--nm-tabbar-height) + env(safe-area-inset-bottom, 0px)); }

  /* The panel doesn't scroll the body — it scrolls .np-content. */
  body.has-tabbar.np-panel { padding-bottom: 0; }
  body.has-tabbar.np-panel .np-content {
    padding-bottom: calc(var(--nm-tabbar-height) + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Installed app (standalone): no browser chrome below the bar ───────── */
@media (max-width: 900px) and (display-mode: standalone) {
  .nm-tabbar {
    background: rgba(5, 11, 24, 0.97);
    box-shadow: none;
  }
}

@media print {
  .nm-tabbar { display: none !important; }
}
