body {
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
    background: #f4f4f4;
    color: #333;
}

#map {
    height: 70vh;
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
        
.controls-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.control-group { display: flex; flex-direction: column; gap: 8px; }
label { font-weight: bold; font-size: 0.9em; }

input, select { padding: 10px; border: 1px solid #ddd; border-radius: 6px; }

.provider-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    font-size: 0.9em;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    background: #fff;
    padding: 10px 20px;
    border-radius: 8px;
}

.marker-cluster-custom {
    background: none !important;
    border: none !important;
}

.marker-cluster-custom .overlap-cluster {
    background: #333;
    color: #fff;
    border: 2px solid #fff;
    font-size: 10px;
}

.overlap-cluster {
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.9); 
    border: 1px solid black;
    border-radius: 50%;
    color: black;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 3px rgba(0,0,0,0.4);
    pointer-events: none;
}

.overlap-cluster span {
    font-family: Arial, sans-serif;
    font-size: 9px;
    font-weight: bold;
    line-height: 1;
}

#toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 12px;
    position: fixed;
    z-index: 9999;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#toast.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from { bottom: 0; opacity: 0; }
    to { bottom: 30px; opacity: 1; }
}

@keyframes fadeout {
    from { bottom: 30px; opacity: 1; }
    to { bottom: 0; opacity: 0; }
}

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn-primary {
    background: #0044ff;
    color: white;
}

.btn-outline {
    background: #eee;
    color: #333;
}

.btn:hover {
    opacity: 0.8;
}

.btn-back {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #e9ecef;
    border-color: #ccc;
}

/* Spinner for the popup loading. */
.loader-dots:after {
    content: ' .';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { color: rgba(0,0,0,0); text-shadow: .25em 0 0 rgba(0,0,0,0), .5em 0 0 rgba(0,0,0,0); }
    40% { color: #333; text-shadow: .25em 0 0 rgba(0,0,0,0), .5em 0 0 rgba(0,0,0,0); }
    60% { text-shadow: .25em 0 0 #333, .5em 0 0 rgba(0,0,0,0); }
    80%, 100% { text-shadow: .25em 0 0 #333, .5em 0 0 #333; }
}
.controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
}

.search-container {
    position: relative;
    width: 100%;
    margin-bottom: 5px;
}

#searchInput {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 30px 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* This targets the container we created for clusters */
#multi-popup-container {
    padding: 5px 15px 5px 10px !important;
    box-sizing: border-box;
    width: 100%;
    overflow-x: hidden;
    max-height: 400px;
}

/* #multi-popup-container::-webkit-scrollbar {
    width: 6px;
}
#multi-popup-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
} */

/* This ensures the table inside doesn't ignore the padding */
#multi-popup-container table {
    width: calc(100% - 5px); 
    margin-right: 5px;
}

/* Leaflet specific override to ensure the container doesn't fight the bubble */
.leaflet-popup-content {
    margin: 13px 19px 13px 14px !important;
}

.cell-summary {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    margin-top: 10px;
}

.cell-summary thead {
     position: sticky;
     top: 0;
     background: #f4f4f4;
}

.cell-summary th {
    text-align: left;
    padding: 6px;
    background: #f8f8f8;
    border-bottom: 2px solid #eee;
}

.cell-summary td {
    padding: 6px;
    border-bottom: 1px solid #eee;
}

.cell-band {
    text-decoration-line: underline;
    text-decoration-style: dotted;
    text-decoration-color: #000000;
}

.popup-footer {
    margin-top: 12px;
    padding-top: 10px;
    /* height: 40px; */
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-start;
}

/* Legend CSS */
.legend-control {
    background: white;
    padding: 0;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease-in-out;
    width: fit-content;
    height: 32px;
    display: flex;
    flex-direction: column;
    border: 2px solid rgba(0,0,0,0.2);
}

.legend-control.expanded {
    width: fit-content;
    height: auto;
    max-height: 450px;
    overflow-y: auto;
    padding: 12px;
    cursor: default;
    border: 2px solid #fff;
}

.legend-icon {
    flex-shrink: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;    
    font-weight: bold;
    font-family: Arial, sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    color: #444;
    letter-spacing: 1px;
    white-space: nowrap;
}

.legend-control.expanded .legend-icon {
    display: none;
}

.legend-content {
    display: none;
}

.legend-control.expanded .legend-content {
    display: block;
}

.legend-content i {
    width: 14px;
    height: 14px;
    float: left;
    margin-top: 4px;
    margin-right: 8px;
    border-radius: 50%;
}

.legend-close {
    font-size: 20px;         /* Larger 'x' */
    line-height: 1;
    font-weight: bold;
    color: #999;
    padding-left: 10px;
    cursor: pointer;
}

.legend-close:hover {
    color: #333;
}