/* Huisstijl van My Evental Media (zoals QueueTimes): donker, Arial, blauw accent, afgeronde kaarten. */
:root {
  color-scheme: dark;
  --page: #0f1115;
  --surface: #171a21;
  --surface-glass: rgba(23, 26, 33, 0.94);
  --inset: #0f1115;
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, 0.7);
  --muted: rgba(255, 255, 255, 0.5);
  --line: rgba(255, 255, 255, 0.06);
  --grid: #252932;
  --axis: #3a3f4b;
  --accent: #2d6df6;
  --accent-soft: rgba(45, 109, 246, 0.2);
  --accent-ink: #9fc2ff;

  --series-1: #2d6df6;     /* verwacht */
  --series-2: #d95926;     /* gemeten */

  /* toestand van een portaal op de kaart */
  --sev-0: rgba(200, 210, 230, 0.35);
  --sev-1: #e8c547;        /* verlaagde snelheid */
  --sev-2: #ff8a3d;        /* vertraging */
  --sev-3: #ff4747;        /* file */
  --closed: #c084fc;       /* werk of afzetting */
  --speed-ok: #3fb27f;     /* vrije doorstroming (80+ km/u) */

  --green-bg: rgba(80, 200, 120, 0.15);   --green-ink: #b7f0c7;
  --orange-bg: rgba(255, 170, 80, 0.12);  --orange-ink: #ffd9a3;
  --red-bg: rgba(255, 80, 80, 0.12);      --red-ink: #ffb3b3;
  --gray-bg: rgba(255, 255, 255, 0.08);   --gray-ink: #ffffff;
  --blue-bg: rgba(45, 109, 246, 0.2);     --blue-ink: #9fc2ff;

  --radius: 18px;
  --radius-inner: 14px;
  --font: Arial, Helvetica, sans-serif;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  --timebar-h: 168px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--page); color: var(--ink); font: 15px/1.45 var(--font); overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
[hidden] { display: none !important; }

/* ---------- kaart ---------- */
#map { position: fixed; inset: 0 0 var(--timebar-h) 0; background: #0c0e12; }
/* PDOK grijs, donker gemaakt. */
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.82) contrast(0.92) saturate(0.4); }
.leaflet-container { font: 12px/1.4 var(--font); background: #0c0e12; }
.leaflet-control-attribution { background: rgba(15, 17, 21, 0.75) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }
.leaflet-bar a { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.leaflet-bar { border: 0 !important; box-shadow: var(--shadow) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-control-zoom { margin-right: 14px !important; margin-bottom: 14px !important; }

/* Borden bij inzoomen: een portaal als rij zwarte matrixborden. */
.gantry-icon { background: none; border: 0; }
.gantry-icon .row {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 6px; background: rgba(5, 6, 8, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%); position: absolute; left: 0; top: 0; cursor: pointer; white-space: nowrap;
}
.gantry-icon .row.sel { outline: 2px solid var(--accent); }
.gantry-icon .pct {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); font-weight: 700; font-size: 11px;
  padding: 2px 6px; border-radius: 8px; background: rgba(5, 6, 8, 0.9); border: 1px solid rgba(255, 255, 255, 0.14); cursor: pointer;
}
svg.board { display: block; }
/* Knipperlichten: boven - onder - uit - pauze, steeds opnieuw. */
svg.board .flash { opacity: 0.12; animation: 1.6s step-end infinite; }
svg.board .flash-top { animation-name: flash-top; }
svg.board .flash-bottom { animation-name: flash-bottom; }
@keyframes flash-top { 0% { opacity: 1; } 25% { opacity: 0.12; } }
@keyframes flash-bottom { 0% { opacity: 0.12; } 25% { opacity: 1; } 50% { opacity: 0.12; } }
@media (prefers-reduced-motion: reduce) { svg.board .flash { animation: none; opacity: 1; } }

/* ---------- zwevende kaarten ---------- */
.topcard, .legend, .panel {
  position: fixed; z-index: 500; background: var(--surface-glass); border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.topcard { top: 14px; left: 14px; width: 320px; padding: 16px 16px 12px; }
.brandrow { display: flex; align-items: center; gap: 12px; }
.logo { height: 26px; width: auto; filter: invert(1); padding-right: 12px; border-right: 1px solid rgba(255, 255, 255, 0.15); box-sizing: content-box; }
.brand { font-size: 18px; font-weight: 700; line-height: 1.1; }
.brand-sub { font-size: 12px; opacity: 0.65; }
.searchrow { margin-top: 12px; }
.search {
  width: 100%; height: 42px; border: none; border-radius: 12px; padding: 0 14px; background: var(--inset); color: var(--ink);
}
.search::placeholder { color: var(--muted); }
.search:focus-visible { outline: 2px solid var(--accent); }
.searchhint { font-size: 12px; opacity: 0.7; margin-top: 6px; min-height: 0; }
.searchhint:empty { display: none; }
.seg { display: flex; gap: 4px; margin-top: 10px; background: var(--inset); border-radius: 12px; padding: 4px; }
.seg button { flex: 1; border: 0; border-radius: 9px; padding: 7px 8px; background: none; color: var(--ink-2); font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent-ink); }
.seg button:focus-visible { outline: 2px solid var(--accent); }
.legend .dim { opacity: 0.6; }

.legend { left: 14px; bottom: calc(var(--timebar-h) + 14px); padding: 10px 14px; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.legend .t { font-weight: 700; opacity: 0.8; margin-bottom: 2px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }

.panel { top: 14px; right: 14px; width: 380px; max-height: calc(100% - var(--timebar-h) - 28px); overflow-y: auto; padding: 18px; }
.panel h2 { font-size: 20px; margin: 0 34px 2px 0; line-height: 1.2; }
.panel .sub { opacity: 0.65; font-size: 13px; margin: 0; }
.panel .close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 10px; border: 0;
  background: var(--gray-bg); color: var(--ink); cursor: pointer; font-size: 16px; line-height: 1;
}
.panel .close:focus-visible { outline: 2px solid var(--accent); }
.lanes { display: flex; gap: 6px; margin: 14px 0 6px; padding: 10px; background: #050608; border-radius: 12px; justify-content: center; flex-wrap: wrap; }
.lanes-note { font-size: 12px; opacity: 0.6; text-align: center; margin-bottom: 4px; }
.status { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; font-size: 15px; }
.status b { font-size: 22px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.fact { background: var(--inset); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.panel h3 { font-size: 14px; margin: 18px 0 8px; opacity: 0.85; }
.daynav { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; }
.daynav h3 { margin: 0; flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 8px;
  background: var(--gray-bg); color: var(--gray-ink); white-space: nowrap;
}
.chip.lv1, .chip.lv2 { background: var(--green-bg); color: var(--green-ink); }
.chip.lv4 { background: var(--orange-bg); color: var(--orange-ink); }
.chip.lv5 { background: var(--red-bg); color: var(--red-ink); }
.note { opacity: 0.55; font-size: 12px; margin-top: 12px; line-height: 1.5; }
.empty { opacity: 0.6; padding: 16px 0; text-align: center; font-size: 13px; }

.btn {
  display: inline-block; text-decoration: none; padding: 8px 14px; border-radius: 10px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-ink); border: 0; cursor: pointer; white-space: nowrap;
}
.btn:focus-visible, .ib:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ib {
  width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--gray-bg); color: var(--ink); cursor: pointer;
  font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.ib:hover { background: rgba(255, 255, 255, 0.14); }
.ib:disabled { opacity: 0.35; cursor: default; }
.ib[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- tijdlijn ---------- */
.timebar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--timebar-h); z-index: 600; background: var(--surface);
  border-top: 1px solid var(--line); padding: 10px 16px calc(8px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px;
}
.tb-head { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; min-width: 0; }
.tb-when { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mode { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 9px; border-radius: 8px; white-space: nowrap; }
.mode.live { background: var(--red-bg); color: var(--red-ink); }
.mode.live::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #ff5a5a; margin-right: 6px; vertical-align: 1px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.mode.past { background: var(--gray-bg); color: var(--gray-ink); }
.mode.future { background: var(--blue-bg); color: var(--blue-ink); }
.when { font-size: 18px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tb-day { flex: 1; min-width: 0; display: flex; gap: 6px; align-items: center; overflow: hidden; font-size: 13px; }
.tb-day .dim { opacity: 0.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-buttons { display: flex; gap: 6px; align-items: center; }
.tb-track { position: relative; flex: 1; min-height: 70px; border-radius: 12px; background: var(--inset); overflow: hidden; touch-action: none; }
.tl-canvas { display: block; cursor: grab; outline: none; }
.tl-canvas:active { cursor: grabbing; }
.tl-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 12px; }
.tb-key { display: flex; gap: 16px; font-size: 11px; opacity: 0.75; flex-wrap: wrap; }
.tb-key span { display: inline-flex; align-items: center; gap: 6px; }
.tb-key .dim { opacity: 0.6; margin-left: auto; }
.key { width: 14px; height: 3px; border-radius: 1px; display: inline-block; }

/* ---------- grafiek ---------- */
.legend-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; opacity: 0.8; margin: 0 0 8px; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.key.band { height: 10px; border-radius: 2px; opacity: 0.3; }
.key.bar { width: 8px; height: 10px; border-radius: 1px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.tip {
  position: absolute; pointer-events: none; background: var(--inset); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px; padding: 8px 11px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  min-width: 150px; transform: translateX(-50%); white-space: nowrap; z-index: 2;
}
.tip .t { opacity: 0.6; font-size: 12px; margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; }
.tip .r b { font-size: 14px; }
.tip .r .lbl { opacity: 0.7; }

.foot { opacity: 0.5; font-size: 11px; margin-top: 16px; line-height: 1.6; }

/* ---------- mobiel ---------- */
@media (max-width: 760px) {
  :root { --timebar-h: 178px; }
  .topcard { left: 10px; right: 10px; top: 10px; width: auto; padding: 10px 12px; }
  .brandrow .logo { height: 18px; }
  .brand { font-size: 16px; }
  .brand-sub { display: none; }
  .brandrow { display: none; }
  .searchrow { margin-top: 0; }
  .legend { display: none; }
  .panel {
    left: 0; right: 0; top: auto; bottom: var(--timebar-h); width: auto; max-height: 58vh; border-radius: var(--radius) var(--radius) 0 0;
    padding: 16px;
  }
  .timebar { padding: 8px 10px calc(6px + env(safe-area-inset-bottom)); }
  .tb-head { flex-wrap: wrap; gap: 6px 10px; }
  .tb-day { order: 3; flex-basis: 100%; }
  .tb-buttons { margin-left: auto; }
  /* Op een telefoon veeg je over de tijdlijn; alleen "Nu" en afspelen blijven als knop. */
  .tb-buttons .ib[data-step] { display: none; }
  .tb-buttons .btn { padding: 7px 12px; }
  .tb-buttons .ib { width: 32px; height: 32px; }
  .mode { font-size: 10px; padding: 3px 7px; }
  .when { font-size: 15px; }
  .tb-key { display: none; }
  .tb-track { min-height: 72px; }
}
