/* ── Onit huisstijl, dark variant for courtside / broadcast tooling ──────────
   Brand red is the accent (primary actions + LIVE). Team identity stays
   blue (thuis) / amber (uit) so the colours carry meaning on the scoreboard. */
:root {
  --onit-red: #E30613;
  --onit-red-dark: #B0050F;
  --onit-red-light: #FDE8E9;
  --onit-grey: #474745;
  --grey-med: #A3A3A1;

  --bg: #161615;
  --surface: #232321;
  --surface-2: #2C2C2A;
  --surface-3: #353532;
  --border: #3b3b38;
  --text: #F5F5F4;
  --muted: #A3A3A1;

  --home: #2F6BE4;
  --home-dark: #1f54bf;
  --away: #F2A516;
  --away-dark: #cf8a06;
  --ok: #3FB950;

  --radius: 16px;
  --font: 'Neue Haas Grotesk Display Pro', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { letter-spacing: .01em; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ── Top bar ───────────────────────────────────────────────────────────────*/
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(180deg, #1f1f1d, #19191800);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 26px; width: auto; display: block; }
.brand .divider { width: 1px; height: 22px; background: var(--border); }
.brand h1 { font-size: 17px; font-weight: 800; margin: 0; white-space: nowrap; }
.brand .sub { color: var(--muted); font-weight: 600; }
.topbar .right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── Status chips / badges ──────────────────────────────────────────────────*/
.status {
  font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 5px 11px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); white-space: nowrap;
}
.status.ok { color: #0c2; background: rgba(63,185,80,.15); border-color: rgba(63,185,80,.4); }
.status.err { color: #ffb3b3; background: rgba(227,6,19,.15); border-color: rgba(227,6,19,.45); }
.status.live { color: #fff; background: var(--onit-red); border-color: var(--onit-red); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; letter-spacing: .12em;
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.live { background: var(--onit-red); color: #fff; border-color: var(--onit-red); }
.badge.live::before { background: #fff; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ── Layout wrappers ────────────────────────────────────────────────────────*/
.panel-wrap { max-width: 540px; margin: 0 auto; padding: 16px 16px 32px; }
.stream-wrap { max-width: 920px; margin: 0 auto; padding: 16px 16px 32px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card-label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}

/* ── Buttons ────────────────────────────────────────────────────────────────*/
.btn, button, a.btn {
  font: inherit; font-weight: 700; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; cursor: pointer;
  transition: transform .04s, filter .12s, background .12s;
}
a.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
button:hover:not(:disabled), a.btn:hover, .btn:hover { filter: brightness(1.12); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary { background: var(--onit-red); border-color: var(--onit-red); color: #fff; }
.btn-primary:hover { background: var(--onit-red-dark); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-danger { background: transparent; border-color: rgba(227,6,19,.5); color: #ff9a9a; }
.btn-text {
  background: none; border: none; padding: 8px 12px; color: var(--muted);
  font-weight: 600; font-size: 13px; text-decoration: underline; cursor: pointer;
}
.btn-text.danger { color: #d8736f; }

/* ── Inputs ─────────────────────────────────────────────────────────────────*/
input[type=text], input[type=password] {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; width: 100%;
}
input:focus { outline: none; border-color: var(--onit-red); box-shadow: 0 0 0 3px rgba(227,6,19,.18); }
select {
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; max-width: 220px;
}

/* ─────────────────────────── CONTROL PANEL ─────────────────────────────────*/
.score-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.team-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
.team-card .team-top { height: 6px; }
.team-card.home .team-top { background: var(--home); }
.team-card.away .team-top { background: var(--away); }
.team-card .inner { padding: 14px; display: flex; flex-direction: column; gap: 12px; }

.team-name {
  text-align: center; font-weight: 800; font-size: 16px;
  background: var(--bg); padding: 10px;
}
.team-score {
  text-align: center; font-size: 68px; font-weight: 900; line-height: 1;
  letter-spacing: -.02em;
}
.team-card.home .team-score { color: #8fb4ff; }
.team-card.away .team-score { color: #ffce6b; }

.btn-plus { font-size: 26px; font-weight: 900; padding: 20px 8px; color: #fff; border: none; }
.team-card.home .btn-plus { background: var(--home); }
.team-card.home .btn-plus:hover { background: var(--home-dark); }
.team-card.away .btn-plus { background: var(--away); color: #1b1b1a; }
.team-card.away .btn-plus:hover { background: var(--away-dark); }
.btn-minus { font-size: 16px; padding: 10px; }

/* Clock */
.clock-card { text-align: center; }
.clock-time { font-size: 72px; font-weight: 900; line-height: 1; letter-spacing: .02em; }
.clock-period {
  color: var(--muted); font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; font-size: 13px; margin: 6px 0 16px;
}
.btn-clock { width: 100%; font-size: 22px; padding: 18px; margin-bottom: 10px; }
.clock-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Team settings (colour + logo) */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-col {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
.settings-side { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.settings-side .dot { width: 12px; height: 12px; border-radius: 50%; }
.home-dot { background: var(--home); }
.away-dot { background: var(--away); }
.color-row { display: flex; align-items: center; justify-content: space-between; font-weight: 600; color: var(--muted); font-size: 14px; }
.color-row input[type=color] {
  width: 52px; height: 34px; padding: 0; border: 1px solid var(--border);
  border-radius: 8px; background: none; cursor: pointer;
}
.logo-thumb {
  width: 100%; aspect-ratio: 16/9; border-radius: 10px; border: 1px solid var(--border);
  background: #0e0e0d center/contain no-repeat; position: relative;
}
.logo-thumb.empty::after {
  content: "geen logo"; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; color: var(--muted); font-size: 12px;
}
.logo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.logo-actions .btn { flex: 1 1 auto; font-size: 14px; padding: 10px; }
.logo-actions .btn-text { flex: 1 1 100%; text-align: center; }

/* Sponsors / ads */
.ads-controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-bottom: 12px; }
.switch-row { display: flex; align-items: center; gap: 12px; font-weight: 700; cursor: pointer; }
.interval-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.interval-row input { width: 64px; padding: 8px 10px; }
/* Checkbox styled as a toggle */
.switch {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  width: 46px; height: 26px; border-radius: 999px; background: var(--surface-3);
  border: 1px solid var(--border); position: relative; transition: background .15s; flex-shrink: 0;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch:checked { background: var(--onit-red); border-color: var(--onit-red); }
.switch:checked::after { transform: translateX(20px); }

.sponsor-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.sponsor-item { display: flex; align-items: center; gap: 12px; }
.sponsor-thumb {
  flex: 1 1 auto; height: 52px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff center/contain no-repeat; background-size: contain;
}
.sponsor-item .btn-text { flex: 0 0 auto; }
.ads-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ads-actions .btn { flex: 0 0 auto; }

/* Live preview */
#preview { width: 100%; border-radius: 12px; background: #0e0e0d; display: block; aspect-ratio: 16/9; }

/* Footer actions */
.footer-actions { display: flex; justify-content: center; margin-top: 4px; }
.brand-credit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 18px; color: var(--muted); font-size: 12px;
}
.brand-credit img { height: 16px; opacity: .8; }

/* ─────────────────────────── STREAMING PAGE ────────────────────────────────*/
.stage {
  position: relative; background: #000; border-radius: var(--radius);
  overflow: hidden; aspect-ratio: 16/9; border: 1px solid var(--border);
}
.stage video { display: none; }
.stage canvas { width: 100%; height: 100%; display: block; }
.stage .stage-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-weight: 600; text-align: center; padding: 24px; pointer-events: none;
}

.steps { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3);
  font-size: 12px; font-weight: 800; color: var(--muted); flex-shrink: 0;
}
.step { display: flex; align-items: center; gap: 8px; }
.controls-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }

#log {
  white-space: pre-wrap; font: 12px/1.5 ui-monospace, "SF Mono", Menlo, "Courier New", monospace;
  color: var(--muted); background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; max-height: 150px; overflow: auto;
}

/* ── Login overlay ──────────────────────────────────────────────────────────*/
.overlay {
  position: fixed; inset: 0; background: rgba(15,15,14,.94);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.overlay .box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; width: min(380px, 92vw); text-align: center;
}
.overlay .box img { height: 30px; margin-bottom: 16px; }
.overlay h2 { margin: 0 0 4px; font-size: 22px; }
.overlay .pin-input {
  text-align: center; font-size: 28px; letter-spacing: .5em; font-weight: 800;
  padding-left: .5em; margin: 16px 0 4px;
}
.overlay button { width: 100%; margin-top: 14px; font-size: 17px; padding: 14px; }
.error-line { color: #ff9a9a; font-size: 13px; min-height: 18px; }

/* ── Misc ───────────────────────────────────────────────────────────────────*/
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

#flash {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 12px 18px; border-radius: 12px; opacity: 0; transition: opacity .3s;
  pointer-events: none; z-index: 50; max-width: 90vw; font-size: 14px;
}
#flash.show { opacity: 1; }

@media (max-width: 520px) {
  .topbar { padding: 10px 12px; }
  .brand { gap: 8px; }
  .brand .divider, .brand .sub { display: none; }
  .brand h1 { font-size: 15px; }
  .brand img { height: 22px; }
  .status, .badge { font-size: 11px; padding: 4px 9px; letter-spacing: .06em; }
}

@media (max-width: 380px) {
  .team-score { font-size: 56px; }
  .clock-time { font-size: 60px; }
  .btn-minus { font-size: 14px; }
}
