﻿/* =====================================================================
   Lane assignments — Run › Lanes. A rail of rounds on the left and, for
   the selected round, the lane board (lanes are drop zones, fixtures are
   dragged between them) or the fixture list. Same rail/main vocabulary
   as the Score Desk; colours come from the --bo-* tokens, so both themes
   are covered here without a dark block.
   ===================================================================== */

.la {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.la-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---- Empty tournament ----------------------------------------------- */

.la-empty {
    max-width: 520px;
    margin: 24px auto;
    padding: 28px 24px;
    text-align: center;
}

.la-empty__icon {
    font-size: 28px;
    color: var(--bo-text-muted);
}

.la-empty__title {
    margin: 10px 0 4px;
    font-size: 0.95rem;
    font-weight: 600;
}

.la-empty__text {
    margin: 0;
    color: var(--bo-text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ---- Rail ------------------------------------------------------------ */

.la-rail {
    position: sticky;
    top: 12px;
    background: var(--bo-surface-solid);
    border: 1px solid var(--bo-border);
    border-radius: var(--bo-radius-lg);
    overflow: hidden;
}

.la-rail__head {
    padding: 8px 10px;
    border-bottom: 1px solid var(--bo-border);
}

.la-rail__title {
    padding: 0 2px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 30px;
}

.la-select {
    width: 100%;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--bo-border-strong);
    border-radius: var(--bo-radius);
    background: var(--bo-surface-solid);
    color: var(--bo-text);
    font: inherit;
    font-size: 0.82rem;
}

    .la-select:focus-visible {
        outline: 2px solid var(--bo-primary);
        outline-offset: 1px;
    }

.la-rail__progress {
    padding: 8px 12px 10px;
    border-bottom: 1px solid var(--bo-border);
    font-size: 0.75rem;
    color: var(--bo-text-muted);
    font-variant-numeric: tabular-nums;
}

.la-bar {
    height: 4px;
    margin-top: 6px;
    border-radius: 2px;
    background: var(--bo-border-strong);
    overflow: hidden;
}

    .la-bar > span {
        display: block;
        width: 100%;
        height: 100%;
        background: var(--bo-primary);
        transform-origin: left;
        transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
    }

.la-rail__list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

.la-round {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "name count clash" "date count clash";
    align-items: center;
    column-gap: 8px;
    width: 100%;
    padding: 7px 12px;
    border: 0;
    border-bottom: 1px solid var(--bo-border);
    background: transparent;
    color: var(--bo-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

    .la-round:hover {
        background: var(--bo-hub-row-hover);
    }

    .la-round.is-selected {
        background: var(--bo-primary-soft);
        box-shadow: inset 3px 0 0 var(--bo-primary);
    }

    .la-round:focus-visible {
        outline: 2px solid var(--bo-primary);
        outline-offset: -2px;
    }

.la-round__name {
    grid-area: name;
    font-size: 0.82rem;
    font-weight: 500;
}

.la-round__date {
    grid-area: date;
    font-size: 0.7rem;
    color: var(--bo-text-muted);
}

.la-round__count {
    grid-area: count;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--bo-surface-muted);
    color: var(--bo-text-muted);
    font-size: 0.68rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

    .la-round__count.is-done {
        background: var(--bo-hub-ok-soft);
        color: var(--bo-hub-ok);
    }

.la-round__clash {
    grid-area: clash;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bo-hub-warn);
}

/* ---- Main + toolbar -------------------------------------------------- */

.la-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.la-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 8px 12px;
}

.la-toolbar__title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-right: 6px;
}

    .la-toolbar__title h2 {
        margin: 0;
        font-size: 0.98rem;
        font-weight: 600;
        white-space: nowrap;
    }

.la-toolbar__meta {
    font-size: 0.75rem;
    color: var(--bo-text-muted);
    white-space: nowrap;
}

/* The framework sub-tabs, stripped of their strip chrome so they sit inline as a switch. */
.la-toolbar .bo-hub-subtabs {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.la-toolbar .bo-hub-subtab {
    padding: 4px 10px;
}

.la-toolbar .bo-hub-subtab--active {
    background: var(--bo-surface-muted);
}

.la-pill {
    cursor: default;
}

/* Actions stay together: when the toolbar wraps they move down as one group. */
.la-toolbar__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
}

.la-unsaved {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--bo-hub-warn);
    white-space: nowrap;
}

    .la-unsaved::before {
        content: "";
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: currentColor;
    }

/* View options popover */
.la-options {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.la-options__panel {
    width: 320px;
    max-width: min(320px, calc(100vw - 2rem));
}

.la-options__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

    .la-options__row .mud-switch {
        margin-right: 0;
    }

.la-options__num {
    width: 128px;
    flex: 0 0 128px;
}

.la-options__hint {
    margin: 2px 0 0;
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--bo-text-muted);
}

/* ---- Board ------------------------------------------------------------ */

.la-board {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.la-tray {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px 10px;
    border: 1px dashed var(--bo-border-strong);
    border-radius: var(--bo-radius-lg);
    background: var(--bo-surface-muted);
    transition: background-color 150ms ease, border-color 150ms ease;
}

    .la-tray.la-tray--clear {
        padding-bottom: 8px;
    }

.la-tray__head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-basis: 100%;
    min-height: 22px;
}

.la-tray__title {
    font-size: 0.82rem;
    font-weight: 600;
}

.la-tray__hint {
    font-size: 0.75rem;
    color: var(--bo-text-muted);
}

.la-lanes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
}

.la-lane {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 96px;
    padding: 8px 8px 8px;
    background: var(--bo-surface-solid);
    border: 1px solid var(--bo-border);
    border-radius: var(--bo-radius-lg);
    transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.la-lane__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 2px 6px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--bo-border);
}

.la-lane__name {
    font-size: 0.82rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.la-lane--empty .la-lane__name {
    color: var(--bo-text-muted);
    font-weight: 500;
}

.la-count {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--bo-surface-muted);
    color: var(--bo-text-muted);
    font-size: 0.68rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

    .la-count.is-warn {
        background: var(--bo-hub-warn-soft);
        color: var(--bo-hub-warn);
    }

.la-tray__head .la-count {
    margin-left: 0;
}

.la-lane__empty {
    padding: 10px 2px;
    font-size: 0.75rem;
    color: var(--bo-text-muted);
}

.la-lane--over {
    border-color: var(--bo-hub-warn);
    background: var(--bo-hub-warn-soft);
}

.la-lane__warn {
    order: 99;
    padding: 6px 2px 0;
    font-size: 0.72rem;
    color: var(--bo-hub-warn);
}

/* MudDropZone applies this while a dragged fixture is over a zone that will accept it. */
.la-drop-ok {
    border-color: var(--bo-primary);
    background: var(--bo-primary-soft);
    box-shadow: 0 0 0 2px var(--bo-primary-soft);
}

/* ---- Fixtures --------------------------------------------------------- */

.la-board .mud-drop-item {
    cursor: grab;
}

    .la-board .mud-drop-item.mud-drop-item-disabled,
    .la-board .mud-drop-item:has(.is-locked) {
        cursor: default;
    }

.la-tray .mud-drop-item {
    flex: 0 1 260px;
    min-width: 0;
}

.la-fixture {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 5px 4px 5px 6px;
    border-radius: var(--bo-radius);
    transition: background-color 120ms ease;
}

    .la-fixture:hover {
        background: var(--bo-hub-row-hover);
    }

    .la-fixture:focus-visible {
        outline: 2px solid var(--bo-primary);
        outline-offset: -2px;
    }

.la-tray .la-fixture {
    padding: 6px 6px 6px 8px;
    background: var(--bo-surface-solid);
    border: 1px solid var(--bo-border);
}

    .la-tray .la-fixture:hover {
        border-color: var(--bo-border-strong);
    }

.la-fixture__num {
    font-size: 0.7rem;
    color: var(--bo-text-muted);
    font-variant-numeric: tabular-nums;
}

.la-fixture__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.la-fixture__teams {
    font-size: 0.82rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.la-vs {
    color: var(--bo-text-muted);
    font-weight: 400;
}

.la-fixture__meta {
    font-size: 0.7rem;
    color: var(--bo-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.la-fixture__state,
.la-fixture__pending {
    margin-left: 4px;
}

.la-fixture__pending {
    color: var(--bo-primary);
    font-weight: 500;
}

.la-fixture.is-clash .la-fixture__meta {
    color: var(--bo-hub-warn);
}

.la-fixture.is-locked {
    opacity: 0.65;
}

.la-fixture__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--bo-text-muted);
    cursor: pointer;
}

    .la-fixture__remove:hover {
        background: var(--bo-surface-muted);
        color: var(--bo-text);
    }

    .la-fixture__remove:focus-visible {
        outline: 2px solid var(--bo-primary);
        outline-offset: 1px;
    }

    .la-fixture__remove:disabled {
        opacity: 0.5;
        cursor: default;
    }

.la-fixture--dragging {
    opacity: 0.45;
}

/* ---- List -------------------------------------------------------------- */

.la-list {
    overflow-x: auto;
}

.la-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 0.82rem;
}

    .la-table th {
        padding: 7px 12px;
        border-bottom: 1px solid var(--bo-border);
        color: var(--bo-text-muted);
        font-size: 0.7rem;
        font-weight: 500;
        text-align: left;
        white-space: nowrap;
    }

    .la-table td {
        padding: 4px 12px;
        border-bottom: 1px solid var(--bo-border);
        vertical-align: middle;
    }

    .la-table tbody tr:hover {
        background: var(--bo-hub-row-hover);
    }

    .la-table tbody tr.is-pending {
        background: var(--bo-primary-soft);
    }

    .la-table tbody tr:last-child td {
        border-bottom: 0;
    }

.la-table__num {
    width: 48px;
    color: var(--bo-text-muted);
    font-variant-numeric: tabular-nums;
}

.la-table__time {
    width: 72px;
    color: var(--bo-text-muted);
    font-variant-numeric: tabular-nums;
}

.la-table__state {
    width: 200px;
}

.la-table__lane {
    width: 220px;
}

    .la-table__lane .mud-input-control {
        margin: 0;
    }

.la-table__teams {
    font-weight: 500;
}

.la-table__lane-text {
    font-variant-numeric: tabular-nums;
}

.la-state {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--bo-surface-muted);
    color: var(--bo-text-muted);
    font-size: 0.68rem;
    font-weight: 500;
    white-space: nowrap;
}

.la-state--clash {
    background: var(--bo-hub-warn-soft);
    color: var(--bo-hub-warn);
}

.la-state--pending {
    background: var(--bo-primary-soft);
    color: var(--bo-primary);
}

/* ---- Narrow screens ----------------------------------------------------- */

@media (max-width: 959.98px) {
    .la {
        grid-template-columns: minmax(0, 1fr);
    }

    .la-rail {
        position: static;
    }

    .la-rail__list {
        display: flex;
        max-height: none;
        overflow-x: auto;
        border-bottom: 0;
    }

        .la-rail__list li {
            flex: 0 0 auto;
        }

    .la-round {
        border-bottom: 0;
        border-right: 1px solid var(--bo-border);
    }

        .la-round.is-selected {
            box-shadow: inset 0 -3px 0 var(--bo-primary);
        }

    .la-lanes {
        grid-template-columns: minmax(0, 1fr);
    }
}
