:root {
  --bg: #0f1216;
  --panel: #171c22;
  --panel-2: #1e252d;
  --border: #2a333d;
  --text: #e6edf3;
  --muted: #93a1b0;
  --accent: #4aa3ff;
  --accent-2: #ff5a4d;
  --home: #ffcc33;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

#app {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: 100vh;
}

/* ---------- Seitenleiste ---------- */
#sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar header {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
}
#sidebar header h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.2px;
}
#sidebar header p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.controls {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modeswitch {
  display: flex;
  gap: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 4px;
}
.modeswitch button {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 6px;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.modeswitch button.active {
  background: var(--accent);
  color: #04121f;
}

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 18px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: var(--panel-2);
  color: var(--text);
}
.dropzone strong { color: var(--text); }

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04121f; font-weight: 600; }

.filter {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.filter input[type="date"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 12.5px;
  color-scheme: dark;
}

.status {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.status b { color: var(--text); }

/* ---------- Stationsliste ---------- */
#stations {
  overflow-y: auto;
  padding: 6px 10px 20px;
  flex: 1;
}
.station {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 9px;
  cursor: pointer;
}
.station:hover { background: var(--panel-2); }
.station .idx {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #04121f;
  font-weight: 700;
  font-size: 12.5px;
  display: grid;
  place-items: center;
}
.station.home .idx { background: var(--home); }
.station .body { flex: 1; min-width: 0; }
.station .body .t { font-size: 13.5px; font-weight: 600; }
.station .body .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.empty-hint {
  color: var(--muted);
  font-size: 13px;
  padding: 24px 14px;
  text-align: center;
  line-height: 1.6;
}

/* ---------- Karte ---------- */
#map { width: 100%; height: 100%; }

.map-marker {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #04121f;
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.5);
  cursor: pointer;
}
.map-marker.home { background: var(--home); }
.map-marker.start { background: #35c46a; }
.map-marker.finish { background: var(--accent-2); }
.map-marker.dot {
  width: 15px; height: 15px;
  font-size: 0;
  border-width: 2px;
  background: var(--accent);
}
.station.start .idx { background: #35c46a; }
.station.finish .idx { background: var(--accent-2); }

/* ---------- Foto-Galerie & Lightbox ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 11, 15, 0.94);
  display: flex;
  flex-direction: column;
}
.overlay[hidden] { display: none; }

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.gallery-title { font-size: 16px; font-weight: 600; }
.gallery-title span { color: var(--muted); font-weight: 400; font-size: 13.5px; margin-left: 8px; }

.icon-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px; height: 36px;
  font-size: 17px;
  cursor: pointer;
  flex: 0 0 auto;
}
.icon-btn:hover { border-color: var(--accent); }

.gallery-grid {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  align-content: start;
}
.gallery-grid .cell {
  position: relative;
  aspect-ratio: 1;
  background: var(--panel-2);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
}
.gallery-grid .cell img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}
.gallery-grid .cell:hover img { transform: scale(1.05); }
.gallery-grid .cell .ph {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: var(--muted); font-size: 12px; text-align: center; padding: 8px;
}
.gallery-grid .cell .badge-thumb {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 10px; padding: 2px 6px; border-radius: 5px;
}

.lb-img {
  max-width: 92vw;
  max-height: 82vh;
  margin: auto;
  object-fit: contain;
  border-radius: 6px;
}
.lb-close { position: absolute; top: 16px; right: 20px; z-index: 2; }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(30,37,45,.7);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 48px; height: 48px;
  font-size: 26px; line-height: 1;
  cursor: pointer;
}
.lb-nav:hover { border-color: var(--accent); }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-caption {
  position: absolute;
  bottom: 18px; left: 0; right: 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.maplibregl-popup-content {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.maplibregl-popup-content strong { display:block; margin-bottom:2px; }
.maplibregl-popup-tip { border-top-color: var(--panel-2) !important; border-bottom-color: var(--panel-2) !important; }
