/*
 * Gedeelde bouwstenen. Pagina's en componenten gebruiken deze klassen zodat alles er
 * hetzelfde uitziet; scoped .razor.css bevat alleen wat echt uniek is voor één component.
 */

/* ---------- Paginakop ---------- */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin-bottom: 0.35rem;
}

.page-lead,
.section-subtitle {
    color: var(--inkt-zacht);
    font-size: 0.975rem;
    max-width: 38rem;
    margin-bottom: 0;
}

.page-context {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--laken);
    margin-bottom: 0.2rem;
}

.page-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 2.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--inkt-zacht);
    text-decoration: none;
    margin-bottom: 0.4rem;
}

.page-back-link:hover {
    color: var(--laken);
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.section-title {
    font-size: 1.15rem;
    margin: 2rem 0 0.85rem;
}

.section-title:first-child {
    margin-top: 0;
}

/* ---------- Vlakken ---------- */
.surface {
    background: var(--vlak);
    border: 1px solid var(--lijn);
    border-radius: var(--radius-vlak);
    box-shadow: var(--schaduw);
    overflow: hidden;
}

.surface-pad {
    padding: 1.25rem;
}

@media (min-width: 576px) {
    .surface-pad {
        padding: 1.5rem;
    }
}

.form-narrow {
    max-width: 34rem;
}

/* ---------- Lijsten (spelers, blokken, wedstrijden) ---------- */
.lijst {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lijst > li + li,
.lijst > .lijst-rij + .lijst-rij {
    border-top: 1px solid var(--lijn);
}

.lijst-rij {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    min-height: 3.5rem;
    color: inherit;
    text-decoration: none;
}

a.lijst-rij:hover,
a.lijst-rij:focus-visible {
    background: var(--laken-mist);
    color: inherit;
}

.lijst-rij-hoofd {
    flex: 1 1 auto;
    min-width: 0;
}

.lijst-rij-titel {
    display: block;
    font-weight: 700;
    color: var(--inkt);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lijst-rij-sub {
    display: block;
    font-size: 0.85rem;
    color: var(--inkt-zacht);
}

.lijst-rij-pijl {
    flex: 0 0 auto;
    color: var(--inkt-vaag);
}

/* Het getal waar een rij om draait (punten, serie, gemiddelde) */
.lijst-rij-waarde {
    flex: 0 0 auto;
    font-stretch: var(--smal);
    font-weight: 800;
    font-size: 1.35rem;
    line-height: 1;
    color: var(--laken-diep);
    font-variant-numeric: tabular-nums;
}

.lijst-rij-waarde small {
    margin-left: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-stretch: 100%;
    color: var(--inkt-zacht);
}

a.lijst-rij:hover .lijst-rij-pijl {
    color: var(--laken);
}

/* ---------- Statistieken ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
        gap: 1rem;
    }
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.9rem 1rem 1rem;
    background: var(--vlak);
    border: 1px solid var(--lijn);
    border-radius: var(--radius-vlak);
    box-shadow: var(--schaduw);
    min-width: 0;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--inkt-zacht);
}

.stat-value {
    font-stretch: var(--smal);
    font-weight: 800;
    font-size: 2.25rem;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
    color: var(--inkt);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stat-value-tekst {
    font-size: 1.6rem;
    font-stretch: 100%;
    padding-top: 0.35rem;
}

.stat-hint {
    font-size: 0.82rem;
    color: var(--inkt-zacht);
}

/* Het uitgelichte getal staat op het laken */
.stat-laken {
    background: var(--laken);
    border-color: var(--laken);
    background-image: radial-gradient(120% 90% at 100% 0%, rgba(255, 255, 255, 0.10), transparent 60%);
}

.stat-laken .stat-label,
.stat-laken .stat-hint {
    color: rgba(255, 255, 255, 0.78);
}

.stat-laken .stat-value {
    color: #fff;
}

/* ---------- Rangballen: 1 = gele bal, 2 = witte bal, 3 = rode bal ---------- */
.bal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-stretch: var(--smal);
    font-weight: 800;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    color: var(--inkt-zacht);
    background: var(--laken-mist);
    border: 1px solid var(--lijn);
}

.bal-geel,
.bal-wit,
.bal-rood {
    border: 0;
    box-shadow: inset -2px -3px 5px rgba(0, 0, 0, 0.16), 0 1px 2px rgba(0, 0, 0, 0.18);
}

.bal-geel {
    background: radial-gradient(circle at 34% 30%, #fff6d6 0 12%, var(--bal-geel) 42%, #d9a21c 100%);
    color: #4d3800;
}

.bal-wit {
    background: radial-gradient(circle at 34% 30%, #ffffff 0 18%, #f1f3f2 50%, #c9d0cc 100%);
    color: var(--inkt);
}

.bal-rood {
    background: radial-gradient(circle at 34% 30%, #ff9aa6 0 10%, var(--bal-rood) 45%, #9e1a2a 100%);
    color: #fff;
}

/* Initialen-avatar voor spelers */
.speler-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--laken-licht);
    color: var(--laken-diep);
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

/* ---------- Wissel (twee weergaven van dezelfde pagina) ---------- */
.wissel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    padding: 0.25rem;
    margin-bottom: 1.25rem;
    border-radius: 999px;
    background: var(--laken-licht);
    max-width: 24rem;
}

.wissel-optie {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--laken-diep);
    text-decoration: none;
}

.wissel-optie:hover {
    color: var(--laken-diep);
    background: rgba(255, 255, 255, 0.5);
}

.wissel-optie.actief {
    background: var(--vlak);
    box-shadow: 0 1px 3px rgba(8, 67, 47, 0.18);
}

/* ---------- Chips (blokwisselaar) ---------- */
.chip-rij {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -1rem 1.25rem;
    padding: 0 1rem 0.2rem;
}

.chip-rij::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0.35rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--lijn-sterk);
    background: var(--vlak);
    color: var(--inkt);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    white-space: nowrap;
}

.chip:hover {
    border-color: var(--laken);
    color: var(--laken);
}

.chip.actief {
    background: var(--laken);
    border-color: var(--laken);
    color: #fff;
}

/* ---------- Datatabellen (stand, carrière) ---------- */
.data-tabel-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-tabel {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.data-tabel th,
.data-tabel td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--lijn);
    white-space: nowrap;
    vertical-align: middle;
    background: var(--vlak);
}

.data-tabel tbody tr:last-child > * {
    border-bottom: 0;
}

.data-tabel thead th {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--inkt-zacht);
    padding-top: 0.8rem;
    padding-bottom: 0.6rem;
    background: var(--laken-mist);
}

.data-tabel .num {
    text-align: right;
}

.data-tabel .kolom-nadruk {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--laken-diep);
}

.data-tabel .kolom-naam {
    font-weight: 700;
}

.data-tabel tbody tr.klikbaar {
    cursor: pointer;
}

.data-tabel tbody tr.klikbaar:hover > * {
    background: var(--laken-mist);
}

/* Eerste kolommen blijven staan bij horizontaal scrollen */
.data-tabel .plak-1,
.data-tabel .plak-2 {
    position: sticky;
    z-index: 1;
}

.data-tabel .plak-1 {
    left: 0;
    width: 3rem;
    min-width: 3rem;
    padding-right: 0.25rem;
    text-align: center;
}

.data-tabel .plak-2 {
    left: 3rem;
    box-shadow: 1px 0 0 var(--lijn);
}

.tabel-hint {
    font-size: 0.85rem;
    color: var(--inkt-zacht);
    margin: 0.65rem 0.1rem 0;
}

/* ---------- Sheet: bottom sheet op mobiel, dialoog op desktop ---------- */
.sheet-achtergrond {
    position: fixed;
    inset: 0;
    z-index: 1055;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(6, 47, 34, 0.5);
    animation: sheet-fade 0.18s ease-out;
}

.sheet {
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: var(--vlak);
    border-radius: 20px 20px 0 0;
    box-shadow: var(--schaduw-hoog);
    animation: sheet-omhoog 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
    padding-bottom: env(safe-area-inset-bottom);
}

.sheet::before {
    content: "";
    align-self: center;
    width: 2.5rem;
    height: 0.3rem;
    border-radius: 999px;
    background: var(--lijn-sterk);
    margin-top: 0.55rem;
}

.sheet-kop {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem 0.9rem;
    border-bottom: 1px solid var(--lijn);
}

.sheet-titel {
    margin: 0;
    font-size: 1.35rem;
}

.sheet-subtitel {
    font-size: 0.875rem;
    color: var(--inkt-zacht);
    margin-top: 0.15rem;
}

.sheet-sluit {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 50%;
    background: var(--laken-mist);
    color: var(--inkt-zacht);
    font-size: 1.4rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sheet-sluit:hover {
    background: var(--laken-licht);
    color: var(--inkt);
}

.sheet-body {
    padding: 1.1rem 1.25rem;
    overflow-y: auto;
}

.sheet-voet {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem 1rem;
    border-top: 1px solid var(--lijn);
    background: var(--laken-mist);
}

.sheet-voet .spacer {
    flex: 1 1 auto;
}

@media (min-width: 768px) {
    .sheet-achtergrond {
        align-items: center;
        padding: 1.5rem;
    }

    .sheet {
        width: min(var(--sheet-breedte, 560px), 100%);
        border-radius: 18px;
        overflow: hidden;
        animation-name: sheet-fade;
        padding-bottom: 0;
    }

    .sheet::before {
        display: none;
    }

    .sheet-kop {
        padding-top: 1.1rem;
    }
}

@keyframes sheet-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes sheet-omhoog {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Sleutel-waardelijst in sheets */
.kv-lijst {
    list-style: none;
    margin: 0;
    padding: 0;
}

.kv-lijst li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--lijn);
    font-size: 0.95rem;
}

.kv-lijst li:last-child {
    border-bottom: 0;
}

.kv-lijst strong {
    font-variant-numeric: tabular-nums;
}

/* ---------- Lege toestand ---------- */
.leeg {
    padding: 1.5rem 1.25rem;
    text-align: center;
    color: var(--inkt-zacht);
    background: var(--vlak);
    border: 1px dashed var(--lijn-sterk);
    border-radius: var(--radius-vlak);
}

/* ---------- Opslaan-status in rijen ---------- */
.opslaan-status {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--inkt-zacht);
    white-space: nowrap;
}

.opslaan-status.klaar {
    color: var(--laken);
}
