/* GEO Matching — Standortsuche mit Karte.

   Übernommen aus dem Prototyp `Claude_Working/basetrain-map/map.html`; Aufbau
   (Seitenspalte mit Standortwahl, Typfiltern und sortierter Liste, daneben die
   Karte) ist derselbe. Farben, Schrift und Radien kommen aus den Tokens in
   hero.css — der Prototyp lief auf einem eigenen Teal-Satz mit Neongrün, davon
   ist nichts übrig.

   Die drei Typfarben sind Brand-Tokens: Gym = Mint 500, Studio = Sand,
   Club = Clay. Sand und Clay sind im Design System als Warn- und Fehlerfarbe
   geführt; hier tragen sie keine Bedeutung ausser "anderer Typ", und es sind
   die einzigen zwei Farben des Satzes, die sich auf Ink klar von Mint und
   voneinander trennen. */

.geo { --gym: var(--mint); --studio: var(--warn); --club: var(--err); }

.geo .pl-h2 { margin-bottom: 20px; }

.geo-lead {
  margin: 0 0 40px;
  max-width: 46em;
  font-size: 16px;
  line-height: 26px;
  color: var(--tx-2);
}

.geo-app {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  height: min(680px, 74vh);
  min-height: 520px;
  border: 1px solid var(--ink-500);
  border-radius: var(--r-panel);
  background: var(--ink-900);
  overflow: hidden;
}

/* Seitenspalte -------------------------------------------------------- */
.geo-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--ink-500);
  background: var(--ink-800);
}

.geo-locate {
  display: grid;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--ink-500);
}

.geo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--mint);
  border-radius: 999px;
  background: var(--mint-800);
  color: var(--tx-1);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}

.geo-btn:hover { border-color: var(--mint-300); box-shadow: 0 0 0 3px rgba(var(--akzent-rgb), .18); }
.geo-btn:focus-visible { outline: 2px solid var(--mint-300); outline-offset: 3px; }
.geo-btn svg { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: var(--mint); stroke-width: 1.7; stroke-linecap: round; }

.geo-row { display: flex; align-items: center; gap: 10px; }

.geo-or {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tx-2);
}

#geoDistrict {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px 34px 10px 12px;
  appearance: none;
  border: 1px solid var(--mint-800);
  border-radius: 10px;
  background: var(--ink-900) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238fc4ae' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--tx-1);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

#geoDistrict:focus { outline: none; border-color: var(--mint); }

.geo-status {
  margin: 0;
  min-height: 17px;
  font-size: 12px;
  line-height: 17px;
  color: var(--tx-2);
}

.geo-status.is-ok { color: var(--mint); }
.geo-status.is-warn { color: var(--warn); }

/* Typfilter */
.geo-filters {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ink-500);
}

.geo-chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 6px;
  border: 1px solid var(--ink-500);
  border-radius: 999px;
  background: transparent;
  color: var(--tx-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s var(--ease), background-color .2s var(--ease),
              color .2s var(--ease);
}

.geo-chip.is-on { border-color: var(--mint-800); background: var(--ink-700); color: var(--tx-1); }
.geo-chip:focus-visible { outline: 2px solid var(--mint-300); outline-offset: 2px; }
.geo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--tx-3)); }
.geo-n { color: var(--tx-3); font-weight: 500; }
.geo-chip.is-on .geo-n { color: var(--tx-2); }
.geo-chip[data-type="gym"]    { --c: var(--gym); }
.geo-chip[data-type="studio"] { --c: var(--studio); }
.geo-chip[data-type="club"]   { --c: var(--club); }

/* Liste */
.geo-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 10px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-500) transparent;
}

.geo-list-title {
  padding: 12px 10px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--tx-2);
}

.geo-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-card);
  cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}

.geo-item:hover { background: var(--ink-700); }
.geo-item.is-active { background: var(--ink-700); border-color: var(--mint); }
.geo-item:focus-visible { outline: 2px solid var(--mint-300); outline-offset: 2px; }

.geo-item .geo-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  box-shadow: 0 0 0 3px rgba(var(--akzent-rgb), .12);
}

.geo-name { font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--tx-1); }

.geo-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--tx-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.geo-dist {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--mint);
  font-variant-numeric: tabular-nums;
}

.geo-dist.is-muted { color: var(--tx-2); font-weight: 500; }
.geo-empty { padding: 28px 12px; text-align: center; font-size: 13px; color: var(--tx-2); }

/* Karte ---------------------------------------------------------------- */
.geo-map { position: relative; min-height: 0; background: var(--ink-900); }

.geo-boot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--tx-2);
}

.geo-app.is-ready .geo-boot { display: none; }

.geo-legend {
  position: absolute;
  left: 14px;
  bottom: 30px;
  z-index: 2;
  display: flex;
  gap: 14px;
  padding: 9px 13px;
  border: 1px solid var(--ink-500);
  border-radius: var(--r-chip);
  background: rgba(var(--grund-rgb), .88);
  backdrop-filter: blur(6px);
  font-size: 11px;
  color: var(--tx-1);
  pointer-events: none;
}

.geo-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; }
.geo-legend i[data-type="gym"]    { background: var(--gym); }
.geo-legend i[data-type="studio"] { background: var(--studio); }
.geo-legend i[data-type="club"]   { background: var(--club); }

/* Standortmarke */
.geo-user {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--mint);
  border: 3px solid var(--ink-900);
  box-shadow: 0 0 0 2px var(--mint);
}

.geo-user::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 2px solid var(--mint);
  opacity: 0;
  animation: geo-ping 2.2s ease-out infinite;
}

@keyframes geo-ping {
  0%   { transform: scale(.4); opacity: .8; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* MapLibre-Chrome ------------------------------------------------------ */
.geo .maplibregl-ctrl-group {
  border: 1px solid var(--ink-500);
  border-radius: var(--r-chip) !important;
  background: var(--ink-800) !important;
  box-shadow: none !important;
}

.geo .maplibregl-ctrl-group button { width: 36px !important; height: 36px !important; }
.geo .maplibregl-ctrl-group button + button { border-top: 1px solid var(--ink-500) !important; }
.geo .maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(1) opacity(.85); }

.geo .maplibregl-ctrl-attrib {
  background: rgba(var(--grund-rgb), .85) !important;
  color: var(--tx-2) !important;
  font-size: 10px !important;
}

.geo .maplibregl-ctrl-attrib a { color: var(--tx-1) !important; }

.geo .maplibregl-popup { max-width: 320px !important; z-index: 5; }

.geo .maplibregl-popup-content {
  padding: 18px 18px 16px !important;
  border: 1px solid var(--mint-800);
  border-radius: var(--r-card) !important;
  background: var(--ink-700) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .55) !important;
  color: var(--tx-1);
  font-family: inherit;
}

.geo .maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--ink-700) !important; }
.geo .maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--ink-700) !important; }
.geo .maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--ink-700) !important; }
.geo .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--ink-700) !important; }

.geo .maplibregl-popup-close-button {
  width: 32px;
  height: 32px;
  right: 3px;
  top: 3px;
  border-radius: var(--r-chip);
  color: var(--tx-2) !important;
  font-size: 20px !important;
}

.geo .maplibregl-popup-close-button:hover { background: var(--ink-600) !important; color: var(--tx-1) !important; }

.geo-pop .geo-pop-type {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--c);
}

.geo-pop .geo-pop-type::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.geo-pop h3 { margin: 8px 26px 5px 0; font-size: 16px; line-height: 1.28; font-weight: 700; color: var(--tx-1); }
.geo-pop .geo-pop-addr { font-size: 13px; color: var(--tx-1); }
.geo-pop .geo-pop-dist { margin-top: 5px; font-size: 12px; font-weight: 600; color: var(--mint); }

.geo-pop .geo-pop-facts {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--mint-800);
  font-size: 12.5px;
  color: var(--tx-1);
}

.geo-pop .geo-pop-facts span { color: var(--tx-2); }
.geo-pop .geo-pop-links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }

.geo-pop .geo-pop-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ink-500);
  border-radius: 999px;
  background: var(--ink-800);
  color: var(--tx-1);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.geo-pop .geo-pop-links a.is-route { border-color: var(--mint); background: var(--mint-800); }
.geo-pop .geo-pop-links a:hover { border-color: var(--mint-300); }

.geo-note {
  margin: 18px 0 0;
  font-size: 11.5px;
  line-height: 18px;
  color: var(--tx-2);
}

/* Responsive ----------------------------------------------------------- */
@media (max-width: 1100px) {
  .geo-app { grid-template-columns: 320px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  /* Karte oben, Liste darunter — ein Bodenblatt wie im Prototyp braucht die
     ganze Fensterhoehe, die hat das Panel innerhalb der Buehne nicht. */
  .geo-app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 300px minmax(0, 1fr);
    height: auto;
    min-height: 0;
  }
  .geo-map { order: 0; min-height: 300px; }
  .geo-side { order: 1; border-right: 0; border-top: 1px solid var(--ink-500); max-height: 460px; }
  .geo-legend { bottom: 14px; }
}

@media (max-width: 480px) {
  .geo-lead { margin-bottom: 28px; font-size: 15px; line-height: 24px; }
  .geo-locate, .geo-filters { padding-left: 16px; padding-right: 16px; }
  .geo-chip { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .geo-user::after { animation: none; }
}
