* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===========================
NDMA DASHBOARD VARIABLES
=========================== */
:root {
    /* Brand Colors */
    --ndma-green: #2ecc71;
    --ndma-green-opaque: rgba(9, 106, 11, 0.75);
    --ndma-green-light: rgba(9, 106, 11, 0.35);
    --ndma-green-glow: rgba(9, 106, 11, 0.25);
    --ndma-green-gradient: linear-gradient(to right, rgba(28, 169, 30, 0.6), rgba(9, 106, 11, 0.9));

    --ndma-blue: #46b2ff;
    --ndma-blue-opaque: rgba(70, 178, 255, 0.75);
    --ndma-blue-light: rgba(70, 178, 255, 0.35);
    --ndma-blue-glow: rgba(70, 178, 255, 0.25);
    --ndma-blue-gradient: linear-gradient(to right, rgba(70, 178, 255, 0.9), rgba(30, 144, 255, 0.6));

    --ndma-red: #ff0000;
    --ndma-red-opaque: rgba(255, 0, 0, 0.75);
    --ndma-red-light: rgba(255, 0, 0, 0.35);
    --ndma-red-glow: rgba(255, 0, 0, 0.25);
    --ndma-red-gradient: linear-gradient(to right, rgba(255, 76, 76, 0.7), rgba(255, 0, 0, 0.9));

    /* Glass Backgrounds */
    --glass-dark: rgba(0, 0, 0, 0.6);
    --glass-medium: rgba(0, 0, 0, 0.4);
    --glass-light: rgba(255, 255, 255, 0.2);
    --glass-lighter: rgba(255, 255, 255, 0.15);
    --glass-highlight: rgba(255, 255, 255, 0.25);

    /* Backgrounds */
    --primary-bg: var(--glass-dark);
    --secondary-bg: var(--glass-medium);
    --tertiary-bg: var(--glass-light);
    --accent-bg-green: var(--ndma-green-opaque);
    --accent-bg-blue: var(--ndma-blue-opaque);
    --overlay-bg: rgba(255, 255, 255, 0.05);
    --frost-bg: rgba(255, 255, 255, 0.12);

    /* Text */
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.75);
    --text-muted: rgba(255, 255, 255, 0.55);
    --text-inverse: rgba(0, 0, 0, 0.85);

    /* Borders */
    --border-dark: rgba(255, 255, 255, 0.2);
    --border-light: rgba(255, 255, 255, 0.7);
    --border-strong: rgba(0, 0, 0, 0.2);

    /* Buttons */
    --btn-green-bg: var(--ndma-green-opaque);
    --btn-green-hover: var(--ndma-green-gradient);
    --btn-blue-bg: var(--ndma-blue-opaque);
    --btn-blue-hover: var(--ndma-blue-gradient);

    /* Highlights */
    --focus-ring: var(--ndma-blue-light);
    --hover-bg: rgba(255, 255, 255, 0.08);
    --active-bg: rgba(255, 255, 255, 0.12);
    --success-bg: var(--ndma-green-glow);

    /* Shadows */
    --shadow-soft: 0 8px 16px rgba(0, 0, 0, 0.25);
    --shadow-glow-green: 0 0 12px 2px var(--ndma-green-glow);
    --shadow-glow-blue: 0 0 12px 2px var(--ndma-blue-glow);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}



.header {
    background: linear-gradient(135deg, rgba(10, 22, 30, 0.97) 0%, rgba(20, 44, 58, 0.97) 50%, rgba(28, 58, 76, 0.97) 100%);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    color: var(--text-primary);
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10006;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(70, 178, 255, 0.2);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.menu-toggle-btn {
    position: absolute;
    top: 50%;
    left: 0.65rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    border: 1px solid rgba(70, 178, 255, 0.45);
    background: linear-gradient(135deg, rgba(70, 178, 255, 0.25), rgba(10, 22, 30, 0.7));
    color: var(--text-primary);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    z-index: 10007;
    text-transform: none;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.menu-toggle-icon {
    width: 15px;
    height: 12px;
    display: inline-flex;
    flex-direction: column;
    justify-content: space-between;
}

.menu-toggle-icon span {
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: rgba(224, 242, 255, 0.95);
    box-shadow: 0 0 6px rgba(70, 178, 255, 0.65);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-toggle-btn:hover:not(:disabled) {
    transform: translateY(-50%) translateY(-1px);
    border-color: rgba(70, 178, 255, 0.7);
    background: linear-gradient(135deg, rgba(70, 178, 255, 0.42), rgba(10, 22, 30, 0.84));
    box-shadow: var(--shadow-glow-blue), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.menu-toggle-btn.is-open .menu-toggle-icon span:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
}

.menu-toggle-btn.is-open .menu-toggle-icon span:nth-child(2) {
    opacity: 0;
}

.menu-toggle-btn.is-open .menu-toggle-icon span:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
}

.header-title {
    font-size: clamp(1.1rem, 3.5vw, 1.6rem);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    width: 100%;
    text-align: center;
    background: linear-gradient(90deg, #46b2ff 0%, #e0f2ff 50%, #46b2ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 14px rgba(70, 178, 255, 0.45));
}

.api-status {
    display: flex;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1rem);
    margin-top: 1rem;
    flex-wrap: wrap;
}

.api-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-dark);
    transition: all 0.3s ease;
    background: var(--secondary-bg);
}

.api-badge.loading {
    background: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.4);
}

.api-badge.success {
    background: var(--success-bg);
    color: var(--ndma-green);
    border-color: var(--ndma-green-light);
}

.api-badge.error {
    background: var(--ndma-red-glow);
    color: var(--ndma-red);
    border-color: var(--ndma-red-light);
}

.container {
    max-width: 100%;
    padding: clamp(.5rem, 3vw, .5rem);
    position: relative;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.25);
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.3s ease;
    border: 1px solid var(--border-dark);
}

.toggle-switch .slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch input:checked + .slider {
    background: var(--ndma-green-opaque);
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.controls {
    background: var(--primary-bg);
    backdrop-filter: blur(20px) saturate(110%);
    -webkit-backdrop-filter: blur(20px) saturate(110%);
    padding: clamp(0.75rem, 2vw, 1.25rem);
    border-radius: 12px;
    margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
    box-shadow: var(--shadow-soft),
        inset 0 1px 0 var(--glass-highlight);
    border: 2px solid var(--border-dark);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
    gap: clamp(0.5rem, 1.5vw, 0.875rem);
    align-items: end;
    width: 100%;
    max-width: 100%;
}

.controls-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: min(420px, calc(100vw - 1rem));
    height: 100dvh;
    padding: 5rem 0.5rem 0.75rem;
    background: linear-gradient(165deg, rgba(10, 22, 30, 0.96) 0%, rgba(15, 35, 48, 0.96) 55%, rgba(20, 44, 58, 0.94) 100%);
    border-right: 1px solid rgba(70, 178, 255, 0.32);
    box-shadow: 14px 0 34px rgba(0, 0, 0, 0.48);
    overflow-y: auto;
    transform: translateX(-110%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 10004;
    transition: transform 0.32s ease, opacity 0.26s ease, visibility 0.26s ease;
}

.controls-drawer.open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.controls-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 10003;
    transition: opacity 0.24s ease, visibility 0.24s ease;
}

.controls-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.controls-drawer .controls {
    min-width: 100%;
    margin-bottom: 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

select,
button {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-dark);
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: inherit;
}

select {
    background: rgb(8 255 164 / 69%);
    backdrop-filter: blur(12px);
    color: rgb(0 0 0 / 95%);
    cursor: pointer;
}

select:hover,
select:focus {
    border-color: var(--border-light);
    background: var(--glass-highlight);
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

button {
    background: var(--btn-blue-bg);
    backdrop-filter: blur(12px) saturate(105%);
    color: var(--text-primary);
    border: 2px solid var(--border-dark);
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: var(--shadow-soft),
        inset 0 1px 0 var(--glass-highlight);
}

button:hover:not(:disabled) {
    background: var(--btn-blue-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-blue),
        inset 0 1px 0 var(--glass-highlight);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.top-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
}

/* Stats take more width */
.stats {
    flex: 1.5;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

/* Responsive fallback ≤ 1024px */
@media (max-width: 1024px) {
    .top-row {
        flex-direction: column;
    }

    .controls {
        max-width: 100%;
        width: 100%;
    }

    .controls-drawer {
        width: min(420px, calc(100vw - 0.75rem));
        padding: 5rem 0.375rem 0.6rem;
    }

    .stats {
        width: 100%;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}


.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
    gap: clamp(0.5rem, 1.5vw, 1rem);
    margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

.stat-card {
    background: var(--primary-bg);
    backdrop-filter: blur(20px) saturate(110%);
    -webkit-backdrop-filter: blur(20px) saturate(110%);
    padding: clamp(0.6rem, 1.5vw, 1rem) clamp(0.5rem, 1.5vw, 0.875rem);
    border-radius: 12px;
    box-shadow: var(--shadow-soft),
        inset 0 1px 0 var(--glass-highlight);
    border: 2px solid var(--border-dark);
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--ndma-blue-gradient);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow-blue),
        inset 0 1px 0 var(--glass-highlight);
    border-color: var(--border-light);
}

.stat-card h3 {
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.stat-card .value {
    font-size: clamp(1.05rem, 2.6vw, 1.45rem);
    font-weight: 900;
    color: var(--ndma-blue);
    text-shadow: 0 2px 8px var(--ndma-blue-glow);
    line-height: 1;
}

/* ===============================
   MAIN GRID LAYOUT
================================ */
.main-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

/* ===============================
   MAP
================================ */
#map {
    height: 320px;
    width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    background: var(--primary-bg);
    border: 2px solid var(--border-dark);
    position: relative;
    margin-top: 0;
    box-sizing: border-box;
}

/* ===============================
   CHARTS GRID (2 × 2)
================================ */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
}

/* ===============================
   CHART CARD
================================ */
.chart-card-right {
    background: var(--primary-bg);
    backdrop-filter: blur(20px) saturate(110%);
    -webkit-backdrop-filter: blur(20px) saturate(110%);
    padding: 0.6rem 0.6rem 0.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-soft),
        inset 0 1px 0 var(--glass-highlight);
    border: 2px solid var(--border-dark);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

/* Header takes only required space */
.chart-card-right .chart-header {
    flex-shrink: 0;
}

/* Title inside card */
.chart-card-right .chart-label {
    flex-shrink: 0;
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    padding-bottom: 4px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Canvas wrapper — explicit height so Chart.js always gets a non-zero measurement */
.chart-canvas-wrap {
    position: relative;
    width: 100%;
    height: 260px;
    flex-shrink: 0;
}

.chart-canvas-wrap canvas {
    display: block;
    width: 100% !important;
    height: 260px !important;
}

.chart-card canvas {
    height: 260px !important;
}

/* Doughnut needs extra room for multi-row legend */
.chart-canvas-wrap--tall {
    height: 300px;
}
.chart-canvas-wrap--tall canvas {
    height: 300px !important;
}


/* ===============================
   RESPONSIVE FALLBACK ≤ 1200px
================================ */
@media (max-width: 1200px) {
    .main-grid {
        flex-direction: column;
    }

    #map {
        width: 100%;
        height: clamp(320px, 55vh, 550px);
        margin-top: 0;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        width: 100%;
    }

    .chart-card-right {
        width: 100%;
        height: auto;
    }

    /* Remove the negative top that overlaps charts onto map */
    .charts {
        grid-template-columns: 1fr;
        top: 0;
        gap: 16px;
    }

    .chart-card {
        width: 100%;
        height: auto;
        min-height: 0;
    }
}



.side-panel {
    display: flex;
    flex-direction: row;
    gap: clamp(1rem, 2vw, 1.5rem);
}

/* Desktop: overlay on top of map */
.side-panel-overlay {
    position: absolute;
    top: 70px;
    right: 0;
    z-index: 10;
}

.panel {
    background: var(--primary-bg);
    backdrop-filter: blur(20px) saturate(110%);
    -webkit-backdrop-filter: blur(20px) saturate(110%);
    padding: clamp(0.6rem, 2vw, 1rem);
    border-radius: 16px;
    box-shadow: var(--shadow-soft),
        inset 0 1px 0 var(--glass-highlight);
    border: 2px solid var(--border-dark);
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.panel::-webkit-scrollbar {
    width: 8px;
}

.panel::-webkit-scrollbar-track {
    background: transparent;
}

.panel::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
}

.panel::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* Firefox */
.panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

.panel h2 {
    color: var(--ndma-blue);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-dark);
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ===================================
   COUNTRY PANEL (cp-*) — redesigned
=================================== */

/* Header banner */
.cp-header {
    text-align: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(70,178,255,0.25) 0%, rgba(30,100,200,0.35) 100%);
    border-radius: 12px;
    border: 1px solid rgba(70,178,255,0.35);
    margin-bottom: 0.6rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}
.cp-name {
    font-size: clamp(1rem, 4vw, 1.35rem);
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.cp-region {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.65);
    margin-top: 0.15rem;
    letter-spacing: 0.04em;
}

/* Score row — 3 equal cards */
.cp-scores {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
    margin-bottom: 0.6rem;
}
.cp-score-card {
    background: var(--secondary-bg);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 0.55rem 0.3rem;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}
.cp-score-card:hover {
    transform: translateY(-2px);
    border-color: rgba(70,178,255,0.4);
}
.cp-score-icon {
    font-size: 1rem;
    line-height: 1;
    margin-bottom: 0.2rem;
}
.cp-score-label {
    font-size: 0.52rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}
.cp-score-val {
    font-size: clamp(1rem, 4vw, 1.35rem);
    font-weight: 900;
    color: var(--ndma-blue);
    line-height: 1;
    text-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

/* Section title */
.cp-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ndma-blue);
    margin-bottom: 0.4rem;
    letter-spacing: 0.03em;
}

/* World Bank card */
.cp-wb {
    background: var(--secondary-bg);
    border: 1px solid rgba(70,178,255,0.2);
    border-left: 3px solid var(--ndma-blue);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.6rem;
}
.cp-wb-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
}
.cp-wb-item {
    background: rgba(255,255,255,0.05);
    border-radius: 7px;
    padding: 0.45rem 0.5rem;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.07);
}
.cp-wb-label {
    font-size: 0.58rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}
.cp-wb-val {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

/* Historical Trends section */
.cp-trends-section {
    background: var(--secondary-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
    margin-bottom: 0.6rem;
}
.cp-trends-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}
.cp-info-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(70,178,255,0.85);
    color: white;
    border: 1px solid rgba(255,255,255,0.25);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
.cp-goal-row {
    margin-bottom: 0.4rem;
}
.cp-label {
    display: block;
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    letter-spacing: 0.03em;
}
.cp-select {
    width: 100%;
    padding: 0.3rem 0.5rem;
    background: var(--primary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-dark);
    border-radius: 7px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: border-color 0.2s;
    font-family: inherit;
}
.cp-select:hover, .cp-select:focus {
    border-color: var(--ndma-blue);
    outline: none;
}
.cp-chart-wrap {
    height: 210px;
    position: relative;
    background: rgba(0,0,0,0.25);
    border-radius: 7px;
    overflow: hidden;
}
.cp-chart-wrap canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
}

/* SDG Goals grid */
.cp-goals-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0.5rem 0 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ndma-blue);
    letter-spacing: 0.03em;
}
.cp-goals-hint {
    font-size: 0.55rem;
    color: var(--text-muted);
    font-weight: 400;
}
.cp-goals {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.35rem;
    margin-bottom: 0.6rem;
}

/* Progress Trends */
.cp-progress {
    background: var(--secondary-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
}
.cp-progress-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    text-align: center;
    margin-top: 0.35rem;
}
.cp-progress-item {
    background: rgba(255,255,255,0.04);
    border-radius: 7px;
    padding: 0.45rem 0.3rem;
    border: 1px solid rgba(255,255,255,0.07);
}
.cp-progress-val {
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 0.2rem;
}
.cp-progress-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Legacy classes kept for backward compat */
.country-header {
    display: none;
}
.score-grid {
    display: none;
}

.goals-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.35rem;
}

.goal {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.35rem 0.2rem;
    border-radius: 8px;
    font-weight: 700;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.goal .number {
    font-size: clamp(0.75rem, 2vw, 0.95rem);
}

.goal .trend {
    font-size: 0.55rem;
    position: absolute;
    top: 2px;
    right: 2px;
}

.goal.green {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.goal.yellow {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.goal.orange {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
}

.goal.red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.goal.gray {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    color: white;
}

.legend {
    padding: 1rem;
    background: var(--secondary-bg);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 2px solid var(--border-dark);
}

.legend h3 {
    color: var(--ndma-blue);
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 800;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.legend-color {
    width: 32px;
    height: 20px;
    border-radius: 6px;
    margin-right: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

.chart-card {
    background: var(--primary-bg);
    backdrop-filter: blur(20px) saturate(110%);
    -webkit-backdrop-filter: blur(20px) saturate(110%);
    padding: 0.6rem 0.6rem 0.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-soft),
        inset 0 1px 0 var(--glass-highlight);
    border: 2px solid var(--border-dark);
    transition: all 0.3s ease;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}


.chart-card:hover {
    box-shadow: var(--shadow-glow-blue),
        inset 0 1px 0 var(--glass-highlight);
    border-color: var(--border-light);
}

.chart-card .chart-label {
    flex-shrink: 0;
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    padding-bottom: 4px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-dark);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chart-card h3 {
    color: var(--ndma-blue);
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.badge {
    padding: 0.375rem 0.75rem;
    background: var(--btn-blue-bg);
    backdrop-filter: blur(12px);
    color: var(--text-primary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid var(--border-dark);
}

.badge.country {
    background: var(--btn-green-bg);
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 32, 39, 0.97);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    color: var(--text-primary);
    max-width: 600px;
    padding: 2rem;
}

.spinner {
    border: 6px solid var(--glass-light);
    border-top: 6px solid var(--ndma-blue);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
    box-shadow: var(--shadow-glow-blue);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-content h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.loading-content p {
    font-size: 1.125rem;
    opacity: 0.8;
    color: var(--text-secondary);
}

.progress {
    width: 100%;
    height: 8px;
    background: var(--glass-dark);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
    border: 1px solid var(--border-dark);
}

.progress-fill {
    height: 100%;
    background: var(--ndma-blue-gradient);
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: var(--shadow-glow-blue);
}

.wb-data-section {
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--secondary-bg);
    backdrop-filter: blur(12px);
    border-radius: 10px;
    border: 2px solid var(--border-dark);
    border-left: 3px solid var(--ndma-blue);
}

.wb-data-section h4 {
    color: var(--ndma-blue);
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.wb-data-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
}

.wb-data-item {
    background: var(--tertiary-bg);
    backdrop-filter: blur(8px);
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--border-dark);
}

.wb-data-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.wb-data-item .label {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.wb-data-item .value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ndma-blue);
}

@media (max-width: 768px) {
    .controls {
        grid-template-columns: 1fr;
        max-width: 100%;
        padding: 1rem;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Header */
    .header {
        height: auto;
        min-height: 60px;
        padding: 0.5rem 1rem 0.5rem 3.1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header h1 {
        font-size: clamp(1rem, 4vw, 1.5rem);
    }

    .navbar-logo {
        height: 36px;
        position: static;
    }

    .header-left {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .header-right {
        position: static;
        transform: none;
        gap: 8px;
    }

    .navbar-right .status-label {
        font-size: 1.25rem;
        min-width: 36px;
        min-height: 28px;
        padding: 2px 8px;
    }

    /* Map */
    #map {
        height: 300px;
    }

    /* Charts grid inside main-grid */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-card-right {
        height: auto;
    }

    /* Bottom charts row */
    .charts {
        grid-template-columns: 1fr;
        top: 0;
        gap: 16px;
    }

    .chart-card {
        width: 100%;
        height: auto;
        min-height: 0;
    }

    /* Modals — bottom sheet handles sizing natively */

    .report-header {
        padding: 1.25rem 1rem;
    }

    .report-body {
        padding: 1rem;
    }

    .report-actions {
        padding: 1rem;
        gap: 0.5rem;
    }

    .report-actions button {
        flex: 1 1 auto;
        font-size: 0.8125rem;
        padding: 0.75rem 0.5rem;
    }

    /* Side panel — make it in-flow on mobile */
    .side-panel,
    .side-panel-overlay {
        position: static !important;
        display: block !important;
        width: 100%;
        margin-top: 1rem;
    }

    /* Embedded iframe shorter */
    .embedded-chart-iframe {
        height: 360px;
    }

    /* Score grid */
    .score-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 0.5rem;
    }

    .score-box {
        padding: 0.875rem 0.5rem;
    }

    .score-box .score {
        font-size: 1.75rem;
    }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10001;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--primary-bg);
    backdrop-filter: blur(20px) saturate(110%);
    -webkit-backdrop-filter: blur(20px) saturate(110%);
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: var(--shadow-soft),
        inset 0 1px 0 var(--glass-highlight);
    border: 2px solid var(--border-dark);
    position: relative;
}

.report-header {
    background: var(--btn-blue-bg);
    backdrop-filter: blur(12px) saturate(105%);
    color: var(--text-primary);
    padding: 2rem;
    text-align: center;
    position: relative;
    border-bottom: 2px solid var(--border-dark);
}

.report-body {
    padding: 2rem;
}

.report-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-dark);
}

.report-section:last-child {
    border-bottom: none;
}

.report-section h3 {
    color: var(--ndma-blue);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.report-actions {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--secondary-bg);
    backdrop-filter: blur(12px);
    border-top: 2px solid var(--border-dark);
    justify-content: center;
    flex-wrap: wrap;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--glass-light);
    color: var(--text-primary);
    border: 2px solid var(--border-dark);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: var(--glass-highlight);
    transform: scale(1.1);
}

/* GOAL DETAILS MODAL */
/* =========================================
   GOAL DETAIL MODAL — mobile bottom sheet
========================================= */
.goal-detail-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10002;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.goal-detail-modal.active {
    display: flex;
}

/* Sheet card */
.goal-detail-content {
    background: linear-gradient(160deg, rgba(10,22,34,0.98) 0%, rgba(18,38,56,0.98) 100%);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    width: 100%;
    max-width: 540px;
    max-height: 88dvh;
    border-radius: 20px 20px 0 0;
    border: 1px solid rgba(70,178,255,0.2);
    border-bottom: none;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Drag handle removed for cleaner header edge */
.goal-detail-content::before {
    display: none;
}

/* Header */
.goal-detail-header {
    background: linear-gradient(135deg, rgba(70,178,255,0.25) 0%, rgba(30,100,200,0.35) 100%);
    border-bottom: 1px solid rgba(70,178,255,0.2);
    padding: 0.65rem 0.75rem 0.7rem 1rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}

.goal-detail-header-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.goal-detail-header h2 {
    font-size: clamp(0.85rem, 3.5vw, 1rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.12rem;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.goal-detail-header p {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.55);
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.03em;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Close button — sits inline in the goal detail header row */
.goal-detail-header .close-modal {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.24);
    color: rgba(240, 248, 255, 0.92);
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 0;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
    padding: 0 0 1px 0;
    position: static;
    box-shadow: none;
    text-shadow: none;
    text-align: center;
    vertical-align: middle;
}

.goal-detail-header .close-modal:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
    transform: none;
    box-shadow: none;
}

.goal-detail-header .close-modal:active {
    transform: scale(0.94);
}

/* Scrollable body */
.goal-detail-body {
    padding: 0.65rem 0.75rem 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(70,178,255,0.3) transparent;
}

.goal-detail-body::-webkit-scrollbar {
    width: 4px;
}
.goal-detail-body::-webkit-scrollbar-thumb {
    background: rgba(70,178,255,0.3);
    border-radius: 2px;
}

/* OWID resource card */
.owid-resource-card {
    background: rgba(70,178,255,0.08);
    border: 1px solid rgba(70,178,255,0.2);
    border-left: 3px solid var(--ndma-blue);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.6rem;
}

.owid-resource-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ndma-blue);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

/* Target section */
.target-section {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-left: 3px solid var(--ndma-blue);
    padding: 0.6rem 0.7rem;
    margin-bottom: 0.5rem;
    border-radius: 10px;
    transition: border-color 0.2s;
}

.target-section:hover {
    border-color: rgba(70,178,255,0.35);
}

.target-section h4 {
    color: var(--text-primary);
    font-size: 0.76rem;
    font-weight: 700;
    margin-bottom: 0.45rem;
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    line-height: 1.4;
}

/* Target badge pill */
.target-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ndma-blue);
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 0.18rem 0.45rem;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 1px;
    letter-spacing: 0.02em;
}

/* Links */
.target-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--ndma-blue);
    text-decoration: none;
    font-size: 0.73rem;
    font-weight: 600;
    transition: color 0.2s, gap 0.2s;
    margin-bottom: 0.45rem;
}

.target-link:hover {
    color: var(--ndma-green);
    gap: 0.5rem;
}

/* Indicators */
.indicators-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.indicator-item {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    transition: border-color 0.2s;
}

.indicator-item:hover {
    border-color: rgba(70,178,255,0.3);
}

.indicator-link {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.73rem;
    line-height: 1.4;
}

.indicator-link:hover {
    color: var(--ndma-blue);
}

.chart-indicator {
    background: rgba(46,204,113,0.06);
    border-color: rgba(46,204,113,0.2);
}

/* Embedded chart */
.embedded-chart-container {
    margin-top: 0.45rem;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.embedded-chart-header {
    background: rgba(46,204,113,0.2);
    padding: 0.4rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    gap: 0.5rem;
}

.embedded-chart-header span {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.embedded-chart-header a {
    color: white;
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    background: rgba(46,204,113,0.5);
    border-radius: 6px;
    border: 1px solid rgba(46,204,113,0.4);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.embedded-chart-header a:hover {
    background: rgba(46,204,113,0.7);
    transform: none;
}

.embedded-chart-iframe {
    width: 100%;
    height: 300px;
    border: none;
    display: block;
    background: #ffffff;
}

.external-link-icon {
    width: 11px;
    height: 11px;
    opacity: 0.75;
    flex-shrink: 0;
}

/* OWID footer badge */
.owid-badge {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    background: rgba(70,178,255,0.07);
    color: rgba(255,255,255,0.55);
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 500;
    margin-top: 0.5rem;
    border: 1px solid rgba(70,178,255,0.15);
    line-height: 1.5;
}

/* SCROLLBAR STYLING */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--glass-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--glass-highlight);
}

@media print {
    body * {
        visibility: hidden;
    }

    .modal-content,
    .modal-content * {
        visibility: visible;
    }

    .modal-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    .report-actions,
    .close-modal {
        display: none !important;
    }
}

/* ===================================
   ENHANCED CSS FOR SDG DASHBOARD
   Additional styles for new features
   =================================== */

/* Chart Description Styling */
.chart-description {
    position: absolute;
    bottom: 1px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 0px 16px;
    border-radius: 14px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.95);
    text-align: center;
    max-width: 90%;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    opacity: 0.9;
    line-height: 1.4;
}

.chart-description:hover {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Time Series Section Styling */
.time-series-section {
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--secondary-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 10px;
    border: 2px solid var(--border-dark);
    animation: slideInFromBottom 0.5s ease-out;
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.time-series-section h4 {
    color: var(--ndma-blue);
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

#goalSelector {
    width: 100%;
    padding: 0.3rem 0.5rem;
    background: var(--primary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.4rem;
}

#goalSelector:hover {
    border-color: var(--ndma-blue);
    background: var(--secondary-bg);
}

#goalSelector:focus {
    outline: none;
    border-color: var(--ndma-blue);
    box-shadow: 0 0 0 3px var(--ndma-blue-light);
}

/* Enhanced Chart Card Styling */
.chart-card,
.chart-card-right {
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chart-card:hover,
.chart-card-right:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

/* Enhanced Loading Animation */
.loading {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--ndma-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Enhanced Progress Bars */
.progress {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    height: 8px;
    margin-top: 1rem;
}

.progress-fill {
    background: linear-gradient(90deg, var(--ndma-green), var(--ndma-blue));
    height: 100%;
    transition: width 1.5s ease-in-out;
    border-radius: 10px;
}

/* Enhanced Modal Styling */
.modal.active {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Score Cards */
.score-box {
    background: linear-gradient(135deg, rgba(70, 178, 255, 0.15), rgba(46, 204, 113, 0.15));
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-box:hover {
    transform: scale(1.05);
    border-color: var(--ndma-blue);
    box-shadow: 0 8px 16px rgba(70, 178, 255, 0.2);
}

.score-box h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-box .score {
    font-size: 2.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--ndma-blue), var(--ndma-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Enhanced Goals Grid */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    gap: 0.8rem;
    margin: 1.5rem 0;
}

.goal {
    position: relative;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid;
    overflow: hidden;
}

.goal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.goal:hover::before {
    opacity: 1;
}

.goal:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.goal .trend {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.goal .number {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    margin-top: 8px;
}

/* WB Data Section Enhanced */
.wb-data-section {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: var(--secondary-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 2px solid var(--border-dark);
    transition: all 0.3s ease;
}

.wb-data-section:hover {
    border-color: var(--ndma-blue);
    box-shadow: 0 8px 16px rgba(70, 178, 255, 0.2);
}

.wb-data-section h4 {
    color: var(--ndma-blue);
    margin-bottom: 1rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wb-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.wb-data-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.wb-data-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.wb-data-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wb-data-item .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
}

/* Enhanced Button Styles */
button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::before {
    width: 300px;
    height: 300px;
}

/* Enhanced Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--ndma-blue), var(--ndma-green));
    border-radius: 5px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--ndma-green), var(--ndma-blue));
}

/* Enhanced Stat Cards */
.stat-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.stat-card:hover::after {
    left: 100%;
}

/* Enhanced Panel Styling */
.panel {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .chart-description {
        font-size: 0.65rem;
        padding: 6px 12px;
    }

    .time-series-section {
        padding: 1rem;
    }

    .goals-grid {
        grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
        gap: 0.6rem;
    }

    .score-box .score {
        font-size: 2rem;
    }
}

/* Print Styles for Reports */
@media print {
    .chart-description {
        display: none;
    }

    .modal-content {
        box-shadow: none;
        max-height: none;
        overflow: visible;
    }

    .report-actions {
        display: none;
    }

    body {
        background: white;
        color: black;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Visible for Keyboard Navigation */
*:focus-visible {
    outline: 3px solid var(--ndma-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .chart-description {
        background: rgba(0, 0, 0, 0.95);
        border: 2px solid white;
    }

    .goal {
        border-width: 3px;
    }
}

/* ============================================
   ENHANCED TIME SERIES INFO MODAL STYLES
   ============================================ */

/* Modal overlay for time series info */
.modal#timeSeriesInfoModal {
    animation: fadeIn 0.3s ease-out;
}

/* Info modal content with enhanced styling */
.modal#timeSeriesInfoModal .modal-content {
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Scrollbar for info modal */
.modal#timeSeriesInfoModal .modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal#timeSeriesInfoModal .modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.modal#timeSeriesInfoModal .modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--ndma-blue), var(--ndma-green));
    border-radius: 4px;
}

/* Enhanced chart info button for time series */
.chart-info-button {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.chart-info-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(70, 178, 255, 0.4);
}

.chart-info-button:active {
    transform: scale(0.95);
}

/* Info content styling */
#timeSeriesInfoContent h3 {
    border-bottom: 2px solid var(--ndma-blue);
    padding-bottom: 0.5rem;
}

#timeSeriesInfoContent h4 {
    margin-top: 1rem;
}

#timeSeriesInfoContent ul {
    line-height: 1.8;
}

#timeSeriesInfoContent ul li {
    margin-bottom: 0.5rem;
}

#timeSeriesInfoContent p {
    line-height: 1.6;
}

/* Enhanced tooltip animation */
@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments for info modal */
@media (max-width: 768px) {
    .modal#timeSeriesInfoModal .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
        max-height: 85vh;
    }

    #timeSeriesInfoContent h3 {
        font-size: 1rem;
    }

    #timeSeriesInfoContent h4 {
        font-size: 0.9rem;
    }

    #timeSeriesInfoContent p,
    #timeSeriesInfoContent li {
        font-size: 0.85rem;
    }
}
/* Ensure chart labels don't block interactions */
.chart-label {
    pointer-events: none;
    user-select: none;
}

/* Ensure chart containers allow interactions */
.chart-card-right {
    position: relative;
    pointer-events: auto;
}

.chart-card-right canvas {
    pointer-events: auto;
    cursor: pointer;
}

/* Enhanced info button SVG styling */
.chart-info-button svg {
    display: block;
    pointer-events: none;
}

.chart-info-button:hover svg {
    transform: scale(1.1);
}

/* ===============================
   PHONE: ≤ 480px
================================ */
@media (max-width: 480px) {
    /* Header collapses to logo + title stacked */
    .header {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.5rem 0.75rem 0.5rem 2.95rem;
        height: auto;
    }

    .menu-toggle-btn {
        left: 0.45rem;
        width: 34px;
        height: 34px;
        padding: 0;
        border-radius: 8px;
        display: inline-grid;
        place-items: center;
    }

    .menu-toggle-text {
        display: none;
    }

    .controls-drawer {
        width: calc(100vw - 0.4rem);
        padding-top: 4.7rem;
    }

    .header-left {
        width: 100%;
    }

    .header h1 {
        font-size: clamp(0.875rem, 5vw, 1.125rem);
    }

    .navbar-logo {
        height: 30px;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
    }

    .navbar-right .status-label {
        font-size: 1rem;
    }

    /* Controls single column */
    .controls {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .controls button {
        padding: 0.75rem;
        font-size: 0.75rem;
    }

    /* Stats 2 columns */
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
    }

    .stat-card {
        padding: 0.875rem 0.625rem;
    }

    /* Map shorter */
    #map {
        height: 250px;
    }

    /* Charts grid: single column */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .chart-card-right {
        height: auto;
    }

    .charts {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .chart-card {
        min-height: 0;
    }

    /* Modals slide up from bottom */
    .modal.active {
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        border-radius: 12px 12px 0 0;
        max-height: 92vh;
    }

    /* Side panel in-flow on small phones too */
    .side-panel,
    .side-panel-overlay {
        position: static !important;
        display: block !important;
        width: 100%;
        margin-top: 1rem;
    }

    /* Bottom sheet modal: slightly taller on small phones */
    .goal-detail-content {
        max-height: 92dvh;
    }

    .embedded-chart-iframe {
        height: 260px;
    }

    /* Goal icons: compact */
    .goals-grid {
        grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
        gap: 0.375rem;
    }

    .goal {
        padding: 0.5rem;
    }

    .goal .number {
        font-size: 1.1rem;
    }

    /* WB data 2 columns */
    .wb-data-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    /* Spinner smaller */
    .spinner {
        width: 42px;
        height: 42px;
    }

    .loading-content h2 {
        font-size: 1.25rem;
    }

    .loading-content p {
        font-size: 0.875rem;
    }

    .country-header {
        padding: 0.875rem;
    }
}
