/* ============================================================
   Racetijden — stijl voor klassement + beheer
   ============================================================ */
:root {
    --bg: #0f1424;
    --bg-2: #1a2138;
    --card: #ffffff;
    --ink: #1c2333;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #2563eb;
    --accent-ink: #ffffff;
    --gold: #f5c518;
    --silver: #c8ccd4;
    --bronze: #cd7f4d;
    --danger: #dc2626;
    --ok: #16a34a;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 28px 20px 48px;
}
.container.narrow { max-width: 440px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------- Taalwissel ------------------------ */
.lang-switch { display: inline-flex; gap: 6px; }
.lang-switch a {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, .25);
    color: inherit;
}
.lang-switch a.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); text-decoration: none; }
.lang-switch.top-right { position: absolute; top: 18px; right: 18px; }

/* =====================  PUBLIEK KLASSEMENT  ================== */
body.board {
    background: radial-gradient(1200px 600px at 50% -10%, var(--bg-2), var(--bg));
    min-height: 100vh;
    color: #eef2ff;
}
.board .lang-switch a { border-color: rgba(255,255,255,.3); color: #eef2ff; }

.board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.board-header h1 { margin: 0; font-size: clamp(26px, 4vw, 42px); letter-spacing: -.5px; }
.board-header .subtitle { margin: 4px 0 0; color: #9fb0d8; font-size: clamp(14px, 2vw, 18px); text-transform: uppercase; letter-spacing: 3px; }

table.leaderboard {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, .04);
    border-radius: var(--radius);
    overflow: hidden;
}
table.leaderboard th {
    text-align: left;
    padding: 14px 18px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #9fb0d8;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
table.leaderboard td {
    padding: 16px 18px;
    font-size: clamp(18px, 2.6vw, 26px);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
table.leaderboard tr:last-child td { border-bottom: none; }
.col-rank { width: 70px; text-align: center; font-weight: 800; }
.col-time { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.col-name { font-weight: 600; }
tr.empty td { text-align: center; color: #9fb0d8; font-size: 18px; padding: 40px 18px; }

/* Podium top 3 */
tr.rank-1 .col-rank { color: var(--gold); }
tr.rank-2 .col-rank { color: var(--silver); }
tr.rank-3 .col-rank { color: var(--bronze); }
tr.rank-1 td { background: linear-gradient(90deg, rgba(245,197,24,.16), transparent); }
tr.rank-2 td { background: linear-gradient(90deg, rgba(200,204,212,.12), transparent); }
tr.rank-3 td { background: linear-gradient(90deg, rgba(205,127,77,.12), transparent); }

.board-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    color: #7e8db5;
    font-size: 13px;
}
.board-footer .admin-link { color: #7e8db5; }
.footer-links { display: inline-flex; gap: 16px; }
.board-footer .register-link { color: #cdd7f3; font-weight: 600; }

/* ====================  REGISTRATIEPAGINA  =================== */
body.register { background: radial-gradient(1200px 600px at 50% -10%, var(--bg-2), var(--bg)); min-height: 100vh; }
body.register .container { padding-top: 64px; }
body.register .card h1 { margin-bottom: 4px; }
.subtitle-light { color: var(--muted); margin-top: 0; margin-bottom: 20px; }
.stack-form { display: flex; flex-direction: column; gap: 14px; }
.btn.block { width: 100%; text-align: center; padding: 14px; font-size: 16px; margin-top: 6px; }
.center { text-align: center; }
.success-block { text-align: center; padding: 14px 0 6px; }
.success-block .check {
    width: 64px; height: 64px; line-height: 64px; margin: 0 auto 14px;
    border-radius: 50%; background: #ecfdf3; color: var(--ok);
    font-size: 34px; font-weight: 700;
}
.success-block h2 { margin: 0 0 6px; }

/* =========================  BEHEER  ========================= */
body.admin { background: #f4f6fb; min-height: 100vh; }

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.admin-header h1 { margin: 0; font-size: 26px; }
.admin-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin .lang-switch a { border-color: var(--line); color: var(--ink); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 22px;
    position: relative;
}
.card h1, .card h2 { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.count { font-size: 13px; color: var(--muted); font-weight: 500; }

/* Formulier */
.grid-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.field { display: flex; flex-direction: column; }
.field.full { grid-column: 1 / -1; }
.field.actions { grid-column: 1 / -1; flex-direction: row; gap: 10px; align-items: center; }
label { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input, select, textarea {
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
}
textarea { resize: vertical; min-height: 52px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.extra-note { display: inline-block; margin-left: 8px; color: var(--accent); font-weight: 600; cursor: help; white-space: nowrap; }

/* Status in beheertabel */
.col-status { white-space: nowrap; }
.rank-badge { display: inline-block; min-width: 34px; text-align: center; padding: 3px 8px; border-radius: 999px; background: #eef2ff; color: var(--accent); font-weight: 800; font-size: 13px; }
.pending-dot { color: #f59e0b; font-size: 16px; }
tr.pending td { background: #fffbeb; }

/* Tijd-ingaveblok */
.edit-card { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.12), var(--shadow); }
.participant-context { margin: 0 0 16px; color: var(--ink); font-size: 15px; }
.participant-context strong { font-size: 17px; }

/* Manuele inschrijving (opvouwbaar) */
details.manual-add { padding: 0; overflow: hidden; }
.manual-add summary { cursor: pointer; font-weight: 700; font-size: 16px; list-style: none; padding: 16px 22px; border-radius: var(--radius); }
.manual-add summary::-webkit-details-marker { display: none; }
.manual-add summary::before { content: "+ "; color: var(--accent); font-weight: 800; }
.manual-add[open] summary::before { content: "\2212 "; }
.manual-add[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
.manual-add .hint, .manual-add form { padding: 0 22px; }
.manual-add[open] form { padding-bottom: 22px; }
.manual-add .hint { padding-top: 14px; }

/* Knoppen */
.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}
.btn:hover { text-decoration: none; background: #f8fafc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #1d4ed8; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: #f3c4c4; background: #fff6f6; }
.btn.danger:hover { background: #fdecec; }

/* Resultatentabel */
table.results { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.results th, table.results td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; white-space: nowrap; vertical-align: middle; }
table.results td:nth-child(4) { white-space: normal; word-break: break-word; } /* e-mail mag breken */
table.results td:nth-child(8) { white-space: normal; }                         /* geregistreerd */
table.results th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
table.results td.mono { font-variant-numeric: tabular-nums; font-weight: 700; }
table.results .extra-note { display: block; margin-left: 0; margin-top: 3px; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.inline { display: inline; margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 26px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Meldingen */
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin: 0 0 18px; }
.alert.ok { background: #ecfdf3; color: #166534; border: 1px solid #bbf7d0; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Responsief */
@media (max-width: 640px) {
    .grid-form { grid-template-columns: 1fr; }
    table.results thead { display: none; }
    table.results, table.results tbody, table.results tr, table.results td { display: block; width: 100%; }
    table.results tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; padding: 6px 0; }
    table.results td { border: none; padding: 6px 14px; white-space: normal; }
    .row-actions { padding: 10px 14px; }
}
