/* ============================================================
   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);
}

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); }

.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);
}

.content { padding-top: 1.25rem; }
h1:focus { outline: none; }

/* ---- 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); }

/* ---- 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; }
}
/* 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; }

/* 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;
    color: var(--ink-soft);
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
}
.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; }
.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; }
