/* ============================================
   Pitbay — base.css
   Reset, CSS variables, shared utilities
   ============================================ */

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

:root {
  /* Brand Colors — Deep Blue theme (Pitbay).
     --blue / --navy carry the brand so every existing reference across the app
     adopts the theme without touching each rule. Var names like --teal-tint are
     kept for compatibility but now point at blue tints. */
  --blue:   #1E5FBF;   /* brand blue — primary actions, links, active states */
  --green:  #2e7d32;   /* success (kept green for meaning) */
  --red:    #c62828;
  --gold:   #f59e0b;   /* amber — star ratings */
  --navy:   #0b3f8a;   /* deep blue — selected / dark boxes */

  /* Brand gradients + accents */
  --brand-grad:  linear-gradient(135deg, #2f7be0 0%, #1E5FBF 55%, #0b3f8a 100%);
  --accent-grad: linear-gradient(135deg, #3b82f6, #1E5FBF);
  --teal-tint:        #EAF1FC;   /* brand tint (blue) */
  --teal-tint-border: #D6E4FB;
  --chip-glow:  0 4px 14px rgba(30,95,191,.45);
  --card-glow:  0 4px 16px rgba(30,95,191,.10);

  /* Backgrounds */
  --bg-primary:   #ffffff;
  --bg-secondary: #f4f8ff;   /* soft blue-white app background */
  --bg-tertiary:  #eaf1fc;

  /* Text */
  --text-primary:   #1a1a2e;
  --text-secondary: #5f6368;
  --text-tertiary:  #9aa0a6;

  /* Borders */
  --border-light:  #e8eaed;
  --border-medium: #dadce0;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
  --shadow-md: 0 2px 12px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.15);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;

  /* Border radius */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-pill: 100px;

  /* Typography */
  --font-xs:   12px;
  --font-sm:   13px;
  --font-base: 15px;
  --font-md:   17px;
  --font-lg:   19px;
  --font-xl:   22px;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: var(--font-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* No body-level safe-area padding: the native status bar runs in
     overlaysWebView:false mode, so Android already insets the WebView below the
     status bar. Adding env() padding here double-counted it and left a visible
     gap strip on devices that still report a top inset (e.g. Samsung S24 Ultra).
     Each header handles its own top padding; the bottom nav pads for gesture nav. */
}

/* ── PHONE SHELL (for prototyping) ── */
.phone-shell {
  width: 375px;
  min-height: 100vh;
  background: var(--bg-primary);
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* ── STATUS BAR (web preview only; native uses the OS bar) ── */
.status-bar {
  background: var(--bg-primary);
  padding: 10px 18px 8px;
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
}
.status-bar span { font-size: 13px; color: var(--text-primary); font-weight: 600; }

/* ── SCREEN ── */
.screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-primary);
}

/* ── HEADERS ── */
.header-primary {
  background: var(--blue);
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 20px;
  flex-shrink: 0;
}
.header-sub {
  background: var(--blue);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 12px;
  flex-shrink: 0;
}

/* ── HOME HEADER (white, dark text — matches design) ── */
.hd {
  background: var(--bg-primary);
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-light);
}
.hd-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
/* Avatar + greeting cluster on the left. */
.hd-left { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.hd-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  background: var(--brand-grad); color: #fff; font-weight: 800; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(30,95,191,.30);
}
.hd-avatar:active { transform: scale(.95); }
/* Icon-button cluster on the right (support · bell · bookings). */
.hd-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.hd-icon-btn {
  position: relative; width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--bg-secondary); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.hd-icon-btn:active { background: var(--border-light); }
.hd-greeting {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.2px;
  line-height: 1.2;
}
.hd-greeting .wave {
  display: inline-block;
  animation: wave-hand .8s ease-in-out 1;
  transform-origin: 70% 70%;
}
@keyframes wave-hand {
  0%,100% { transform: rotate(0deg); }
  20%      { transform: rotate(15deg); }
  60%      { transform: rotate(-10deg); }
}
.hd-loc-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  cursor: pointer;
  width: fit-content;
}
.hd-loc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(74,222,128,.3);
}
.hd-loc-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}
.hd-loc-arrow {
  font-size: 11px;
  color: var(--text-tertiary);
}
/* Address + car-type chips sit on one row under the greeting. */
.hd-chip-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 5px; }
.hd-chip-row .hd-loc-row { margin-top: 0; }
.hd-cartype-row {
  display: flex; align-items: center; gap: 5px; cursor: pointer;
  background: var(--teal-tint); border-radius: 100px; padding: 3px 9px 3px 7px;
  width: fit-content;
}
.hd-cartype-row .hd-loc-label { color: var(--navy); }
.hd-cartype-row:active { background: var(--teal-tint-border); }
.hd-cartype-ico { display: inline-flex; align-items: center; }
.hd-cartype-ico svg { display: block; }
.hd-bell {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.hd-bell:active { background: rgba(255,255,255,.25); }
.hd-bell-icon   { font-size: 20px; line-height: 1; }
.hd-bell-badge  {
  position: absolute;
  top: 1px;
  right: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  box-sizing: border-box;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
}
.header-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}
.header-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,.8);
  margin-top: 2px;
}
.header-back {
  font-size: 13px;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
}
.header-back:hover { color: #fff; }

/* ── SCROLL AREA ── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.scroll-area::-webkit-scrollbar { display: none; }

/* ── SECTION LABEL ── */
.section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}

/* ── DIVIDER ── */
.divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
.divider-line { flex: 1; height: .5px; background: var(--border-light); }
.divider-text { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }

/* ── BOTTOM NAV — 3 TABS ── */
.bottom-nav {
  display: flex;
  border-top: .5px solid var(--border-light);
  background: var(--bg-primary);
  flex-shrink: 0;
  /* Clear the gesture-nav bar on devices that report a bottom inset. */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-btn {
  flex: 1;
  padding: 8px 4px 6px;
  text-align: center;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 12px;
  color: var(--text-secondary);
  transition: color .15s;
}
.nav-btn.active { color: var(--blue); font-weight: 700; }
.nav-btn.active .nav-icon { filter: drop-shadow(0 2px 6px rgba(30,95,191,.45)); }
.nav-icon { font-size: 19px; display: block; margin-bottom: 3px; line-height: 1; }
.nav-icon svg { display: block; margin: 0 auto; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: #1a1a2e;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 22px;
  z-index: 999;
  transition: transform .22s;
  white-space: nowrap;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── SPINNER ── */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid #bfdbfe;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PULSE (live status) ── */
.pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.2s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.4; transform:scale(1.4); }
}

/* ── ANIMATED CAR MODELS (size picker) ── */
.car-model .cm-body { animation: cm-float 2.6s ease-in-out infinite; transform-origin: center; }
.car-model.cm-active .cm-body { animation: cm-float 1.4s ease-in-out infinite; }
.car-model .cm-wheel { transform-box: fill-box; transform-origin: center; }
.car-model.cm-active .cm-wheel { animation: cm-spin .9s linear infinite; }
@keyframes cm-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-1.4px); } }
@keyframes cm-spin  { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .car-model .cm-body, .car-model .cm-wheel { animation: none; } }

/* ── UTILITY ── */
.text-blue   { color: var(--blue); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-gold   { color: var(--gold); }
.text-navy   { color: var(--navy); }
.text-muted  { color: var(--text-secondary); }
.text-xs     { font-size: var(--font-xs); }
.text-sm     { font-size: var(--font-sm); }
.text-bold   { font-weight: 700; }
.text-center { text-align: center; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.p-13   { padding: 0 13px; }
.mt-8   { margin-top: 8px; }
.mb-8   { margin-bottom: 8px; }
.hidden { display: none; }
