/* ===== Leaflet track map ===== */
.leaflet-track-map {
    width: 100%;
    height: 520px;
}

/* ===== Track builder layout =====
   The workspace fills the window below the page header (trackbuilder.js sets --track-builder-height
   from the real window height; the calc is only the first-paint fallback). Below lg the map is
   pinned on top at half the workspace and the panel scrolls beneath it; from lg up the panel sits
   beside the map. Either way only the panel scrolls, not the page. */
.track-builder-workspace {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: var(--track-builder-height, calc(100dvh - 12rem));
    min-height: 26rem;
}

.track-builder-map-pane {
    order: -1;
    flex: 0 0 50%;
    min-height: 12rem;
}

.leaflet-track-map.track-builder-map {
    height: 100%;
}

.track-builder-panel {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

@media (min-width: 992px) {
    .track-builder-workspace {
        flex-direction: row;
        gap: 1rem;
    }

    .track-builder-map-pane {
        order: 0;
        flex: 1 1 0;
        min-width: 0;
        min-height: 0;
    }

    .track-builder-panel {
        flex: 0 0 clamp(18rem, 28%, 24rem);
        padding-right: 0.25rem;
    }
}

.track-map-legend {
    background: var(--surface-raised);
    color: var(--text);
}

.track-map-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
}

.track-map-legend .legend-swatch {
    display: inline-block;
    width: 18px;
    height: 8px;
    border-radius: 4px;
}

.track-map-legend .legend-start { background-color: var(--status-success); }
.track-map-legend .legend-split { background-color: var(--brand-orange); }
.track-map-legend .legend-finish { background-color: var(--text); }

/* Numbered gate labels (Leaflet divIcon) */
.leaflet-div-icon.track-gate-label {
    background: transparent;
    border: none;
}

/* Draggable trap pin on the track builder map (Leaflet divIcon) -- see trackbuilder.js */
.leaflet-div-icon.track-builder-badge {
    background: transparent;
    border: none;
}

/* Rover position dot on the track builder map's "use rover position" picker -- see trackbuilder.js */
.leaflet-div-icon.track-builder-rover {
    background: transparent;
    border: none;
}

.track-gate-label span {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 10px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 0 0 2px #fff;
}

