/* LocalHub — main stylesheet.
 * Mobile-first. Tokens + base + shared chrome (buttons, forms, topbar,
 * bottom nav, modal, sheet) live here; feature components live in components.css.
 */
:root {
  /* LocalHub design tokens — the complete colour set.
   * Only these tokens (plus standard white/neutral greys and the two
   * functional exceptions documented below) are used across the product.
   *
   *  --color-cream   primary surface / warm background
   *  --color-blue    primary action / brand blue
   *  --color-navy    text, headers, dark surfaces
   *  --color-blue-dark  hover/active state for blue
   *  --color-surface    card / white surface
   *  --color-border     cream-adjacent neutral
   *  --color-text-muted navy-adjacent neutral
   *
   * Functional exceptions (justified against the palette):
   *  --color-danger    desaturated red for destructive actions/errors only.
   *  --color-whatsapp  WhatsApp brand green for third-party WhatsApp buttons.
   */
  --color-cream: #F5E4CF;
  --color-blue: #275CCC;
  --color-navy: #172B4D;
  --color-blue-dark: #1E48A3;
  --color-surface: #FFFFFF;
  --color-border: #E5D9C6;
  --color-text-muted: #5B6B85;

  /* Aliases used by components; all resolve to the tokens above. */
  --color-bg: var(--color-cream);
  --color-text: var(--color-navy);
  --color-text-secondary: var(--color-text-muted);
  --color-primary: var(--color-blue);
  --color-primary-dark: var(--color-blue-dark);
  --color-call: var(--color-blue);
  --color-call-dark: var(--color-blue-dark);
  --color-primary-soft: #E8EEFC;   /* tint of brand blue for selection/active rows */
  --color-text-faint: #8E99AE;     /* neutral grey for the lightest meta text */
  --color-danger: #D92D20;         /* desaturated red — destructive actions */
  --color-whatsapp: #128C4A;       /* WhatsApp brand green (third-party button) */
  --color-whatsapp-dark: #0D7440;
  --color-star: var(--color-blue); /* rating glyph uses brand blue */
  --color-skeleton: #EEF0F3;       /* neutral grey for skeleton placeholders */
  --shadow-sm: 0 1px 2px rgba(23, 43, 77, 0.08);
  --shadow-md: 0 8px 20px rgba(23, 43, 77, 0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --nav-height: 64px;
  --contact-bar-height: 74px;
  --topbar-height: 60px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-width: 1200px;
}

*, 
*::before,
*::after { box-sizing: border-box; }

/* spacing utilities — replace ad-hoc inline styles */
.u-mt-sm { margin-top: 10px; }
.u-mt-md { margin-top: 14px; }
.u-mt-lg { margin-top: 16px; }
.u-mb-sm { margin-bottom: 12px; }
.u-mb-md { margin-bottom: 14px; }
.u-mb-lg { margin-bottom: 16px; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--color-primary); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4, p, figure, dl, dd, dt, ul { margin: 0; }
ul { padding: 0; list-style: none; }

:focus-visible { outline: 3px solid rgba(39, 92, 204, 0.45); outline-offset: 2px; border-radius: 4px; }

.muted { color: var(--color-text-secondary); font-size: 0.92rem; }

/* ---- layout ---- */
.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.container--narrow { max-width: 720px; }

main { min-height: 60vh; }

/* Bottom padding so the fixed nav / contact bar never covers content. */
body.has-nav { padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); }
body.has-contact-bar { padding-bottom: calc(var(--contact-bar-height) + env(safe-area-inset-bottom)); }
body.modal-open, body.sheet-open { overflow: hidden; }

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn .icon { flex-shrink: 0; }

.btn--primary { background: var(--color-primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--color-primary-dark); }

.btn--ghost { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn--ghost:hover { border-color: var(--color-text-muted); }
.btn--ghost.is-active { color: var(--color-primary); border-color: var(--color-primary); }

.btn--whatsapp { background: var(--color-whatsapp); color: #fff; box-shadow: var(--shadow-sm); }
.btn--whatsapp:hover { background: var(--color-whatsapp-dark); }

.btn--call { background: var(--color-call); color: #fff; box-shadow: var(--shadow-sm); }
.btn--call:hover { background: var(--color-call-dark); }

.btn--primary-cta { min-height: 52px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn--full-width { width: 100%; }

.btn-row { display: flex; gap: 10px; }
.btn-row--primary .btn { flex: 1 1 0; min-width: 0; }

@media (min-width: 1024px) {
  .btn { min-height: 48px; }
  .btn--primary-cta { min-height: 54px; }
}

/* ---- forms ---- */
.field { margin-bottom: 18px; }
.field label,
.field__label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field__hint { font-size: 0.84rem; color: var(--color-text-muted); margin-top: 6px; }
.field--required label::after { content: " *"; color: var(--color-danger); }

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-size: 16px; /* >=16px stops iOS zoom-on-focus */
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(39, 92, 204, 0.15);
}
input.is-invalid, select.is-invalid, textarea.is-invalid {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}
input.is-disabled { opacity: 0.55; background: var(--color-bg); cursor: not-allowed; }

.check-row { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.check-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--color-primary); flex-shrink: 0; }
.check-row span { font-size: 0.95rem; }
.check-row__icon { color: var(--color-text-muted); flex-shrink: 0; }

/* ---- chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.chip--active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.chips button.is-selected { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.chip--ghost { border-color: transparent; color: var(--color-text-muted); font-weight: 500; }

/* ---- topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.topbar__inner { display: flex; align-items: center; gap: 12px; min-height: var(--topbar-height); }
.topbar__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}
.topbar__back:hover { background: var(--color-bg); }
.topbar__title { font-size: 1.05rem; font-weight: 700; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.logo { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; color: var(--color-text); text-decoration: none; }
.logo em { font-style: normal; color: var(--color-primary); }

/* ---- location pill ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.88rem;
  max-width: 220px;
}
.pill .icon { color: var(--color-primary); flex-shrink: 0; }
.pill__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill__action { font-weight: 600; color: var(--color-primary); flex-shrink: 0; display: none; }
@media (min-width: 768px) { .pill__action { display: inline; } }

/* ---- bottom nav ---- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 12px rgba(16, 24, 40, 0.04);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav__item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--nav-height);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
}
.bottom-nav__item .icon { width: 24px; height: 24px; }
.bottom-nav__item.is-active { color: var(--color-primary); }
@media (min-width: 1024px) { .bottom-nav { display: none; } }

/* ---- footer ---- */
.footer { margin-top: 48px; border-top: 1px solid var(--color-border); background: var(--color-surface); }
.footer__inner {
  padding: 32px 16px 40px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  display: grid;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  text-align: left;
}
.footer__brand p { margin-top: 8px; }
.footer__links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.footer__links a, .footer__support a { color: var(--color-text-secondary); text-decoration: none; }
.footer__links a:hover, .footer__support a:hover { color: var(--color-primary); }
.footer__support { display: grid; gap: 10px; font-weight: 600; }
.footer__copy { margin-top: 8px; }
@media (min-width: 768px) {
  .footer__inner { grid-template-columns: 1.4fr 1fr 1fr; grid-template-areas: "brand links support" "copy copy copy"; }
  .footer__brand { grid-area: brand; }
  .footer__links { grid-area: links; }
  .footer__support { grid-area: support; }
  .footer__copy { grid-area: copy; margin-top: 12px; }
}

/* ---- modal (location) ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(23, 43, 77, 0.6);
  padding: 12px;
}
.modal__panel {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 0 20px; }
.modal__title { font-size: 1.05rem; font-weight: 700; }
.modal__close { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: var(--color-text-secondary); }
.modal__close:hover { background: var(--color-bg); }
.modal__body { padding: 8px 20px 20px; }
@media (min-width: 768px) {
  .modal { align-items: center; }
  .modal__panel { border-radius: var(--radius-xl); }
}

.loc-box { margin: 12px 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--color-danger); color: #fff; font-size: 0.9rem; }
.loc-status { margin: 12px 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--color-primary-soft); color: var(--color-primary-dark); font-size: 0.9rem; }
.modal__actions { display: flex; gap: 10px; margin-top: 16px; }
.modal__actions .btn { flex: 1 1 0; }

/* ---- bottom sheet (filters) ---- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(23, 43, 77, 0.6);
}
.sheet__panel {
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-md);
  transform: translateY(100%);
  transition: transform 0.28s ease;
}
.sheet.is-open .sheet__panel { transform: translateY(0); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px 0; }
.sheet__title { font-size: 1.05rem; font-weight: 700; }
.sheet__close { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: var(--color-text-secondary); }
.sheet__close:hover { background: var(--color-bg); }
.sheet__body { padding: 8px 20px 0; }
.sheet__actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border);
  margin-top: 16px;
  background: var(--color-surface);
}
.sheet__actions .btn { flex: 1 1 0; }

/* ---- wizard steps ---- */
.step { display: none; }
.step.is-active { display: block; }
.steps__head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-top: 4px; }
.steps__label { font-size: 0.85rem; font-weight: 700; color: var(--color-primary); text-transform: uppercase; letter-spacing: 0.04em; }
.steps__actions { display: flex; gap: 10px; margin-top: 8px; }
.steps__actions .btn { flex: 1 1 0; }
.step[data-step="0"] [data-wizard-back] { visibility: hidden; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-border); }
.dot--current { width: 22px; border-radius: 5px; background: var(--color-primary); }
.dot--done { background: var(--color-primary-soft); }

/* ---- skeleton loading ---- */
.skeleton-block {
  position: relative;
  overflow: hidden;
  background: var(--color-skeleton);
  border-radius: var(--radius-sm);
}
.skeleton-block::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---- empty / error states ---- */
.state { text-align: center; padding: 56px 20px; }
.state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.state__icon .icon { width: 28px; height: 28px; }
.state__title { font-size: 1.15rem; font-weight: 700; }
.state__sub { color: var(--color-text-secondary); margin: 8px auto 0; max-width: 340px; }
.state__chips { margin-top: 18px; }
.state__chips-title { font-size: 0.8rem; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.state__chips-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.state__chips .chip { display: inline-flex; align-items: center; gap: 6px; }
.state__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }

/* ---- success panel ---- */
.success { text-align: center; padding: 48px 20px; }
.success__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.success__title { font-size: 1.3rem; font-weight: 800; margin-top: 12px; }
.success__sub { color: var(--color-text-secondary); margin-top: 8px; max-width: 380px; margin-inline: auto; }
.success__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 24px; }

/* ---- provider dashboard ---- */
.dash-nav { display: flex; flex-direction: column; gap: 4px; }
.dash-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.dash-nav__item:hover { background: var(--color-bg); }
.dash-nav__item.is-active { background: var(--color-primary-soft); color: var(--color-primary); }
.dash-nav__item .icon { flex-shrink: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.stat-card__value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-card__label { font-size: 0.85rem; color: var(--color-text-secondary); margin-top: 2px; }
.stat-card__delta { font-size: 0.78rem; font-weight: 700; margin-top: 6px; }
.stat-card__delta--up { color: var(--color-primary); }
.stat-card__delta--down { color: var(--color-danger); }

.panel-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}
.panel-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }

.activity-list li {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.92rem;
}
.activity-list li:last-child { border-bottom: 0; }
.activity-list .activity-list__time { color: var(--color-text-muted); font-size: 0.8rem; flex-shrink: 0; }

/* ---- utilities ---- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-3 { margin-bottom: 24px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
  html { scroll-behavior: auto; }
}