/* event.html-only rules (races table, entry banner/fullscreen mode,
   arrivals-live, liens publics). See base.css's header comment for why a
   rule ending up here instead of base.css is a filing choice, not a
   loading boundary. */


/* Houses #connection-status (pinned top-left, see above) and #feedback,
   above the entry form - keeping the operator's eyes in one place instead
   of having to glance below the bib field for a result message, and letting
   the quick-entry card be exactly as tall as the entry form itself rather
   than reserving a fixed clearance band for the status indicator plus a
   whole separate line for feedback underneath. */
.quick-entry-header {
    position: relative;
    margin-bottom: 8px;
}

/* Event detail page's own header content (event.html's page_header block) -
   scoped to these classes rather than restyling the bare h1/p that
   index.html/admin.html/race.html also put in .page-header-title, so their
   plainer titles are unaffected. */
.event-header-title {
    font-size: 28px;
    font-weight: 800;
    color: #1a2b3c;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.event-header-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-size: 14px;
    margin: 0;
}

.event-header-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.event-header-meta-icon { font-size: 14px; }

.event-header-meta-sep { color: #ccc; }

/* Recent-entries table on the quick-entry ("Saisie Chrono") tab: rows are
   shown ~45% shorter (reduced vertical padding, in two successive passes)
   and with a slightly smaller font so more history fits on screen while
   the operator is entering bibs. Edit/delete icons are scaled down to
   match the tighter row height. */
#section-entry table th,
#section-entry table td {
    padding: 4.5px 6px;
    font-size: 13px;
}

/* Kept as narrow as the LED itself - a whole extra table column (see the
   quick-entry history) is otherwise enough to push a wide, already-tight
   table (many nowrap columns) past the viewport, forcing a horizontal
   scroll that used to fit without one. */
.col-sync { width: 1%; padding-left: 4px; padding-right: 4px; }

.public-link-status-badge {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    vertical-align: middle;
}

.public-link-status-badge.public-link-status-active { background: #eaf3de; color: #27500a; }
.public-link-status-badge.public-link-status-inactive { background: #eee; color: #666; }

.race-name-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.race-name-row input[type="text"] {
    flex: 1;
}

.race-color-input {
    -webkit-appearance: none;
    appearance: none;
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0 4px;
    border: 1px solid #bbb;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    flex: none;
}
.race-color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.race-color-input::-webkit-color-swatch { border: none; border-radius: 4px; }
.race-color-input::-moz-color-swatch { border: none; border-radius: 4px; }

.tab-icon { font-size: 14px; line-height: 1; }

#tab-entry {
    background: #ff5722;
    color: white;
    /* Tighter than the base .tab's inherited 18px right padding: the
       fullscreen toggle butts flush against this tab's right edge (see
       .entry-fullscreen-toggle below), so that much padding just reads as
       a wide gap between the "Saisie Chrono" label and the toggle icon. */
    padding-right: 0px;
}

#tab-entry.tab-disabled {
    background: #eee;
    color: #555;
}

/* Lives right after #tab-entry in the tab bar by default (see event.html) -
   a plain sibling rather than nested inside that button (buttons can't
   nest), butted up against it with a matching background/negative margin
   (see the #tab-entry(...)+.entry-fullscreen-toggle rules below) so it reads
   as part of the "Saisie Chrono" tab's own title instead of a separate tab.
   dockEntryFullscreenToggle() (event.html) physically moves this same
   element into .entry-banner-wrap while fullscreen is active, since that
   whole tab bar is hidden then (body.entry-fullscreen .tabs below) and this
   control would otherwise vanish with it - see .entry-banner-wrap
   .entry-fullscreen-toggle further down for how it looks once relocated
   there. Icon-only + title tooltip (no visible label) keeps it compact. */
.entry-fullscreen-toggle {
    width: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    background: #ff5722;
    color: #fff;
    border: none;
    border-radius: 0 8px 0 0;
    margin-left: -4px;
}

.entry-fullscreen-toggle:hover { background: #f4511e; }

.entry-fullscreen-toggle.tab-disabled {
    background: #eee;
    color: #555;
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* #tab-entry's own top-right corner is squared off (rather than the 8px
   .tab default) so it butts flush against the toggle instead of leaving a
   rounded sliver of tab background peeking out between the two. */
#tab-entry { border-top-right-radius: 0; }

/* Docked here (not the tab bar) while fullscreen is active - see
   dockEntryFullscreenToggle() in event.html. Pinned to the top-right corner
   of the black race-clocks banner (.entry-banner-wrap has position:relative
   for this to anchor against) - same corner-pin idea as .connection-status
   in .quick-entry, just the opposite corner - and restyled back to a
   free-floating icon button since it's no longer flush against a tab. */
.entry-banner-wrap .entry-fullscreen-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    margin-left: 0;
}

.entry-banner-wrap .entry-fullscreen-toggle:hover { background: rgba(255, 255, 255, 0.22); }

/* Shrink-to-fit and centered as a whole (by .quick-entry's text-align, its
   own text-align:left below keeps the entry-row and the "Abandon" checkbox
   sharing the same left edge instead of each being independently centered). */
.entry-form {
    display: inline-block;
    text-align: left;
}

.entry-row {
    display: flex;
    align-items: stretch;
    gap: 16px;
}

/* Colors matched to .entry-race-panel/.entry-banner above (same cyan/navy
   theme) rather than the app's generic blue, so the quick-entry field the
   operator actually types into reads as part of the same banner. */
.bib-input {
    width: 6ch;
    /* Generic `input { flex: 1 }` would otherwise stretch this to fill the
       row - a bib field has no business growing to the width of the card. */
    flex: none;
    box-sizing: content-box;
    font-size: 64px;
    font-weight: 600;
    text-align: center;
    padding: 24px 12px;
    border: 3px solid #1c5269;
    border-radius: 12px;
    background: #fff;
    color: black;
}

.bib-input:focus {
    outline: none;
    border-color: #3bbbda;
    box-shadow: 0 0 0 4px rgba(59, 187, 218, 0.25);
}

/* The 64px value font-size would clip the ("Num. Dossard") placeholder
   in a field this narrow (6ch, sized for 4 digits) - the placeholder only
   ever shows while empty, so it can afford its own much smaller size. */
.bib-input::placeholder {
    font-size: 18px;
    font-weight: 600;
    color: #8fb8cc;
    opacity: 1;
}

/* Grouped-arrival entry ("45-46-47", see recordEntry/multiBibEntryEnabled in
   event.html): doubled width so several hyphen-separated bibs stay readable
   at the same 64px size instead of shrinking or overflowing. */
.bib-input.bib-input-wide {
    width: 12ch;
}

/* Same accent color as .entry-panel-action-start above (the race panels'
   own "Démarrer Course" button) so it reads as part of that banner too. */
.record-entry-button {
    font-size: 28px;
    font-weight: 700;
    padding: 0 32px;
    border-radius: 12px;
    background: #3bbbda;
    color: #06222c;
}

.record-entry-button:hover,
.record-entry-button:active {
    background: #2fa5c2;
}

.dnf-checkbox-label {
    /* A normal flex block (not inline-flex) so it lines up flush against
       .entry-form's left edge - same as .entry-row above it - rather than
       being centered independently within .quick-entry. */
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    color: #b30000;
    font-weight: 600;
}

.dnf-checkbox-label input[type="checkbox"] {
    accent-color: #b30000;
    width: 18px;
    height: 18px;
}

/* Sits in .quick-entry-header, above the entry form - min-height (not
   margin-top anymore, now that it's not a block below the entry form)
   keeps that row's height stable whether or not a message is currently
   showing. Inherits .quick-entry's centered text-align, so it lines up
   over the bib input/button cluster rather than #connection-status, which
   is pinned separately to the corner (see .connection-status). */
.feedback {
    min-height: 26px;
    font-size: 18px;
    font-weight: 600;
}

.feedback.success { color: #27500a; }
.feedback.error { color: #791f1f; }
.feedback.dnf { color: #8a5a00; }
.row-dnf { color: #c0392b; }

/* Card header above the races table: title left, "Partager"/"Ajouter une
   course" buttons right - replaces the old plain <h2> with float:right
   icons. */
.races-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 4px;
}

.races-toolbar-title { margin: 0; }

.races-toolbar-actions {
    display: flex;
    gap: 10px;
}

/* Scoped to this one toolbar ("Partager"/"Ajouter une course", races
   listing screen) rather than the app-wide button/.secondary defaults, so
   only these two pick up the app's cyan accent with a black (not white)
   label - everywhere else keeps the standard blue/white button. */
.races-toolbar-actions button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #3bbbda;
    color: white;
}

.races-toolbar-actions button:hover,
.races-toolbar-actions button:active {
    background: #2fa5c2;
    color: #000;
}

.races-toolbar-actions .btn-icon { font-size: 14px; line-height: 1; }

/* Race name cell: the same .color-swatch dot used elsewhere for a race's
   color (results tables, race.html's own header...) sits beside the name,
   and that same color also runs down the row's left edge as a border. */
.race-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Small solid dot before the status text, reusing the badge's own text
   color (currentColor) via background so it's never a color out of step
   with the pill it sits in - one color source (.status-badge.status-* in
   the block above) instead of a second copy per status. */
.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 5px;
    vertical-align: middle;
}

/* Participants/Partants/Arrivés/Abandons cells: the count, then its share
   of this race's participants right underneath (see loadRaceStats) - same
   "value + context line" idea as the event-wide stat cards above the
   tabs. */
.cell-stat-value { font-weight: 700; }

.cell-stat-percent {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

/* "Temps" cell while a race is in_progress: the ticking value plus a small
   accent-colored "Temps réel" caption underneath (see updateLiveTime) -
   hidden entirely for a race with nothing live to show (finished / not yet
   started), where the value is just "-". */
.cell-live-time-caption {
    font-size: 11px;
    color: #3bbbda;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 2px;
}

/* Edit/delete + "next status" action merged into one cell (previously two
   separate columns) - the icon buttons on one line, the bold call-to-action
   button (when there is one) on its own line right underneath. */
.races-actions-cell { text-align: right; }

.races-actions-row {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* Same bordered-box language as the row-action icons above (rather than its
   old solid orange pill) so the races table's one text-labeled row action
   reads as part of the same family - just wider, to fit its label, and its
   own orange kept as the text/hover color instead of a fill. */
.race-next-status-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    height: 30px;
    background: white;
    color: #0f3b47;
    border: 1px solid #e0e0e0;
    font-weight: 700;
    white-space: nowrap;
    font-size: 12px;
    padding: 0 10px;
    border-radius: 8px;
}

.race-next-status-button:hover { background: #fff3e8; }

/* Entered bib matching no runner ("orphan"), or re-entered for a checkpoint
   it already has ("duplicate"): same bright red to flag unambiguously that
   the entry is suspect - the pencil icon lets you fix it (reconciling an
   orphan automatically, or promoting a leftover duplicate if the corrected
   record was the real one). */
.row-orphan, .row-duplicate { background: #ff1a1a; color: #fff; }

/* Per-row sync status in the quick-entry history: green once the server has
   confirmed the record, red while it only exists in this device's local
   offline queue (see event.html's pending-entries handling). */
.sync-led {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
}
.sync-led-synced { background: #2ecc71; box-shadow: 0 0 3px #2ecc71; }
.sync-led-pending { background: #ff1a1a; box-shadow: 0 0 3px #ff1a1a; }

/* A row that only exists in the local offline queue, not yet confirmed by
   the server: same idea as .row-orphan (little reliable info beyond
   bib/time) but a distinct muted style since it isn't suspect, only
   pending. */
.row-pending-sync { background: #fef3e2; color: #7a5200; font-style: italic; }

/* Saisie Chrono's own banner (renderEntryBanner in event.html): one dark
   cyan/navy panel per race, plus one for the event's own totals - same hue
   family as .topbar-clock's pill (see base.html), so it reads as part of
   this site's own cyan theme rather than a generic dark scoreboard. Also
   reused (without the stats panel or action buttons) for the "Dernières
   arrivées" tab's own read-only copy of the race panels - see
   renderEntryRacePanel/updateArrivalsClock in event.html. */
.entry-banner-wrap {
    position: relative;
    margin-bottom: 16px;
}

.entry-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.entry-race-panel,
.entry-stats-panel {
    flex: 1 1 260px;
    background: #0e3b47;
    border: 1px solid #1c5269;
    border-radius: 14px;
    padding: 12px 20px;
    color: #fff;
    text-align: center;
    /* .entry-banner's flex row already stretches every panel to the height
       of its tallest sibling. Every .entry-race-panel always renders the
       same rows in the same order - title, caption, time, (optionally)
       button - falling back to an invisible placeholder rather than being
       omitted when a race has no running time or no action to show (see
       renderEntryRacePanel in event.html), so each row's own height is
       identical across every panel. space-between (not center) then only
       has to distribute the leftover stretch height into equal gaps, which
       keeps title/caption/time/button on the same line across every card
       regardless of that leftover amount. */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.entry-panel-title {
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Race's own color as a small square before its name (rather than tinting
   the name text itself, now always white - see .entry-panel-title). */
.entry-panel-color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex: none;
}

/* Doubles as the race's own status (EN COURS / TERMINÉE / REMISE DOSSARDS
   FERMÉE...) instead of a fixed "Temps de course" label - see
   renderEntryRacePanel - so status is stated once here rather than repeated
   on a second line underneath the time. */
.entry-panel-caption {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8fb8cc;
    margin-bottom: 4px;
}

.entry-panel-time {
    font-size: 32px;
    font-weight: 800;
    font-family: "Courier New", Courier, monospace;
    font-variant-numeric: tabular-nums;
    margin-bottom: 4px;
}

/* Reserves the same line height as a real running time, for a race with
   nothing to show yet (e.g. still "en préparation") - see
   renderEntryRacePanel. */
.entry-panel-time-placeholder { visibility: hidden; }

/* Sized to fit "Démarrer Course" (longer than "Arrêter Course") so both
   variants share one width and a race's button doesn't visibly resize
   when it flips between the two on start/stop - rather than stretching to
   the panel's full width, which the shared .entry-race-panel flex column
   would otherwise do by default. */
.entry-panel-action-button {
    align-self: center;
    font-size: 14px;
    padding: 7px 18px;
    min-width: 168px;
    white-space: nowrap;
    border-radius: 8px;
    border: none;
    margin-top: 4px;
}

.entry-panel-action-start { background: #3bbbda; color: #06222c; }
.entry-panel-action-start:hover { background: #2fa5c2; }
.entry-panel-action-stop { background: #e05252; color: #fff; }
.entry-panel-action-stop:hover { background: #c43e3e; }

/* Reserves the same button height for a race with no start/stop action to
   show (already finished, or the viewer lacks manage_race_status) - see
   renderEntryRacePanel. */
.entry-panel-action-placeholder { visibility: hidden; background: none; }

/* Overrides the space-between shared with .entry-race-panel above: that
   rule exists to keep multi-row race panels (title/caption/time/button)
   aligned line-by-line across siblings, but the stats panel only has two
   rows (title, counters row). flex-start keeps the title pinned at the
   same top position as every race panel's own title (see
   .entry-panel-title) regardless of how much the card is stretched to
   match its tallest sibling; the counters row then centers itself in
   whatever space is left below via its own auto margins (see
   .entry-stats-row) rather than being glued to either end. */
.entry-stats-panel {
    justify-content: flex-start;
}

.entry-stats-title {
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    color: #fff;
}

.entry-stats-row {
    display: flex;
    gap: 10px;
    margin: auto 0;
}

/* Equal-width columns (rather than space-around, whose gap only equalizes
   the leftover free space - not the columns themselves) so the three
   counters sit at even intervals regardless of label length. Bottom-aligned
   so a two-line label (e.g. "Reste à arriver") doesn't push its value lower
   than the single-line labels' values sitting next to it - every value ends
   up on the same baseline. */
.entry-stat-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.entry-stat-col-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #8fb8cc;
    margin-bottom: 4px;
}

.entry-stat-col-value {
    font-size: 24px;
    font-weight: 800;
}

.entry-stat-col-finishers .entry-stat-col-value { color: #4ade80; }
.entry-stat-col-dnf .entry-stat-col-value { color: #f87171; }
.entry-stat-col-remaining .entry-stat-col-value { color: #fbbf24; }

@media (max-width: 700px) {
    .entry-race-panel, .entry-stats-panel { padding: 10px 16px; }
    .entry-panel-time { font-size: 26px; }
    .entry-panel-title { font-size: 16px; }
    .entry-stat-col-value { font-size: 22px; }
}

@media (max-width: 700px) {
    .bib-input { font-size: 40px; padding: 16px 8px; }
    .feedback { font-size: 16px; }
}
