/* MitaBase Pro — a product of ETMITA · https://etmita.com
   Copyright © ETMITA. All rights reserved. */
/* ════════════════════════════════════════════════════════════════
   PICK A PLACE ON THE MAP — the dialog behind every address field's
   map button (2026-09-14). Markup and behaviour live in
   src/shared/geo-pick.ts → public/js/core/geo-pick.js.

   It carries `mt-scope`, because every token below is declared under
   that class; without it the dialog paints itself see-through (IS-077,
   the same trap the SEPA strip fell into).

   It opens ABOVE the ride form (100000) and below the ⌘K palette, so
   the form it serves stays visible behind its backdrop and the palette
   can still be opened over everything.
   ════════════════════════════════════════════════════════════════ */

.gp-shell {
  position: fixed;
  inset: 0;
  z-index: 100065;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 10, 10, 0.55);
  animation: gp-in var(--mb-dur-fast, 150ms) var(--mb-ease-out, ease-out);
}
.gp-shell[hidden] { display: none !important; }
@keyframes gp-in { from { opacity: 0; } to { opacity: 1; } }

.gp-dialog {
  display: flex;
  flex-direction: column;
  inline-size: min(880px, 100%);
  block-size: min(620px, 100%);
  min-block-size: 0;
  border-radius: 18px;
  border: 1px solid var(--border-default, var(--mb-line));
  background: var(--surface-card, var(--mb-white));
  color: var(--text-primary, var(--mb-ink));
  box-shadow: var(--shadow-md, 0 24px 60px rgba(0, 0, 0, .28));
  overflow: hidden;
}

.gp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-block-end: 1px solid var(--border-subtle, var(--mb-hairline));
}
.gp-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-family: var(--font-display), sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.gp-close { margin-inline-start: auto; }
.gp-ic { flex: none; }

/* the map fills what is left; MapLibre needs a sized box */
.gp-map { position: relative; flex: 1; min-block-size: 0; background: var(--surface-inset, var(--mb-row)); }
.gp-map canvas { outline: none; }

/* The crosshair sits at the map's centre and never moves — the map
   moves under it. Its point is the bottom tip of the pin, so the disc
   under it marks the exact spot the driver is sent to. */
.gp-cross {
  position: absolute;
  inset-inline-start: 50%;
  inset-block-start: 50%;
  /* the pin's tip, not its middle, lands on the centre */
  transform: translate(-50%, -100%);
  z-index: 2;
  pointer-events: none;
  color: var(--mb-ink, #171717);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35));
}
.gp-cross::after {
  content: "";
  position: absolute;
  inset-inline-start: 50%;
  inset-block-start: 100%;
  inline-size: 8px;
  block-size: 8px;
  margin-inline-start: -4px;
  margin-block-start: -3px;
  border-radius: 50%;
  background: var(--mb-lime, #A4F03A);
  box-shadow: 0 0 0 2px var(--mb-ink, #171717);
}

.gp-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-block-start: 1px solid var(--border-subtle, var(--mb-hairline));
}
.gp-found {
  flex: 1;
  min-inline-size: 0;
  margin: 0;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary, var(--mb-ink));
  overflow-wrap: anywhere;
}
.gp-found.is-busy { color: var(--text-muted, var(--mb-muted)); font-weight: 500; }
.gp-found.is-none { color: var(--status-expiring, var(--mb-warn)); font-weight: 500; }
.gp-take { flex: none; }

/* the button that opens this, sitting inside an address field */
.tm-addr { position: relative; display: flex; align-items: center; }
.tm-addr .tm-input { flex: 1; min-width: 0; padding-inline-end: 40px; }
.tm-geo {
  position: absolute;
  inset-inline-end: 5px;
  inline-size: 30px;
  block-size: 30px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted, var(--mb-muted));
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.tm-geo:hover { background: var(--surface-inset, var(--mb-row)); color: var(--text-primary, var(--mb-ink)); }
.tm-geo:focus-visible { outline: 2px solid var(--accent-fill-solid, var(--mb-lime)); outline-offset: 1px; }

@media (max-width: 720px) {
  .gp-shell { padding: 0; }
  .gp-dialog { inline-size: 100%; block-size: 100%; border-radius: 0; border: 0; }
  .gp-take { inline-size: 100%; justify-content: center; min-block-size: 44px; }
  .tm-geo { inline-size: 36px; block-size: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .gp-shell { animation: none; }
  .tm-geo { transition: none; }
}
