/**
 * Routenplaner – Karten-Modus „Ladestopps wählen“ (2.51.0)
 * Pfad: /pages/route-planner/assets/route-stop-picker.css
 * Eingebunden von: pages/route-planner/route-planner.php
 * Logik: route-stop-picker.js
 *
 * Desktop: links Fahrt-Einstellungen und Stopp-Leiste, rechts die Karte, Stationen als
 * Fenster an der Karte. Handy (bis 899 px): Karte im Vollbild, Einstellungen oben,
 * Stopp-Leiste als Blatt unten, Stationen als Blatt.
 */

html.lsp-open,
html.lsp-open body {
  overflow: hidden;
}

/* Über der Vollbild-Karte (9999), Meldungen bleiben sichtbar; Spenden-Knopf und Video-Hinweis
   (teaser.css, Ebene 30000/30001) verdecken sonst Karte und „Route übernehmen“ */
html.lsp-open #notification-container {
  z-index: 21000 !important;
}

html.lsp-open .donation-button-container,
html.lsp-open .ls-teaser,
html.lsp-open .ls-teaser-lb {
  display: none;
}

.lsp {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #111827;
  font-size: 14px;
}

.lsp.hidden,
.lsp .hidden {
  display: none !important;
}

.lsp-top {
  flex: none;
}

.lsp-head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 56px;
  padding: 0 8px;
  background: #fff;
  box-shadow: 0 1px 0 #e5e7eb;
}

.lsp-back,
.lsp-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #111827;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.lsp-back:hover,
.lsp-close:hover {
  background: #f3f4f6;
}

.lsp-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.lsp-body {
  position: relative;
  display: grid;
  flex: 1;
  grid-template-columns: 400px minmax(0, 1fr);
  min-height: 0;
}

.lsp-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  padding: 16px 16px 0;
  overflow-y: auto;
  border-right: 1px solid #e5e7eb;
  background: #fff;
}

.lsp-map-wrap {
  position: relative;
  z-index: 0; /* eigene Ebene: Leaflet-Bedienelemente bleiben unter dem Blatt */
  display: flex;
  min-height: 0;
}

/* Kein position: absolute – design-system.css erzwingt für .leaflet-container
   position: relative !important; die Höhe kommt deshalb aus dem Flex-Container */
.lsp-map {
  flex: 1 1 auto;
  min-width: 0;
  background: #e7eee8;
}

.lsp-h {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.lsp-muted {
  color: #4b5563;
  font-size: 13px;
}

/* Fahrt-Einstellungen */

.lsp-settings {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
}

.lsp-settings-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  list-style: none;
  cursor: pointer;
}

.lsp-settings-summary::-webkit-details-marker {
  display: none;
}

.lsp-settings-icon {
  flex: none;
  color: #17784a;
}

.lsp-settings-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.4;
}

.lsp-settings-text strong {
  font-weight: 600;
}

.lsp-settings-text span {
  color: #4b5563;
  font-size: 13px;
}

.lsp-settings-hint {
  display: none;
}

.lsp-settings-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 14px 14px;
  border-top: 1px solid #f3f4f6;
}

.lsp-settings-body .lsp-h {
  margin-top: 10px;
}

.lsp-slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lsp-slider-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.lsp-slider-row strong {
  color: #17784a;
}

.lsp-slider input {
  width: 100%;
  accent-color: #2eb873;
}

.lsp-detour {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lsp-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #d1d5db;
  border-radius: 10px;
}

.lsp-chip {
  padding: 9px 0;
  border: 0;
  border-right: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font: inherit;
  cursor: pointer;
}

.lsp-chip:last-child {
  border-right: 0;
}

.lsp-chip.is-active {
  background: #dcf3e6;
  color: #17784a;
  font-weight: 600;
}

.lsp-note {
  margin: 0;
  color: #4b5563;
  font-size: 13px;
}

/* Stopp-Leiste */

.lsp-stops {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lsp-stops-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.lsp-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lsp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
  border-top: 1px solid #f3f4f6;
  border-radius: 8px;
}

.lsp-row:first-child {
  border-top: 0;
}

.lsp-row--stop {
  cursor: pointer;
}

.lsp-row--stop:hover,
.lsp-row--stop.is-selected {
  background: #f2fbf6;
}

.lsp-row--stop:focus-visible,
.lsp-chip:focus-visible,
.lsp-primary:focus-visible,
.lsp-secondary:focus-visible,
.lsp-link:focus-visible,
.lsp-back:focus-visible,
.lsp-close:focus-visible,
.lsp-settings-summary:focus-visible,
.lsp-map-button:focus-visible {
  outline: 2px solid #0067d1;
  outline-offset: 2px;
}

.lsp-row-main {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.lsp-row-main strong {
  font-weight: 600;
}

.lsp-row-end {
  flex: none;
  font-weight: 600;
  white-space: nowrap;
}

.lsp-row-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  box-sizing: border-box;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.lsp-row-pin--start {
  background: #0080ff;
  color: #fff;
}

.lsp-row-pin--dest,
.lsp-row-pin--choice {
  background: #2eb873;
  color: #06301c;
}

.lsp-row-pin--suggestion {
  border: 2px solid #2eb873;
  background: #fff;
  color: #17784a;
}

.lsp-warn {
  margin: 4px 0 0;
  padding: 8px 10px;
  border: 1px solid #fcd9a8;
  border-radius: 8px;
  background: #fff7ec;
  color: #7a4300;
  font-size: 13px;
  line-height: 1.4;
}

.lsp-warn--crit {
  border-color: #f5c2c2;
  background: #fdecec;
  color: #9b1c1c;
}

.lsp-guest {
  padding: 10px 12px;
  border: 1px solid #fcd9a8;
  border-radius: 10px;
  background: #fff7ec;
  color: #7a4300;
  font-size: 13px;
  line-height: 1.45;
}

.lsp-guest a,
.lsp-details {
  color: #0067d1;
  font-weight: 600;
}

.lsp-link {
  align-self: flex-start;
  padding: 6px 0;
  border: 0;
  background: none;
  color: #0067d1;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.lsp-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: auto;
  padding: 10px 0 16px;
  background: #fff;
}

.lsp-primary,
.lsp-secondary {
  padding: 13px 16px;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.lsp-primary {
  border: 0;
  background: #2eb873;
  color: #06301c;
}

.lsp-primary:hover {
  background: #27a466;
}

.lsp-secondary {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
}

.lsp-secondary--danger {
  border-color: #e5b4b4;
  color: #9b1c1c;
}

.lsp-primary:disabled,
.lsp-secondary:disabled,
.lsp-link:disabled {
  opacity: 0.55;
  cursor: progress;
}

/* Karte */

.lsp-map-hint,
.lsp-status,
.lsp-empty {
  position: absolute;
  z-index: 500;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
  font-size: 13px;
}

.lsp-map-hint {
  top: 12px;
  left: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #ebf5ff;
  color: #0f3a66;
}

.lsp-status {
  top: 60px;
  left: 50%;
  padding: 9px 14px;
  background: #111827;
  color: #fff;
  transform: translateX(-50%);
}

.lsp-empty {
  right: 14px;
  bottom: 14px;
  left: 14px;
  padding: 12px 14px;
  background: #fff7ec;
  color: #7a4300;
}

.lsp-pin-wrap {
  background: none;
  border: 0;
}

.lsp-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.3);
  font-size: 14px;
  font-weight: 700;
}

.lsp-pin--start {
  background: #0080ff;
  color: #fff;
}

.lsp-pin--dest,
.lsp-pin--choice {
  background: #2eb873;
  color: #06301c;
}

.lsp-pin--suggestion {
  border-color: #2eb873;
  background: #fff;
  color: #17784a;
}

/* Stations-Fenster */

.lsp-popup .leaflet-popup-content {
  margin: 14px 16px;
}

.lsp-popup .leaflet-popup-content-wrapper {
  border-radius: 16px;
}

.lsp-station {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}

.lsp-station-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.lsp-station-title {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.lsp-station-title strong {
  font-size: 16px;
  font-weight: 600;
}

.lsp-station-title span {
  color: #4b5563;
  font-size: 13px;
}

.lsp-popup .lsp-close {
  display: none;
}

.lsp-price {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f2fbf6;
}

.lsp-price-value {
  font-size: 22px;
  font-weight: 700;
}

.lsp-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lsp-facts div {
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-radius: 10px;
  background: #f3f4f6;
}

.lsp-facts strong {
  font-size: 15px;
  font-weight: 600;
}

.lsp-facts span {
  color: #4b5563;
  font-size: 12px;
}

.lsp-position {
  margin: 0;
  color: #374151;
  line-height: 1.45;
}

.lsp-details {
  padding: 4px;
  text-align: center;
}

.lsp-scrim {
  position: fixed;
  inset: 56px 0 0;
  z-index: 20100;
  background: rgba(15, 23, 42, 0.35);
}

.lsp-sheet {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20200;
  max-height: 80vh;
  padding: 10px 16px 22px;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  background: #fff;
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.14);
}

/* Knopf auf der Hauptkarte */

.lsp-map-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #17784a;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
  cursor: pointer;
}

.lsp-map-button.hidden {
  display: none;
}

/* Handy */

@media (max-width: 899px) {
  .lsp-body {
    display: block;
  }

  .lsp-map-wrap {
    position: absolute;
    inset: 0;
  }

  .lsp-side {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 600;
    max-height: 52vh;
    padding: 12px 16px 0;
    border-right: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.14);
  }

  #lsp-settings {
    position: fixed;
    top: 68px;
    right: 12px;
    left: 12px;
    z-index: 650;
  }

  .lsp-settings {
    max-height: calc(48vh - 80px);
    overflow-y: auto;
    border: 0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
  }

  .lsp-settings:not([open]) {
    overflow: hidden;
  }

  .lsp-map-hint {
    display: none;
  }

  /* Auf dem Handy steht der Hinweis im Kasten oben, wie in der App */
  .lsp-settings-hint {
    display: block;
    grid-column: 1 / -1;
    margin: 0 -14px -12px;
    padding: 9px 14px;
    background: #ebf5ff;
    color: #0f3a66;
    font-size: 13px;
  }

  .lsp-settings[open] .lsp-settings-hint {
    display: none;
  }

  .lsp-status {
    top: 150px;
  }

  .lsp-empty {
    bottom: calc(52vh + 10px);
  }
}
