/* Dunkles Design angelehnt an die EnBW-App */
:root {
  --bg: #1c1c1e;
  --surface: #2a2a2c;
  --surface-2: #343437;
  --line: #3a3a3d;
  --text: #f2f2f2;
  --muted: #9a9aa0;
  --accent: #4a90e2;
  --green: #6cc04a;
  --red: #e5484d;
  --orange: #f08a24;
  --enbw-blue: #000099;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
h2 { font-size: 18px; margin: 0; text-align: center; }
h3 { color: var(--muted); font-size: 16px; margin: 24px 0 12px; }
small { display: block; color: var(--muted); }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
[hidden] { display: none !important; }

#map { position: absolute; inset: 0; background: #222; }
.leaflet-control-attribution { font-size: 10px; }

button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.icon-btn { background: none; border: 0; padding: 10px; position: relative; display: grid; place-items: center; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); }

.topbar { position: absolute; z-index: 1000; top: calc(12px + var(--safe-top)); left: 12px; right: 12px;
  display: flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 14px; padding: 4px 6px; box-shadow: 0 4px 16px #0008; }
.topbar input { flex: 1; background: none; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  color: var(--text); padding: 10px 14px; outline: none; font-size: 17px; }
.suggestions { list-style: none; margin: 0; padding: 4px 0; background: var(--surface); border-radius: 12px; }
.topbar .suggestions { position: absolute; top: 100%; left: 0; right: 0; margin-top: 6px; box-shadow: 0 4px 16px #0008; }
.suggestions li { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.suggestions li:last-child { border-bottom: 0; }
.suggestions.inline { margin-top: 6px; }

.side-buttons { position: absolute; z-index: 900; right: 12px; bottom: calc(110px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.btn-group { background: var(--bg); border-radius: 14px; display: flex; flex-direction: column; box-shadow: 0 4px 16px #0008; }
.btn-group .icon-btn { padding: 14px; }
.btn-group .icon-btn + .icon-btn { border-top: 1px solid var(--line); }
.fab { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 16px #0008; }
.fab svg { width: 30px; height: 30px; }

.pill { position: absolute; z-index: 900; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--safe-bottom));
  display: flex; gap: 10px; align-items: center; border: 0; border-radius: 999px; background: var(--accent); color: #fff;
  padding: 14px 28px; font-size: 17px; font-weight: 600; box-shadow: 0 4px 16px #0008; white-space: nowrap; }

.toast { position: absolute; z-index: 3000; left: 50%; transform: translateX(-50%); top: calc(80px + var(--safe-top));
  background: var(--surface-2); padding: 10px 16px; border-radius: 12px; max-width: 90vw; box-shadow: 0 4px 16px #0008; }
.toast.error { background: #5a1e20; }

/* Sheets */
.sheet { position: absolute; z-index: 2000; left: 0; right: 0; bottom: 0; max-height: 85vh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 20px 20px 0 0; box-shadow: 0 -4px 24px #000a; }
.sheet.full { top: calc(var(--safe-top) + 8px); max-height: none; }
.sheet-head { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; padding: 12px 12px 4px; }
.sheet-head .close { font-size: 22px; }
.sheet-body { overflow-y: auto; padding: 8px 20px 24px; flex: 1; }
.sheet-foot { padding: 12px 20px calc(16px + var(--safe-bottom)); gap: 12px; }
.primary { width: 100%; border: 0; border-radius: 999px; background: var(--accent); color: #fff; padding: 16px; font-size: 18px; font-weight: 600; }
.secondary { width: 100%; border: 2px solid var(--accent); border-radius: 999px; background: none; color: var(--accent); padding: 14px; font-size: 18px; font-weight: 600; text-align: center; text-decoration: none; }

.field { display: block; margin-bottom: 16px; color: var(--muted); }
.field input:not([type=range]) { width: 100%; margin-top: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text); padding: 12px 14px; }
.field .row input { margin-top: 6px; }
.field strong, .field span { color: var(--text); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-top: 6px; }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.list { padding: 0; }
.note { background: var(--surface); border-radius: 12px; padding: 12px 14px; color: var(--muted); font-size: 14px; }
.presets { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.presets button { flex: none; border: 0; background: var(--surface); border-radius: 10px; padding: 8px 16px; font-weight: 600; }
.presets button.active { background: var(--accent); color: #fff; }
.scale { display: flex; justify-content: space-between; font-size: 13px; color: var(--text); margin-top: 4px; }

input[type=range] { width: 100%; accent-color: var(--accent); }
.dual-range { position: relative; height: 28px; }
.dual-range input { position: absolute; left: 0; right: 0; top: 0; margin: 0; pointer-events: none; background: none; -webkit-appearance: none; appearance: none; height: 28px; }
.dual-range input::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); border: 0; }
.dual-range input::-moz-range-thumb { pointer-events: auto; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); border: 0; }
.dual-range input:first-child::-webkit-slider-runnable-track { height: 6px; background: var(--surface-2); border-radius: 3px; margin-top: 11px; }
.dual-range input::-webkit-slider-runnable-track { height: 6px; }
.dual-range input::-webkit-slider-thumb { margin-top: -10px; }

.stepper { display: flex; align-items: center; justify-content: space-between; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 22px; }

.toggle-row { display: flex; align-items: center; gap: 14px; padding: 16px; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row > span:not(.enbw-logo) { flex: 1; }
.toggle-row input { -webkit-appearance: none; appearance: none; width: 52px; height: 30px; border-radius: 15px; background: var(--surface-2); position: relative; flex: none; transition: background .2s; }
.toggle-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; }
.toggle-row input:checked { background: var(--accent); }
.toggle-row input:checked::after { left: 25px; }
.enbw-logo { width: 46px; height: 46px; border-radius: 50%; background: #f4efe6; color: var(--enbw-blue); display: grid; place-items: center; font-weight: 800; font-size: 20px; flex: none; }

.tiles { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.tile { flex: none; width: 86px; text-align: center; background: none; border: 0; padding: 0; color: var(--text); }
.tile .box { width: 76px; height: 76px; margin: 0 auto 6px; border: 2px solid var(--line); border-radius: 14px; display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.tile.active .box { border-color: var(--accent); color: var(--accent); }
.tile span { font-size: 14px; }

/* Marker */
.pin { position: relative; width: 44px; height: 54px; }
.pin .body { position: absolute; left: 2px; top: 0; width: 40px; height: 40px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--green); box-shadow: 0 2px 6px #0008; }
.pin.none .body { background: var(--red); }
.pin.unknown .body { background: #9a9a9a; }
.pin .txt { position: absolute; left: 0; right: 0; top: 10px; text-align: center; color: #fff; font-weight: 700; font-size: 13px; }
.pin .badge { position: absolute; top: -6px; right: -2px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; }
.pin .badge.enbw { background: var(--enbw-blue); color: #fff; }
.pin .badge.partner { background: #fff; color: #222; }
.pin .kw { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); background: #fff; color: #111; border-radius: 8px; font-size: 11px; padding: 0 5px; white-space: nowrap; font-weight: 600; }
.pin.stop .body { outline: 3px solid #fff; }
.pin .stopnr { position: absolute; top: -10px; left: -6px; background: var(--accent); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 2px solid #fff; }
.pin.faded { opacity: .45; }
.group-marker { width: 40px; height: 40px; border-radius: 50%; background: #7da7e0; border: 2px solid #4f79b3; color: #fff; display: grid; place-items: center; font-weight: 700; }
.flag { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; background: var(--accent); box-shadow: 0 1px 4px #0009; }
.flag.dest { background: var(--orange); }

/* Ergebnis-Panel */
.panel { position: absolute; z-index: 1500; left: 0; right: 0; bottom: 0; height: 46vh; background: var(--bg); border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px #000a; display: flex; flex-direction: column; transition: height .2s; }
.panel.collapsed { height: 120px; }
.grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto; cursor: pointer; flex: none; }
.panel-body { overflow-y: auto; padding: 0 16px calc(16px + var(--safe-bottom)); }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.summary div { background: var(--surface); border-radius: 12px; padding: 10px; text-align: center; }
.summary strong { display: block; font-size: 18px; }
.summary span { color: var(--muted); font-size: 12px; }
.stop-card, .st-row { background: var(--surface); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.stop-card { border-left: 4px solid var(--accent); }
.stop-card .title, .st-row .title { font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 14px; margin-top: 4px; }
.avail { display: inline-block; border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: 14px; background: #2c3a22; color: var(--green); }
.avail.none { background: #3d2224; color: var(--red); }
.avail.unknown { background: var(--surface-2); color: var(--muted); }
.soc { font-weight: 700; }
.soc.low { color: var(--red); }
.soc.mid { color: var(--orange); }
.soc.ok { color: var(--green); }
.section-title { color: var(--muted); font-size: 14px; margin: 16px 0 8px; }
.warn { background: #3d2a12; color: #f5c27a; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px; }

/* Stationsdetails */
.st-name { font-size: 22px; font-weight: 700; margin: 8px 0 6px; }
.st-line { margin: 6px 0; }
.st-head { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; }
.equip { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.equip .plug { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; background: var(--surface); border-radius: 12px; padding: 12px 14px; }
.kv > span:nth-child(odd) { color: var(--muted); }

.legend .lg-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; }
.legend .pin { transform: scale(.9); }

.settings .field input { text-align: right; }

.operators { padding: 0 16px 16px; }
.operators ul { list-style: none; margin: 0 0 10px; padding: 0; }
.operators li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.operators li button { background: none; border: 0; color: var(--muted); font-size: 18px; padding: 4px 8px; }
.operators input { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text); padding: 11px 12px; margin-top: 6px; min-width: 0; }
#station-body .secondary { margin-top: 4px; }

/* Bedienung unterwegs: große Ziele, wenige Tipps */
.big-dest { display: block; width: 100%; text-align: left; background: var(--surface); border: 0; border-radius: 14px; padding: 16px; margin-bottom: 8px; font-size: 19px; font-weight: 600; min-height: 64px; }
.big-dest small { font-size: 14px; font-weight: 400; margin-top: 2px; }
.primary.big { display: block; text-align: center; text-decoration: none; font-size: 20px; padding: 18px; margin: 10px 0 14px; }
.next-stop { background: var(--surface); border-radius: 16px; padding: 14px 16px; border-left: 5px solid var(--accent); cursor: pointer; }
.next-name { font-size: 21px; font-weight: 700; margin: 2px 0 4px; }
.soc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.soc-bar button { width: 64px; height: 56px; border-radius: 14px; border: 0; background: var(--surface-2); font-size: 28px; }
.soc-bar div { text-align: center; flex: 1; }
.soc-bar strong { display: block; font-size: 26px; }
.panel { height: 58vh; }

.panel-top { position: relative; flex: none; }
.panel-top .icon-btn { position: absolute; right: 8px; top: 0; font-size: 20px; color: var(--muted); }
.grip { width: 60px; height: 6px; margin: 14px auto 12px; }
body.has-result .side-buttons { bottom: calc(58vh + 12px); }
body.has-result .side-buttons .btn-group { display: none; }
body.has-result.result-collapsed .side-buttons { bottom: 132px; }
