/* High-contrast layer on top of Tailwind CDN. Optimized for outdoor tablets and projectors. */

:root {
    --ink-900: #0b1220;
    --ink-800: #111a2e;
    --ink-700: #1c2742;
    --brand-500: #facc15;
}

html, body { -webkit-tap-highlight-color: transparent; }

body { font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

/* Race tap tiles */
.tap-tile {
    position: relative;
    padding: 1rem;
    border-radius: 14px;
    border: 4px solid transparent;
    transition: transform .06s ease, box-shadow .1s ease, background-color .15s ease;
    user-select: none;
    cursor: pointer;
    background: var(--ink-800);
    min-height: 170px;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.tap-tile:hover { box-shadow: 0 0 0 3px rgba(250,204,21,.35); }
.tap-tile:active { transform: scale(0.97); }
.tap-tile[data-finished="1"] { opacity: .55; cursor: not-allowed; }
.tap-tile .bib {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 900;
    letter-spacing: -1px;
    line-height: 1;
}
.tap-tile .lap-count {
    font-size: clamp(2.4rem, 6vw, 4rem);
    font-weight: 900;
    line-height: .95;
}
.tap-tile .lap-remaining {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: .35rem;
    line-height: .95;
    color: #fff;
}
.tap-tile .lap-remaining .rem-num {
    font-size: clamp(2.6rem, 7vw, 4.5rem);
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--brand-500);
    text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.tap-tile .lap-remaining .rem-label {
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .85;
}
.tap-tile .lap-progress {
    font-size: .75rem;
    font-weight: 600;
    color: #fff;
    opacity: .8;
    letter-spacing: .03em;
}
.tap-tile .name { font-weight: 700; font-size: 1rem; line-height: 1.1; }
.tap-tile .meta { font-size: .8rem; opacity: .85; }
.tap-tile.flash-success {
    animation: tile-flash .55s ease;
    border-color: #34d399;
    box-shadow: 0 0 0 6px rgba(52,211,153,.35);
}
@keyframes tile-flash {
    0%   { background: #064e3b; }
    50%  { background: #10b981; }
    100% { background: var(--ink-800); }
}

.color-strip {
    position: absolute;
    inset: 0 0 auto 0;
    height: 8px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

/* Big-screen leaderboard */
.lb-row {
    display: grid;
    grid-template-columns: 60px 60px 1fr 80px 100px 120px;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--ink-800);
    border-left: 6px solid var(--ink-700);
}
.lb-row + .lb-row { margin-top: 8px; }
.lb-row .rank { font-size: 1.4rem; font-weight: 900; text-align: center; }
.lb-row .bib  { font-size: 1.2rem; font-weight: 800; text-align: center; }
.lb-row .name { font-weight: 700; font-size: 1rem; }
.lb-row .laps { font-size: 1.6rem; font-weight: 900; text-align: center; }
.lb-row .time { font-variant-numeric: tabular-nums; text-align: right; }

@media (max-width: 720px) {
    .lb-row { grid-template-columns: 50px 50px 1fr 60px 90px; }
    .lb-row .time { display: none; }
}

/* Form controls in dark theme.
   We explicitly cover every text-like type, including bare <input> tags
   (no `type` attribute -> defaults to text) used in several admin forms. */
input:not([type]),
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=time], input[type=month],
input[type=search], input[type=tel], input[type=url],
input[type=color], input[type=file],
select, textarea {
    background-color: var(--ink-700);
    color: #f1f5f9;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: .55rem .7rem;
    width: 100%;
    font-size: .95rem;
    -webkit-text-fill-color: #f1f5f9;
    caret-color: #f1f5f9;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(250,204,21,.25);
}

/* Make placeholders readable on dark inputs (was nearly invisible by default). */
input::placeholder, textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

/* Kill the Chrome/Edge autofill white background + black text that makes
   email/phone/password inputs look white-on-white over our dark theme. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--ink-700) inset !important;
    -webkit-text-fill-color: #f1f5f9 !important;
    caret-color: #f1f5f9 !important;
    border: 1px solid #334155 !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Force the date/time picker indicator icon to be visible on dark backgrounds. */
input[type=date]::-webkit-calendar-picker-indicator,
input[type=datetime-local]::-webkit-calendar-picker-indicator,
input[type=time]::-webkit-calendar-picker-indicator,
input[type=month]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.3);
    opacity: .8;
    cursor: pointer;
}

/* Compact color picker (override the shared full-width rule) */
input[type=color] {
    width: 4rem;
    height: 2.5rem;
    padding: 2px;
    cursor: pointer;
}

/* Brand-tinted checkboxes / radios on dark backgrounds */
input[type=checkbox], input[type=radio] {
    accent-color: var(--brand-500);
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    vertical-align: middle;
}

/* Skin the native file-picker button to match .btn-secondary */
input[type=file] { padding: .35rem .5rem; }
input[type=file]::file-selector-button {
    margin-right: .6rem;
    padding: .35rem .7rem;
    border-radius: 6px;
    border: 1px solid #334155;
    background: var(--ink-700);
    color: #e2e8f0;
    font-weight: 600;
    cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: #243049; }

label { display: block; font-size: .8rem; color: #94a3b8; margin-bottom: .25rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
/* Inline labels (e.g. wrapping a checkbox + text) should stay normal-case and readable. */
label.flex, label.inline-flex {
    display: inline-flex;
    text-transform: none;
    letter-spacing: normal;
    font-size: .9rem;
    color: inherit;
    font-weight: 500;
    margin-bottom: 0;
}

/* GET filter bars: opt out of the shared full-width rule so controls sit nicely in a flex row. */
.filter-bar > div { display: flex; flex-direction: column; }
.filter-bar input, .filter-bar select { width: auto; min-width: 12rem; }

/* Collapsible sections (used in heat editor "Add participants" etc.) */
details > summary { list-style: none; padding: .35rem 0; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: .35rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem .9rem; border-radius: 8px; font-weight: 700; cursor: pointer; transition: background-color .12s ease; border: 1px solid transparent; font-size: .9rem; }
.btn-primary { background: var(--brand-500); color: #0b1220; }
.btn-primary:hover { background: #eab308; }
.btn-secondary { background: var(--ink-700); color: #e2e8f0; border-color: #334155; }
.btn-secondary:hover { background: #243049; }
.btn-danger  { background: #be123c; color: #fff; }
.btn-danger:hover { background: #9f1239; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }

.card { background: var(--ink-800); border: 1px solid #1f2a44; border-radius: 12px; padding: 1.1rem; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; padding: .6rem .7rem; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: #94a3b8; border-bottom: 1px solid #1f2a44; }
.table td { padding: .65rem .7rem; border-bottom: 1px solid #1f2a44; font-size: .9rem; vertical-align: middle; }
.table tr:hover td { background: rgba(255,255,255,.03); }

.muted { color: #94a3b8; }

.kbd { background: var(--ink-700); border: 1px solid #334155; border-radius: 6px; padding: 2px 6px; font-size: .72rem; font-family: ui-monospace, monospace; }

.swatch { width: 22px; height: 22px; border-radius: 6px; display: inline-block; vertical-align: middle; border: 1px solid rgba(255,255,255,.15); }

/* Print friendly */
@media print {
    body { background: #fff; color: #000; }
    header, aside, .no-print { display: none !important; }
    .card { border-color: #d1d5db; background: #fff; color: #000; }
}
