/* =========================================================
   GIMS � Bright Scientific Theme (Single Theme, Consistent)
   Replace your whole CSS with this file
   ========================================================= */

/* ---------- TOKENS ---------- */
/* =========================================================
   GLOBAL FONT � ROBOTO (ENTIRE PAGE)
========================================================= */
html,
body,
button,
input,
select,
textarea {
    font-family: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
}


:root {
    --bg: #f7fafc;
    --bg2: #eef5fb;
    --panel: #ffffff;
    --panel2: #f4f8fd;
    --border: rgba(15,23,42,.14);
    --primary: #0ea5e9;
    --primary2: #38bdf8;
    --accent: #22c55e;
    --text: #0b1220;
    --muted: rgba(15,23,42,.62);
    --muted2: rgba(15,23,42,.45);
    --shadow: 0 16px 40px rgba(2,6,23,.08);
    --shadow2: 0 10px 24px rgba(2,6,23,.08);
    --ring: 0 0 0 .15rem rgba(14,165,233,.28);
    --radius: 18px;
    --radius2: 14px;
}

/* ---------- BASE ---------- */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    background: radial-gradient(circle at top, rgba(14,165,233,.18), transparent 55%), radial-gradient(circle at bottom right, rgba(34,211,238,.10), transparent 55%), linear-gradient(180deg,var(--bg),var(--bg2));
    color: var(--text);
    min-height: 100vh;
}

.shell {
    min-height: 100vh;
    display: flex;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg,#ffffff,#f1f7fe);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: .9rem 1rem .75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: .6rem;
    align-items: center;
}

.sidebar-header-icon {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: linear-gradient(135deg,var(--primary2),var(--primary));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px rgba(14,165,233,.22);
}

.sidebar-title {
    font-size: .9rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.sidebar-subtitle {
    font-size: .72rem;
    color: var(--muted);
}

.sidebar-nav {
    padding: .75rem .4rem 1rem;
    flex: 1;
    overflow-y: auto;
}

.sidebar-section-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted2);
    padding: .45rem .8rem .2rem;
}

.nav-link-gims {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem .85rem;
    margin: .12rem .4rem;
    font-size: .83rem;
    color: var(--text);
    border-radius: .75rem;
    text-decoration: none;
    border: 1px solid transparent;
}

    .nav-link-gims:hover {
        background: rgba(14,165,233,.10);
        border-color: rgba(14,165,233,.18);
    }

    .nav-link-gims.active {
        background: linear-gradient(90deg,var(--primary),var(--primary2));
        color: #fff;
        border-color: rgba(14,165,233,.28);
        box-shadow: 0 12px 24px rgba(14,165,233,.18);
    }

.sidebar-footer {
    padding: .65rem .9rem .85rem;
    border-top: 1px solid var(--border);
    font-size: .72rem;
    color: var(--muted);
}

/* ---------- MAIN + TOPBAR ---------- */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    padding: .75rem 1.2rem .65rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(6px);
}

.top-title {
    font-size: .78rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
}

.top-heading {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
}

/* ---------- BADGES + SEARCH ---------- */
.badge-soft {
    border-radius: 999px;
    border: 1px solid rgba(14,165,233,.25);
    padding: .12rem .6rem;
    font-size: .72rem;
    background: rgba(14,165,233,.10);
    color: var(--text);
}

.search-wrapper {
    max-width: 320px;
    width: 100%;
    position: relative;
}

    .search-wrapper input {
        padding-left: 2.1rem;
        font-size: .83rem;
        border-radius: 999px;
        background: #fff;
        border: 1px solid var(--border);
        color: var(--text);
        box-shadow: 0 10px 22px rgba(2,6,23,.06);
    }

        .search-wrapper input::placeholder {
            color: var(--muted2);
        }

.search-icon {
    position: absolute;
    left: .7rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--muted2);
}

/* ---------- FILTER BAR + CHIPS ---------- */
.filters-bar {
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--border);
    padding: .45rem 1.2rem .5rem;
    font-size: .8rem;
}

.chip {
    border-radius: 999px;
    padding: .12rem .65rem;
    border: 1px solid var(--border);
    background: rgba(14,165,233,.08);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .72rem;
}

.chip-key {
    color: var(--muted2);
}

.chip-val {
    color: var(--text);
    font-weight: 600;
}

/* ---------- CONTENT ---------- */
.content {
    padding: .95rem 1.2rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: .95rem;
}

/* ---------- CARDS (ALL BRIGHT CONSISTENT) ---------- */
.card-gims,
.card-gims-soft {
    background: var(--panel);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: .8rem .95rem;
    box-shadow: var(--shadow);
}

.card-gims {
    border-left: 4px solid var(--primary);
}

.card-header-gims {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
    margin-bottom: .55rem;
}

.card-title-gims {
    font-size: .86rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--text);
}

.card-subtitle-gims {
    font-size: .75rem;
    color: var(--muted);
}

.badge-mini {
    font-size: .68rem;
    border-radius: 999px;
    padding: .08rem .55rem;
    border: 1px solid var(--border);
    color: var(--muted);
    background: rgba(15,23,42,.04);
}

/* ---------- KPI GRID ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .9rem;
}

.kpi {
    border-radius: var(--radius);
    padding: .8rem .95rem;
    background: radial-gradient(circle at top, rgba(14,165,233,.18), rgba(255,255,255,1));
    border: 1px solid rgba(14,165,233,.25);
    box-shadow: var(--shadow2);
}

.kpi-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

.kpi-value {
    font-size: 1.55rem;
    font-weight: 900;
    color: var(--text);
}

.kpi-sub {
    font-size: .75rem;
    color: var(--muted);
}

    .kpi-sub.up {
        color: #166534;
    }

    .kpi-sub.down {
        color: #991b1b;
    }

/* ---------- MAP + CHART PANELS ---------- */
.map-panel,
.chart-panel {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.map-panel {
    height: 260px;
    overflow: hidden;
}

#gims-map {
    width: 100%;
    height: 100%;
    border-radius: var(--radius);
}

.chart-panel {
    padding: .55rem;
}

    .chart-panel canvas {
        width: 100% !important;
        height: 180px !important;
    }

/* ---------- TABLE (BRIGHT + READABLE) ---------- */
.table-gims {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
}

    .table-gims thead th {
        text-transform: uppercase;
        letter-spacing: .08em;
        font-size: .68rem;
        padding: .42rem .45rem;
        border-bottom: 1px solid var(--border);
        color: var(--muted);
        background: var(--panel2);
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .table-gims tbody tr {
        border-bottom: 1px solid rgba(15,23,42,.06);
        cursor: pointer;
    }

        .table-gims tbody tr:hover {
            background: rgba(14,165,233,.08);
        }

    .table-gims td {
        padding: .42rem .45rem;
        vertical-align: middle;
        color: var(--text);
    }

    /* Active selected row */
    .table-gims tbody tr.active-glacier-row {
        background: rgba(14,165,233,.12);
        outline: 1px solid rgba(14,165,233,.40);
    }

/* ---------- STATUS PILLS ---------- */
.status-pill {
    border-radius: 999px;
    padding: .08rem .55rem;
    font-size: .68rem;
    border: 1px solid rgba(15,23,42,.12);
    background: rgba(15,23,42,.03);
}

.status-stable {
    background: rgba(34,197,94,.16);
    color: #166534;
    border-color: rgba(34,197,94,.22);
}

.status-retreat {
    background: rgba(248,113,113,.16);
    color: #991b1b;
    border-color: rgba(248,113,113,.22);
}

.status-advance {
    background: rgba(59,130,246,.16);
    color: #1e40af;
    border-color: rgba(59,130,246,.22);
}

/* ---------- BUTTONS / ACTIONS ---------- */
.btn-ghost {
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,.14);
    background: rgba(255,255,255,.92);
    color: var(--text);
    font-size: .75rem;
    padding: .25rem .6rem;
    box-shadow: 0 10px 20px rgba(2,6,23,.06);
    transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

    .btn-ghost:hover {
        transform: translateY(-1px);
        background: #fff;
        border-color: rgba(14,165,233,.30);
    }

    .btn-ghost:active {
        transform: translateY(0);
    }

/* ---------- AI BOX + ALERTS ---------- */
.ai-box {
    border-radius: var(--radius2);
    border: 1px dashed rgba(14,165,233,.40);
    background: #ffffff;
    padding: .75rem .8rem;
    font-size: .78rem;
    box-shadow: var(--shadow2);
}

.alert-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .38rem .55rem;
    border-radius: .75rem;
    border: 1px solid var(--border);
    background: #fff;
    font-size: .76rem;
    gap: .4rem;
    box-shadow: 0 10px 18px rgba(2,6,23,.05);
}

.alert-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    margin-right: .25rem;
}

.alert-dot-high {
    background: #ef4444;
}

.alert-dot-medium {
    background: #f59e0b;
}

.alert-dot-low {
    background: #22c55e;
}

/* ---------- FORM CONTROLS (BRIGHT) ---------- */
.form-select,
.form-control {
    background: #fff !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
}

    .form-select:focus,
    .form-control:focus {
        border-color: rgba(14,165,233,.45) !important;
        box-shadow: var(--ring) !important;
    }

    /* Options (browser-dependent; best-effort) */
    .form-select option {
        background: #ffffff !important;
        color: #0b1220 !important;
    }

/* ---------- SCROLLBAR (TABLE CONTAINERS) ---------- */
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: rgba(14,165,233,.65) rgba(15,23,42,.06);
}

    .table-responsive::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    .table-responsive::-webkit-scrollbar-track {
        background: linear-gradient(180deg, rgba(15,23,42,.06), rgba(15,23,42,.03));
        border-left: 1px solid rgba(15,23,42,.10);
    }

    .table-responsive::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, rgba(14,165,233,.85), rgba(34,211,238,.70));
        border-radius: 999px;
        border: 2px solid rgba(255,255,255,.95);
        box-shadow: 0 0 10px rgba(14,165,233,.16);
    }

        .table-responsive::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, rgba(14,165,233,1), rgba(34,211,238,.95));
        }

/* ---------- MOBILE MENU BUTTON ---------- */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: .75rem;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.92);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(2,6,23,.06);
    transition: background .15s ease, border-color .15s ease;
}

.mobile-menu-btn:hover {
    background: #fff;
    border-color: rgba(14,165,233,.30);
}

.mobile-menu-btn i {
    font-size: 1.25rem;
}

/* ---------- SIDEBAR OVERLAY ---------- */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* ---------- RESPONSIVE ---------- */

/* Tablet & mobile: sidebar becomes a drawer */
@media (max-width: 991.98px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(.4,0,.2,1);
        box-shadow: 16px 0 48px rgba(2,6,23,.18);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }

    .topbar {
        padding: .7rem 1rem .6rem;
    }

    .top-heading {
        font-size: 1rem;
    }
}

/* Small tablet */
@media (max-width: 767.98px) {
    .top-title {
        font-size: .7rem;
    }

    .top-heading {
        font-size: .9rem;
    }

    .badge-soft {
        font-size: .65rem;
        padding: .08rem .45rem;
    }

    .card-header-gims {
        flex-direction: column;
        gap: .3rem;
    }
}

/* Mobile */
@media (max-width: 575.98px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .content {
        padding: .85rem;
    }

    .topbar {
        padding: .7rem .85rem .6rem;
    }

    .filters-bar {
        padding: .45rem .85rem;
    }

    .top-heading {
        font-size: .82rem;
    }

    .card-title-gims {
        font-size: .78rem;
    }

    .kpi-value {
        font-size: 1.3rem;
    }

    .search-wrapper {
        max-width: 100%;
    }
}