/* --- Main Dashboard Layout --- */
#dashboard-container {
    width: 100%;
    /* Let the user control the height from the shortcode or page builder */
    height: 60vh; /* A good default height */
    min-height: 500px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    position: relative;
    overflow: hidden; /* Important for containing absolutely positioned children */
    background-color: #f0f0f0; /* Fallback color while map loads */
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
}

/* --- Filter Container (Over the Map) --- */
#filter-container {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; /* Allows filters to stack on smaller screens */
}

.filter-control {
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #fff;
    transition: border-color 0.2s;
}
.filter-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

#apply-filters-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 0;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s;
}
#apply-filters-btn:hover {
    background-color: #0056b3;
}
#apply-filters-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.map-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 123, 255, 0.3);
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 5px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* --- Layers Control --- */
#layers-control-container {
    position: absolute;
    bottom: 15px;
    left: 15px;
    z-index: 10;
}

#layers-btn {
    background: #007bff;
    border: 1px solid #ccc;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    font-size: 14px;
}
#layers-btn i {
    margin-right: 5px;
}
#layers-panel {
    display: none; /* Toggled by JS */
    position: absolute;
    bottom: 100%; /* Position above the button */
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
    width: 150px;
}
#layers-panel .layer-option {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: black;
}
#layers-panel .layer-option:hover {
    background: #f0f0f0;
}
#layers-panel .layer-option.active {
    background-color: #007bff;
    color: white;
    font-weight: bold;
}


/* --- Custom Price Marker --- */
.price-marker {
    background-color: #d9534f; /* A nice red */
    color: white;
    font-size: 14px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 16px;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
.price-marker:hover {
    transform: scale(1.15);
    z-index: 20;
}
.price-marker.active {
    background-color: #007bff;
    transform: scale(1.25);
    z-index: 21;
}

/* --- Sidebar Styling --- */
#sidebar {
    width: clamp(300px, 30%, 400px); /* Responsive width */
    background-color: #fff;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateX(-110%); /* Hide completely off-screen */
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 1001; /* Above all map elements */
}
#sidebar.open {
    transform: translateX(0);
}
#sidebar-content {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
}
#sidebar-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #999;
}
#sidebar .placeholder { text-align: center; padding: 100px 20px; color: #adb5bd; }
#sidebar .placeholder i { font-size: 50px; margin-bottom: 20px; }
#sidebar .mandi-title { font-size: 1.5rem; font-weight: 600; color: #343a40; margin-bottom: 0; }
#sidebar .mandi-subtitle { font-size: 1rem; color: #6c757d; margin-bottom: 1.5rem; }
#sidebar .price-card { background-color: #f8f9fa; border-radius: 8px; padding: 15px; margin-bottom: 1.5rem; }
#sidebar .price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
#sidebar .price-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: #6c757d; }
#sidebar .price-value { font-size: 1.1rem; font-weight: bold; color: #28a745; }
#sidebar .graph-container { width: 100%; height: 250px; }

/* Mapbox UI overrides */
.mapboxgl-ctrl-top-right {
    top: 15px;
    right: 15px;
}