/* Zugfinder – eigene Styles zusätzlich zu Bootstrap 5.3 */

:root {
  --zf-brand: #ec0016;
  --zf-bottom-nav-height: 64px;
  --bs-primary: #ec0016;
  --bs-primary-rgb: 236, 0, 22;
  --bs-link-color: #c50014;
  --bs-link-color-rgb: 197, 0, 20;
  --bs-link-hover-color: #9a0010;
}

[data-bs-theme="dark"] {
  --bs-link-color: #ff6b77;
  --bs-link-color-rgb: 255, 107, 119;
  --bs-link-hover-color: #ff97a0;
}

.btn-primary {
  --bs-btn-bg: var(--zf-brand);
  --bs-btn-border-color: var(--zf-brand);
  --bs-btn-hover-bg: #c50014;
  --bs-btn-hover-border-color: #c50014;
  --bs-btn-active-bg: #a80011;
  --bs-btn-active-border-color: #a80011;
  --bs-btn-disabled-bg: var(--zf-brand);
  --bs-btn-disabled-border-color: var(--zf-brand);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: .5rem;
  background: var(--zf-brand);
  color: #fff;
}

.form-control:focus, .form-select:focus {
  border-color: rgba(var(--bs-primary-rgb), .5);
  box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .15);
}

.search-tabs .nav-link { white-space: nowrap; }
.search-tabs .nav-link.active { color: var(--zf-brand); font-weight: 600; }

/* Bottom-Navigation (Mobil) */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: flex;
  height: calc(var(--zf-bottom-nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  font-size: .72rem;
  color: var(--bs-secondary-color);
  text-decoration: none;
}

.bottom-nav a .bi { font-size: 1.35rem; }
.bottom-nav a.active { color: var(--zf-brand); font-weight: 600; }

@media (max-width: 767.98px) {
  .footer-space { padding-bottom: calc(var(--zf-bottom-nav-height) + env(safe-area-inset-bottom) + 1rem) !important; }
}

/* Große Touch-Ziele */
.list-group-item-action, .btn { min-height: 44px; }

/* ---- Admin ---- */
.admin-sidebar { width: 240px; }
.admin-sidebar .nav-link { color: var(--bs-body-color); border-radius: .5rem; }
.admin-sidebar .nav-link.active { background: rgba(var(--bs-primary-rgb), .1); color: var(--zf-brand); font-weight: 600; }
.admin-sidebar .nav-link:hover:not(.active) { background: var(--bs-tertiary-bg); }

@media (min-width: 992px) {
  .admin-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}

.test-result { font-size: .875rem; }
.font-monospace-sm { font-family: var(--bs-font-monospace); font-size: .85em; }

/* ---- Autocomplete ---- */
.ac-list { max-height: 60vh; overflow-y: auto; z-index: 1050; }
.ac-list .dropdown-item { min-height: 44px; }
.ac-list .dropdown-item.active { background: rgba(var(--bs-primary-rgb), .1); color: var(--bs-body-color); }

.min-w-0 { min-width: 0; }

/* ---- Bahnhofstafel ---- */
.time-group { max-width: 330px; }

.board-entry { padding: 0; }
.board-entry.is-cancelled .board-main, .board-entry.is-cancelled .board-time { opacity: .75; }

.board-row {
  display: grid;
  grid-template-columns: 3.6rem minmax(0, 1fr) auto;
  gap: .75rem;
  width: 100%;
  padding: .75rem 1rem;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  min-height: 64px;
}
.board-row:hover { background: var(--bs-tertiary-bg); }
.board-row:focus-visible { outline: 2px solid var(--zf-brand); outline-offset: -2px; }
.board-time { line-height: 1.25; font-variant-numeric: tabular-nums; }
.board-details { padding: 0 1rem .9rem calc(3.6rem + 1.75rem); }
@media (max-width: 575.98px) {
  .board-details { padding-left: 1rem; }
}

.platform {
  display: inline-block;
  min-width: 2rem;
  white-space: nowrap;
  padding: .1rem .35rem;
  border-radius: .35rem;
  font-weight: 600;
  text-align: center;
  background: var(--bs-secondary-bg);
}
.platform.changed { background: #ffd800; color: #1e1e1e; }

/* Produkt-/Linien-Badges (Fallback-Farben, solange OpenBoards keine Linienfarben liefert) */
.prod-badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: .35rem;
  font-weight: 700;
  font-size: .85rem;
  line-height: 1.3;
  color: #fff;
  background: #646973;
}
.prod-fern  { background: #ec0016; }
.prod-regio { background: #646973; }
.prod-sbahn { background: #408335; }
.prod-other { background: #3c414b; }

/* Kleine Buttons (Filter-Chips) etwas kompakter, aber noch gut tippbar */
.btn-sm { min-height: 36px; }

/* Such-Tabs: Mobil Symbol über kleiner Beschriftung, ab sm nebeneinander */
.search-tabs .nav-link { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem .25rem; }
.search-tabs .tab-label { font-size: .75rem; }
@media (min-width: 576px) {
  .search-tabs .nav-link { flex-direction: row; justify-content: center; gap: .35rem; padding: .5rem 1rem; }
  .search-tabs .tab-label { font-size: 1rem; }
}

/* ---- Zuglauf ---- */
.train-map { height: 260px; border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0; }
@media (min-width: 992px) {
  .train-map { height: 440px; }
  .train-map-card { top: 5rem; }
}
[data-bs-theme="dark"] .train-map .leaflet-tile { filter: brightness(.75) contrast(1.1) saturate(.8); }

.timeline .stop { position: relative; display: flex; gap: .75rem; padding: 0 0 1rem 0; }
.timeline .stop::before {           /* Verbindungslinie */
  content: ""; position: absolute; left: 7px; top: 18px; bottom: -4px; width: 3px; background: var(--zf-brand); opacity: .85;
}
.timeline .stop:last-child::before { display: none; }
.timeline .stop-past::before { background: var(--bs-secondary-color); opacity: .5; }
.timeline .stop-dot {
  flex: 0 0 17px; width: 17px; height: 17px; margin-top: 3px; border-radius: 50%;
  background: var(--bs-body-bg); border: 3px solid var(--zf-brand); z-index: 1;
}
.timeline .stop-past .stop-dot { border-color: var(--bs-secondary-color); background: var(--bs-secondary-color); }
.timeline .stop-current .stop-dot, .timeline .stop-next .stop-dot { box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb), .25); }
.timeline .stop-current .stop-dot { background: var(--zf-brand); }
.timeline .stop-cancelled .stop-dot { border-color: var(--bs-danger); border-style: dashed; }
.timeline .stop-body { flex: 1; min-width: 0; padding-bottom: .5rem; border-bottom: 1px solid var(--bs-border-color-translucent); }
.timeline .stop-past .stop-body { opacity: .75; }
.timeline .stop-next .stop-body, .timeline .stop-current .stop-body { opacity: 1; }
.stop-time { font-variant-numeric: tabular-nums; }

/* ---- Verbindungssuche ---- */
.conn-swap { width: 44px; }
.conn-card { overflow: hidden; }
.conn-card.is-unreachable { opacity: .8; }
.conn-head {
  display: block; width: 100%; padding: .75rem 1rem; text-align: left;
  background: none; border: 0; color: inherit; font-variant-numeric: tabular-nums;
}
.conn-head:hover { background: var(--bs-tertiary-bg); }
.conn-head:focus-visible { outline: 2px solid var(--zf-brand); outline-offset: -2px; }
.conn-details { padding: .25rem 1rem .9rem; border-top: 1px solid var(--bs-border-color-translucent); }
.conn-leg { padding: .6rem 0 .6rem .85rem; border-left: 3px solid var(--zf-brand); margin-top: .5rem; }
.conn-stop { display: flex; align-items: center; gap: .6rem; min-height: 32px; font-variant-numeric: tabular-nums; }
.conn-stop-time { flex: 0 0 auto; min-width: 6.6rem; white-space: nowrap; }
.conn-transfer { padding: .4rem 0 .1rem .85rem; border-left: 3px dotted var(--bs-secondary-color); margin-top: .5rem; }
