/* =================================================================
   map.css — UNIFIED MAP-STYLE THEME (Light)
   All map-specific elements: HUD, bulk actions, popovers, layer panel
   Palette: frosted glass, sky-blue / teal accents on light backgrounds
   ================================================================= */

/* ---- "Current slice" HUD (coastline year + SST month) ---- */
#slice-hud.slice-hud {
    position: absolute;
    top: .75rem;
    right: .8rem;
    z-index: 5001;
    display: none; /* JS will toggle */
    align-items: center;
    gap: .4rem;
    padding: .25rem .7rem;
    border-radius: 999px;
    font-size: .70rem;
    font-weight: 600;
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(2,132,199,.14);
    color: rgba(15,23,42,.75);
    box-shadow: 0 4px 16px rgba(2,6,23,.08);
    backdrop-filter: blur(12px);
}

#slice-hud::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14,165,233,.18);
}

/* ---- Bulk actions bar ---- */
#layer-actions {
    margin-bottom: .3rem;
}

    #layer-actions .layer-bulk-actions {
        display: none;
        align-items: center;
        justify-content: space-between;
        gap: .5rem;
        padding: .3rem .6rem;
        border-radius: 8px;
        border: 1px dashed rgba(2,132,199,.18);
        background: rgba(248,252,255,.92);
        font-size: .72rem;
        color: rgba(15,23,42,.55);
        opacity: 0;
        transform: translateY(4px);
        pointer-events: none;
        transition: opacity .15s ease, transform .15s ease;
    }

        #layer-actions .layer-bulk-actions.visible {
            display: flex;
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto;
        }

.layer-bulk-label {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .62rem;
    font-weight: 700;
    color: rgba(15,23,42,.40);
}

.layer-bulk-count {
    font-size: .72rem;
    font-weight: 600;
    color: rgba(15,23,42,.72);
}

#btn-bulk-delete {
    font-size: .7rem;
    padding: .18rem .45rem;
    border-radius: 999px;
}

/* ---- Layer meta popover ---- */
.layer-meta-popover {
    position: absolute;
    z-index: 9999;
    background: rgba(255,255,255,.97);
    border-radius: 10px;
    border: 1px solid rgba(2,132,199,.14);
    box-shadow: 0 8px 32px rgba(2,6,23,.12);
    padding: .6rem .7rem;
    font-size: .72rem;
    color: rgba(15,23,42,.80);
    min-width: 260px;
    max-width: 320px;
    display: none;
    backdrop-filter: blur(14px);
}

    .layer-meta-popover::before {
        content: "";
        position: absolute;
        top: 14px;
        left: -7px;
        width: 12px;
        height: 12px;
        background: rgba(255,255,255,.97);
        border-left: 1px solid rgba(2,132,199,.14);
        border-bottom: 1px solid rgba(2,132,199,.14);
        transform: rotate(45deg);
    }

    .layer-meta-popover.pop-left::before {
        left: auto;
        right: -7px;
        border-left: 0;
        border-bottom: 0;
        border-right: 1px solid rgba(2,132,199,.14);
        border-top: 1px solid rgba(2,132,199,.14);
    }

.layer-meta-popover-inner {
    position: relative;
}

.layer-meta-popover-title {
    font-size: .86rem;
    font-weight: 700;
    color: rgba(15,23,42,.88);
    margin-bottom: .1rem;
}

.layer-meta-popover-sub {
    font-size: .7rem;
    color: rgba(15,23,42,.45);
    margin-bottom: .35rem;
    word-break: break-all;
}

.layer-meta-popover-hr {
    border-top: 1px solid rgba(2,132,199,.08);
    margin: .15rem 0 .35rem;
}

.layer-meta-popover-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .25rem .8rem;
    margin-bottom: .35rem;
}

    .layer-meta-popover-grid .label {
        text-transform: uppercase;
        letter-spacing: .09em;
        font-size: .63rem;
        font-weight: 700;
        color: rgba(15,23,42,.38);
    }

    .layer-meta-popover-grid .value {
        font-size: .72rem;
        color: rgba(15,23,42,.75);
    }

/* raw metadata block */
.layer-meta-popover-raw-label {
    text-transform: uppercase;
    letter-spacing: .09em;
    font-size: .62rem;
    font-weight: 700;
    color: rgba(15,23,42,.38);
    margin-bottom: .1rem;
}

.layer-meta-popover-raw {
    max-height: 140px;
    overflow: auto;
    border-radius: 8px;
    border: 1px solid rgba(2,132,199,.10);
    background: rgba(248,252,255,1);
    padding: .3rem .4rem;
    font-size: .68rem;
    color: rgba(15,23,42,.55);
    white-space: pre-wrap;
}

/* info button state */
.btn-info-layer.active {
    border-color: #0ea5e9 !important;
    color: #0284c7 !important;
    background: rgba(14,165,233,.08) !important;
}

.layer-info {
    display: none;
    margin: 0 .55rem .2rem 2.35rem;
    padding: .25rem .45rem;
    border-radius: 8px;
    background: rgba(248,252,255,.95);
    border: 1px dashed rgba(2,132,199,.14);
    font-size: .68rem;
    color: rgba(15,23,42,.55);
}

.layer-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .15rem .75rem;
}

.layer-info-label {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .62rem;
    font-weight: 700;
    color: rgba(15,23,42,.38);
}

.layer-info-value {
    font-size: .7rem;
    color: rgba(15,23,42,.72);
}

/* info button state */
.layer-controls .btn-info-layer {
    padding-inline: .3rem;
    padding-block: .15rem;
    font-size: .65rem;
}

    .layer-controls .btn-info-layer.active {
        border-color: #0ea5e9;
        color: #0284c7;
        background: rgba(14,165,233,.08);
    }

/* ---- Dashboard layer panel (#layer-panel) ---- */
#layer-panel {
    background: transparent;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    color: inherit;
    padding: 0;
}

    #layer-panel .card-header {
        padding: .55rem .80rem;
        border-bottom: 1px solid rgba(2,132,199,.08);
        background: transparent;
    }

    #layer-panel .card-title {
        font-size: .80rem;
        font-weight: 700;
        letter-spacing: .04em;
        text-transform: uppercase;
        color: rgba(15,23,42,.65);
    }

    #layer-panel .badge.bg-secondary-lt {
        background: rgba(14,165,233,.08);
        color: rgba(2,132,199,.80);
        border-radius: 999px;
        border: 1px solid rgba(2,132,199,.14);
        font-size: .68rem;
    }

    #layer-panel .input-icon {
        margin-bottom: .35rem;
    }

    #layer-panel #layer-search {
        background: rgba(255,255,255,.92);
        border-radius: 999px;
        border: 1px solid rgba(2,132,199,.14);
        font-size: .78rem;
        color: rgba(15,23,42,.85);
    }

        #layer-panel #layer-search::placeholder {
            color: rgba(15,23,42,.38);
        }

    #layer-panel #layer-actions {
        padding: .25rem .1rem .10rem;
        border-radius: 10px;
        background: rgba(248,252,255,.92);
        border: 1px solid rgba(2,132,199,.08);
        margin-bottom: .45rem;
    }

    #layer-panel #btn-bulk-delete {
        font-size: .72rem;
        padding: .20rem .55rem;
    }

/* #layer-shell visual styling is handled by Index.cshtml styles */

/* ---- Category group (dashboard) ---- */

#layer-panel .layer-group {
    margin-bottom: .45rem;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(2,132,199,.10);
    overflow: hidden;
}

#layer-panel .group-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .40rem .60rem;
    font-size: .74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: rgba(15,23,42,.60);
    background: rgba(248,252,255,.90);
    cursor: default;
    user-select: none;
    border-bottom: 1px solid rgba(2,132,199,.06);
}

    #layer-panel .group-head .count {
        font-size: .68rem;
        padding: .05rem .55rem;
        border-radius: 999px;
        background: rgba(14,165,233,.08);
        color: rgba(2,132,199,.75);
        border: 1px solid rgba(2,132,199,.14);
    }

#layer-panel .layer-items {
    max-height: 210px;
    overflow-y: auto;
}

    #layer-panel .layer-items::-webkit-scrollbar {
        width: 5px;
    }

    #layer-panel .layer-items::-webkit-scrollbar-thumb {
        background: rgba(2,132,199,.16);
        border-radius: 999px;
    }

/* ---- Single layer row (dashboard) ---- */

#layer-panel .layer-row {
    display: grid;
    grid-template-columns: 20px minmax(0,1fr) auto;
    gap: .40rem;
    align-items: center;
    padding: .38rem .55rem;
    margin: 0;
    border-top: 1px solid rgba(2,132,199,.05);
    background: transparent;
    transition: background .12s ease, box-shadow .12s ease;
}

    #layer-panel .layer-row:hover {
        background: rgba(14,165,233,.04);
    }

#layer-panel .layer-select {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

#layer-panel .layer-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

    #layer-panel .layer-meta .layer-name {
        font-size: .80rem;
        font-weight: 600;
        color: rgba(15,23,42,.85) !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #layer-panel .layer-meta .badge {
        order: 2;
        font-size: .66rem;
        border-radius: 999px;
        padding: 0 .45rem;
        background: rgba(14,165,233,.06);
        border: 1px solid rgba(2,132,199,.12);
        color: rgba(2,132,199,.72);
        text-transform: lowercase;
    }

#layer-panel .layer-controls {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

#layer-panel .btn.btn-sm.btn-outline-danger.btn-delete {
    padding: .10rem .45rem;
    line-height: 1.1;
    font-size: .68rem;
    border-radius: 999px;
    display: none;
}

#layer-panel .layer-row:hover .btn-delete,
#layer-panel .layer-row.selected .btn-delete {
    display: inline-flex;
}

/* ---- Toggle switch (dashboard) ---- */
#layer-panel .form-check.form-switch {
    padding-left: 0;
}

#layer-panel .form-check-input.layer-toggle {
    position: relative;
    width: 34px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: rgba(15,23,42,.14);
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,.18);
    background-image: none !important;
    box-shadow: none;
    outline: none;
    transition: background-color .22s, border-color .22s, box-shadow .22s;
}

    #layer-panel .form-check-input.layer-toggle::before {
        content: "";
        position: absolute;
        top: 2px;
        left: 2px;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,.18);
        transition: transform .22s cubic-bezier(.4,0,.2,1);
    }

    #layer-panel .form-check-input.layer-toggle:checked {
        background-color: #0ea5e9;
        border-color: #0284c7;
    }

        #layer-panel .form-check-input.layer-toggle:checked::before {
            transform: translateX(16px);
        }

    #layer-panel .form-check-input.layer-toggle:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px rgba(14,165,233,.16);
    }

/* Old custom switch (kept for backwards compatibility) */
#layer-panel .switch {
    width: 34px;
    height: 18px;
    border-radius: 999px;
    background: rgba(15,23,42,.14);
    border: 1px solid rgba(15,23,42,.18);
    cursor: pointer;
    position: relative;
    flex: 0 0 auto;
    transition: background .18s, border-color .18s;
}

    #layer-panel .switch .knob {
        position: absolute;
        top: 2px;
        left: 2px;
        width: 12px;
        height: 12px;
        border-radius: 999px;
        background: #fff;
        box-shadow: 0 1px 2px rgba(0,0,0,.18);
        transition: left .18s ease;
    }

    #layer-panel .switch.on {
        background: #0ea5e9;
        border-color: #0284c7;
    }

        #layer-panel .switch.on .knob {
            left: 18px;
        }

    #layer-panel .switch:focus-visible {
        box-shadow: 0 0 0 3px rgba(14,165,233,.18);
    }

/* selected state */
#layer-panel .layer-row.selected {
    box-shadow: 0 0 0 1px rgba(14,165,233,.35);
    background: rgba(14,165,233,.04);
}
