/* Mobile Bottom Navigation — Frontend Styles v1.1.3 */
:root {
  --mbn-bg:         #ffffff;
  --mbn-text:       #9ca3af;
  --mbn-active:     #6366f1;
  --mbn-active-bg:  #eef2ff;
  --mbn-font-size:  11px;
  --mbn-icon-size:  22px;
  --mbn-height:     64px;
  --mbn-radius:     0px;
  --mbn-shadow:     0 -4px 24px rgba(0,0,0,.08), 0 -1px 0 rgba(0,0,0,.04);
  --mbn-border-top: 1px solid #e5e7eb;
}

/* ── Bar ──────────────────────────────────────────── */
/*
 * iOS safe-area fix:
 * Do NOT set a fixed `height` on #mbn-bar.
 * Instead, the bar has NO explicit height — it grows naturally
 * to wrap .mbn-bar-inner (which has height: var(--mbn-height))
 * PLUS padding-bottom equal to the safe-area inset.
 * This removes the phantom white gap below the buttons.
 *
 * z-index: 200000 keeps the bar visible above any open panel.
 */
#mbn-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200000;
  background: var(--mbn-bg);
  box-shadow: var(--mbn-shadow);
  border-top: var(--mbn-border-top);
  border-radius: var(--mbn-radius) var(--mbn-radius) 0 0;
  /* Safe area: fills empty space below icons on notched phones */
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* Prevent any accidental height override */
  box-sizing: content-box;
}

/* The actual clickable row — always exactly --mbn-height tall */
.mbn-bar-inner {
  display: flex;
  align-items: stretch;
  height: var(--mbn-height);
  max-width: 640px;
  margin: 0 auto;
}

/* ── Items ───────────────────────────────────────── */
.mbn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--mbn-text);
  font-size: var(--mbn-font-size);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 500;
  letter-spacing: 0.3px;
  position: relative;
  transition: color 0.22s ease;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  padding: 8px 4px 4px;
  /* reset <button> defaults */
  background: none;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.mbn-item:hover {
  color: var(--mbn-active);
}

.mbn-item.mbn-active {
  color: var(--mbn-active);
}

/* ── Icon wrap ───────────────────────────────────── */
.mbn-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--mbn-icon-size) + 16px);
  height: calc(var(--mbn-icon-size) + 10px);
  border-radius: 100px;
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1);
}

.mbn-item.mbn-active .mbn-icon-wrap {
  transform: translateY(-1px);
}

.mbn-icon {
  position: relative;
  z-index: 2;
  width: var(--mbn-icon-size);
  height: var(--mbn-icon-size);
  display: block;
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1);
}

.mbn-item.mbn-active .mbn-icon {
  transform: scale(1.1);
}

/* ── Label ───────────────────────────────────────── */
.mbn-label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60px;
  transition: opacity 0.2s, transform 0.2s;
}

/* ── Indicator: Pill ─────────────────────────────── */
.mbn-pill-bg {
  position: absolute;
  inset: 0;
  border-radius: 100px;
  background: var(--mbn-active-bg);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(.34,1.56,.64,1);
  z-index: 1;
}

.mbn-item.mbn-active .mbn-pill-bg {
  opacity: 1;
  transform: scale(1);
}

/* ── Indicator: Dot ──────────────────────────────── */
.mbn-dot {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mbn-active);
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.2s;
  opacity: 0;
  z-index: 3;
}

.mbn-item.mbn-active .mbn-dot {
  transform: translateX(-50%) scale(1);
  opacity: 1;
}

/* ── Indicator: Line ─────────────────────────────── */
.mbn-line {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 24px;
  height: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--mbn-active);
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
  z-index: 3;
}

.mbn-item.mbn-active .mbn-line {
  transform: translateX(-50%) scaleX(1);
}

/* ── Tap ripple ──────────────────────────────────── */
.mbn-ripple {
  position: absolute;
  border-radius: 50%;
  background: var(--mbn-active);
  opacity: 0;
  pointer-events: none;
  transform: scale(0);
  animation: mbn-ripple-anim 0.5s ease-out forwards;
  z-index: 0;
}

@keyframes mbn-ripple-anim {
  0%   { transform: scale(0); opacity: 0.25; }
  100% { transform: scale(3); opacity: 0; }
}

/* ── Entrance animations ─────────────────────────── */
.mbn-anim-slide {
  animation: mbn-slide-in 0.4s cubic-bezier(.22,1,.36,1) both;
}
.mbn-anim-fade {
  animation: mbn-fade-in 0.4s ease both;
}
.mbn-anim-none { /* no animation */ }

@keyframes mbn-slide-in {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes mbn-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Body padding — bar height + iOS safe area ────── */
body.mbn-active-bar {
  padding-bottom: calc(var(--mbn-height) + env(safe-area-inset-bottom, 0px));
}

/* ── Center FAB button ───────────────────────────── */
.mbn-fab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--mbn-fab-bg, var(--mbn-active));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--mbn-font-size);
  font-weight: 600;
  padding: 8px 4px 6px;
  -webkit-tap-highlight-color: transparent;
}

.mbn-fab-inner {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--mbn-fab-bg, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -18px;
  flex-shrink: 0;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.18),
    0 1px 0 rgba(255,255,255,0.12) inset;
  transition:
    transform 0.25s cubic-bezier(.34,1.56,.64,1),
    box-shadow 0.22s ease;
  z-index: 2;
}

.mbn-fab-inner .mbn-icon {
  color: var(--mbn-fab-ic, #fff) !important;
  width: 22px !important;
  height: 22px !important;
  filter: none !important;
}

.mbn-fab:hover .mbn-fab-inner,
.mbn-fab.mbn-active .mbn-fab-inner {
  transform: translateY(-3px) scale(1.06);
  box-shadow:
    0 8px 24px rgba(0,0,0,0.22),
    0 1px 0 rgba(255,255,255,0.15) inset;
}

.mbn-fab-label {
  font-size: 9px !important;
  letter-spacing: 0.2px;
  opacity: 0.85;
}

/* ═══════════════════════════════════════════════════
   MENU PANELS
   ═══════════════════════════════════════════════════

   Design:  Glassmorphism — frosted glass card
   z-index: 199998, below the nav bar (200000)
             so the nav bar always stays visible.

   ═══════════════════════════════════════════════════ */

/* ── Shared panel wrapper ────────────────────────── */
.mbn-menu-panel {
  position: fixed;
  inset: 0;
  /* Below the nav bar so bar is always accessible */
  z-index: 199998;
  pointer-events: none;
}

.mbn-menu-panel:not([hidden]) {
  pointer-events: auto;
}

/* ── Backdrop ─────────────────────────────────────── */
.mbn-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mbn-menu-panel.mbn-panel-open .mbn-panel-backdrop {
  opacity: 1;
}

/* ── Drawer shell (shared base) — plain light default ── */
.mbn-panel-drawer {
  position: absolute;
  background: #ffffff;
  border: none;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(.22,1,.36,1);
  will-change: transform;
  /* Stop scroll propagation at drawer boundary (iOS rubber-band) */
  overscroll-behavior: contain;
}

/* ── Panel Header ────────────────────────────────── */
.mbn-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  background: transparent;
}

.mbn-panel-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.2px;
}

.mbn-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: #f3f4f6;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  flex-shrink: 0;
}

.mbn-panel-close:hover {
  background: #e5e7eb;
  color: #111827;
  transform: scale(1.08);
}

/* ── Panel Content (scrollable) ──────────────────── */
.mbn-panel-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Contain overscroll so rubber-banding never propagates to page */
  overscroll-behavior-y: contain;
  padding: 6px 0 12px;
  /* thin scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}

.mbn-panel-content::-webkit-scrollbar { width: 3px; }
.mbn-panel-content::-webkit-scrollbar-track { background: transparent; }
.mbn-panel-content::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 2px;
}

/* ── WP nav menu items ───────────────────────────── */
.mbn-panel-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mbn-panel-menu li {
  margin: 0;
  padding: 0;
}

.mbn-panel-menu > li + li > a {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.mbn-panel-menu a {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #1f2937;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, padding-left 0.18s ease;
}

.mbn-panel-menu a:hover {
  background: #f9fafb;
  color: var(--mbn-active);
}

/* Active/current page */
.mbn-panel-menu .current-menu-item > a,
.mbn-panel-menu .current_page_item > a {
  color: var(--mbn-active);
  background: #f0f4ff;
  font-weight: 600;
}

/* Sub-menus */
.mbn-panel-menu .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #f9fafb;
}

.mbn-panel-menu .sub-menu a {
  padding-left: 36px;
  font-size: 13.5px;
  color: #4b5563;
}

.mbn-panel-menu .sub-menu a:hover {
  color: var(--mbn-active);
  background: #f3f4f6;
}

.mbn-panel-menu .sub-menu .sub-menu a {
  padding-left: 52px;
  font-size: 13px;
  color: #6b7280;
}

/* ────────────────────────────────────────────────────
   PANEL STYLE 1: Bottom Sheet
   • Slides up from just above the nav bar
   • Nav bar stays fully visible beneath it
   ─────────────────────────────────────────────────── */
.mbn-panel-bottom-sheet {
  left: 0;
  right: 0;
  /*
   * Bottom edge sits exactly on top of the nav bar.
   * The nav bar total height = --mbn-height + safe area padding.
   * We pin to that so there is no gap between sheet and bar.
   */
  bottom: calc(var(--mbn-height) + env(safe-area-inset-bottom, 0px));
  max-height: 70vh;
  border-radius: 20px 20px 0 0;
  transform: translateY(110%);
}

.mbn-menu-panel.mbn-panel-open .mbn-panel-bottom-sheet {
  transform: translateY(0);
}

/* Drag handle pill */
.mbn-panel-bottom-sheet::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 4px;
  border-radius: 2px;
  background: rgba(0,0,0,0.18);
  z-index: 1;
}

/* ────────────────────────────────────────────────────
   PANEL STYLE 2: Side Panel (from right)
   • Full height slide-in, nav bar sits above it (z-index)
   ─────────────────────────────────────────────────── */
.mbn-panel-side-panel {
  top: 0;
  right: 0;
  /*
   * Stop above the nav bar so the nav remains accessible.
   */
  bottom: calc(var(--mbn-height) + env(safe-area-inset-bottom, 0px));
  width: min(300px, 85vw);
  border-radius: 0 0 0 16px;
  transform: translateX(110%);
}

.mbn-menu-panel.mbn-panel-open .mbn-panel-side-panel {
  transform: translateX(0);
}

/* ────────────────────────────────────────────────────
   PANEL STYLE 3: Top Panel (from top)
   • Slides down from the top, never covers nav bar
   ─────────────────────────────────────────────────── */
.mbn-panel-top-panel {
  top: 0;
  left: 0;
  right: 0;
  max-height: 75vh;
  border-radius: 0 0 20px 20px;
  transform: translateY(-110%);
}

.mbn-menu-panel.mbn-panel-open .mbn-panel-top-panel {
  transform: translateY(0);
}
