/* Immer helles, cremefarbenes Design. Kein automatischer Dunkelmodus. */
:root {
  color-scheme: light;
  --bg: #f5efe4;
  --surface: #fffcf5;
  --surface-2: #f0e8d9;
  --text: #2b2721;
  --muted: #6f675a;
  --border: #e2d9c8;
  --accent: #8a6a3a;
  --accent-soft: #f1e6d0;
  --ok: #3f7d5a;
  --ok-soft: #e2efe3;
  --out: #a9442f;
  --out-soft: #f6e2dc;
  --gray: #9a9184;
  --shadow: 0 8px 28px rgba(70, 50, 20, 0.12);
  --radius: 14px;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-body);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1, h2 { font-family: var(--font-display); font-weight: 500; letter-spacing: 0.01em; }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-icon { font-size: 28px; }
.brand h1 { font-size: 24px; line-height: 1.15; }
.summary { margin: 0; color: var(--muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.tabs { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.tab {
  border: 0; background: transparent; padding: 6px 16px; border-radius: 999px; cursor: pointer;
  color: var(--muted); font-weight: 600;
}
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(70, 50, 20, 0.16); }

/* Filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); min-width: 140px; }
.filters label.grow { flex: 1 1 220px; }
.filters-toggle, .filters-toggle[hidden] { display: none; }
.filters select, .filters input {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 10px; min-width: 0; width: 100%;
}
.filters select:focus, .filters input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-ghost { background: transparent; }
.btn-icon { padding: 4px 9px; }
.btn-out { color: var(--out); }
.btn-out:hover { background: var(--out-soft); border-color: var(--out); }
.btn-restore { color: var(--ok); }
.btn-restore:hover { background: var(--ok-soft); border-color: var(--ok); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #75592f; }
.btn-fav { color: var(--accent); }
.btn-fav.is-on { background: var(--accent-soft); border-color: var(--accent); }
.btn-fav:hover { background: var(--accent-soft); border-color: var(--accent); }
.filters.is-hidden { display: none; }

/* Entfernung ab Bremen */
.travel { color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.tip-muted { color: var(--muted); }
.panel-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 0 4px; }
.city-actions { display: inline-flex; }

/* Favoriten */
.view-fav { overflow: auto; }
.fav-page { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; }
.fav-head h2 { font-size: 28px; }
.fav-intro { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.fav-list { list-style: none; margin: 16px 0 0; padding: 0; }
.fav-list .empty { padding: 32px 16px; }
.fav {
  display: flex; align-items: center; gap: 14px; margin-top: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px;
}
.fav-rank { font-family: var(--font-display); font-size: 28px; line-height: 1; color: var(--accent); width: 34px; text-align: center; flex-shrink: 0; }
.fav-main { flex: 1; min-width: 0; }
.fav-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fav-name h3 { font-size: 17px; }
.fav.is-out .fav-name h3 { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--out); }
.fav-meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.fav-actions { display: flex; gap: 4px; flex-shrink: 0; }
.fav-add { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--border); }
.fav-add label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); flex: 1 1 240px; }
.fav-add select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; width: 100%; }
.fav-count { color: var(--muted); font-size: 13px; align-self: center; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; vertical-align: middle;
}
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-out { background: var(--out-soft); color: var(--out); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-note { background: var(--surface-2); color: var(--muted); font-weight: 500; }
.badge-local { background: #fbeec7; color: #6b4f00; }

/* Main views */
main { flex: 1; display: flex; min-height: 0; }
.view { flex: 1; min-height: 0; }
.view[hidden] { display: none; }
.view-map { position: relative; display: flex; }
#map { flex: 1; min-height: 60vh; background: var(--surface-2); z-index: 0; }

.legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 500;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; color: var(--muted); box-shadow: var(--shadow);
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-hint { color: var(--muted); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-active { background: var(--ok); }
.dot-out { background: var(--gray); opacity: 0.7; }

/* Side panel */
.panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(440px, calc(100% - 24px));
  z-index: 600; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.panel[hidden] { display: none; }
.panel:focus { outline: none; }
.panel .program-name { flex-basis: 140px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 20px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-body { overflow: auto; padding: 8px 14px 14px; }

/* List */
.view-list { overflow: auto; }
.list { max-width: 1000px; margin: 0 auto; padding: 12px 16px 40px; }
.empty { color: var(--muted); text-align: center; padding: 48px 16px; }
.empty-sm { padding: 8px 4px; text-align: left; margin: 0; }

.group { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.group-state > .group-head { background: var(--surface-2); padding-top: 12px; padding-bottom: 12px; }
.group-head h2 { font-size: 20px; }
.group-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.group-head h3 { font-size: 15px; }
.group-head h4 { font-size: 14px; }
.group-head .count { color: var(--muted); font-size: 12.5px; font-weight: 500; margin-left: auto; }
.group.is-out > .group-head h2,
.group.is-out > .group-head h3,
.group.is-out > .group-head h4 { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--out); text-decoration-thickness: 2px; }
.group-body { padding: 4px 10px 10px; }
.group-city { margin: 10px 0 0; }
.group-uni { margin: 8px 0 0; }
.uni-name { color: var(--muted); font-weight: 500; font-size: 12.5px; }

.programs { list-style: none; margin: 0; padding: 0; }
.program {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 4px; border-top: 1px dashed var(--border);
}
.program:first-child { border-top: 0; }
.program-name { flex: 1 1 240px; font-weight: 500; }
.program.is-out .program-name { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--out); }
.program-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.program-actions { margin-left: auto; }
.lock { color: var(--muted); font-size: 12px; }

/* Karte: Kacheln leicht entsättigt und wärmer, damit sie zum Creme-Ton passen. */
.leaflet-tile { filter: saturate(0.55) sepia(0.18) brightness(1.02); }
.leaflet-tooltip.city-tip { font: 12.5px/1.3 var(--font-body); border-radius: 8px; border-color: var(--border); }
.leaflet-container { font: inherit; }
.leaflet-bar a { color: var(--text) !important; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 2000;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  box-shadow: var(--shadow); font-size: 14px; max-width: calc(100% - 32px);
}
.toast[hidden] { display: none; }

/* Mobile */
@media (max-width: 720px) {
  body { overflow-x: hidden; }
  .topbar { flex-wrap: wrap; gap: 10px 16px; }
  .topbar-right { width: 100%; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
  .legend {
    left: auto; right: 12px; top: 12px; bottom: auto;
    flex-direction: column; align-items: flex-start; gap: 3px; padding: 6px 8px;
  }
  .legend .legend-hint { display: none; }
  .list { padding-left: 12px; padding-right: 12px; }
  .filters-toggle { display: inline-block; }
  .filters.is-collapsed { display: none; }
  .filters label { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .filters label.grow { flex-basis: 100%; }
  .filters select, .filters input { min-width: 0; max-width: 100%; }
  #f-reset { flex: 1 1 calc(50% - 5px); }
  .panel {
    top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 62%;
  }
  .group-head .count { margin-left: 0; width: 100%; }
  .fav { flex-wrap: wrap; }
  .fav-actions { width: 100%; justify-content: flex-end; }
}
