/* =====================================================================
   Karten – Oberfläche im "Liquid Glass"-Stil
   Durchscheinende, weichgezeichnete Flächen über der Karte; Text und
   Bedienelemente bleiben kontrastreich (Glas wird hinter Text dichter).
   ===================================================================== */
:root {
  --fg: #1c1c1e; --muted: #5f6368; --accent: #0a84ff; --accent-fg: #ffffff;
  --start: #1e9e4a; --end: #e5383b; --line: rgba(60, 60, 67, .14);
  --glass: rgba(255, 255, 255, .66);            /* Glasfläche */
  --glass-strong: rgba(255, 255, 255, .82);     /* dichteres Glas hinter viel Text */
  --glass-border: rgba(255, 255, 255, .75);
  --glass-edge: rgba(0, 0, 0, .06);
  --fill: rgba(118, 118, 128, .14);             /* Eingabefelder, Segmente */
  --hover: rgba(118, 118, 128, .12);
  --blur: blur(22px) saturate(180%);
  --shadow: 0 10px 30px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .08);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .14), 0 1px 3px rgba(0, 0, 0, .08);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, .85), inset 0 -1px 0 rgba(255, 255, 255, .25);
  --radius: 22px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #f2f2f7; --muted: #a1a1aa; --accent: #0a84ff; --line: rgba(255, 255, 255, .1);
    --glass: rgba(30, 30, 32, .62); --glass-strong: rgba(30, 30, 32, .8);
    --glass-border: rgba(255, 255, 255, .14); --glass-edge: rgba(255, 255, 255, .04);
    --fill: rgba(118, 118, 128, .24); --hover: rgba(255, 255, 255, .08);
    --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, .4);
    --highlight: inset 0 1px 0 rgba(255, 255, 255, .12);
  }
}
/* Wer Transparenz reduziert haben möchte (Bedienungshilfen) bekommt feste Flächen */
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: var(--glass-strong); --blur: none; }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--fg); background: #e9eef3; overflow: hidden; }
#map { position: absolute; inset: 0; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* Gemeinsame Glas-Fläche */
.glass, #panel, .fab, .poi-panel, #toast, .maplibregl-popup-content, .maplibregl-ctrl-group, .info-btn, .info-text {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow), var(--highlight);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: var(--glass-strong); }
}

/* ------------------------------------------------------------- Seitenleiste */
#panel {
  position: absolute; top: 14px; left: 14px; width: 390px; max-height: calc(100% - 28px);
  border-radius: var(--radius); overflow-y: auto; z-index: 2; scrollbar-width: thin;
  transition: max-height .25s ease;
}
/* Mehr Inhalt (Ergebnisse, Route) -> dichteres Glas für gute Lesbarkeit */
#panel:has(.results li, #maneuvers li) { background: var(--glass-strong); }
section { padding: 12px; }

.searchbox { display: flex; gap: 8px; align-items: center; }
input[type=search], .wp input {
  flex: 1; width: 100%; font-size: 16px; padding: 11px 14px; border: 0; border-radius: 14px;
  background: var(--fill); color: var(--fg); outline: none; transition: box-shadow .15s, background .15s;
}
input[type=search]::placeholder, .wp input::placeholder { color: var(--muted); }
input[type=search]:focus, .wp input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); background: var(--glass-strong); }
.searchbox input[type=search] { padding-left: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%238e8e93'%3E%3Cpath d='M10 2a8 8 0 016.32 12.9l5.39 5.4-1.41 1.4-5.4-5.39A8 8 0 1110 2zm0 2a6 6 0 100 12 6 6 0 000-12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center; background-size: 18px; }

.icon { border: 0; background: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; transition: background .15s, transform .1s; }
.icon:hover { background: var(--hover); }
.icon:active { transform: scale(.94); }
.icon svg { width: 22px; height: 22px; fill: var(--accent); }
.icon.small { width: 34px; height: 34px; font-size: 18px; }
#btn-directions { background: var(--accent); }
#btn-directions svg { fill: var(--accent-fg); }
#btn-directions:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }

/* Ergebnislisten */
.results { list-style: none; margin: 8px 0 0; padding: 0; }
.results li { padding: 10px 10px; border-radius: 14px; cursor: pointer; transition: background .12s; }
.results li + li { margin-top: 2px; }
.results li:hover, .results li.active { background: var(--hover); }
.results li.active { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.results .title { font-weight: 600; font-size: 15px; }
.results .sub { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.results li.hint .title { color: var(--accent); }

/* ------------------------------------------------------------- Routenplanung */
.route-head { display: flex; align-items: center; gap: 6px; }
/* Segment-Steuerung wie bei iOS */
.profiles { display: flex; flex: 1; gap: 2px; padding: 3px; border-radius: 14px; background: var(--fill); }
.profiles button { flex: 1; border: 0; background: none; font-size: 19px; padding: 6px 0; border-radius: 11px; transition: background .15s, box-shadow .15s; }
.profiles button.active { background: var(--glass-strong); box-shadow: 0 2px 8px rgba(0, 0, 0, .14), var(--highlight); }
.waypoints { position: relative; display: grid; gap: 8px; margin: 12px 44px 0 0; }
.wp { display: flex; align-items: center; gap: 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); }
.dot.start { background: var(--start); color: var(--start); } .dot.end { background: var(--end); color: var(--end); }
#btn-swap { position: absolute; right: -44px; top: 50%; transform: translateY(-50%); background: var(--fill); }
.options { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin: 12px 0 0 22px; align-items: center; }
.options label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.options input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.options[hidden] { display: none; }

#route-summary { padding: 10px 10px 4px; }
#route-summary .big { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--start); }
#route-summary .sub { color: var(--muted); }
.search-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.search-status .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.search-status .lg { display: inline-flex; gap: 4px; align-items: center; }
.search-status .lg i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
@keyframes pulse { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.1); opacity: 1; } }
#maneuvers { margin: 6px 0 0; padding: 0 0 0 30px; font-size: 14px; }
#maneuvers li { padding: 9px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
#maneuvers li:last-child { border-bottom: 0; }
#maneuvers li:hover { background: var(--hover); }
#maneuvers .dist { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ÖPNV */
.chip { display: inline-block; padding: 2px 8px; border-radius: 7px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chips { line-height: 2; }
#transit-time input[type=datetime-local] { font: inherit; font-size: 13px; padding: 6px 10px; border: 0;
  border-radius: 10px; background: var(--fill); color: var(--fg); }

/* ------------------------------------------------------------- Schaltknöpfe rechts */
.fab {
  position: absolute; right: 12px; bottom: 180px; z-index: 2; width: 48px; height: 48px;
  border-radius: 50%; display: grid; place-items: center; transition: transform .12s, background .15s;
}
.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(.95); }
.fab svg { width: 24px; height: 24px; fill: var(--muted); }
.fab2 { bottom: 236px; }
.fab3 { bottom: 292px; }
.fab4 { bottom: 348px; }
.fab.active { background: var(--accent); border-color: transparent; }
.fab.active svg { fill: #fff; }

/* MapLibre-Bedienelemente im Glas-Stil */
.maplibregl-ctrl-group { border-radius: 16px !important; overflow: hidden; }
.maplibregl-ctrl-group:not(:empty) { box-shadow: var(--shadow-sm), var(--highlight) !important; }
.maplibregl-ctrl-group button { width: 38px !important; height: 38px !important; background-color: transparent !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.maplibregl-ctrl-group button:hover { background-color: var(--hover) !important; }
@media (prefers-color-scheme: dark) { .maplibregl-ctrl-group .maplibregl-ctrl-icon { filter: invert(1); } }
.maplibregl-ctrl-scale { background: var(--glass) !important; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-radius: 6px; border-color: var(--muted) !important; color: var(--fg) !important; }

/* Quellenangabe: nur "i", Klick zeigt den Text */
.info-ctrl { display: flex; align-items: center; gap: 6px; flex-direction: row-reverse; }
.info-btn { width: 26px; height: 26px; border-radius: 50%; color: var(--muted); font: italic 600 14px/24px Georgia, serif; padding: 0; box-shadow: var(--shadow-sm), var(--highlight); }
.info-btn[aria-expanded=true] { color: var(--accent); }
.info-text { color: var(--fg); font-size: 12px; padding: 5px 12px; border-radius: 14px; white-space: nowrap; box-shadow: var(--shadow-sm); }
.info-text[hidden] { display: none; }
.info-text a { color: var(--accent); text-decoration: none; }

/* ------------------------------------------------------------- Meldungen & Popups */
#toast {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 5;
  color: var(--fg); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: var(--glass-strong); animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

.maplibregl-popup-content { color: var(--fg); border-radius: 18px; padding: 14px 16px; min-width: 230px; background: var(--glass-strong); }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { font-size: 20px; right: 6px; top: 4px; color: var(--muted); border-radius: 50%; width: 28px; height: 28px; }
.maplibregl-popup-close-button:hover { background: var(--hover); }
.popup .title { font-weight: 650; font-size: 15px; padding-right: 18px; }
.popup .sub { font-size: 13px; color: var(--muted); margin: 3px 0 8px; line-height: 1.35; }
.popup .coords { font-family: ui-monospace, "SF Mono", monospace; font-size: 12px; color: var(--muted); cursor: copy; }
.popup .detail { font-size: 13px; margin: 4px 0; word-break: break-word; }
.popup .detail a { color: var(--accent); text-decoration: none; }
.popup .actions { display: flex; gap: 8px; margin-top: 12px; }
.popup .actions button { flex: 1; border: 0; background: var(--fill); border-radius: 12px; padding: 8px 8px; font-size: 13px; font-weight: 600; color: var(--accent); }
.popup .actions button:last-child { background: var(--accent); color: #fff; }
.popup .actions button:hover { filter: brightness(1.05); }

/* ------------------------------------------------------------- POI-Suche */
.results li.poi { display: flex; gap: 12px; align-items: flex-start; }
.results li.poi .ico { font-size: 20px; line-height: 1; width: 36px; height: 36px; display: grid; place-items: center; flex: none;
  border-radius: 50%; background: var(--fill); }
.results .oh { font-size: 12px; }
.poi-title { flex: 1; font-weight: 650; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-btn { display: block; margin: 8px auto 0; border: 0; background: var(--accent); color: #fff; font-weight: 600;
  border-radius: 999px; padding: 8px 16px; font-size: 13px; box-shadow: var(--shadow-sm); }
.area-btn[hidden] { display: none; }
.poi-marker { font-size: 17px; line-height: 1; width: 34px; height: 34px; display: grid; place-items: center; background: #fff;
  border-radius: 50%; box-shadow: var(--shadow-sm); cursor: pointer; border: 2.5px solid var(--end); transition: transform .12s; }
.poi-marker:hover { transform: scale(1.15); }

/* POI-Ebene: Kategorien-Auswahl */
.poi-panel { position: absolute; right: 72px; bottom: 180px; z-index: 3; width: 340px; max-height: calc(100% - 180px); overflow-y: auto;
  border-radius: var(--radius); padding: 12px 14px 14px; font-size: 13px; background: var(--glass-strong); }
.poi-panel[hidden] { display: none; }
.pp-head { display: flex; align-items: center; justify-content: space-between; }
.pp-head .switch { font-size: 15px; display: flex; gap: 8px; align-items: center; cursor: pointer; }
.pp-head .switch input { accent-color: var(--accent); width: 18px; height: 18px; }
.pp-actions { margin: 6px 0 6px; color: var(--muted); }
.pp-actions button { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 600; }
.pp-actions .sub { display: block; font-size: 12px; margin-top: 3px; }
.zoom-hint { background: var(--fill); border-radius: 10px; padding: 7px 10px; margin: 6px 0; }
.zoom-hint[hidden] { display: none; }
.poi-panel .grp { font-weight: 650; margin: 12px 0 6px; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chip { border: 0; background: var(--fill); border-radius: 999px; padding: 5px 11px 5px 7px; font-size: 12.5px;
  display: inline-flex; gap: 5px; align-items: center; color: var(--fg); transition: background .12s, box-shadow .12s; }
.cat-chip:hover { background: var(--hover); }
.cat-chip.on { background: color-mix(in srgb, var(--c) 20%, var(--glass-strong)); box-shadow: inset 0 0 0 1.5px var(--c); font-weight: 600; }

/* ------------------------------------------------------------- Handy */
@media (max-width: 600px) {
  #panel { left: 8px; right: 8px; top: 8px; width: auto; max-height: 55%; border-radius: 20px; }
  .info-text { white-space: normal; max-width: calc(100vw - 60px); }
  .poi-panel { right: 8px; left: 8px; width: auto; bottom: 180px; max-height: 45%; }
  .fab { right: 10px; }
}

/* Verkehr in der Routenplanung */
.jam-text { color: var(--end); font-weight: 600; }
#route-summary .big.late { color: #d97706; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.badge.detour { background: color-mix(in srgb, var(--start) 18%, transparent); color: var(--start); }
.detour-box { margin-top: 8px; padding: 8px 10px; border-radius: 12px; font-size: 13px; line-height: 1.4;
  background: color-mix(in srgb, var(--start) 14%, transparent); border: 1px solid color-mix(in srgb, var(--start) 35%, transparent); }
#maneuvers li.traffic-item { list-style: none; margin-left: -22px; background: color-mix(in srgb, var(--end) 8%, transparent); border-radius: 10px; margin-bottom: 4px; border-bottom: 0; }

/* =====================================================================
   Routenplanung im Stil von Google Maps
   ===================================================================== */
#route-view { padding: 10px 12px 14px; }
.rv-top { display: flex; align-items: flex-start; gap: 4px; }
.modes { flex: 1; display: flex; gap: 2px; }
.modes button { flex: 1; border: 0; background: none; border-radius: 16px; padding: 6px 2px 4px; display: grid; justify-items: center; gap: 2px;
  color: var(--muted); transition: background .15s; min-width: 0; }
.modes button:hover { background: var(--hover); }
.modes .mi { font-size: 20px; line-height: 28px; width: 52px; border-radius: 14px; transition: background .15s; }
.modes .mt { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; min-height: 15px; }
.modes button.active .mi { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.modes button.active .mt { color: var(--fg); font-weight: 700; }
#btn-back svg { fill: var(--fg); }

.stops-wrap { position: relative; display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.stops { flex: 1; display: grid; gap: 10px; }
.stop-row { position: relative; display: flex; align-items: center; gap: 12px; }
.stop-row input { flex: 1; min-width: 0; font-size: 15px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--glass-strong); color: var(--fg); outline: none; transition: border-color .15s, box-shadow .15s; }
.stop-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.stop-ico { width: 18px; flex: none; display: grid; place-items: center; position: relative; }
.stop-ico.start::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--fg); box-sizing: border-box; }
.stop-ico.end::before { content: ''; width: 14px; height: 14px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--end);
  box-shadow: inset 0 0 0 4px var(--end), inset 0 0 0 7px #fff; }
.stop-ico.via { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); font-size: 10px; font-weight: 700; color: var(--muted); }
/* gepunktete Verbindung zwischen den Symbolen */
.stop-row:not(:last-child) .stop-ico::after { content: ''; position: absolute; left: 50%; top: 16px; height: 26px;
  border-left: 2.5px dotted var(--muted); transform: translateX(-50%); }
.stop-row .rm { border: 0; background: none; color: var(--muted); width: 28px; height: 28px; border-radius: 50%; flex: none; }
.stop-row .rm:hover { background: var(--hover); color: var(--fg); }
.results.suggest { margin: -4px 0 0 30px; background: var(--glass-strong); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 4px; }
#btn-swap { position: static; transform: none; background: none; }
#btn-swap svg { fill: var(--fg); }
#btn-swap[hidden] { display: none; }

.add-stop { display: flex; align-items: center; gap: 12px; border: 0; background: none; color: var(--muted); font-size: 15px; padding: 10px 0 2px; }
.add-stop .plus { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--fg); color: var(--fg); display: grid; place-items: center;
  font-weight: 700; font-size: 16px; line-height: 1; margin-left: -1px; }
.add-stop:hover { color: var(--fg); }
.add-stop[hidden] { display: none; }

.rv-when { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 0 30px; }
.when-select { display: inline-flex; align-items: center; gap: 6px; background: var(--fill); border-radius: 10px; padding: 0 10px; }
.when-select select { border: 0; background: transparent; color: var(--fg); font: inherit; font-size: 14px; font-weight: 600; padding: 8px 2px; cursor: pointer; outline: none; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 14px; padding: 6px 4px; border-radius: 8px; }
.link-btn:hover { background: var(--hover); }
.when-row { margin: 8px 0 0 30px; }
.when-row[hidden] { display: none; }
.when-row input { font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass-strong); color: var(--fg); }
.route-options { display: grid; gap: 6px; margin: 10px 0 0 30px; font-size: 14px; }
.route-options[hidden] { display: none; }
.route-options label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.route-options input { accent-color: var(--accent); width: 16px; height: 16px; }
.rv-share { display: flex; justify-content: flex-end; border-top: 6px solid var(--fill); margin: 12px -12px 0; padding: 6px 12px 0; }

.route-msg { padding: 10px 4px; color: var(--muted); font-size: 14px; }
.detour-text { color: var(--start); font-weight: 600; }

/* Routen-Karten */
.route-list { list-style: none; margin: 4px -12px 0; padding: 0; }
.route-card { display: grid; grid-template-columns: 40px 1fr auto; gap: 4px 8px; padding: 14px 14px 14px 10px;
  border-top: 1px solid var(--line); cursor: pointer; border-left: 4px solid transparent; transition: background .12s; }
.route-card:hover { background: var(--hover); }
.route-card.active { border-left-color: var(--accent); }
.rc-ico { font-size: 20px; padding-top: 2px; text-align: center; }
.rc-title { font-weight: 650; font-size: 16px; line-height: 1.3; }
.rc-sub { color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.4; }
.rc-right { text-align: right; white-space: nowrap; }
.rc-time { color: var(--start); font-weight: 700; font-size: 17px; }
.rc-time.warn { color: #d97706; } .rc-time.bad { color: var(--end); }
.rc-dist { color: var(--muted); font-size: 13px; margin-top: 3px; }
.rc-links { display: flex; gap: 18px; margin-top: 8px; }
.rc-links button { border: 0; background: none; padding: 4px 0; color: var(--accent); font-weight: 600; font-size: 14px; }
.route-card .maneuvers { grid-column: 1 / -1; margin: 8px 0 0; padding: 0 0 0 30px; font-size: 14px; cursor: default; }
.route-card .maneuvers li { padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.route-card .maneuvers li:hover { background: var(--hover); }
.route-card .maneuvers .dist { color: var(--muted); font-size: 12px; margin-top: 2px; }
.route-card .maneuvers li.traffic-item { list-style: none; margin-left: -22px; background: color-mix(in srgb, var(--end) 8%, transparent); border-bottom: 0; margin-bottom: 4px; }
#route-summary:empty { display: none; }
#route-summary { padding: 8px 4px 0; }
