/* ═══════════════════════════════════════════════════════════
   App Nav Bar — MOBILE FIRST, PWA feel
   Sticky bottom nav, 48px touch targets, graceful degradation
   Mobile: full bottom bar
   Desktop (992+): hidden (desktop nav in header suffices)
   ═══════════════════════════════════════════════════════════ */

/* ─── Body padding to prevent content hiding behind nav ──── */
body:not(.bricks-is-frontend) {
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}

/* ─── Bottom Nav Bar ─────────────────────────────────────── */
.sew-app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: 56px;
  background: #fff;
  border-top: 1px solid var(--sew-gray-200, #EEEEEE);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  background: rgba(255,255,255,0.92);
}

/* ─── Nav Item ───────────────────────────────────────────── */
.sew-app-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-width: 48px;
  min-height: 48px;
  padding: 4px 0;
  color: var(--sew-gray-500, #9E9E9E);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.sew-app-nav__item svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.75;
  transition: transform 0.15s;
}

.sew-app-nav__item span {
  line-height: 1;
}

/* ─── Active state ───────────────────────────────────────── */
.sew-app-nav__item.is-active {
  color: var(--sew-primary-500);
  font-weight: 600;
  position: relative;
}
/* Active dot indicator */
.sew-app-nav__item.is-active::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sew-primary-500);
}
.sew-app-nav__item.is-active svg {
  transform: scale(1.08);
}

/* ─── Hover/press ────────────────────────────────────────── */
.sew-app-nav__item:hover {
  color: var(--sew-dark-600);
}

.sew-app-nav__item:active {
  color: var(--sew-primary-500);
}

.sew-app-nav__item:active svg {
  transform: scale(0.92);
}

/* ─── More Button ────────────────────────────────────────── */
.sew-app-nav__more-btn {
  background: none; border: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ─── More Menu — Full-page slide-up sheet ───────────────── */
.sew-app-nav__popover {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.15);
  padding: 0.75rem 1rem calc(56px + env(safe-area-inset-bottom, 0px) + 0.75rem);
  z-index: 10001;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
  max-height: 85vh;
  overflow-y: auto;
}
.sew-app-nav__popover.is-open {
  transform: translateY(0);
  pointer-events: auto;
}
/* Close button */
.sew-app-nav__pop-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
}
.sew-app-nav__pop-close:active { color: #333; }
/* Drag handle */
.sew-app-nav__popover::before {
  content: '';
  display: block;
  width: 36px; height: 4px;
  border-radius: 2px;
  background: #ddd;
  margin: 0 auto 1rem;
}
.sew-app-nav__pop-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0.5rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--sew-dark-600, #1A1A1A);
  font-size: 1rem;
  font-weight: 500;
  transition: background 0.12s;
}
.sew-app-nav__pop-item:active { background: #f5f5f5; }
.sew-app-nav__pop-item svg { stroke: #666; flex-shrink: 0; width: 22px; height: 22px; }
/* Overlay — sibling div managed by JS, must sit just below popover */
.sew-app-nav__overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.sew-app-nav__overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
/* Hide SEWN Connect FAB when More sheet is open */
.sew-app-nav__overlay.is-open ~ .sewn-connect-fab,
body.sew-more-open .sewn-connect-fab,
body.sew-more-open [style*="z-index: 999999"],
body.sew-more-open [style*="z-index:999999"] {
  display: none !important;
}

/* ─── Push FAB up above nav bar ──────────────────────────── */
.sewn-fab {
  bottom: calc(56px + 1rem + env(safe-area-inset-bottom, 0px)) !important;
}

/* ─── Desktop: hide bottom nav (header nav suffices) ─────── */
@media (min-width: 992px) {
  .sew-app-nav {
    display: none;
  }

  body:not(.bricks-is-frontend) {
    padding-bottom: 0;
  }

  .sewn-fab {
    bottom: 1.5rem !important;
  }
}
