﻿:root {
    --bg: #0d0f12;
    --panel: #151a20;
    --acc: #98c379;
    --muted: #8a9099;
    --text: #e6ebf2;
    --chip: #222833;
    --danger: #d66;
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
    overflow: hidden;
}

.app {
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 320px 1fr;
    grid-template-areas: "sidebar header" "sidebar map" "sidebar footer";
    height: 100%;
    width: 100%;
}

#cesiumContainer {
    grid-area: map;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.sidebar {
    grid-area: sidebar;
    background: var(--panel);
    border-right: 1px solid #212833;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px
}

.brand {
    font-weight: 700;
    letter-spacing: .5px
}

    .brand small {
        color: var(--muted);
        font-weight: 500
    }

.btn-toggle {
    display: flex;
    gap: 8px;
    background: #11161c;
    border: 1px solid #263041;
    border-radius: 18px;
    padding: 4px
}

    .btn-toggle button {
        flex: 1;
        padding: 10px 12px;
        border: 0;
        border-radius: 14px;
        background: transparent;
        color: var(--muted);
        font-weight: 700;
        cursor: pointer
    }

        .btn-toggle button.active {
            background: var(--acc);
            color: #07140d
        }

.select {
    display: flex;
    flex-direction: column;
    gap: 6px
}

    .select label {
        color: var(--muted);
        font-size: 12px;
        letter-spacing: .6px
    }

select {
    width: 100%;
    padding: 10px 12px;
    background: #11161c;
    color: var(--text);
    border: 1px solid #263041;
    border-radius: 12px
}

.legend {
    padding: 12px;
    background: #0f1319;
    border: 1px solid #202837;
    border-radius: 12px
}

    .legend h4 {
        margin: 0 0 10px 0;
        font-size: 12px;
        color: var(--muted);
        letter-spacing: .6px
    }

    .legend .item {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 6px 0
    }

.swatch {
    width: 24px;
    height: 6px;
    border-radius: 4px;
    background: var(--acc);
    opacity: .4
}

    .swatch.s1 {
        opacity: .25
    }

    .swatch.s2 {
        opacity: .45
    }

    .swatch.s3 {
        opacity: .7
    }

    .swatch.s4 {
        opacity: 1
    }

.header {
    grid-area: header;
    padding: 12px 16px;
    border-bottom: 1px solid #212833;
    background: linear-gradient(180deg,#0f141a,transparent)
}

    .header .meta {
        display: flex;
        gap: 18px;
        align-items: center;
        flex-wrap: wrap
    }

.chip {
    background: var(--chip);
    color: #c9d2de;
    border: 1px solid #2a3340;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px
}

.footer {
    grid-area: footer;
    background: var(--panel);
    border-top: 1px solid #212833;
    padding: 10px 14px;
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 12px
}

.stat {
    display: flex;
    flex-direction: column
}

    .stat .k {
        font-size: 22px;
        font-weight: 800
    }

    .stat .l {
        font-size: 11px;
        color: var(--muted);
        letter-spacing: .5px;
        text-transform: uppercase
    }

.hud {
    position: absolute;
    z-index: 500;
    padding: 10px 12px;
    border-radius: 12px;
    background: #0f141a;
    border: 1px solid #202837;
    left: 350px;
    top: 72px;
    box-shadow: 0 8px 24px rgba(0,0,0,.35)
}

    .hud .title {
        font-weight: 800
    }

    .hud .sub {
        font-size: 12px;
        color: var(--muted)
    }

.flow-filter {
    display: flex;
    gap: 6px;
    background: #11161c; /* match sidebar theme */
    border: 1px solid #263041; /* outer border like toggle */
    border-radius: 18px;
    padding: 4px;
    justify-content: center;
    margin-top: 6px;
}

    .flow-filter button {
        flex: 1;
        background: transparent;
        border: 0;
        color: var(--muted);
        padding: 6px 10px;
        border-radius: 14px;
        cursor: pointer;
        font-size: 13px;
        font-weight: 700;
        transition: all 0.2s;
    }

        .flow-filter button.active {
            background: var(--acc);
            color: #07140d;
            border-color: var(--acc);
            transform: scale(1.05);
        }

        .flow-filter button:hover {
            background: #2b2b2b;
            color: white;
        }



/* Container like inbound/outbound */
#genderFilter {
    display: flex;
    gap: 6px;
    background: #11161c; /* match sidebar theme */
    border: 1px solid #263041; /* outer border like toggle */
    border-radius: 18px;
    padding: 4px;
    justify-content: center;
}

    /* Individual buttons inside container */
    #genderFilter button {
        flex: 1;
        background: transparent;
        border: 0;
        color: var(--muted);
        padding: 6px 10px;
        border-radius: 14px; /* inner round corners */
        cursor: pointer;
        font-size: 13px;
        display: flex;
        align-items: center;
        gap: 6px;
        font-weight: 700;
        transition: all 0.2s;
    }

        #genderFilter button i {
            font-size: 14px;
        }

        #genderFilter button[data-gender="total"] i {
            color: #FFD700;
        }
        /* gold */
        #genderFilter button[data-gender="male"] i {
            color: #FFD700;
        }
        /* blue */
        #genderFilter button[data-gender="female"] i {
            color: #FFD700;
        }
        /* pink */

        #genderFilter button.active {
            background: var(--acc);
            color: #07140d;
            border-color: var(--acc);
            transform: scale(1.05);
        }

        #genderFilter button:hover {
            background: #2b2b2b;
            color: white;
        }

/* Right-side chart sidebar that overlays the map */
#chartSidebar {
    position: absolute;
    right: 12px;
    top: 58px;
    height: 770px;
    width: 400px;
    bottom: 96px;
    background: rgba(15,19,25,0.96);
    border: 1px solid #202837;
    border-radius: 12px;
    padding: 12px;
    z-index: 700;
    overflow: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}


.chart-block {
    background: transparent;
    border-radius: 8px;
    padding: 6px;
    margin-bottom: 12px;
    min-height: 140px;
}


.chart-title {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.highcharts-contextbutton {
    border: none !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 6px !important;
    transition: all 0.2s ease-in-out;
}

    .highcharts-contextbutton:hover {
        background: rgba(255, 255, 255, 0.3) !important;
    }


#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);
    }
}

.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: 200px !important;
    width: 20rem;
    left: 0;
    right: 0;
    background: #222833;
}

.pbs-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
}


.pbs-logo {
    height: 27px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.pbs-header h2 {
    font-size: 1rem;
    font-weight: 600;
    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;
    }


.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: #2a2a2a;
    color: white;
    margin-right: 4px;
    font-size: 12px;
    cursor: default; /* default cursor for chip itself */
}

    .chip.clickable {
        cursor: pointer; /* pointer cursor for chips with cross */
    }

    .chip .close {
        margin-left: 6px;
        font-weight: bold;
        cursor: pointer; /* pointer for cross */
    }
.dropdown-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.dropdown-search {
    display: none;
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-bottom: 1px solid #444;
    background: #11161c;
    color: white;
    font-size: 13px;
    padding: 6px 8px;
    outline: none;
}

#districtSelect {
    width: 100%;
    box-sizing: border-box;
    color: #fff;
    border: 1px solid #555;
    font-size: 13px;
    max-height: 200px;
    overflow-y: auto;
}

    /* Hover effect for dropdown options */
    #districtSelect option:hover {
        background-color: #333;
        color: #fff;
        cursor: pointer;
    }
