/* ==========================================================================
   Location picker — Claude Design 6a (desktop 520) / 6c (states) / 6d (sheet)

   Scoped entirely under #loc-modal with an .xloc- prefix so none of it can leak
   into the Tailwind theme the rest of the site still runs on. The modal keeps
   its id and its open/close contract (openModal('loc-modal') + initLocModal),
   so all eight existing call sites are untouched.

   Tokens are the scheduler design system, not the site's navy/gold:
   ink #111111 · body #374151 · secondary #6b7280 · muted #9ca3af
   lines #e5e7eb · hairline #f3f4f6 · surface #f8f9fa · success #059669
   ========================================================================== */

#loc-modal.xloc-ov {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(17, 17, 17, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: 'Inter', system-ui, sans-serif;
}
#loc-modal.xloc-ov.hidden { display: none; }

#loc-modal .xloc-sheet {
  background: #fff;
  width: 100%;
  max-width: 520px;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(17, 17, 17, .22);
  display: flex;
  flex-direction: column;
  max-height: min(640px, 88vh);
  overflow: hidden;
}

/* Grab handle — mobile only (6d) */
#loc-modal .xloc-grab { display: none; }

/* ── header ─────────────────────────────────────────────────────────────── */
#loc-modal .xloc-hd {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
#loc-modal .xloc-t {
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -.5px;
  color: #111111;
  line-height: 1.25;
  margin: 0;
}
#loc-modal .xloc-sub {
  font-size: 11.5px;
  font-weight: 400;
  color: #6b7280;
  line-height: 1.5;
  margin: 5px 0 0;
}
#loc-modal .xloc-x {
  margin-left: auto;
  flex-shrink: 0;
  height: 30px;
  width: 30px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  color: #9ca3af;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
#loc-modal .xloc-x:hover { background: #f3f4f6; color: #111111; }

/* ── body ───────────────────────────────────────────────────────────────── */
#loc-modal .xloc-body {
  padding: 16px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* search field */
#loc-modal .xloc-field { position: relative; flex-shrink: 0; }
#loc-modal .xloc-field > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}
#loc-modal .xloc-field input {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 11px 34px 11px 36px;
  font: 400 13.5px 'Inter', system-ui, sans-serif;
  color: #111111;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#loc-modal .xloc-field input::placeholder { color: #9ca3af; }
#loc-modal .xloc-field input:focus {
  border-color: #111111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, .06);
}
#loc-modal .xloc-clr {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  width: 24px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  color: #9ca3af;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#loc-modal .xloc-clr.on { display: inline-flex; }
#loc-modal .xloc-clr:hover { background: #f3f4f6; color: #111111; }

/* ── "Use my current location" ───────────────────────────────────────────
   The design system's `secondary` button: canvas fill, hairline border,
   radius-md. Quiet — it is not competing with the search field — but it is a
   control and it reads as one. */
#loc-modal .xloc-gps {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 10px 13px;
  cursor: pointer;
  border-radius: 8px;
  transition: border-color .15s, background .15s;
}
#loc-modal .xloc-gps:hover { background: #f8f9fa; border-color: #111111; }
#loc-modal .xloc-gps:disabled { opacity: .55; cursor: default; }

/* Locating: the SAME row, working. Not a second panel above it — the border,
   position and height are unchanged, only the contents swap. */
#loc-modal .xloc-gps.locating { background: #f8f9fa; border-color: #e5e7eb; cursor: default; }
#loc-modal .xloc-gps.locating:hover { border-color: #e5e7eb; }
#loc-modal .xloc-cancel {
  margin-left: auto;
  flex-shrink: 0;
  font: 500 12px 'Inter', system-ui, sans-serif;
  color: #111111;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
#loc-modal .xloc-gps > svg { flex-shrink: 0; color: #111111; }
#loc-modal .xloc-gps b {
  display: block;
  font: 500 13.5px 'Inter', system-ui, sans-serif;
  color: #111111;
}
#loc-modal .xloc-gps span {
  display: block;
  font: 400 11px 'Inter', system-ui, sans-serif;
  color: #9ca3af;
  margin-top: 1px;
}

/* ── rows (current, recent, results, saved) ─────────────────────────────── */
#loc-modal .xloc-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
}
#loc-modal .xloc-row:hover { background: #f8f9fa; }

/* The area you are currently on, shown as selected. The design system marks a
   selected control with the canvas fill, ink text and a lift against a softer
   track (NavPillGroup); rows already sit on canvas, so the same relationship is
   expressed the other way up — soft fill, hairline edge, ink text. */
#loc-modal .xloc-row.sel {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  padding: 9px 12px;
  margin: 0;
}
#loc-modal .xloc-row.sel:hover { background: #f3f4f6; }
#loc-modal .xloc-row.sel .xloc-name { color: #111111; font-weight: 600; }
#loc-modal .xloc-row.sel .xloc-tag { color: #059669; }
#loc-modal .xloc-row .xloc-ico { flex-shrink: 0; color: #9ca3af; display: flex; }
#loc-modal .xloc-row .xloc-txt { min-width: 0; flex: 1; }
#loc-modal .xloc-name {
  display: block;
  font: 500 13.5px 'Inter', system-ui, sans-serif;
  color: #111111;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#loc-modal .xloc-meta {
  display: block;
  font: 400 11.5px 'Inter', system-ui, sans-serif;
  color: #6b7280;
  line-height: 1.4;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* the coverage count — the reason this redesign exists */
#loc-modal .xloc-cnt {
  flex-shrink: 0;
  font: 400 11.5px 'Inter', system-ui, sans-serif;
  color: #6b7280;
  white-space: nowrap;
}
#loc-modal .xloc-cnt.zero { color: #9ca3af; }

/* green dot for the currently-selected area */
#loc-modal .xloc-dot {
  flex-shrink: 0;
  height: 8px;
  width: 8px;
  border-radius: 999px;
  background: #059669;
  margin: 0 4px;
}
#loc-modal .xloc-tag {
  flex-shrink: 0;
  font: 500 9.5px 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: .06em;
  color: #6b7280;
  text-transform: uppercase;
}

/* per-row remove (recents) */
#loc-modal .xloc-rm {
  flex-shrink: 0;
  height: 24px;
  width: 24px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  color: #9ca3af;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#loc-modal .xloc-rm:hover { background: #f3f4f6; color: #111111; }

/* ── section labels + dividers ──────────────────────────────────────────── */
#loc-modal .xloc-lbl {
  font: 500 9.5px 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #9ca3af;
  margin: 0 0 6px;
}
#loc-modal .xloc-sec { border-top: 1px solid #f3f4f6; padding-top: 13px; }
#loc-modal .xloc-sec:first-child { border-top: 0; padding-top: 0; }

/* ── popular area pills ─────────────────────────────────────────────────── */
#loc-modal .xloc-pills { display: flex; flex-wrap: wrap; gap: 7px; }
#loc-modal .xloc-pill {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font: 400 12.5px 'Inter', system-ui, sans-serif;
  color: #374151;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
#loc-modal .xloc-pill:hover { border-color: #111111; background: #f8f9fa; color: #111111; }
#loc-modal .xloc-pill b { font-weight: 400; color: #9ca3af; margin-left: 5px; }

/* ── status / verdict block (6c) ────────────────────────────────────────── */
#loc-modal .xloc-status { display: none; }
#loc-modal .xloc-status.on { display: block; }
#loc-modal .xloc-note {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #e5e7eb;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 11px 13px;
  font: 400 12.5px 'Inter', system-ui, sans-serif;
  color: #374151;
}
#loc-modal .xloc-note.ok { border-color: #a7f3d0; background: #ecfdf5; color: #059669; font-weight: 500; }
#loc-modal .xloc-note.warn { border-color: #e5e7eb; background: #f8f9fa; color: #374151; }
#loc-modal .xloc-note svg { flex-shrink: 0; }
#loc-modal .xloc-note .xloc-chg {
  margin-left: auto;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  font: 500 12px 'Inter', system-ui, sans-serif;
  color: #111111;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0;
}

/* spinner */
#loc-modal .xloc-spin {
  height: 14px;
  width: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: #111111;
  border-radius: 999px;
  animation: xlocspin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes xlocspin { to { transform: rotate(360deg); } }

/* ── empty / no-match (6c) ──────────────────────────────────────────────── */
#loc-modal .xloc-empty { padding: 4px 0 2px; }
#loc-modal .xloc-empty h4 {
  font: 500 13.5px 'Inter', system-ui, sans-serif;
  color: #111111;
  margin: 0 0 3px;
}
#loc-modal .xloc-empty p {
  font: 400 12px 'Inter', system-ui, sans-serif;
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}
/* the waitlist way out — never a dead end */
#loc-modal .xloc-cta {
  display: block;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  margin-top: 12px;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
#loc-modal .xloc-cta:hover { border-color: #111111; background: #f8f9fa; }
#loc-modal .xloc-cta b {
  display: block;
  font: 500 13px 'Inter', system-ui, sans-serif;
  color: #111111;
}
#loc-modal .xloc-cta span {
  display: block;
  font: 400 11.5px 'Inter', system-ui, sans-serif;
  color: #6b7280;
  margin-top: 2px;
  line-height: 1.45;
}

/* skeletons while counts resolve — never a fake number */
#loc-modal .xloc-skel {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 37%, #f3f4f6 63%);
  background-size: 400% 100%;
  animation: xlocsk 1.3s ease infinite;
  border-radius: 6px;
}
@keyframes xlocsk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ── footer note ────────────────────────────────────────────────────────── */
#loc-modal .xloc-ft {
  flex-shrink: 0;
  border-top: 1px solid #e5e7eb;
  padding: 12px 22px;
  font: 400 11px 'Inter', system-ui, sans-serif;
  color: #9ca3af;
  background: #fff;
}

#loc-modal .xloc-err {
  font: 400 12px 'Inter', system-ui, sans-serif;
  color: #374151;
  margin: 0;
}
#loc-modal .xloc-err:empty { display: none; }

/* ==========================================================================
   Font guard. index.php sets
     body, h1..h4, p, span, a, button, div, input, .font-heading
       { font-family: 'Plus Jakarta Sans' !important }
   which outranks any specificity, so the picker rendered in the wrong face on
   every page that is not services.php. Re-assert the design's faces, scoped.
   ========================================================================== */
#loc-modal,
#loc-modal div, #loc-modal span, #loc-modal p, #loc-modal a,
#loc-modal button, #loc-modal input, #loc-modal label, #loc-modal b, #loc-modal i {
  font-family: 'Inter', system-ui, sans-serif !important;
}
#loc-modal .xloc-t {
  font-family: 'Manrope', system-ui, sans-serif !important;
}
#loc-modal .xloc-lbl, #loc-modal .xloc-tag {
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
}

/* ==========================================================================
   6d — mobile 390: full-height sheet from the bottom
   ========================================================================== */
@media (max-width: 639px) {
  #loc-modal.xloc-ov {
    align-items: flex-end;
    padding: 0;
  }
  #loc-modal .xloc-sheet {
    max-width: none;
    border-radius: 16px 16px 0 0;
    /* 54px of the dimmed page stays visible at the top */
    max-height: calc(100vh - 54px);
    height: calc(100vh - 54px);
  }
  #loc-modal .xloc-grab {
    display: flex;
    justify-content: center;
    padding: 9px 0 3px;
    flex-shrink: 0;
  }
  #loc-modal .xloc-grab i {
    display: block;
    height: 4px;
    width: 36px;
    border-radius: 999px;
    background: #e5e7eb;
  }
  #loc-modal .xloc-hd { padding: 10px 18px 13px; }
  #loc-modal .xloc-t { font-size: 17px; }
  #loc-modal .xloc-body { padding: 14px 18px 18px; gap: 13px; }
  #loc-modal .xloc-ft { padding: 11px 18px; }
  /* rows get a little more height for thumbs */
  #loc-modal .xloc-row { padding: 11px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  #loc-modal .xloc-spin, #loc-modal .xloc-skel { animation: none; }
}
