body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
}

/* MAP CONTAINER FULL-SCREEN BACKGROUND */
#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* MAPBOX POPUP BASE STYLES */
.mapboxgl-popup {
    font-family: 'Arial', sans-serif;
    font-size: 1.1em;
    z-index: 9999 !important;
}

/* MAPBOX POPUP CONTENT PANEL STYLES */
.mapboxgl-popup-content {
    color: #000;
    background-color: #fff;
    border-color: #a50f15;
    border-width: 2px;
    padding: 10px;
    border-radius: 5px;
    width: 380px !important;
    /* OVERRIDE INLINE WIDTH */
}

/* POPUP CLOSE (X) BUTTON STYLES */
.mapboxgl-popup-close-button {
    color: #a50f15;
    font-size: 1.4em;
    font-weight: bold;
    background: #fff;
    border-radius: 50%;
    width: 1.6em;
    height: 1.6em;
    line-height: 1.5em;
    text-align: center;
    top: 12px !important;
    right: 12px !important;
    box-shadow: 0 2px 8px rgba(165, 15, 21, 0.07);
    border: 2px solid #a50f15;
    opacity: 0.98;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    z-index: 10001;
    cursor: pointer;
}

.mapboxgl-popup-close-button:hover,
.mapboxgl-popup-close-button:focus {
    background: #a50f15;
    color: #fff;
    border-color: #a50f15;
    box-shadow: 0 2px 12px rgba(165, 15, 21, 0.14);
    opacity: 1;
    outline: none;
}

/* POPUP TIP/ARROW COLOR MATCHES PANEL */
.mapboxgl-popup-tip {
    border-top-color: #fff;
}

/* MAP TOOLTIP (CUSTOM ON HOVER) */
#map-tooltip {
    position: absolute;
    background: rgba(255, 255, 255, 0.78);
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    font-family: Arial, sans-serif;
    z-index: 101;
    color: #000;
    transition: background 0.2s;
}

/* TITLE BANNER IMAGE CENTERED TOP */
#title-container {
    position: absolute;
    top: 15px;
    width: 100%;
    text-align: center;
    z-index: 10;
}

#title-container img {
    max-width: 600px;
    width: 80%;
    height: auto;
    pointer-events: none;
}

/* LEGEND CONTAINER FOR DISASTER COUNT SCALE */
#legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: white;
    border-radius: 6px;
    padding: 12px 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    font-family: Arial, sans-serif;
    font-size: 13px;
    z-index: 10;
    width: 280px;
}

/* LEGEND TITLE */
.legend-title {
    font-weight: bold;
    margin-bottom: 8px;
}

/* LEGEND GRADIENT COLOR BAR */
.legend-gradient {
    position: relative;
    height: 24px;
    background: linear-gradient(to right,
            #f0f0f0 0%,
            #fee5d9 14%,
            #fcae91 28%,
            #fb6a4a 43%,
            #de2d26 71%,
            #a50f15 100%);
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    color: white;
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 10px;
}

.legend-gradient span {
    position: relative;
    z-index: 1;
}

/* LEGEND OUTLINE BOX FOR COUNTY BOUNDARY SYMBOL */
.legend-outline {
    display: flex;
    align-items: center;
    margin-top: 6px;
}

.legend-box {
    width: 18px;
    height: 14px;
    border: 1px solid #000;
    margin-right: 8px;
}

/* MOBILE RESPONSIVE LEGEND STYLES */
@media (max-width: 700px) {
    #legend {
        width: 40vw !important;
        max-width: 340px !important;
        min-width: 160px !important;
        left: 2vw !important;
        bottom: 12px !important;
        font-size: 11px !important;
        padding: 7px 7px !important;
        border-radius: 5px;
        z-index: 14;
    }

    .legend-title {
        font-size: 0.9em !important;
        margin-bottom: 6px;
    }

    .legend-gradient {
        font-size: 10px !important;
        height: 14px !important;
        padding: 0 3px !important;
        margin-bottom: 6px;
    }

    .legend-box {
        width: 12px !important;
        height: 10px !important;
        margin-right: 5px;
    }

    .legend-gradient span {
        font-size: 9px !important;
    }
}



/* LAYER TOGGLES */

#layer-toggle-ui label {
display: block;
margin-bottom: 6px;
cursor: pointer;
}
#layer-toggle-ui input[type="checkbox"] {
margin-right: 6px;
cursor: pointer;
}



/* MOBILE RESPONSIVE POPUP CONTENT WIDTH */
@media (max-width: 700px) {
    .mapboxgl-popup-content {
        width: 50vw !important;
        min-width: 0 !important;
        max-width: 50vw !important;
        padding: 6vw 3vw 3vw 3vw !important;
        font-size: 0.8em !important;
        border-radius: 0 !important;
        box-sizing: border-box;
    }

    .mapboxgl-popup {
        left: 0 !important;
        right: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* POPUP PARAGRAPH AND LIST SPACING (TIGHTER LINES) */
.mapboxgl-popup-content p,
.mapboxgl-popup-content ul,
.mapboxgl-popup-content li,
.mapboxgl-popup-content div,
.mapboxgl-popup-content {
    line-height: 1.32 !important;
}

.mapboxgl-popup-content p,
.mapboxgl-popup-content ul,
.mapboxgl-popup-content li {
    margin-top: 0.25em !important;
    margin-bottom: 0.25em !important;
}

/* EXTRA SPACE FOR POPUP SECTION HEADERS */
.mapboxgl-popup-content div[style*="margin-bottom:1em"],
.mapboxgl-popup-content div[style*="margin-bottom:0.9em"] {
    margin-bottom: 0.6em !important;
}

/* HIDE POPUP TIP ON SMALL SCREENS */
@media (max-width: 700px) {
    .mapboxgl-popup-tip {
        display: none !important;
    }
}

/* HIGH-LEVEL FINDINGS PANEL STYLES */
#highlevel-findings {
    position: absolute;
    top: 140px;
    left: 19px;
    z-index: 9998;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 2px 12px rgba(165, 15, 21, 0.06);
    padding: 10px 14px 9px 14px;
    max-width: 500px;
    width: 40vw;
    font-family: 'Arial', sans-serif;
    font-size: 0.92em;
    color: #232323;
    line-height: 1.38;
    letter-spacing: 0.01em;
    border-left: 8px solid #000;
    transition: box-shadow 0.18s;
    opacity: 0.97;
}

/* RED HIGHLIGHT TEXT IN FINDINGS PANEL */
#highlevel-findings .highlight-red {
    color: #a50f15;
    font-weight: bold;
    letter-spacing: 0.01em;
    background: linear-gradient(90deg, #fee5d9 0%, #fee5d9 80%);
    padding: 0 2px;
    border-radius: 2px;
}

#highlevel-findings p {
    margin: 0 0 0.6em 0;
    font-family: 'Arial', sans-serif;
    font-size: 0.93em;
    line-height: 1.35;
}

/* MOBILE RESPONSIVE HIGH-LEVEL FINDINGS */
@media (max-width: 700px) {
    #highlevel-findings {
        top: 140px;
        left: 19px;
        right: 2vw;
        width: 65vw;
        max-width: 65vw;
        padding: 7px 7px 6px 10px;
        font-size: 0.88em;
        border-left-width: 6px;
        box-shadow: 0 2px 8px rgba(165, 15, 21, 0.08);
        opacity: 0.96;
    }

    #highlevel-findings p {
        font-size: 0.89em;
    }
}

/* RBD LOGO TOP LEFT */
#rbd-logo-container {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 11000; /* ENSURE IT'S ABOVE MAP UI */
}

#rbd-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    display: block;
}

@media (max-width: 700px) {
    #rbd-logo {
        width: 40px;
        height: 40px;
    }
    #rbd-logo-container {
        top: 10px;
        left: 10px;
    }
}



@media (max-width: 700px) {
    #layer-toggle-ui {
        width: 25vw !important;
        max-width: 300px !important;
        min-width: 150px !important;
        right: 2vw !important;
        bottom: 12px !important;
        padding: 7px 9px !important;
        border-radius: 5px !important;
        font-size: 12px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.18);
        z-index: 14;
    }

    #layer-toggle-ui strong {
        font-size: 0.9em !important;
        margin-bottom: 6px;
    }

    #layer-toggle-ui label {
        font-size: 0.9em !important;
        margin-bottom: 5px !important;
    }

    #layer-toggle-ui input[type="checkbox"] {
        transform: scale(0.9);
        margin-right: 4px;
    }
}