/* ══════════════════════════════════════════════════════
   Corporalis PWA — stylesheet
   Kleurpalet: #3399CC (primair) / #0D4A6B (donker)
               #7DCDEF (accent)  / #E6F4FB (licht)
               #F8F9FA (achtergrond)
               Les-kleuren: #BA7517 / #FAEEDA (functioneel)
               PT-kleuren:  #533AB7 / #EEEDFE (functioneel)
   ══════════════════════════════════════════════════════ */

:root {
    --groen:        #3399CC;
    --groen-donker: #0D4A6B;
    --groen-licht:  #E6F4FB;
    --oranje:       #BA7517;
    --oranje-licht: #FAEEDA;
    --paars:        #533AB7;
    --paars-licht:  #EEEDFE;
    --rood:         #c0392b;
    --rood-licht:   #fde8e6;
    --grijs:        #6b7280;
    --grijs-licht:  #f3f4f6;
    --rand:         #e5e7eb;
    --tekst:        #111827;
    --tekst-sub:    #6b7280;
    --wit:          #ffffff;
    --radius:       8px;
    --schaduw:      0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
    --schaduw-hoog: 0 4px 16px rgba(0,0,0,.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--tekst);
    background: #F8F9FA;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ── Hulpklassen ────────────────────────────────────────────────────── */
.verborgen { display: none !important; }

/* ── Topbalk ────────────────────────────────────────────────────────── */
.topbalk {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 1rem;
    background: var(--groen);
    color: var(--wit);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--schaduw);
}
.topbalk__logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    font-size: 1.1rem;
}
.topbalk__logo img {
    height: 32px;
    width: auto;
    flex-shrink: 0;
}
.topbalk__acties {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.topbalk__naam {
    font-size: .85rem;
    opacity: .9;
}

/* ── Tabs ───────────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0;
    background: var(--wit);
    border-bottom: 2px solid var(--rand);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}
.tab {
    padding: .75rem 1.1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    touch-action: manipulation;
    font-size: .9rem;
    font-weight: 500;
    color: var(--tekst-sub);
    white-space: nowrap;
    scroll-snap-align: start;
    transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--groen); }
.tab.actief {
    color: var(--groen);
    border-bottom-color: var(--groen);
}

/* ── Tab-inhoud ────────────────────────────────────────────────────── */
.tab-inhoud {
    flex: 1;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* ── Knoppen ────────────────────────────────────────────────────────── */
.knop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .55rem 1.1rem;
    border-radius: var(--radius);
    border: 2px solid transparent;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation; /* verwijder 300ms iOS tap-delay */
    transition: background .15s, color .15s, border-color .15s;
    text-decoration: none;
    white-space: nowrap;
}
.knop:disabled,
.knop[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}
.knop--primair {
    background: var(--groen);
    color: var(--wit);
    border-color: var(--groen);
}
.knop--primair:hover { background: var(--groen-donker); border-color: var(--groen-donker); }
.knop--gevaar {
    background: var(--rood);
    color: var(--wit);
    border-color: var(--rood);
}
.knop--gevaar:hover { background: #a93226; }
.knop--ghost {
    background: transparent;
    color: var(--wit);
    border-color: rgba(255,255,255,.5);
}
.knop--ghost:hover { background: rgba(255,255,255,.15); }
.knop--omlijnd {
    background: transparent;
    color: var(--groen);
    border-color: var(--groen);
}
.knop--omlijnd:hover { background: var(--groen-licht); }
.knop--klein { padding: .35rem .75rem; font-size: .8rem; }
.knop--nav {
    font-size: 1.6rem;
    line-height: 1;
    padding: .25rem .75rem;
    border-color: rgba(255,255,255,.4);
}
.knop--vol { width: 100%; display: flex; }

/* ── Formulieren ─────────────────────────────────────────────────────── */
.veld { display: flex; flex-direction: column; gap: .3rem; }
.veld label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--tekst-sub);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.veld input,
.veld select {
    padding: .55rem .75rem;
    border: 1.5px solid var(--rand);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: inherit;
    color: var(--tekst);
    background: var(--wit);
    transition: border-color .15s;
}
.veld input:focus,
.veld select:focus {
    outline: none;
    border-color: var(--groen);
    box-shadow: 0 0 0 3px rgba(29,158,117,.15);
}

.formulier-kaart {
    background: var(--wit);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--schaduw);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.formulier-kaart h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--groen-donker);
}
.formulier-rij {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}
.formulier-rij .veld { flex: 1 1 180px; }

/* ── Meldingen ───────────────────────────────────────────────────────── */
.melding {
    padding: .65rem 1rem;
    border-radius: var(--radius);
    font-size: .9rem;
}
.melding--fout        { background: var(--rood-licht); color: var(--rood); }
.melding--succes      { background: var(--groen-licht); color: var(--groen-donker); }
.melding--info        { background: var(--paars-licht); color: var(--paars); }
.melding--waarschuwing { background: #fef9c3; color: #854d0e; }

/* ── Login-pagina ────────────────────────────────────────────────────── */
body.login-pagina {
    justify-content: center;
    align-items: center;
    background: #E6F4FB;
    padding: 1rem;
}
.login-kaart {
    background: var(--wit);
    border-radius: 12px;
    padding: 2rem 2.25rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--schaduw-hoog);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: .25rem;
}
.login-logo img {
    background-color: #0D4A6B;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(13,74,107,.25);
    display: block;
    width: 96px;
    height: 96px;
    padding: 12px;
    object-fit: contain;
}
.login-kaart h1 {
    text-align: center;
    font-size: 1.5rem;
    color: var(--groen-donker);
}
.login-subtitel {
    text-align: center;
    color: var(--tekst-sub);
    font-size: .9rem;
    margin-top: -.5rem;
}

/* ── Week-agenda navigatie ───────────────────────────────────────────── */
.agenda-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    background: var(--groen);
    color: var(--wit);
    border-radius: var(--radius);
    padding: .5rem .75rem;
    margin-bottom: .75rem;
    box-shadow: var(--schaduw);
}
.week-label {
    font-size: .95rem;
    font-weight: 600;
    text-align: center;
    flex: 1;
}

/* ── Kalender grid ───────────────────────────────────────────────────── */
.kalender-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.kalender {
    display: grid;
    grid-template-columns: 46px repeat(7, minmax(80px, 1fr));
    gap: 2px;
    background: var(--rand);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 600px;
}
.kalender-lader {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--tekst-sub);
}
.kalender-header {
    background: var(--groen-donker);
    color: var(--wit);
    font-size: .78rem;
    font-weight: 700;
    text-align: center;
    padding: .45rem .2rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.kalender-header.tijdcel { background: transparent; }
.kalender-header.vandaag-kop {
    background: var(--groen);
    text-decoration: underline;
}
.tijdcel {
    background: var(--wit);
    font-size: .72rem;
    font-weight: 600;
    color: var(--tekst-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    min-height: 44px;
}
.slot {
    background: var(--wit);
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .78rem;
    font-weight: 600;
    transition: filter .1s;
    padding: 2px;
    text-align: center;
    position: relative;
    line-height: 1.3;
}
.slot:hover:not(.slot--geblokkeerd):not(.slot--aanloop) { filter: brightness(.93); }

/* Slot-kleuren op basis van beschikbaarheid */
.slot--beschikbaar   { background: #E6F4FB; color: var(--groen-donker); }
.slot--deels-vol     { background: #fff3cd; color: #856404; }
.slot--vol           { background: #f8d7da; color: #842029; }
.slot--geblokkeerd   {
    background: var(--oranje-licht);
    color: var(--oranje);
    cursor: default;
    font-style: italic;
    font-size: .72rem;
}
.slot--aanloop       { background: #E6F4FB; color: var(--groen-donker); pointer-events: none; cursor: not-allowed; }
.slot--aanloop:hover { background: inherit; }
.slot--eigen         {
    outline: 2px solid var(--groen);
    outline-offset: -2px;
}
.slot--pt            { background: var(--paars-licht); color: var(--paars); }

/* Half-uur-rij scheiding */
.slot.half-uur { border-top: 1px dashed var(--rand); }

/* ── Legenda ─────────────────────────────────────────────────────────── */
.legenda {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    padding: .75rem 0;
    font-size: .8rem;
    color: var(--tekst-sub);
}
.legenda-item { display: flex; align-items: center; gap: .35rem; }
.legenda-kleur {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}
.legenda-kleur.beschikbaar { background: var(--groen-licht); border: 1px solid var(--groen); }
.legenda-kleur.deels-vol   { background: #fff3cd; border: 1px solid #ffc107; }
.legenda-kleur.vol         { background: #f8d7da; border: 1px solid var(--rood); }
.legenda-kleur.geblokkeerd { background: var(--oranje-licht); border: 1px solid var(--oranje); }
.legenda-kleur.pt          { background: var(--paars-licht); border: 1px solid var(--paars); }

/* ── Mijn reserveringen ──────────────────────────────────────────────── */
.sectie-titel {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--groen-donker);
    margin-bottom: 1rem;
}
.res-lijst { display: flex; flex-direction: column; gap: .5rem; }
.res-kaart {
    background: var(--wit);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    box-shadow: var(--schaduw);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.res-kaart__info { display: flex; flex-direction: column; gap: .15rem; }
.res-kaart__datum { font-weight: 700; }
.res-kaart__detail { font-size: .85rem; color: var(--tekst-sub); }
.res-leeg {
    text-align: center;
    padding: 2rem;
    color: var(--tekst-sub);
    background: var(--wit);
    border-radius: var(--radius);
}

/* ── Ledenbeheertabel ────────────────────────────────────────────────── */
.tabel {
    width: 100%;
    border-collapse: collapse;
    background: var(--wit);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--schaduw);
    font-size: .9rem;
}
.tabel th {
    background: var(--groen-donker);
    color: var(--wit);
    padding: .6rem .85rem;
    text-align: left;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.tabel td {
    padding: .6rem .85rem;
    border-top: 1px solid var(--rand);
    vertical-align: middle;
}
.tabel tr:hover td { background: var(--grijs-licht); }
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.badge--lid     { background: var(--groen-licht); color: var(--groen-donker); }
.badge--trainer { background: var(--paars-licht); color: var(--paars); }
.badge--admin   { background: #fef3c7; color: #92400e; }
.badge--actief  { background: var(--groen-licht); color: var(--groen-donker); }

/* ── Lessen-lijst ────────────────────────────────────────────────────── */
.lessen-lijst { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.5rem; }
.les-kaart {
    background: var(--wit);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    box-shadow: var(--schaduw);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.les-kaart--wekelijks { border-left: 4px solid var(--oranje); }
.les-kaart--eenmalig  { border-left: 4px solid var(--paars); }
.les-kaart__naam  { font-weight: 700; }
.les-kaart__meta  { font-size: .83rem; color: var(--tekst-sub); }
.les-kaart__acties { display: flex; gap: .4rem; flex-shrink: 0; }
.toelichting { font-size: .9rem; color: var(--tekst-sub); }

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    /* iOS Safari: cursor:pointer is required for click events to fire on divs */
    cursor: pointer;
}
@media (min-width: 600px) {
    .modal-overlay { align-items: center; padding: 1rem; }
}
.modal-kaart {
    background: var(--wit);
    border-radius: 16px 16px 0 0;
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    position: relative;
    box-shadow: var(--schaduw-hoog);
    max-height: 90vh;     /* fallback voor iOS Safari < 15.4 zonder dvh-support */
    max-height: 90dvh;
    overflow-y: auto;
    /* -webkit-overflow-scrolling: touch; verwijderd — absorbeert click-events in WebKit */
    overscroll-behavior: contain;
    cursor: auto;         /* reset cursor van de overlay */
}
@media (min-width: 600px) {
    .modal-kaart { border-radius: 16px; }
}
.modal-sluiten {
    position: absolute;
    top: .75rem;
    right: .75rem;
    background: var(--grijs-licht);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--grijs);
    touch-action: manipulation;
}
.modal-kaart h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: var(--groen-donker);
    padding-right: 2rem;
}
#modal-inhoud { display: flex; flex-direction: column; gap: .75rem; }

/* Tijdkiezerknoppen in de modal */
.tijdkiezer { display: flex; gap: .5rem; flex-wrap: wrap; position: relative; z-index: 10; }
.tijdknop {
    padding: .55rem 1rem;
    border: 2px solid var(--rand);
    border-radius: var(--radius);
    background: var(--wit);
    cursor: pointer;
    touch-action: manipulation;
    font-size: .9rem;
    font-weight: 600;
    transition: border-color .1s, background .1s;
    flex: 1;
    text-align: center;
}
.tijdknop:hover:not(:disabled) { border-color: var(--groen); background: var(--groen-licht); }
.tijdknop.actief { border-color: var(--groen); background: var(--groen); color: var(--wit); }
.tijdknop:disabled { opacity: .4; cursor: not-allowed; }

.personen-kiezer { display: flex; gap: .5rem; }
.personen-knop {
    flex: 1;
    padding: .55rem;
    border: 2px solid var(--rand);
    border-radius: var(--radius);
    background: var(--wit);
    cursor: pointer;
    touch-action: manipulation;
    font-size: .9rem;
    font-weight: 600;
    text-align: center;
    transition: border-color .1s, background .1s;
}
.personen-knop.actief { border-color: var(--groen); background: var(--groen); color: var(--wit); }

/* ── Openingstijden-formulier ────────────────────────────────────────── */
.ot-rij {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--rand);
    flex-wrap: wrap;
}
.ot-rij:last-child { border-bottom: none; }

.ot-dag-naam {
    width: 90px;
    font-weight: 600;
    flex-shrink: 0;
}

.ot-tijden {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    transition: opacity .2s;
}
.ot-tijden--uitgeschakeld { opacity: .35; }

/* Toggle-schakelaar */
.schakelaar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}
.schakelaar input[type="checkbox"] { display: none; }

.schakelaar-track {
    width: 44px;
    height: 24px;
    background: var(--grijs);
    border-radius: 12px;
    position: relative;
    transition: background .2s;
    flex-shrink: 0;
}
.schakelaar-track::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.schakelaar input:checked + .schakelaar-track            { background: var(--groen); }
.schakelaar input:checked + .schakelaar-track::after     { transform: translateX(20px); }

.schakelaar-tekst {
    font-size: .85rem;
    font-weight: 600;
    min-width: 58px;
}

/* ── Mobiele dagweergave (standaard verborgen) ───────────────────────── */
#dag-knoppen  { display: none; }
#mobiel-slots { display: none; }

@media (max-width: 767px) {
    .kalender-wrapper { display: none !important; }

    #dag-knoppen {
        display: flex;
        gap: 6px;
        padding: 10px 12px 8px;
        background: var(--wit);
        border-bottom: 1px solid var(--rand);
    }

    .dag-knop {
        flex: 1;
        padding: 8px 0;
        border: 1px solid var(--rand);
        border-radius: 6px;
        background: var(--wit);
        color: var(--tekst);
        font-size: .78rem;
        font-weight: 600;
        cursor: pointer;
        touch-action: manipulation;
        transition: background .15s, color .15s, border-color .15s;
    }
    .dag-knop.actief {
        background: #3399CC;
        color: #fff;
        border-color: #3399CC;
    }

    #mobiel-slots {
        display: block;
        padding: 0 12px 24px;
    }

    .mobiel-slot-rij {
        display: flex;
        align-items: stretch;
        min-height: 52px;
        border-bottom: 1px solid var(--rand);
    }
    .mobiel-slot-rij:last-child { border-bottom: none; }

    .mobiel-slot-tijd {
        width: 52px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        font-size: .78rem;
        color: var(--tekst-sub);
        font-weight: 500;
    }

    .mobiel-slot-blok {
        flex: 1;
        display: flex;
        align-items: center;
        padding: 8px 14px;
        margin: 6px 0;
        border-radius: 8px;
        font-size: .88rem;
        font-weight: 600;
    }

    .mobiel-slot--beschikbaar {
        background: #3399CC;
        color: #fff;
        cursor: pointer;
        touch-action: manipulation;
    }
    .mobiel-slot--beschikbaar:active { filter: brightness(.9); }

    .mobiel-slot--geblokkeerd {
        background: var(--oranje-licht);
        color: var(--oranje);
        font-style: italic;
        cursor: default;
    }

    .mobiel-slot--aanloop {
        background: #E6F4FB;
        color: var(--groen-donker);
        pointer-events: none;
        cursor: not-allowed;
    }

    .mobiel-slot--vol {
        background: var(--grijs-licht);
        color: var(--grijs);
        cursor: default;
    }

    .mobiel-slot--eigen {
        background: var(--groen-licht);
        color: var(--groen-donker);
        cursor: pointer;
        touch-action: manipulation;
        outline: 2px solid var(--groen);
        outline-offset: -2px;
    }
    .mobiel-slot--eigen:active { filter: brightness(.9); }
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .topbalk__naam { display: none; }
    .formulier-rij .veld { flex: 1 1 100%; }
    .tab { padding: .65rem .75rem; font-size: .82rem; }
    .tabel { font-size: .82rem; }
    .tabel th, .tabel td { padding: .45rem .55rem; }
}
