/* WK 2026 Tracker — Cloudflare statische versie. Donker thema, port van de
   Streamlit-styling (bracket-connectoren, schema, standen, uitslagen). */

:root {
  --bg: #0a0f1c;
  --panel: #0f172a;
  --line-soft: #1e293b;
  --bk-line: #46618a;
  --bk-c: 16px;
  --text: #f1f5f9;
  --muted: #94a3b8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 1.2rem 1.4rem 4rem; }

h1 { font-size: 1.6rem; margin: 0 0 0.2rem; }
.subtitle { color: var(--muted); margin: 0 0 1rem; font-size: 0.9rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 0.3rem; }
.section-hint { color: var(--muted); font-size: 0.82rem; margin: 0 0 0.7rem; }
hr { border: none; border-top: 1px solid var(--line-soft); margin: 1.4rem 0 0; }

/* ---- Statusbalk ---- */
.statusbar {
  border-radius: 8px; padding: 0.6rem 0.9rem; font-size: 0.88rem;
  margin-bottom: 1rem; border: 1px solid;
}
.statusbar.live { background: rgba(34,197,94,0.12); border-color: #22c55e; color: #bbf7d0; }
.statusbar.fallback { background: rgba(245,158,11,0.12); border-color: #f59e0b; color: #fde68a; }

/* ---- Bracket-kolomtitels ---- */
.bracket-round-title {
  text-align: center; font-weight: 700; font-size: 0.78rem;
  letter-spacing: 0.03em; text-transform: uppercase; color: #e2e8f0;
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  padding: 0.4rem 0.2rem; border-radius: 8px; margin-bottom: 0.6rem;
  min-height: 1.9rem; display: flex; align-items: center; justify-content: center;
}
.bracket-round-title.final {
  background: linear-gradient(90deg, #b45309, #f59e0b); color: #1c1917;
}

/* ---- Bracket met verbindingslijnen ---- */
.bk-scroll { overflow-x: auto; padding-bottom: 8px; }
.bk-bracket { display: flex; gap: var(--bk-c); min-width: 920px; }
.bk-col { flex: 1 1 0; display: flex; flex-direction: column; min-width: 92px; }
.bk-round { position: relative; height: 560px; display: flex; flex-direction: column; }
.bk-match { position: relative; flex: 1; display: flex; align-items: center; }
.bk-match > .match-card { width: 100%; }

.bk-round.left .bk-match::after {
  content: ""; position: absolute; left: 100%; top: 50%;
  width: var(--bk-c); height: 2px; background: var(--bk-line);
}
.bk-round.left.pairs .bk-match:nth-child(odd)::before {
  content: ""; position: absolute; left: calc(100% + var(--bk-c)); top: 50%;
  width: 2px; height: 100%; background: var(--bk-line);
}
.bk-round.right .bk-match::after {
  content: ""; position: absolute; right: 100%; top: 50%;
  width: var(--bk-c); height: 2px; background: var(--bk-line);
}
.bk-round.right.pairs .bk-match:nth-child(odd)::before {
  content: ""; position: absolute; right: calc(100% + var(--bk-c)); top: 50%;
  width: 2px; height: 100%; background: var(--bk-line);
}

/* ---- Wedstrijdkaart ---- */
.match-card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 0.45rem 0.55rem; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.match-card.live { border-color: #ef4444; box-shadow: 0 0 0 1px #ef4444; }
.match-card.done { border-color: #22c55e; }
.match-card.tbd { border-style: dashed; border-color: #334155; background: #0b1220; }
.match-card.finalcard { border-color: #f59e0b; box-shadow: 0 0 12px rgba(245,158,11,0.35); }
.team-row { display: flex; justify-content: space-between; align-items: center;
  font-size: 0.82rem; color: var(--text); padding: 0.08rem 0; }
.match-card.mirror .team-row { flex-direction: row-reverse; }
.match-card.mirror .team-id { flex-direction: row-reverse; }
.match-card.mirror .team-name { text-align: right; }
.team-row.winner { font-weight: 700; color: #fbbf24; }
.team-id { display: flex; align-items: center; gap: 0.3rem; min-width: 0; }
.flag { width: 20px; height: 14px; object-fit: cover; border-radius: 2px; flex: 0 0 auto; background: #334155; }
.flag-blank { width: 20px; flex: 0 0 auto; }
.team-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80px; }
.team-score { font-variant-numeric: tabular-nums; font-weight: 700; }
.tbd-text { font-size: 0.78rem; color: #64748b; font-style: italic; text-align: center; padding: 0.25rem 0; }
.match-meta { font-size: 0.62rem; color: var(--muted); margin-top: 0.25rem;
  display: flex; justify-content: space-between; }
.badge-live { color: #fca5a5; font-weight: 700; }
.badge-done { color: #86efac; }

/* ---- Grids (standen, uitslagen, stadions) ---- */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
@media (max-width: 900px) { .grid4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid4 { grid-template-columns: 1fr; } }

/* ---- Groepsstanden ---- */
.group-table { width: 100%; border-collapse: collapse; font-size: 0.78rem;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.group-table caption { caption-side: top; text-align: left; font-weight: 700;
  color: #93c5fd; padding: 0.3rem 0.4rem; background: #111827; }
.group-table th { color: var(--muted); font-weight: 600; text-align: center; padding: 0.2rem 0.3rem; }
.group-table td { padding: 0.2rem 0.3rem; text-align: center; color: #e2e8f0; }
.group-table td.gt-team { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.group-table tr.q td { background: rgba(34,197,94,0.12); }
.group-table tr.q3 td { background: rgba(245,158,11,0.10); }
.group-table tr.q td:first-child { border-left: 3px solid #22c55e; }
.group-table tr.q3 td:first-child { border-left: 3px solid #f59e0b; }
.gt-flag { width: 18px; height: 13px; object-fit: cover; border-radius: 2px;
  vertical-align: middle; margin-right: 0.35rem; background: #334155; }

/* ---- Gespeelde groepswedstrijden ---- */
.result-table { width: 100%; border-collapse: collapse; font-size: 0.78rem;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.result-table caption { caption-side: top; text-align: left; font-weight: 700;
  color: #93c5fd; padding: 0.3rem 0.4rem; background: #111827; }
.result-table td { padding: 0.18rem 0.35rem; color: #e2e8f0; }
.result-table img { width: 16px; height: 12px; object-fit: cover; border-radius: 2px;
  vertical-align: middle; margin: 0 0.25rem; background: #334155; }
.res-date { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.res-home { text-align: right; white-space: nowrap; }
.res-away { text-align: left; white-space: nowrap; }
.res-score { text-align: center; font-weight: 700; color: #fbbf24; white-space: nowrap; font-variant-numeric: tabular-nums; }
.res-win { font-weight: 700; color: #fbbf24; }

/* ---- Wedstrijdschema ---- */
.filter-row { display: flex; gap: 0.4rem; margin-bottom: 0.7rem; }
.filter-row button {
  background: #1e293b; color: #cbd5e1; border: 1px solid #334155;
  border-radius: 6px; padding: 0.35rem 0.9rem; cursor: pointer; font-size: 0.85rem;
}
.filter-row button.active { background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 700; }

.sched-scroll { overflow-x: auto; }
.schedule-table { width: 100%; border-collapse: collapse; font-size: 0.88rem;
  background: var(--panel); border: 1px solid #334155; border-radius: 10px; overflow: hidden; min-width: 720px; }
.schedule-table th { position: sticky; top: 0; z-index: 1; background: #1e3a8a; color: #fff;
  text-align: left; padding: 0.5rem 0.7rem; font-weight: 700; border-bottom: 2px solid #2563eb; white-space: nowrap; }
.schedule-table td { padding: 0.45rem 0.7rem; border-bottom: 1px solid #243044; color: #f1f5f9; }
.schedule-table tr.row-odd td { background: #0f172a; }
.schedule-table tr.row-even td { background: #15233b; }
.schedule-table tr:hover td { background: #1e3357; }
.schedule-table tr.date-sep td { background: #0b1220; color: #93c5fd; font-weight: 800;
  text-transform: capitalize; letter-spacing: 0.03em; border-top: 2px solid #334155; }
.schedule-table tr.live td { background: rgba(239,68,68,0.22) !important; }
.sch-team { white-space: nowrap; font-weight: 600; }
.sch-team img { width: 20px; height: 14px; object-fit: cover; border-radius: 2px;
  vertical-align: middle; margin: 0 0.35rem; background: #334155; }
.sch-home { text-align: right; }
.sch-score { text-align: center; font-weight: 800; font-variant-numeric: tabular-nums;
  white-space: nowrap; color: #fde047; font-size: 0.95rem; }
.sch-time { white-space: nowrap; color: #e2e8f0; font-variant-numeric: tabular-nums; font-weight: 600; }
.sch-stage { color: #cbd5e1; white-space: nowrap; }
.sch-status-live { color: #fca5a5; font-weight: 800; }
.sch-status-done { color: #4ade80; font-weight: 600; }
.sch-status-todo { color: var(--muted); }

/* ---- Stadions (uitklapbaar) ---- */
details.stadiums { margin-top: 0.6rem; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--panel); }
details.stadiums summary { cursor: pointer; padding: 0.6rem 0.9rem; font-weight: 700; }
details.stadiums .inner { padding: 0 0.9rem 0.9rem; }
