/* ============================================================
   Biljart Scorebord — thema-systeem (donker standaard + licht)
   Levendiger maar leesbaar; teal-accent als knipoog naar het laken.
   Kleuren komen uit CSS-variabelen die wisselen op [data-theme].
   ============================================================ */

/* ---- Donker (standaard) ---- */
:root, [data-theme='dark'] {
    --bg:            #10151c;
    --surface:       #19212b;
    --surface-2:     #202a36;
    --ink:           #e7ecf2;
    --ink-soft:      #95a1b1;
    --line:          #2a3543;
    --line-soft:     #222c38;
    --sidebar:       #0f141b;
    --sidebar-ink:   #b7c2ce;
    --sidebar-ink-strong: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-brandbar: rgba(0, 0, 0, 0.25);
    --sidebar-border: #20272f;
    --accent:        #34b3a4;
    --accent-strong: #49c9ba;
    --accent-soft:   rgba(52, 179, 164, 0.16);
    --zebra:         rgba(255, 255, 255, 0.025);
    --shadow:        rgba(0, 0, 0, 0.45);
    color-scheme: dark;
}

/* ---- Licht ---- */
[data-theme='light'] {
    --bg:            #eef1f5;
    --surface:       #ffffff;
    --surface-2:     #f5f7f9;
    --ink:           #1d2630;
    --ink-soft:      #586573;
    --line:          #d8dde4;
    --line-soft:     #e9edf1;
    --sidebar:       #ffffff;
    --sidebar-ink:   #51606f;
    --sidebar-ink-strong: #1d2630;
    --sidebar-hover: rgba(0, 0, 0, 0.05);
    --sidebar-brandbar: #f1f3f6;
    --sidebar-border: var(--line);
    --accent:        #1f8d7e;
    --accent-strong: #18a594;
    --accent-soft:   rgba(31, 141, 126, 0.12);
    --zebra:         #f6f8fa;
    --shadow:        rgba(31, 39, 48, 0.10);
    color-scheme: light;
}

html, body {
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.9rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--line);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
h1::before {  /* subtiel accentstreepje voor wat karakter */
    content: "";
    width: 0.32rem;
    height: 1.4rem;
    border-radius: 3px;
    background: var(--accent);
}
/* Consistente kop-hiërarchie binnen de gewone pagina's (Bootstrap maakt h2/h3 anders groot +
   viewport-afhankelijk). `:where(.content)` houdt de specificiteit op element-niveau — zo blijven
   `.h5`/`.h6`, `.panel h2` en `.tile h2` winnen — en sluit het scorebord uit (heeft geen `.content`). */
:where(.content) h2 { font-size: 1.35rem; margin: 1.6rem 0 0.6rem; }
:where(.content) h3 { font-size: 1.1rem; margin: 1.2rem 0 0.4rem; }

a, .btn-link { color: var(--accent-strong); text-underline-offset: 2px; }
a:hover { color: var(--accent); }

.btn-primary {
    color: #fff;
    background-color: var(--accent);
    border-color: var(--accent);
}
.btn-primary:hover { background-color: var(--accent-strong); border-color: var(--accent-strong); }

/* Outline-primary + Bootstrap nav-tabs volgen de club-accentkleur (i.p.v. Bootstrap-blauw). */
.btn-outline-primary { color: var(--accent-strong); border-color: var(--accent); }
.btn-outline-primary:hover, .btn-outline-primary:active { background-color: var(--accent); border-color: var(--accent); color: #fff; }
.nav-tabs { border-bottom-color: var(--line); }
.nav-tabs .nav-link { color: var(--accent-strong); }
.nav-tabs .nav-link:hover { border-color: transparent transparent var(--accent); color: var(--accent); }
.nav-tabs .nav-link.active {
    color: var(--ink);
    background-color: var(--surface);
    border-color: var(--line) var(--line) var(--surface);
    border-top: 2px solid var(--accent);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem var(--accent-soft);
    border-color: var(--accent);
}

/* Inhoud begrenzen op brede schermen — links uitgelijnd (leesrand blijft bij de menubalk).
   88rem (~1496px) > de bruikbare breedte op 1280px (~970px): op 1280×720 verandert er niets,
   de cap grijpt pas in boven ~1300px viewport en temt het uitwaaieren op 1920px. */
.content { padding-top: 1.25rem; max-width: 88rem; margin-right: auto; }
h1:focus { outline: none; }

/* ============================================================
   Layout- & formulier-utilities (gedeeld; tames 1920px, veilig op 1280px)
   ============================================================ */
/* Smal enkelkolom-formulier/paneel: niet laten rekken op brede schermen
   (sluit aan op het bestaande .row g-3 + max-width:46rem-patroon). */
.form-narrow { max-width: 48rem; }

/* Veld-raster voor gekoppelde invoervelden (host/poort, accent-pickers, naam/e-mail).
   Vervangt inline d-flex + style="flex:2/1"; klapt naar 1 kolom op smalle panelen. */
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1rem; align-items: end; }
.field-row.ratio-2-1 { grid-template-columns: 2fr 1fr; }   /* host breed, poort smal */
.field-row > div { min-width: 0; }
@media (max-width: 40rem) { .field-row, .field-row.ratio-2-1 { grid-template-columns: 1fr; } }

/* Benoemde breedtecaps voor losse invoervelden (i.p.v. verspreide inline max-width). */
.input-xs { max-width: 8rem; }
.input-sm { max-width: 12rem; }
.input-md { max-width: 20rem; }
.input-lg { max-width: 28rem; }

/* Brede datatabellen: minimumbreedte zodat kolommen niet pletten op 1280px;
   samen met .table-responsive verschijnt enkel dan horizontaal scrollen. */
.table-wide  { min-width: 48rem; }
.table-xwide { min-width: 64rem; }

/* Filter-/actiebalk boven een lijst of tabel — consistente uitlijning en ruimte. */
.page-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 1rem; }

/* ---- Formuliervelden ---- */
.form-control {
    font-size: 1rem;
    padding: 0.55rem 0.85rem;
    color: var(--ink);
    background-color: var(--surface);
    border-color: var(--line);
}
.form-control:focus { background-color: var(--surface); color: var(--ink); }
.form-control::placeholder { color: var(--ink-soft); opacity: 0.8; }

/* ---- Tabellen: ruim, leesbaar ---- */
.table {
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--ink);
    color: var(--ink);
    border-color: var(--line);
    margin-bottom: 1.25rem;
    background: var(--surface);
    border-radius: 10px;
    overflow: hidden;
}
.table > thead { border-bottom: 2px solid var(--line); }
.table > thead th {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    font-weight: 600;
    padding: 0.65rem 0.85rem;
    background: var(--surface-2);
}
.table > tbody td {
    padding: 0.62rem 0.85rem;
    vertical-align: middle;
    border-color: var(--line-soft);
    color: var(--ink);
}
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-bg-type: var(--zebra); }
.table tbody tr:hover > * { --bs-table-bg-type: var(--accent-soft); }
.num, .table .text-end { font-variant-numeric: tabular-nums; }

/* eerste plaats licht accentueren */
.table > tbody > tr:first-child td:first-child { font-weight: 700; color: var(--accent-strong); }

/* Klikbare, sorteerbare kolomkoppen */
.col-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.col-sort:hover { color: var(--accent-strong); }
.col-sort-ar { color: var(--accent-strong); font-size: 0.8em; }

/* Ledenlijst: smalle icoonkolom + duidelijke, iets grotere contactknop (envelop) */
.mlist-ico-col { width: 3rem; text-align: center; padding-left: 0.4rem !important; padding-right: 0.4rem !important; }
.mlist-contact { font-size: 1.2rem; line-height: 1; padding: 0.2rem 0.5rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); }
.mlist-contact:hover { border-color: var(--accent); color: var(--accent-strong); }
.mlist-contact.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }

/* ---- Kaarten op de startpagina ---- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1.1rem;
    margin-top: 1.5rem;
}
.tile {
    position: relative;
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.35rem 1.4rem 1.35rem 1.5rem;
    text-decoration: none;
    color: var(--ink);
    overflow: hidden;
    transition: border-color .14s, box-shadow .14s, transform .14s;
}
.tile::before {  /* accentbalkje links */
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--accent);
    opacity: 0.85;
}
.tile:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 20px var(--shadow);
    transform: translateY(-2px);
    color: var(--ink);
}
.tile-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.tile-head .ico { width: 1.5rem; height: 1.5rem; color: var(--accent-strong); flex: none; }
.tile h2 { font-size: 1.15rem; margin: 0; }
.tile p  { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

.lead-muted { color: var(--ink-soft); max-width: 46rem; }

/* ---- Instellingenpagina ---- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 1.1rem;
}
/* Competities: smal links kader (competitielijst), brede rechterkolom voor het grid */
.settings-grid.comp-grid {
    grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr);
    align-items: start;
}
@media (max-width: 52rem) {
    .settings-grid.comp-grid { grid-template-columns: 1fr; }
}
/* E-mailpagina: smalle linkerkolom (SMTP + CC gestapeld), brede rechterkolom (sjablonen). */
.email-grid { display: grid; grid-template-columns: minmax(0, 30rem) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.email-col > .panel:last-child { margin-bottom: 0; }
@media (max-width: 60rem) { .email-grid { grid-template-columns: 1fr; } }
/* Compacte competitielijst (naam + type gestapeld, knop rechts) — past netjes in de smalle kolom */
.comp-list { list-style: none; margin: 0 0 0.25rem; padding: 0; }
.comp-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.4rem;
    border-bottom: 1px solid var(--line);
}
.comp-list li:last-child { border-bottom: 0; }
.comp-list li.active { background: var(--accent-soft); border-radius: 8px; }
.comp-list-info { display: flex; flex-direction: column; min-width: 0; }
.comp-list-name { font-weight: 500; overflow-wrap: anywhere; }
.comp-list-type { font-size: 0.8rem; color: var(--ink-soft); }
.comp-list li > .btn { flex: 0 0 auto; }
/* Placeholder rechts zolang geen competitie gekozen is */
.panel.comp-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 8rem;
    border-style: dashed;
    text-align: center;
}
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.25rem 1.35rem;
    margin-bottom: 1.1rem;
}
.panel h2 { font-size: 1.1rem; margin: 0 0 0.9rem; }
.panel h3 { font-size: 1rem; margin: 0 0 0.7rem; }
/* Geen dubbele bovenmarge wanneer een kop bovenaan een paneel staat. */
.panel > :first-child { margin-top: 0; }

/* Beheer: horizontaal-schuivende tabbalk (schaalt mee op smal/mobiel) */
.admin-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--line);
    margin: 0 0 1.2rem;
    scrollbar-width: thin;
}
.admin-tabs .admin-tab {
    flex: 0 0 auto;
    padding: 0.5rem 0.9rem;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    background: transparent;   /* werkt zowel voor <a> (AdminTabs) als <button> (gewest-tabs) */
    color: var(--ink-soft);
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
    cursor: pointer;
}
.admin-tabs .admin-tab:hover { color: var(--ink); background: var(--surface-2); }
.admin-tabs .admin-tab.active {
    color: var(--accent-strong);
    border-bottom-color: var(--accent);
    background: var(--accent-soft);
}
/* Wedstrijden-grid (MatchesGrid): toolbar, sorteren, slepen, dag-groepering, selectie */
.matches-grid .grid-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.matches-grid .grid-toolbar-left,
.matches-grid .grid-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.matches-grid .grid-count {
    font-size: 0.85rem;
    color: var(--ink-soft);
    padding-right: 0.3rem;
    white-space: nowrap;
}
.matches-grid .grid-count.has-sel { color: var(--accent-strong); font-weight: 600; }
.matches-grid .grid-colmenu { position: relative; }
.matches-grid .grid-colmenu-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 30;
    min-width: 12rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.45rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.matches-grid .grid-colmenu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
.matches-grid .grid-colmenu-item:hover { background: var(--surface-2); }
.matches-table th.grid-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.matches-table th.grid-th:hover { color: var(--accent-strong); }
.matches-table th.grid-th.sorted { color: var(--accent-strong); }
.matches-table th.grid-th[draggable="true"]:active { opacity: 0.6; }
.matches-table .grid-sort { font-size: 0.7rem; margin-left: 0.2rem; }
.matches-table .grid-sel-col { width: 2.2rem; text-align: center; }
.matches-table tr.grid-day td { background: var(--surface-2); }
.matches-table tr.grid-day .grid-day-label {
    font-weight: 600;
    text-transform: capitalize;
    color: var(--ink-soft);
}
.matches-table tr.row-sel > td { background: var(--accent-soft); }
.matches-table .grid-actions .btn { margin-left: 0.2rem; }

.rules-block { margin-bottom: 1rem; }
.rules-row {
    display: grid;
    grid-template-columns: auto 4.5rem auto 4.5rem auto 4.5rem;
    align-items: center;
    gap: 0.4rem 0.6rem;
    margin-top: 0.4rem;
}
.rules-row .form-control { width: 4.5rem; }
.logo-preview { height: 3rem; width: auto; border-radius: 6px; border: 1px solid var(--line); }
.brand-logo { height: 1.7rem; width: auto; border-radius: 4px; }
.form-control-color { width: 3.5rem; height: 2.4rem; padding: 0.2rem; }
/* Korte uitleg onder een instelling. */
.field-hint { display: block; margin-top: 0.35rem; color: var(--ink-soft); font-size: 0.8rem; line-height: 1.3; }
/* Aanbevolen-kleuren palet naast de kleurkiezer (klik = invullen). */
.swatch-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; max-width: 14rem; }
.swatch { width: 1.6rem; height: 1.6rem; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; padding: 0; transition: transform .1s; }
.swatch:hover { transform: scale(1.12); border-color: var(--ink-soft); }
.alert { border-radius: 8px; padding: 0.7rem 1rem; border: 1px solid transparent; }
.alert-info { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); }
.alert-success { background: rgba(38,176,80,0.14); color: var(--ink); border-color: #26b050; }

/* ---- Kalender ---- */
.cal-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}
.cal-form > div { min-width: 9rem; }
.cal-form-btn { display: flex; align-items: end; }
.badge-played { background: rgba(38,176,80,0.18); color: #2e9e57; border: 1px solid #2e9e57; font-weight: 600; }
[data-theme='light'] .badge-played { color: #1c7d40; }
.cup-winner { font-weight: 700; color: var(--accent-strong); }

.badge.bg-secondary { background-color: var(--surface-2) !important; color: var(--ink-soft); border: 1px solid var(--line); font-weight: 500; }
.text-muted { color: var(--ink-soft) !important; }

/* ---- Knoppenbalk rechtsboven ---- */
.toolbar { display: inline-flex; align-items: center; gap: 0.6rem; }

/* ---- Seizoenkiezer in de werkbalk ---- */
.season-select { width: auto; min-width: 9rem; font-size: 0.9rem; }

/* ---- Taalwisselaar ---- */
.lang-switch {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}
.lang-link {
    padding: 0.32rem 0.7rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: none;
}
.lang-link:hover { background: var(--surface-2); color: var(--ink); }
.lang-link.active { background: var(--accent); color: #fff; }

/* ---- Thema-knop ---- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.3rem;
    height: 2.3rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
    padding: 0;
}
.theme-toggle:hover { color: var(--accent-strong); border-color: var(--accent); }
.theme-toggle svg { width: 1.2rem; height: 1.2rem; }
.theme-toggle .ico-sun { display: none; }
.theme-toggle .ico-moon { display: inline-block; }
[data-theme='light'] .theme-toggle .ico-sun { display: inline-block; }
[data-theme='light'] .theme-toggle .ico-moon { display: none; }

/* ---- Blazor-foutmeldingen ---- */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Er is een fout opgetreden."; }
.darker-border-checkbox.form-check-input { border-color: #929292; }

/* ---- Footer-banner: subtiele ScoreDisplay.eu-reclame + credits onderaan ---- */
.app-footer {
    margin-top: 2.5rem;
    padding: 0.9rem 1.5rem;
    border-top: 1px solid var(--line);
    background: var(--accent-soft);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1rem;
    font-size: 0.85rem;
    color: var(--ink-soft);
}
.app-footer .app-footer-brand { font-weight: 700; color: var(--accent-strong); text-decoration: none; letter-spacing: .2px; }
.app-footer .app-footer-brand:hover { text-decoration: underline; }
.app-footer .app-footer-tag { flex: 1 1 auto; }
.app-footer .app-footer-cta { color: var(--accent-strong); font-weight: 600; text-decoration: none; white-space: nowrap; }
.app-footer .app-footer-cta::after { content: " \2192"; }
.app-footer .app-footer-cta:hover { text-decoration: underline; }
@media (max-width: 640px) {
    .app-footer { gap: 0.25rem 0.75rem; }
    .app-footer .app-footer-tag { flex-basis: 100%; }
}
