/* ═══════════════════════════════════════════════════════════════
   Pendler Dashboard HH → MUC · Schleich
   style.css — Version 3.0 (Wochen-UI)
   Mobile-First · 390px · Dark Mode · Vanilla CSS
═══════════════════════════════════════════════════════════════ */

/* ─── 0. Custom Properties ──────────────────────────────────── */
:root {
  --bg:           #0f0f11;
  --surface:      #18181c;
  --surface2:     #222228;
  --green:        #2dcc8f;
  --yellow:       #f5a623;
  --red:          #e84a4a;
  --orange:       #ff7a3d;
  --blue:         #4a9eff;
  --text:         #f0f0f4;
  --text-muted:   #8888a0;

  --green-bg:     rgba(45, 204, 143, 0.12);
  --yellow-bg:    rgba(245, 166, 35, 0.14);
  --red-bg:       rgba(232, 74, 74, 0.12);

  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --radius-pill:  100px;

  --topbar-h:     56px;
  --bnav-h:       64px;

  --font-display: 'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Fira Mono', monospace;

  --transition:   150ms ease;
}

/* ─── 1. Reset & Base ───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scrollbar-width: none;
}

html::-webkit-scrollbar { display: none; }

body {
  font-family: var(--font-display);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  max-width: 390px;
  margin: 0 auto;
  padding-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text);
}

[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); }

/* ─── 2. Topbar ─────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  max-width: 390px;
  margin: 0 auto;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 12px;
  padding-right: 12px;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.topbar-btn {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  flex-shrink: 0;
}

.topbar-btn:active { color: var(--text); }

.topbar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.topbar-route {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.topbar-subtitle {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1;
}

/* ─── 3. Main container ─────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
}

/* ─── 4. Wochen-Tabs ────────────────────────────────────────── */
.week-tabs-section {
  padding: 14px 16px 10px;
}

.week-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.week-tabs::-webkit-scrollbar { display: none; }

.week-tab {
  flex-shrink: 0;
  padding: 7px 14px;
  min-height: 36px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  border: 1px solid transparent;
}

.week-tab.active {
  background: var(--green);
  color: #fff;
}

.week-tab:not(.active):active {
  background: var(--surface2);
  color: var(--text);
}

/* ─── 5. Transfer-Bar ───────────────────────────────────────── */
.transfer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 10px;
}

.transfer-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.toggle-group {
  display: flex;
  background: var(--surface2);
  border-radius: var(--radius-pill);
  padding: 2px;
  gap: 2px;
}

.toggle-btn {
  min-height: 30px;
  padding: 0 12px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.toggle-btn.active {
  background: var(--green);
  color: #fff;
}

/* ─── 6. Beste Option — Hauptkarte ──────────────────────────── */
.best-card-section {
  padding: 0 16px 16px;
}

.best-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.05);
}

.best-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.bc-header-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.bc-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.bc-badge {
  display: inline-flex;
  align-items: center;
  background: var(--green-bg);
  color: var(--green);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  align-self: flex-start;
}

.bc-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}

.bc-total-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.bc-total-price {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
  letter-spacing: -0.02em;
}

.bc-total-sub {
  font-size: 0.625rem;
  color: var(--text-muted);
}

.bc-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.4;
}

/* bc-body */
.bc-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 16px;
}

.bc-block {
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.bc-block:first-child {
  border-top: none;
  padding-top: 0;
}

.bc-block-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.bc-block-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 20px;
}

.bc-block-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.bc-block-price {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--green);
  flex-shrink: 0;
}

/* Route entries inside best card */
.bc-routes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 28px;
}

.bc-route-entry {
  display: grid;
  grid-template-columns: 56px 1fr;
  row-gap: 2px;
  column-gap: 8px;
}

.bc-re-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  grid-column: 1;
  grid-row: 1;
  padding-top: 1px;
  white-space: nowrap;
}

.bc-re-main {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.bc-re-date {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
}

.bc-re-times {
  font-size: 0.8125rem;
  color: var(--text);
}

.bc-re-dur {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.bc-re-train {
  grid-column: 2;
  grid-row: 2;
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Hotel block */
.bc-hotel-info {
  padding-left: 28px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Booking button */
.btn-booking {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  background: var(--green);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: opacity var(--transition);
  border: none;
  cursor: pointer;
  letter-spacing: 0.01em;
}

.btn-booking:active { opacity: 0.8; }

/* ─── 7. Günstigste Optionen — Horizontal-Scroll ─────────────── */
.week-options-section {
  padding: 0 0 16px;
}

.week-options-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 10px;
}

.week-options-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.info-btn {
  font-size: 1rem;
  color: var(--text-muted);
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color var(--transition);
}

.info-btn:active { color: var(--text); }

.week-options-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 16px 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
}

.week-options-scroll::-webkit-scrollbar { display: none; }

.woc-card {
  flex-shrink: 0;
  width: 140px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  scroll-snap-align: start;
  border: 1.5px solid transparent;
  transition: border-color var(--transition), opacity var(--transition);
}

.woc-card:active { opacity: 0.75; }

.woc-card--active {
  border-color: var(--green);
}

.woc-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

.woc-price {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
  letter-spacing: -0.02em;
  text-align: center;
}

.woc-icons {
  font-size: 1.125rem;
  text-align: center;
  line-height: 1;
}

/* ─── 8. Kostenübersicht ────────────────────────────────────── */
.kosten-detail-section {
  margin: 0 16px 16px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
}

.kosten-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.kosten-detail-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.btn-bearbeiten {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--green);
  min-height: 32px;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  transition: opacity var(--transition);
}

.btn-bearbeiten:active { opacity: 0.7; }

.kosten-detail-body {
  padding: 4px 0 12px;
}

/* Kosten detail rows */
.kd-row {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.kd-row:last-of-type {
  border-bottom: none;
}

.kd-row-header {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.kd-row-label {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.kd-row-price {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  flex-shrink: 0;
}

.kd-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.kd-row--expanded .kd-chevron {
  transform: rotate(180deg);
}

.kd-row-detail {
  padding: 0 16px 10px 32px;
}

.kd-sub-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.8125rem;
}

.kd-sub-label { color: var(--text-muted); }
.kd-sub-price { color: var(--text); }

.kd-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 4px 16px;
}

.kd-gesamt-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 16px 4px;
  gap: 8px;
}

.kd-gesamt-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.kd-gesamt-price {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--green);
}

.kd-per-day {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 16px 6px;
}

.kd-empty {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 12px 16px;
  text-align: center;
}

/* ─── 9. Spartipp ───────────────────────────────────────────── */
.spartipp-section {
  padding: 0 16px 16px;
}

.spartipp-box {
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 12px 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.spartipp-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.spartipp-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.spartipp-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.spartipp-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--yellow);
}

.spartipp-body {
  font-size: 0.8125rem;
  color: var(--yellow);
  opacity: 0.85;
  line-height: 1.4;
}

.spartipp-chevron {
  font-size: 1.375rem;
  color: var(--yellow);
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.spartipp-chevron:active { opacity: 1; }

/* ─── 10. Kalenderübersicht ─────────────────────────────────── */
.week-cal-section {
  margin: 0 16px 16px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.05);
}

.week-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.week-cal-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.week-cal-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.wcal-nav-btn {
  min-width: 32px;
  min-height: 32px;
  font-size: 1.125rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}

.wcal-nav-btn:active { color: var(--text); }

.wcal-month-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  min-width: 72px;
  text-align: center;
}

.week-cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.week-cal-dow span {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 4px 0;
}

.week-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.wcal-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 2px;
  border-radius: var(--radius-sm);
  min-height: 52px;
  cursor: default;
  transition: background var(--transition);
}

.wcal-cell--clickable {
  cursor: pointer;
}

.wcal-cell--clickable:active {
  background: var(--surface2);
}

.wcal-cell--weekend {
  opacity: 0.35;
}

.wcal-num {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
  margin-bottom: 2px;
}

.wcal-num--today {
  background: var(--green);
  color: #fff;
}

.wcal-price {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1;
}

.wcal-price--green  { color: var(--green); }
.wcal-price--yellow { color: var(--yellow); }
.wcal-price--red    { color: var(--red); }

/* ─── 11. Preisalarm ────────────────────────────────────────── */
.preisalarm-section {
  padding: 0 16px 24px;
}

.preisalarm-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preisalarm-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.preisalarm-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.preisalarm-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.preisalarm-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.preisalarm-body {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* iOS-style toggle switch */
.toggle-switch {
  flex-shrink: 0;
  width: 50px;
  height: 28px;
  background: var(--surface2);
  border-radius: 14px;
  border: none;
  position: relative;
  cursor: pointer;
  transition: background 200ms;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.toggle-switch[aria-checked="true"] {
  background: var(--green);
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  transition: transform 200ms;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle-switch[aria-checked="true"] .toggle-knob {
  transform: translateX(22px);
}

/* ─── 12. Bottom Navigation ─────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 390px;
  margin: 0 auto;
  height: calc(var(--bnav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  display: flex;
  align-items: stretch;
  border-top: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 -2px 16px rgba(0,0,0,0.35);
  z-index: 100;
}

.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.5625rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.bnav-item.bnav-item--active {
  color: var(--green);
}

.bnav-item:not(.bnav-item--active):active {
  color: var(--text);
}

.bnav-icon {
  width: 22px;
  height: 22px;
}

/* ─── 13. Buttons (global) ──────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  background: var(--green);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  width: 100%;
  transition: opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active { opacity: 0.8; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  font-size: 1rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-icon:active { color: var(--text); }

/* ─── 14. Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  display: flex;
  flex-direction: column;
  max-height: 90dvh;
  overflow-y: auto;
  scrollbar-width: none;
}

.modal::-webkit-scrollbar { display: none; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
}

.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus { border-color: var(--green); }

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.form-input[type="number"]::-webkit-inner-spin-button,
.form-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-input[type="number"] {
  -moz-appearance: textfield;
  font-family: var(--font-mono);
}

.modal-footer {
  padding: 12px 20px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ─── 15. No-data states ────────────────────────────────────── */
.no-data-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  padding: 16px;
}
