/* KIOSK LEADERBOARD V2 styles (2026-10)
   Loaded on both kiosk links, AFTER kiosk_leaderboard.css, which styles the
   whole display and the config dialog exactly as on the original kiosk. This
   file adds only:
     - the full-row rule for a table set that needs more width than the others
     - the greyed time-so-far cell
     - the V2 dialog controls (scope dropdown, tabs, drag handles, classes)
   Every V2 dialog control reuses the classic dialog's classes where one
   exists (form-control, kiosk-config-section-title, kiosk-config-hint...), so
   it looks like the classic kiosk config. Colours come from the kiosk theme
   variables, so dark mode follows. */

/* a table that needs clearly more width than the narrowest table set spans the
   whole grid row instead of forcing every card to its width. 1 / -1 spans the
   explicit tracks only, so it can never add a column or overflow sideways
   (and on mobile the grid is one column anyway). */
.kiosk-card.kiosk-card-fullrow {
    grid-column: 1 / -1;
}

/* time so far for a rider not finished every stage yet: the Time and Gap cells
   only are greyed (names stay fully readable); no position is shown for these rows */
.kiosk-row.kiosk-row-partial td.kiosk-col-overall_result,
.kiosk-row.kiosk-row-partial td.kiosk-col-gap_to_leader {
    color: var(--k-text-muted);
    font-style: italic;
    font-weight: 400;
}

/* ---------------- V2 config dialog ------------------------------------- */
.kv2-config-dialog {
    width: 1000px;
}

.kv2-note {
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--k-text-muted);
}

/* public kiosk link: two radios and the link, nothing else */
.kv2-live-box {
    margin-bottom: 0;
}

.kv2-live-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.kv2-live-row .form-check-inline {
    margin-right: 1.5rem;
}

.kiosk-config-body .kv2-live-row .form-check-label {
    font-size: 1rem;
}

.kv2-live-url {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--k-text-muted);
    word-break: break-all;
}

.kv2-live-url:hover {
    color: var(--k-accent);
}

/* "Leaderboard scope": a box that looks like the classic scope select and
   opens a list of tick boxes */
.kv2-scope-dd {
    position: relative;
}

.kiosk-config-body .kv2-scope-dd-toggle {
    position: relative;
    text-align: left;
    cursor: pointer;
    padding-right: 2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* the select chevron */
.kv2-scope-dd-toggle::after {
    content: '';
    position: absolute;
    right: 0.85rem;
    top: 50%;
    width: 0.45rem;
    height: 0.45rem;
    margin-top: -0.32rem;
    border-right: 1.5px solid var(--k-text);
    border-bottom: 1.5px solid var(--k-text);
    transform: rotate(45deg);
}

.kv2-scope-dd-toggle.kv2-open::after {
    margin-top: -0.08rem;
    transform: rotate(-135deg);
}

.kv2-scope-dd-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kv2-scope-dd-text.kv2-scope-dd-empty {
    color: var(--k-text-muted);
}

/* position, width and height are set when it opens (kiosk_v2_config.js) */
.kv2-scope-dd-menu {
    position: fixed;
    z-index: 1060;
    overflow-y: auto;
    padding: 0.35rem 0;
    background: var(--k-surface);
    border: 1px solid var(--k-border);
    border-radius: 4px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.kv2-scope-dd-header {
    padding: 0.55rem 0.9rem 0.15rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--k-text-muted);
}

.kv2-scope-dd-item {
    display: flex;
    align-items: center;
    padding: 0 0.9rem;
}

.kv2-scope-dd-item:hover {
    background: var(--k-row-alt);
}

.kv2-scope-dd-item input {
    flex: 0 0 auto;
    margin: 0 0.55rem 0 0;
    cursor: pointer;
}

.kiosk-config-body .kv2-scope-dd-item label {
    flex: 1 1 auto;
    margin: 0;
    padding: 0.32rem 0;
    font-size: 0.95rem;
    color: var(--k-text);
    cursor: pointer;
}

/* one tab per ticked scope; drag a tab to change the kiosk order */
.kv2-tabs-wrap {
    margin-top: 0.25rem;
}

.kv2-tabs.nav-tabs {
    flex-wrap: wrap;
    border-bottom: 1px solid var(--k-border);
}

.kv2-tabs .nav-link {
    display: flex;
    align-items: center;
    color: var(--k-text-muted);
    padding: 0.45rem 0.9rem 0.45rem 0.55rem;
    font-size: 0.9rem;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kv2-tabs .nav-link:hover {
    color: var(--k-text);
    background: var(--k-row-alt);
    border-color: var(--k-border-soft) var(--k-border-soft) var(--k-border);
}

/* the grip on every tab says "you can drag this" */
.kv2-tab-grip {
    display: inline-flex;
    margin-right: 0.45rem;
    opacity: 0.45;
}

.kv2-tab-grip svg {
    fill: currentColor;
}

.kv2-tabs .nav-link:hover .kv2-tab-grip,
.kv2-tabs .nav-link.active .kv2-tab-grip {
    opacity: 0.85;
}

.kiosk-config-section-title .kv2-section-hint {
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0;
    text-transform: none;
}

.kv2-tabs .nav-link.active {
    color: var(--k-text);
    background: var(--k-surface);
    border-color: var(--k-border) var(--k-border) var(--k-surface);
    font-weight: 600;
}

.kv2-pane {
    padding: 1.1rem 1.25rem 0.75rem;
    border: 1px solid var(--k-border);
    border-top: 0;
    border-radius: 0 0 4px 4px;
}

.kv2-pane-note {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--k-danger);
}

.kv2-pane-help {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--k-text-muted);
}

.kv2-no-tables {
    padding: 0.25rem 0 0.5rem;
    color: var(--k-text-muted);
}

/* drag handles (column rows, classes) */
.kv2-drag-handle {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.4rem;
    color: var(--k-text-muted);
    line-height: 1;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.kv2-drag-handle:hover {
    color: var(--k-text);
}

.kv2-drag-handle svg {
    fill: currentColor;
}

.kv2-columns-body .kiosk-config-order-cell {
    width: 4rem;
}

.kv2-columns-body tr:hover .kv2-drag-handle,
.kv2-class-row:hover .kv2-drag-handle {
    color: var(--k-text);
}

/* the grabbed item: lifted off the list (raised, shadow, accent outline)
   while it follows the pointer; the gap it leaves is where it will land */
.kv2-dragging {
    position: relative;
    z-index: 30;
}

.kv2-dragging .kv2-drag-handle,
.kv2-dragging .kv2-tab-grip {
    color: var(--k-accent);
    opacity: 1;
}

.kv2-tabs li.kv2-dragging .nav-link {
    color: var(--k-text);
    background: var(--k-surface);
    border: 1px solid var(--k-accent);
    border-radius: 4px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    transform: translateY(-3px) scale(1.04);
}

tr.kiosk-config-column-row.kv2-dragging {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    outline: 2px solid var(--k-accent);
    outline-offset: -2px;
}

tr.kiosk-config-column-row.kv2-dragging td {
    background: var(--k-surface);
}

.kv2-class-row.kv2-dragging {
    border-color: var(--k-accent);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

body.kv2-drag-active,
body.kv2-drag-active * {
    cursor: grabbing !important;
}

/* "Classes on the kiosk" (under the scope row) */
.kv2-class-list-wrap {
    margin: 0 0 0.5rem;
}

.kv2-class-list-wrap > label {
    display: block;
    margin-bottom: 0.4rem;
}

.kv2-class-list {
    display: flex;
    flex-wrap: wrap;
}

.kv2-class-row {
    display: flex;
    align-items: center;
    margin: 0 0.6rem 0.5rem 0;
    padding: 0.3rem 0.75rem 0.3rem 0.3rem;
    border: 1px solid var(--k-border);
    border-radius: 4px;
    background: var(--k-surface);
}

.kv2-class-row input {
    margin: 0 0.45rem 0 0.15rem;
    cursor: pointer;
}

.kiosk-config-body .kv2-class-row label {
    margin: 0;
    font-size: 0.95rem;
    color: var(--k-text);
    cursor: pointer;
}

/* phones: the column table scrolls sideways on its own instead of making the
   whole dialog wider than the screen (phones only: on a wide screen the
   column list must not clip a row while it is being dragged) */
@media (max-width: 576px) {
    .kv2-pane {
        padding: 0.9rem 0.75rem 0.5rem;
    }

    .kv2-pane .kiosk-config-columns-wrap {
        overflow-x: auto;
    }
}

/* Short links (public kiosk short links) under the public link choice */
.kv2-links {
    margin-top: 0.9rem;
}

.kv2-links-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.kiosk-config-body .kv2-links-head label {
    margin: 0;
}

.kv2-links-table {
    color: var(--k-text);
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.kv2-links-table th,
.kv2-links-table td {
    border-color: var(--k-border-soft);
    vertical-align: middle;
}

.kv2-links-table th {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--k-text-muted);
}

.kv2-link-url {
    white-space: nowrap;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.kv2-link-url .btn-link {
    padding: 0 0.25rem;
    font-family: inherit;
    font-size: 0.8rem;
}

.kv2-link-actions {
    white-space: nowrap;
    text-align: right;
}

.kv2-link-actions .btn {
    padding: 0.1rem 0.5rem;
    font-size: 0.78rem;
}

.kv2-link-state {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--k-row-alt);
    color: var(--k-text-muted);
}

.kv2-link-state-open {
    color: #1e7e34;
    background: rgba(40, 167, 69, 0.12);
}

.kv2-link-state-revoked {
    color: var(--k-danger);
    background: rgba(220, 53, 69, 0.1);
}

.kv2-link-form {
    margin-top: 0.4rem;
    padding: 0.8rem 0.9rem 0.6rem;
    border: 1px solid var(--k-border);
    border-radius: 4px;
}

.kv2-link-form-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kv2-link-feedback {
    font-size: 0.85rem;
    color: var(--k-text-muted);
}

@media (max-width: 768px) {
    .kv2-links-list {
        overflow-x: auto;
    }
}

/* Event logo (the short links' locked card): preview on the card's grey, as it will show there */
.kv2-logo {
    margin-top: 0.9rem;
}

.kiosk-config-body .kv2-logo > label {
    margin-bottom: 0.3rem;
}

.kv2-logo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
}

.kv2-logo-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 12rem;
    min-height: 4.5rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 0.5rem;
}

.kv2-logo-sample-tag {
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    line-height: 0;
}

.kv2-logo-sample-tag img {
    height: 2.5rem;
    width: auto;
    max-width: 14rem;
}

.kv2-logo-sample-own img {
    display: block;
    height: 3.25rem;
    width: auto;
    max-width: 16rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.kv2-logo-controls {
    flex: 1 1 14rem;
}

.kv2-logo-controls .btn {
    margin: 0 0.35rem 0.4rem 0;
}

.kv2-logo-feedback {
    font-size: 0.85rem;
    color: var(--k-text-muted);
}
