﻿
@font-face {
    font-family: 'baloo2-variablefont_wght';
    src: url('../../fonts/baloo2-variablefont_wght.ttf') format('truetype');
}


.main-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 16px;
    gap: 16px;
    background-color: #3e4b5b;
    border-bottom: 1px solid #ccc;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

    .main-header::-webkit-scrollbar {
        display: none;
    }

.pbs-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
    font-size: 22px;
    font-weight: 500;
    color: white;
    flex-shrink: 0;
}


    .pbs-title img {
        height: 36px;
        flex-shrink: 0;
    }

.psi-heading {
    font-family: 'baloo2-variablefont_wght';
    font-weight: 700;
    font-size: 22px;
    color: #74137c;
    flex-shrink: 0;
    margin-left: 20px;
}


@media (max-width: 1000px) {
    .pbs-title {
        font-size: 18px;
        font-size: 18px;
    }

    .psi-heading {
        font-size: 18px;
        margin-left: 16px;
    }
}

@media (max-width: 480px) {
    .pbs-title {
        font-size: 16px;
    }

    .psi-heading {
        font-size: 16px;
        margin-left: 10px;
    }

    .main-header {
        padding: 6px 10px;
        gap: 10px;
    }
}

@media (max-width: 425px) {
    .pbs-title {
        font-size: 10px;
        margin-left: 2px;
    }

    .psi-heading {
        font-size: 13px;
        margin-left: 5px;
    }

    .main-header {
        padding: 6px 10px;
        gap: 10px;
    }
}

/* Responsive Media Queries */
@media (max-width: 999px) {
    .main-content {
        display: none !important;
    }

    body.sidebar-hidden .main-content {
        display: block !important;
    }

    /* Always hide topic box on mobile */
    #select-topic-box {
        display: none !important;
    }

    #layer-control-wrapper,
    #scale-bar-container,
    #disclaimer-info,
    .polygon-label,
    footer#map-footer {
        display: none !important;
    }

    body.sidebar-hidden #layer-control-wrapper,
    body.sidebar-hidden #scale-bar-container,
    body.sidebar-hidden #disclaimer-info,
    body.sidebar-hidden footer#map-footer {
        display: block !important;
    }

    
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}


#map {
    cursor: default !important;
    width: 100%;
    height: 70vh; /* Default height for desktop */
    position: absolute;
}

/* Mobile responsiveness (below 1000px) */
@media (max-width: 1000px) {
    #map {
        height: 60vh; /* Shorter height on mobile for better UX */
    }
}

/* Extra small devices (phones, below 600px) */
@media (max-width: 600px) {
    #map {
        height: 50vh; /* Even shorter for very small screens */
    }
}

.leaflet-left .leaflet-control-zoom {
    position: absolute !important;
    top: 8px; /* adjust as needed */
    left: 400px !important; /* move 400px from left */
    z-index: 1001;
}

.leaflet-left .leaflet-control-csv-export {
    position: absolute !important;
    top: 270px !important; /* BELOW the zoom buttons (default zoom is at 10px) */
    left: 410px !important; /* EXACTLY 400px from the left */
    width: 30px;
    height: 30px;
    line-height: 30px;
    background-color: white;
    text-align: center;
    font-size: 20px;
    z-index: 1001;
    border: 1px solid #ccc;
    border-radius: 4px;
}


/* Snapshot button custom position */
.leaflet-control-snapshot {
    position: absolute;
    left: 410px; /* ✅ container is correct */
    top: 235px; /* or adjust as needed */
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 24px;
    line-height: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    cursor: pointer;
    z-index: 1001;
}

#scale-bar-container {
    display: none;
    position: fixed;
    bottom: 60px;
    right: 20px;
    width: 90%;
    max-width: 650px;
    min-height: 130px;
    text-align: center;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 15px 25px;
    border-radius: 8px;
    box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.3);
    overflow: visible;
    box-sizing: border-box;
}

/* ✅ Horizontal title + hover info */
#scale-bar-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 10px;
    text-align: left;
    word-break: break-word;
}

/* Title: big and bold */
#scale-bar-title {
    font-size: 35px;
    font-weight: bold;
    color: #000;
    white-space: nowrap;
}

/* Hover info beside title */
#hover-value {
    font-size: 17px;
    font-weight: bold;
    color: #333;
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
    flex: 1 1 auto;
}

/* Main color scale bar */
#scale-bar {
    display: flex;
    width: 100%;
    height: 20px;
    border: 1px solid black;
    position: relative;
    box-sizing: border-box;
    margin-bottom: 15px;
}

/* Segments inside bar */
.scale-segment {
    flex: 1;
    height: 100%;
    position: relative;
}

/* Number labels below */
#scale-values {
    position: relative;
    width: 95%;
    left: 3%;
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    padding: 0 4px;
    text-align: center;
    white-space: nowrap;
}

/* Cursor arrows */
#scale-cursor,
#fixed-cursor {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 1001;
}

#scale-cursor {
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 14px solid black;
    transition: left 0.3s ease;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
}

#fixed-cursor {
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 16px solid white;
    filter: drop-shadow(0px 0px 2px black);
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
}

/* Mobile responsive */
@media (max-width: 768px) {
    #scale-bar-container {
        bottom: 60px;
        right: 10px;
        padding: 12px 10px 20px;
        overflow-x: hidden; /* ✅ Hide anything that goes out */
        right: 0;
        max-width: 100vw;
    }

    #scale-bar-title {
        font-size: 35px;
    }

    #hover-value {
        font-size: 17px;
        font-weight: bold;
        color: #333;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    #scale-values {
        font-size: clamp(12px, 1.4vw, 16px);
    }
}

#disclaimer-info {
    position: absolute;
    top: 320px;
    left: 425px;
    z-index: 700;
}


.tooltip .tooltip-inner {
    text-align: left !important;
    max-width: 250px;
    white-space: normal;
    font-size: 14px;
}

#map-header {
    position: absolute;
    top: 17px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, rgba(0, 127, 95, 0.7), rgba(38, 194, 140, 0.7));
    color: white;
    padding: 16px 24px 28px 24px; /* bottom padding added for PSI */
    border-radius: 10px;
    z-index: 999;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    width: 420px; /* fixed width */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-family: 'Segoe UI', sans-serif;
    border: 2px solid #423a8e;
    box-shadow: 0 4px 0 #423a8e;
    position: relative; /* needed for positioning child elements like badge */
}

.title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.map-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    word-break: break-word;
}

.map-description {
    font-size: 0.8rem;
    opacity: 0.85;
    line-height: 1.3em;
    white-space: normal;
    word-wrap: break-word;
    padding-top: 2px;
}

.psi-badge {
    position: absolute;
    bottom: 6px;
    right: 8px;
    background-color: #8e2a8b;
    color: white;
    font-weight: bold;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: Arial, sans-serif;
    letter-spacing: 1px;
}



#poi-control-wrapper {
    position: absolute;
    top: 145px;
    left: 410px;
    z-index: 1000;
}

#poi-control-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 2px solid #423a8e;
    border-radius: 8px;
    padding: 6px 12px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #423a8e;
    box-shadow: 0 4px 0 #423a8e;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

    #poi-control-trigger:hover {
        background-color: #f1f2f7;
        transform: translateY(1px);
        box-shadow: 0 2px 0 #423a8e;
    }

#poi-control-box {
    display: none;
    position: absolute;
    top: 0;
    left: 100%; /* ✅ moves box to the right of trigger */
    margin-left: 8px;
    background: white;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.15);
    width: 180px;
    border: 1px solid #423a8e;
    color: #423a8e;
}



.poi-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}




#basemap-control-wrapper {
    position: absolute;
    top: 90px;
    left: 407px;
    z-index: 1000;
}

#basemap-control-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 2px solid #423a8e;
    border-radius: 8px;
    padding: 8px 14px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #423a8e;
    box-shadow: 0 4px 0 #423a8e;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

    #basemap-control-trigger:hover {
        background-color: #f1f2f7;
        transform: translateY(1px);
        box-shadow: 0 2px 0 #423a8e;
    }

#basemap-control-box {
    display: none;
    position: absolute;
    top: 0;
    left: 100%; /* ✅ moves box to the right of trigger */
    margin-left: 8px;
    background: white;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.15);
    width: 180px;
    border: 1px solid #423a8e;
    color: #423a8e;
}



/* Same radio style as before */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

    .radio-group label {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 14px;
        font-weight: 500;
        color: #423a8e;
        cursor: pointer;
    }

    .radio-group input[type="radio"] {
        accent-color: #423a8e;
        width: 16px;
        height: 16px;
        cursor: pointer;
    }



/*features css*/
#features {
    position: absolute;
    top: 195px;
    left: 410px;
    z-index: 1000;
}

    #features > div:first-child {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: white;
        border: 2px solid #423a8e;
        border-radius: 8px;
        padding: 8px 14px;
        font-family: 'Segoe UI', sans-serif;
        font-size: 14px;
        font-weight: 600;
        color: #423a8e;
        box-shadow: 0 4px 0 #423a8e;
        cursor: pointer;
        transition: all 0.2s ease-in-out;
    }

        #features > div:first-child:hover {
            background-color: #f1f2f7;
            transform: translateY(1px);
            box-shadow: 0 2px 0 #423a8e;
        }

.icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#layer-control {
    display: none;
}




#layer-control {
    position: absolute;
    top: -10px;
    left: 100%;
    margin-left: 1px;
    display: none;
    background: white;
    padding: 12px 14px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.15);
    margin-top: 5px;
    width: 200px;
    border: 1px solid #423a8e;
    color: #423a8e;
}

/* ✅ Checkbox group styling (renamed) */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

    .checkbox-group label {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 14px;
        font-weight: 500;
        color: #423a8e;
        cursor: pointer;
    }

    .checkbox-group input[type="checkbox"] {
        accent-color: #423a8e;
        width: 16px;
        height: 16px;
        cursor: pointer;
    }
/*features css close*/


#map-footer {
    position: absolute;
    bottom: 0;
    left: 24rem;
    width: calc(100% - 24rem);
    background: #3e4b5b;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
    z-index: 999;
    color: white !important;
}
    #map-footer a {
        color: #3e4b5b !important;
        text-decoration: none;
    }

.category-link, .subcategory-link {
    cursor: pointer;
    font-weight: bold;
}

    .category-link:hover, .subcategory-link:hover {
        text-decoration: underline;
    }







.text-primary {
    color: #423a8e !important;
}
.text-muted {
    --bs-text-opacity: 1;
    color: #423a8e !important; /* a gray tone */
}


.form-check-input {
    accent-color: #423a8e !important;
}


aside {
    position: fixed;
    width: 24rem;
    height: 94vh;
    background: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #dee2e6;
    z-index: 1000;
}


#sidebar-content {
    margin-top: 100px;
}

.sidebar-scroll {
    overflow: auto;
    flex-grow: 1;
    max-height: calc(84vh - 300px);
}

.sidebar-scroll-body {
    overflow-y: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* === Card Layout === */
#sidebar-items .cards-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Hide map container when no topic is selected (desktop view) */
body:not(.topic-selected) #map-container {
    display: none !important;
}

@media (max-width: 999px) {
    /* Sidebar base (default full width) */
    aside {
        position: fixed !important;
        top: 60px;
        left: 0;
        width: 100% !important;
        max-width: none !important;
        height: calc(100vh - 60px);
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease, width 0.3s ease;
        z-index: 1000;
    }

    /* Sidebar shrinks when topic is selected */
    body.topic-selected aside {
        width: 90% !important;
    }

    /* Sidebar hidden (slid left) */
    body.sidebar-hidden aside {
        transform: translateX(-100%);
    }

    /* Card layout for tablets - 2 columns */
    #sidebar-items .cards-wrapper {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Show map container on mobile even when no topic is selected */
    body:not(.topic-selected) #map-container {
        display: block !important;
    }

    /* Sidebar Toggle Button styles */
    .sidebar-toggle {
        display: none;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
        width: 40px;
        height: 90px;
        background: #fff;
        border: 1px solid #423a8e;
        border-left: none;
        border-radius: 0 8px 8px 0; /* Rounded right side */
        cursor: pointer;
        z-index: 1100;
        box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.15);
        padding: 0;
        transition: background 0.3s ease;
    }

    /* Show toggle only when topic is selected */
    body.topic-selected .sidebar-toggle {
        display: block;
        left: 90%;
    }

    /* When sidebar is hidden, move toggle to far left */
    body.sidebar-hidden .sidebar-toggle {
        left: 0 !important;
        border-radius: 0 4px 4px 0;
    }

    .sidebar-toggle:hover {
        background: #f0f0ff;
    }

    .sidebar-toggle svg {
        width: 24px;
        height: 24px;
        stroke: #5856d6;
    }

    .leaflet-left .leaflet-control-zoom {
        position: absolute !important;
        left: 10px !important;
    }

    .leaflet-left .leaflet-control-csv-export {
        position: absolute !important;
        left: 10px !important;
    }

    #province-dropdown {
        position: absolute;
        left: 200px;
    }


     /* Snapshot button custom position */
        .leaflet-control-snapshot {
            position: fixed !important;
            left: auto !important;
            right: 10px !important;
            top: 130px !important;
        }

        #disclaimer-info {
            position: fixed !important;
            left: auto !important;
            right: 12px !important;
            top: 230px !important;
        }

    .leaflet-left .leaflet-control-csv-export {
        position: fixed !important;
        left: auto !important;
        right: 10px !important;
        top: 185px !important;
    }

        #layer-control-wrapper {
            position: absolute;
            left: 18px;
        }

    #poi-control-wrapper {
        position: absolute;
        left: 18px;
    }

    #basemap-control-wrapper {
        position: absolute;
        left: 18px;
    }

    #features {
        position: absolute;
        left: 18px !important;
    }

    #map-footer {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
    }

    #pbs-footer {
        position: absolute;
        bottom: 0 !important;
        width: 100% !important;

    }

    .pbs-header {
        gap: 32px !important;
    }

    #scale-bar-container {
        bottom: 60px !important;
        right: 30px !important;
        padding: 12px 10px 20px;
        overflow-x: hidden; /* ✅ Hide anything that goes out */
        right: 0;
        max-width: 100vw;
    }
}

/* === Small Mobile Devices === */
@media (max-width: 576px) {
    .dropdown-wrapper > div {
        grid-template-columns: 1fr 1fr;
    }

    /* Single column for small devices */
    #sidebar-items .cards-wrapper {
        grid-template-columns: 1fr !important;
    }

        /* Fix for radio buttons moving while scrolling */
        #sidebar-items .cards-wrapper .d-flex {
            position: relative;
            padding-left: 0;
            padding-right: 0;
            flex-wrap: nowrap;
            overflow-x: hidden;
            align-items: center;
            gap: 0.5rem;
        }

        #sidebar-items .cards-wrapper .form-check-input {
            position: absolute;
            left: 0;
            top: 2px;
            margin: 0 !important;
            width: 16px;
            height: 16px;
        }

        #sidebar-items .cards-wrapper .form-check-label {
            padding-left: 24px;
            flex: 1;
            font-size: 14px;
            line-height: 1.2;
            word-break: break-word;
        }

    header img {
        height: 30px !important;
    }

    header span {
        font-size: 14px !important;
    }

    #map-footer {
        position: absolute;
        bottom: 0px !important;
        left: 0;
        width: 100%;
    }

    #scale-bar-container {
        bottom: 60px !important;
        right: 20px !important;
        padding: 12px 10px 20px;
        overflow-x: hidden; /* ✅ Hide anything that goes out */
        right: 0;
        max-width: 100vw;
    }
}

@media (max-width: 600px) {
    #map-footer {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        text-align: center;
    }

    .footer-social {
        position: static;
        order: -1; /* show social icons on top */
        display: flex;
        justify-content: center;
        gap: 12px;
        margin-bottom: 4px;
    }

        .footer-social a {
            font-size: 0.9rem;
        }
}



/* === Desktop Only === */
@media (min-width: 1000px) {
    .sidebar-toggle {
        display: none !important;
    }
}

@media (max-width: 1557px) {
    #pbs-footer {
        position: absolute;
        bottom: 0 !important;
    }
}


@media (min-width: 1000px) and (max-width: 1189px) {
    .leaflet-left .leaflet-control-zoom {
        position: absolute !important;
        left: 360px !important;
    }

    .leaflet-left .leaflet-control-csv-export {
        position: absolute !important;
        left: 360px !important;
    }


    /* Snapshot button custom position */
    .leaflet-control-snapshot {
        position: absolute !important;
        left: 360px !important;
    }

    #disclaimer-info {
        position: absolute !important;
        left: 376px !important;
    }

    #layer-control-wrapper {
        position: absolute;
        left: 366px;
    }

    #poi-control-wrapper {
        position: absolute;
        left: 366px;
    }



    #basemap-control-wrapper {
        position: absolute;
        left: 366px;
    }

    #province-dropdown {
        position: absolute;
        left: 550px;
    }

    #features {
        position: absolute;
        left: 365px !important;
    }

    #map-footer {
        position: absolute;
        bottom: 0;
        left: 22rem;
        width: calc(100% - 22rem);
    }

    #pbs-footer {
        position: absolute;
        bottom: 0 !important;
        height: 240px!important;
    }


    aside {
        width: 22rem !important;
    }


    #sidebar-content {
        margin-top: 110px;
    }
    
        .dropdown-wrapper label {
        display: flex;
        align-items: center;
        color: #423a8e;
        font-size: 13px;
        cursor: pointer;
        padding: 1px 0;
    }

    .sidebar-toggle.moved {
        left: calc(22rem + 4px); /* Adjust toggle button */
    }

    #scale-bar-container {
        max-width: calc(100vw - 23rem); /* Leave space for sidebar + some gap */
        right: 15px; /* Add breathing room from edge */
    }

}




@media (max-width: 1900px) {
    #pbs-footer {
        position: absolute;
        bottom: 0 !important;
    }
}


#ranking-table-container {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 350px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    overflow: hidden;
}
/* Always stick values to the right — only data cells */
#ranking-table tbody td:last-child {
    text-align: right !important;
    padding-right: 10px; /* adjust if needed */
}

/* Keep first column (names) always left */
#ranking-table tbody td:first-child {
    text-align: left !important;
}

    #ranking-table-container.collapsed {
        width: 40px;
        height: 40px;
    }



#ranking-table-header {
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.1);
    font-weight: bold;
    text-align: center;
}

#ranking-table {
    width: 100%;
    border-collapse: collapse;
}



.highlighted-row {
    background-color: #ffeb3b !important;
    font-weight: bold !important;
}

#ranking-table th {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 5px;
    text-align: left;
}
    /* Center the Top and Bottom 5 headers */
    #ranking-table th[colspan="2"] {
        text-align: center;
        padding: 8px;
        font-weight: bold;
    }

/* Table column headers */
#ranking-table thead tr:not(.top-header):not(.bottom-header) th {
    text-align: left;
    padding: 6px;
}

    /* Align the Value column to right */
    #ranking-table thead tr:not(.top-header):not(.bottom-header) th:last-child {
        text-align: right;
        padding-right: 10px; /* 👈 adjust this value as needed */
    }

.scroll-equal {
    max-height: calc((60vh - 50px) / 3); /* same logic, just 60vh */
    overflow-y: auto;
}


#ranking-table td {
    padding: 5px;
    border-bottom: 1px solid #ddd;
}

#ranking-table tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

/* Scrollable Areas — split into 3 equal parts */
.scroll-equal {
    max-height: calc((60vh - 50px) / 3); /* same logic, just 60vh */
    overflow-y: auto;
}


.top-header {
    background-color: #493D9E;
    color: white;
    font-weight: bold;
}

.bottom-header {
    background-color: #F78D60;
    color: white;
    font-weight: bold;
}

@media (max-width: 1700px) {
    #ranking-table-container {
        width: 250px;
        max-height: 68vh;
        top: 10px;
    }
}

    @media (max-width: 1443px) {
        #ranking-table-container {
            width: 250px;
            max-height: 68vh;
            top: 10px;
        }

        /* ====================== MOBILE DRAWER STYLES ====================== */
        @media (max-width: 1000px) {
            #ranking-table-container {
                position: fixed;
                top: 60px;
                right: 0;
                width: 250px;
                max-height: calc(100vh - 70px);
                background: white;
                box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
                z-index: 1000;
                overflow-y: auto;
                transition: transform 0.3s ease-in-out;
                transform: translateX(100%);
            }

                #ranking-table-container.active {
                    transform: translateX(0);
                }

            #ranking-table-toggle {
                position: fixed;
                top: 50%;
                right: 0;
                transform: translateY(-50%);
                width: 40px;
                height: 90px;
                background: #fff;
                border: 1px solid #080c54;
                border-right: none;
                border-radius: 8px 0 0 8px;
                cursor: pointer;
                z-index: 1100;
                display: flex;
                align-items: center;
                justify-content: center;
                box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.15);
                padding: 0;
            }

                #ranking-table-toggle svg {
                    width: 24px;
                    height: 24px;
                }
        }

      

        /* Table inside drawer */
        .ranking-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 14px;
        }

            .ranking-table th,
            .ranking-table td {
                border: 1px solid #ccc;
                padding: 8px;
                text-align: left;
            }

            .ranking-table th {
                background-color: #f0f0f0;
            }

        .scroll-equal {
            max-height: calc((60vh - 50px) / 3); /* same logic, just 60vh */
            overflow-y: auto;
        }

        /* Optional: ensure table row height is consistent */
        #ranking-table td, #ranking-table th {
            padding: 4px 6px;
            line-height: 1.8em;
        }


        #ranking-table td, #ranking-table th {
            line-height: 1.8em;
            padding: 4px 6px;
        }


        #ranking-table-container.collapsed {
            height: 40px;
            width: 40px;
        }

            #ranking-table-container.collapsed #ranking-table-content {
                display: flex;
                flex-direction: column;
                flex: 1;
                overflow: hidden; /* ✅ Prevent inner overflow */
            }
    }

    .custom-link {
        color: #ffff;
        font-size: 0.875rem;
        text-decoration: none;
        font-weight: bold;
        text-decoration: underline;
    }

        .custom-link:hover {
            text-decoration: underline;
        }

    #pbs-footer {
        position: absolute;
        bottom: 0;
        height: 120px;
        left: 0;
        right: 0;
        background: #414042;
    }

    .pbs-header {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }


    .pbs-logo {
        height: 26px;
        width: auto;
        object-fit: contain;
        filter: brightness(0) invert(1);
    }

    .pbs-header h2 {
        font-size: 1.25rem;
        font-weight: 700;
        color: white;
        margin: 0;
        font-family: 'Source Sans Pro', sans-serif;
        line-height: 1;
        transform: translateY(2px);
    }

    .psi-license {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        font-family: 'Source Sans Pro', sans-serif;
        font-size: 10px;
        color: #ddd;
        margin-top: 20px;
        padding-left: 12px;
    }

    .psi-logo {
        font-weight: 900;
        font-size: 15px;
        letter-spacing: -1px;
        color: white;
        margin-bottom: 4px;
    }

    .psi-text a {
        color: #9ecfff;
        text-decoration: none;
    }

        .psi-text a:hover {
            text-decoration: underline;
        }




/* Your existing map-dropdown rules (kept mostly intact) */
.map-dropdown {
    position: fixed;
    background: #dfe2f1;
    padding: 12px 15px;
    border-radius: 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    z-index: 1000;
    width: auto;
    max-width: 180px;
}

    .map-dropdown.hidden {
        display: none;
    }

.dropdown-heading {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #423a8e;
    margin-bottom: 6px;
}

/* Custom dropdown visible UI (minimal, non-invasive) */
.custom-dropdown {
    position: relative;
    width: 160px;
    user-select: none;
}

    .custom-dropdown .selected {
        background: #fafafa;
        padding: 8px 10px;
        border: 1px solid #ccc;
        border-radius: 6px;
        cursor: pointer;
        font-size: 11px;
        color: #423a8e;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

        .custom-dropdown .selected .arrow {
            margin-left: 8px;
            opacity: 0.8;
            font-size: 12px;
        }

    /* ❌ Hide the old top-level options list */
    .custom-dropdown > .options {
        display: none !important;
    }

    /* ✅ Dropdown PANEL: holds search bar + options */
    .custom-dropdown .dropdown-panel {
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        width: 100%;
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 6px;
        box-shadow: 0 6px 18px rgba(0,0,0,0.08);
        z-index: 2000;
        max-height: 240px;
        overflow: hidden; /* search + list contained */
        display: none;
        flex-direction: column;
    }

    /* show panel when open */
    .custom-dropdown.open .dropdown-panel {
        display: flex !important;
    }

    /* search box styling (inside the panel) */
    .custom-dropdown .search-box {
        padding: 6px 8px;
        border-bottom: 1px solid #eee;
        background: #fff;
        position: relative;
        z-index: 3;
    }

        .custom-dropdown .search-box input {
            width: 100%;
            padding: 6px 8px;
            font-size: 12px;
            border: 1px solid #ccc;
            border-radius: 4px;
            outline: none;
        }

    /* ✅ options inside the dropdown-panel */
    .custom-dropdown .dropdown-panel .options {
        list-style: none;
        margin: 0;
        padding: 0;
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: block !important;
    }

        /* option style */
        .custom-dropdown .dropdown-panel .options li {
            padding: 8px 10px;
            font-size: 13px;
            color: #333;
            cursor: pointer;
            border-bottom: 1px solid #eee;
            display: block;
        }

            .custom-dropdown .dropdown-panel .options li:hover {
                background: #f0f0f5;
                color: #423a8e;
            }

            .custom-dropdown .dropdown-panel .options li.active {
                background: #dfe2f1;
                color: #423a8e;
                font-weight: 600;
            }

        /* Scrollbar style */
        .custom-dropdown .dropdown-panel .options::-webkit-scrollbar {
            width: 6px;
        }

        .custom-dropdown .dropdown-panel .options::-webkit-scrollbar-track {
            background: #f5f5f5;
        }

        .custom-dropdown .dropdown-panel .options::-webkit-scrollbar-thumb {
            background: #ccc;
            border-radius: 3px;
        }

/* preserve dropdown positions */
#district-dropdown-wrapper {
    top: 215px;
    left: 10px;
}

#extent-dropdown-wrapper {
    top: 215px;
    left: 200px;
}


/* responsive tweaks (unchanged) */
@media (min-width: 1000px) and (max-width: 1189px) {
    #district-dropdown-wrapper {
        left: 5px !important;
    }

    #extent-dropdown-wrapper {
        left: 180px !important;
    }

    .map-dropdown {
        max-width: 180px !important;
    }

    .custom-dropdown {
        width: 140px;
    }
}

@media (max-width: 999px) {
    #district-dropdown-wrapper {
        top: 150px;
        left: 5px !important;
    }

    #extent-dropdown-wrapper {
        top: 150px;
        left: 210px !important;
    }

    .map-dropdown {
        max-width: 200px !important;
    }

    .custom-dropdown {
        width: 180px;
    }
}

@media (max-width: 576px) {
    #district-dropdown-wrapper {
        top: 150px;
        left: 5px !important;
    }

    #extent-dropdown-wrapper {
        top: 150px;
        left: 190px !important;
    }

    .map-dropdown {
        max-width: 180px !important;
    }

    .custom-dropdown {
        width: 160px;
    }
}



/* === SLIDER WRAPPER (Outer Box with Arrows) === */
#indicator-slider {
    position: relative;
    width: 1020px;
    left: 50px;
    margin: 10px auto;
    background: transparent; /* fully transparent */
    border-radius: 14px;
    box-shadow: none; /* remove shadow if you want it clean */
    padding: 10px 0;
    z-index: 700;
}

/* === SLIDER CONTAINER (Scroll Area) === */
.slider-container {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 10px 20px; /* space for arrows */
}

    .slider-container::-webkit-scrollbar {
        display: none;
    }

.slider-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
/* === SECTION HEADER === */
.section-header {
    display: flex;
    align-items: center; /* vertical center */
    justify-content: center; /* horizontal center */
    height: 80px;
    font-weight: bold;
    font-size: 15px;
    font-family: "Segoe UI", sans-serif;
    color: white; /* base text color */
    line-height: 1.2;
    /* masking effect with #423a8e */
    text-shadow: 2px 2px 0 #423a8e, -2px -2px 0 #423a8e, 2px -2px 0 #423a8e, -2px 2px 0 #423a8e;
}





/* === INDICATOR CARD === */
.indicator-card {
    flex: 0 0 auto;
    width: 120px; /* fixed width for all cards */
    height: 90px; /* a little taller to fit 2 lines */
    background: linear-gradient(145deg, #ffffff, #f1f3f6);
    border-radius: 16px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: "Segoe UI", sans-serif;
    cursor: pointer;
    transition: transform 0.25s, box-shadow 0.25s;
    padding: 6px; /* prevent text touching edges */
    box-sizing: border-box;
}

    .indicator-card:hover {
        transform: translateY(-4px) scale(1.05);
        box-shadow: 0 6px 14px rgba(0,0,0,0.25);
    }

    .indicator-card .icon {
        font-size: 10px;
        color: #007f5f;
        margin-bottom: 4px;
    }

    .indicator-card .value {
        font-size: 12px;
        font-weight: bold;
        color: #080c54;
    }

    .indicator-card .label {
        font-size: 12px;
        color: #444;
        text-align: center;
        white-space: normal; /* ✅ allow wrapping */
        word-wrap: break-word; /* ✅ break long words if needed */
        line-height: 1.2; /* tighter line spacing */
    }


/* === ARROW BUTTONS === */
.arrow-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: background 0.2s, transform 0.2s;
    z-index: 10;
}

    .arrow-btn:hover {
        background: #eee;
        transform: translateY(-50%) scale(1.1);
    }

#leftBtn {
    left: 0px;
}

#rightBtn {
    right: 0px;
}
/* 📐 Between 1000px and 1189px */
@media (max-width:1600px) and (min-width:1246px) {
    #indicator-slider {
        width: 500px !important;
        left:100px !important;
        margin: 10px auto !important;
        padding: 8px 0 !important; /* thoda compact */
    }

    .indicator-card {
        min-width: 100px !important;
        height:80px !important;
    }

        .indicator-card .icon {
            font-size: 10px !important;
        }

        .indicator-card .value {
            font-size: 12px !important;
        }

        .indicator-card .label {
            font-size: 12px !important;
        }
}

/* 📐 Between 1000px and 1189px */
@media (max-width:1246px) and (min-width:1000px) {
    #indicator-slider {
        width: 300px !important;
        left: 100px !important;
        margin: 10px auto !important;
        padding: 8px 0 !important; /* thoda compact */
    }

    .indicator-card {
        min-width: 80px !important;
        height: 100px !important;
    }

        .indicator-card .icon {
            font-size: 10px !important;
        }

        .indicator-card .value {
            font-size: 12px !important;
        }

        .indicator-card .label {
            font-size: 12px !important;
        }
}

/* 📱 Below 1000px → fix 700px */
@media (max-width:999px) {
    #indicator-slider {
        width: 700px !important;
        left: auto !important;
        margin: 8px auto !important;
        padding: 6px 0 !important; /* aur chhota */
    }

    .indicator-card {
        min-width: 100px !important;
        height: 80px !important;
    }

        .indicator-card .icon {
            font-size: 10px !important;
        }

        .indicator-card .value {
            font-size: 12px !important;
        }

        .indicator-card .label {
            font-size: 12px !important;
        }
}
@media (max-width:866px) {
    #indicator-slider {
        width: 500px !important;
        left: auto !important;
        margin: 8px auto !important;
        padding: 6px 0 !important; /* aur chhota */
    }

    .indicator-card {
        min-width: 100px !important;
        height: 80px !important;
    }

        .indicator-card .icon {
            font-size: 10px !important;
        }

        .indicator-card .value {
            font-size: 12px !important;
        }

        .indicator-card .label {
            font-size: 12px !important;
        }
}
@media (max-width:672px) {
    #indicator-slider {
        width: 300px !important;
        left: auto !important;
        margin: 8px auto !important;
        padding: 6px 0 !important; /* aur chhota */
    }

    .indicator-card {
        min-width: 100px !important;
        height: 80px !important;
    }

        .indicator-card .icon {
            font-size: 10px !important;
        }

        .indicator-card .value {
            font-size: 12px !important;
        }

        .indicator-card .label {
            font-size: 12px !important;
        }
}

@media (max-width:472px) {
    #indicator-slider {
        width: 250px !important;
        left: 20px !important;
        margin: 8px auto !important;
        padding: 6px 0 !important; /* aur chhota */
    }

    .indicator-card {
        min-width: 100px !important;
        height: 80px !important;
    }

        .indicator-card .icon {
            font-size: 10px !important;
        }

        .indicator-card .value {
            font-size: 12px !important;
        }

        .indicator-card .label {
            font-size: 12px !important;
        }
}


#toast-container {
    position: fixed;
    bottom: 20px; /* 👈 stick to bottom */
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* 👈 align to right edge */
    gap: 3px; /* 👈 smaller gap between toasts */
    z-index: 9999;
    max-width: 300px;
    pointer-events: none;
}

    #toast-container.hidden {
        display: none; /* hide container completely when empty */
    }

.toast {
    display: inline-block;
    padding: 8px 12px; /* slightly smaller padding */
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    opacity: 1;
    transition: opacity 0.5s ease;
    max-width: 280px;
    word-wrap: break-word;
    height: auto !important;
    flex: 0 0 auto !important;
}

    .toast.success {
        background: #28a745;
    }

    .toast.error {
        background: #dc3545;
    }

    .toast.warning {
        background: #ffc107;
        color: #000;
    }

    .toast.info {
        background: #17a2b8;
    }


#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.6); /* semi-transparent background */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999; /* stays on top of map + sidebar */
    cursor: wait;
}

.spinner {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #4682B4;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
