/*
 * maps-ui.css — shared styles for all map control bars and legends
 *
 * Used by:
 *   surfbox        : precipitation (Nedbør) control bar
 *   surfbox_maps   : wind / gust / wave / combined control bar (via proxy /maps/)
 *
 * Served by surfbox at: /maps-ui.css
 * Loaded in both index.html files with:
 *   <link rel="stylesheet" href="/maps-ui.css">
 *
 * NOTE — Leaflet legend label styles (font-size:10px, color:#555) are set as
 * inline styles inside JS onAdd() callbacks because Leaflet creates those DOM
 * nodes outside the normal document flow. Keep those values in sync with the
 * .legend rule here when making changes.
 */


/* ── Legend card ────────────────────────────────────────────────────────────── */

.legend
{
    background: white;
    border-radius: 6px;
    padding: 6px 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}


/* ── Control bar ────────────────────────────────────────────────────────────── */
/*
 * surfbox_maps uses: #controls, #ctrl-info, #ctrl-playback, #slider, .btn
 * surfbox uses:      #precip-controls, #precip-ctrl-info, #precip-ctrl-playback,
 *                    #frame-slider, #play-btn
 * Both sets of selectors are listed so one stylesheet covers both.
 */

#controls,
#precip-controls
{
    background: white;
    border-top: 1px solid #ddd;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.08);
    flex-shrink: 0;
    /* Pin font-size so native range inputs render at the same height
       regardless of whether the html root is 13px (surfbox) or 16px (iframe) */
    font-size: 13px;
}

#ctrl-info,
#precip-ctrl-info
{
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-width: 0;
    overflow: hidden;
}

#time-display,
#precip-controls #timestamp
{
    font-size: 12.5px;
    color: #444;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

#progress
{
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
}

#ctrl-playback,
#precip-ctrl-playback
{
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 0;
    min-width: 0;
}

#slider,
#precip-controls #frame-slider
{
    flex: 1 1 0;
    min-width: 0;
    accent-color: #555;
    cursor: pointer;
}

.btn,
#precip-controls #play-btn
{
    background: transparent;
    color: #666;
    border: none;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-variant-emoji: text;
    -webkit-font-variant-emoji: text;
}

.btn:hover,
#precip-controls #play-btn:hover
{
    color: #222;
}

.btn.active,
#precip-controls #play-btn.active
{
    color: #111;
    font-weight: 600;
}


/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 540px)
{
    #controls,
    #precip-controls
    {
        flex-wrap: wrap;
    }

    /* view-switcher: full width, first row (first in DOM) */
    #view-switcher
    {
        flex: 1 1 100%;
        order: 1;
    }

    .vs-btn { flex: 1; text-align: center; }

    /* date: full width, second row */
    #ctrl-info,
    #precip-ctrl-info
    {
        flex: 1 1 100%;
        order: 2;
        overflow: hidden;
    }

    /* slider+play+settings: full width, third row */
    #ctrl-playback,
    #precip-ctrl-playback
    {
        flex: 1 1 100%;
        order: 3;
    }

    /* progress counter: after settings, stays inline in ctrl-playback on mobile too */
    #progress
    {
        order: 3;
    }
}
