:root {
  --brand: #0057FF;
  --brand-dark: #003DBF;
  --brand-light: #EBF2FF;
  --green: #00C271;
  --green-dark: #00874E;
  --green-light: #E6F9F1;
  --surface: #FFFFFF;
  --bg: #F4F6F9;
  --text: #0E131F;
  --muted: #64748B;
  --border: #E2E8F0;
  --card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
  --modal-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  --safe-top: max(48px, calc(env(safe-area-inset-top, 0px) + 16px));
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #E2E8F0;
  color: var(--text);
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

/* Mobile Shell Container */
.app {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 50px rgba(0,0,0,0.12);
}

/* ── Sticky Top Nav (Mobile Safe-Area Inset Aware — Lowered below Wi-Fi & Battery status bar) ── */
#top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  min-height: calc(58px + var(--safe-top));
  padding: 0 16px 12px;
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
}
.brand-badge {
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.2px;
  padding: 4px 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.4px;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.b2b-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-light);
  padding: 6px 12px;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
}
.b2b-link:hover {
  background: var(--brand);
  color: #fff;
  transform: translateY(-1px);
}
.profile-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  cursor: pointer;
}

/* ── Main View Pages ── */
.view-container {
  flex: 1;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
.view-page {
  display: none;
  animation: tabFadeIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.view-page.active {
  display: block;
}

/* ── Bottom App Tab Bar ── */
#bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  min-height: 64px;
  height: auto;
  padding-top: 10px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 90;
  padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
}

/* ── Interactive Leaflet Map Viewport & Z-Index Isolation ── */
.map-viewport {
  position: relative;
  z-index: 1;
  isolation: isolate;
  width: 100%;
  height: 460px;
  background: #F4F6F9;
  overflow: hidden;
}
#leaflet-map-container {
  width: 100%;
  height: 100%;
  z-index: 1;
  isolation: isolate;
  background: #F4F6F9;
  font-family: inherit;
}
#leaflet-map-container .leaflet-pane { z-index: 4 !important; }
#leaflet-map-container .leaflet-tile-pane { z-index: 2 !important; }
#leaflet-map-container .leaflet-overlay-pane { z-index: 4 !important; }
#leaflet-map-container .leaflet-shadow-pane { z-index: 5 !important; }
#leaflet-map-container .leaflet-marker-pane { z-index: 6 !important; }
#leaflet-map-container .leaflet-tooltip-pane { z-index: 7 !important; }
#leaflet-map-container .leaflet-popup-pane { z-index: 8 !important; }
#leaflet-map-container .leaflet-top,
#leaflet-map-container .leaflet-bottom { z-index: 9 !important; }
.the-dial-custom-marker {
  background: transparent;
  border: none;
}

/* ── Listing Card — Smooth cubic-bezier hover & press micro-interactions ── */
.restaurant-card {
  background: var(--surface);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, box-shadow;
}
.restaurant-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.14);
  border-color: #CBD5E1;
}
.restaurant-card:active {
  transform: translateY(-1px) scale(0.992);
}

/* Waitlisted / Pending Audit Card Styling */
.restaurant-card.waitlist-card {
  filter: grayscale(100%) opacity(70%);
  cursor: default;
}
.restaurant-card.waitlist-card:hover {
  transform: none;
  box-shadow: var(--card-shadow);
}
.live-verified-badge.pending-audit-badge {
  background: #475569;
  color: #F8FAFC;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.35);
}
.play-video-overlay.waitlist-disabled-overlay {
  pointer-events: none;
  cursor: not-allowed;
  border: none;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0.78;
}

/* ── Interactive Video Audit Modal (Dark-Mode 4K Player) ── */
#video-audit-modal {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(6, 10, 19, 0.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 8px) 16px calc(20px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
#video-audit-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.audit-modal-window {
  width: 100%;
  max-width: 440px;
  background: #0B1120;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.85);
  transform: translateY(24px) scale(0.96);
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
  color: #F8FAFC;
}
#video-audit-modal.open .audit-modal-window {
  transform: translateY(0) scale(1);
}
.audit-html5-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 2;
  background: transparent;
}
.video-live-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  background: rgba(9, 13, 22, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #F8FAFC;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.video-modal-close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background 0.22s ease;
}
.video-modal-close-x:hover {
  background: #EF4444;
  border-color: #EF4444;
  transform: scale(1.08);
}

/* ── Sliding Tab Indicator & Itemized Safety Checklist ── */
.detail-tabs-bar {
  position: relative;
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.detail-tabs-underline {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 33.3333%;
  height: 3px;
  background: var(--brand);
  border-radius: 3px 3px 0 0;
  transform: translateX(0%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.audit-inspection-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px 14px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}
.audit-inspection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.audit-inspection-item:last-child {
  border-bottom: none;
}
.audit-pass-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--green-light);
  color: var(--green-dark);
  border: 1px solid #A7F3D0;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.audit-date-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 18px;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
}
.audit-date-tag {
  color: var(--brand);
  background: var(--brand-light);
  padding: 3px 9px;
  border-radius: 8px;
  font-weight: 800;
}

/* ── "For Restaurant Owners" Application Modal (Netlify Form) ── */
#owner-application-modal {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 230;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 8px) 16px calc(20px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
#owner-application-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.owner-modal-card {
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - var(--safe-top) - 36px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
  transform: translateY(24px) scale(0.96);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}
#owner-application-modal.open .owner-modal-card {
  transform: translateY(0) scale(1);
}

/* ── Profile & Settings Tab + Dark Theme Support ── */
html, body, .app, #top-nav, #bottom-nav-bar, .restaurant-card, .filter-chip, .trust-strip, .settings-bar-card {
  transition: background-color 0.3s cubic-bezier(0.22, 1, 0.36, 1), color 0.25s ease, border-color 0.25s ease, box-shadow 0.3s ease;
}

body.dark-theme {
  --surface: #111827;
  --bg: #0B0F19;
  --text: #F8FAFC;
  --muted: #94A3B8;
  --border: #1E293B;
  --brand-light: rgba(0, 87, 255, 0.2);
  --green-light: rgba(0, 194, 113, 0.16);
  --card-shadow: 0 8px 26px -4px rgba(0, 0, 0, 0.55);
  background: #050811;
  color: var(--text);
}

body.dark-theme #top-nav {
  background: rgba(17, 24, 39, 0.92);
  border-bottom-color: #1E293B;
}

body.dark-theme #bottom-nav-bar {
  background: rgba(17, 24, 39, 0.95);
  border-top-color: #1E293B;
}

