:root {
    --font-bricolage: "Bricolage Grotesque", sans-serif;
}
body {
    font-family: var(--font-bricolage);
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

/* Responsive Sidebar */
.sidebar-container {
    position: absolute;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(241, 245, 249, 0.5);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

@media (min-width: 768px) {
    .sidebar-container {
        top: 20px;
        left: 20px;
        width: 440px;
        max-height: calc(100vh - 40px);
        border-radius: 1.5rem;
    }
}

@media (max-width: 767px) {
    .sidebar-container {
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 70vh; 
        border-top-left-radius: 1.5rem;
        border-top-right-radius: 1.5rem;
        border-bottom: none;
    }
}

.scroll-area {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    -webkit-overflow-scrolling: touch;
}
.scroll-area::-webkit-scrollbar { width: 6px; }
.scroll-area::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 3px; }

.result-card { transition: all 0.2s; }
.result-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }

.loader {
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease-in-out;
}

/* Timeline Graph Bars */
.timeline-bar {
    transition: height 0.3s ease, background-color 0.2s;
}
.timeline-bar:hover {
    background-color: #4f46e5 !important;
}

/* Standard Range Slider */
input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; }
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%;
    background: #4f46e5; cursor: pointer; margin-top: -6px;
    box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(0,0,0,0.2);
    pointer-events: auto;
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%; height: 4px; cursor: pointer; background: #e2e8f0; border-radius: 2px;
}

/* Dual Range Slider Styles */
.range-slider-container {
    position: relative;
    width: 100%;
    height: 20px;
}
.range-slider-input {
    position: absolute;
    pointer-events: none;
    -webkit-appearance: none;
    z-index: 2;
    height: 10px;
    width: 100%;
    opacity: 0;
    cursor: pointer;
}
/* We use opacity 0 inputs on top of visual thumbs for better cross-browser logic in simple JS */
/* Actually simpler: overlay two visible inputs with pointer-events: none on track/bg but auto on thumb */

.dual-range-wrapper {
    position: relative;
    height: 20px;
}
.dual-range-input {
    position: absolute;
    pointer-events: none;
    -webkit-appearance: none;
    width: 100%;
    height: 100%;
    background: none;
    top: 0;
    left: 0;
    z-index: 10;
}
.dual-range-input::-webkit-slider-thumb {
    pointer-events: auto;
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #4f46e5;
    cursor: pointer;
    margin-top: 2px; /* align center */
    box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    z-index: 20;
}
.dual-range-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    right: 0;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    z-index: 1;
}
.dual-range-highlight {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 4px;
    background: #818cf8;
    z-index: 2;
    border-radius: 2px;
}

/* Discrete Layer Control */
.layer-control {
    position: absolute;
    z-index: 900;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    width: 48px;
    height: 48px;
}

/* Mobile: Top Left (Avoids Top-Right Zoom) */
@media (max-width: 767px) {
    .layer-control {
        top: 20px;
        left: 20px;
    }
}

/* Desktop: Bottom Right */
@media (min-width: 768px) {
    .layer-control {
        bottom: 30px;
        right: 20px;
    }
}

.layer-control:hover, .layer-control.expanded {
    width: 240px;
    height: auto;
    max-height: 300px;
}

.layer-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #475569;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 20;
    background: white;
}

.layer-content {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    width: 240px;
    padding-top: 50px; /* Space for the button icon */
}

.layer-control:hover .layer-content, .layer-control.expanded .layer-content {
    opacity: 1;
    pointer-events: auto;
}