/* static/css/main/index-controls.css - Filter controls, toggles, and buttons for index page */

/* ===== FILTER CONTROLS (Sidebar) ===== */
.filters {
    margin: 0;
    padding: 0;
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* Loading state for filters - prevents jarring sequential appearance */
.filters.loading {
    opacity: 0;
    pointer-events: none;
}

.filter-group {
    margin-bottom: 25px;
    padding: 15px;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow-light);
    border: 1px solid var(--border-gray);
}

.filter-group label,
.year-select-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.95rem;
}

.year-select-group label {
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== SELECT DROPDOWNS ===== */
.select-dropdown {
    font-family: var(--main-font-family);
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    background-color: var(--white);
    color: var(--primary-dark);
    font-size: 0.95rem;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    box-sizing: border-box;
    margin: 0;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23004D42' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.select-dropdown:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(0, 77, 66, 0.1);
}

.select-dropdown option {
    font-family: var(--main-font-family);
    background-color: var(--white);
    color: var(--primary-dark);
    padding: 10px 12px;
}

.select-dropdown.disabled-select {
    background-color: #f0f0f0;
    color: #666666;
    cursor: not-allowed;
    border-color: #ccc;
    opacity: 0.8;
}

.select-dropdown.disabled-select:hover {
    border-color: #ccc; /* Keep border color same on hover when disabled */
}

/* ===== YEAR RANGE CONTROLS ===== */
.year-range-container {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 8px;
}

.year-select-group {
    flex: 1;
}

/* Year Range Filter - Side by Side Layout */
.year-range-filter-group {
    margin-bottom: 25px;
    padding: 15px;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow-light);
    border: 1px solid var(--border-gray);
}

.year-range-main-label {
    display: block;
    margin-bottom: 10px;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.95rem;
}

.year-range-inner-container {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    margin-top: 8px;
}

.year-range-subgroup {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.year-range-subgroup label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--primary-dark);
}

.year-range-subgroup select {
    width: 100%;
}

/* Year range filter group: add dataset-specific border/label color */
.year-range-filter-group.uscb {
    border: 1px solid var(--uscb-purple);
}

.year-range-filter-group.uscb .year-range-main-label {
    color: var(--uscb-purple);
}

/* ===== TOGGLE BUTTONS (General) ===== */
.toggle-container {
    display: flex;
    width: 100%;
    margin-top: 8px;
}

.toggle-button {
    flex: 1;
    padding: 10px 0;
    background-color: var(--white);
    color: var(--primary-dark);
    border: 1px solid #ccc;
    cursor: pointer;
    font-family: var(--main-font-family);
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.toggle-button:first-child {
    border-radius: 6px 0 0 6px;
}

.toggle-button:last-child {
    border-radius: 0 6px 6px 0;
}

.toggle-button:not(:first-child):not(:last-child) {
    border-radius: 0;
    border-left: none;
    border-right: none;
}

.toggle-button.active {
    background-color: var(--primary-dark);
    color: var(--white);
    border-color: var(--primary-dark);
    font-weight: 600;
}

/* ===== MAP TYPE TOGGLE BUTTONS ===== */
.map-type-toggle {
    position: absolute;
    bottom: 80px; /* Align with reset button */
    left: 20px;
    z-index: 160; /* MAP_TYPE_TOGGLE - ZIndexManager */
    background-color: var(--bg-transparent, rgba(255, 246, 233, 0.85));
    padding: 5px;
    border-radius: 6px;
    box-shadow: 0 2px 4px var(--shadow-medium);
    border: 2px solid var(--primary-dark);
}

.map-type-toggle .toggle-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
}

.map-type-toggle .toggle-button {
    position: relative;
    padding: 8px 16px;
    border: 2px solid var(--primary-dark);
    background-color: var(--white, #FFFFFF);
    color: var(--primary-dark, #003028);
    cursor: pointer;
    font-family: var(--main-font-family);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.map-type-toggle .toggle-button:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.map-type-toggle .toggle-button:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.map-type-toggle .toggle-button.active {
    background-color: var(--primary-dark, #004D42);
    color: var(--white, #FFFFFF);
    border-color: var(--primary-dark, #004D42);
    font-weight: 600;
}

/* Hide map-type-toggle on desktop (show in drawer instead) */
@media screen and (min-width: 769px) and (min-height: 769px) {
    .map-type-toggle {
        display: none !important;
    }
}

/* ===== DESKTOP MAP CONTROLS BUTTON ===== */
/* Shared styles for desktop map control buttons */
.desktop-map-controls-btn,
.reset-button {
    position: absolute;
    bottom: 80px;
    background-color: var(--bg-transparent);
    color: var(--primary-dark);
    border: 2px solid var(--primary-dark);
    border-radius: 4px;
    padding: 10px 15px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 4px var(--shadow-medium);
    transition: all 0.3s ease;
    font-size: 1rem;
    font-family: var(--main-font-family);
    display: flex;
    align-items: center;
    gap: 6px;
}

.desktop-map-controls-btn:hover,
.reset-button:hover {
    background-color: var(--accent);
    transform: scale(1.05);
}

.desktop-map-controls-btn {
    left: 20px;
    z-index: 100; /* CONTROLS_BASE - ZIndexManager */
}

.desktop-map-controls-btn.active {
    background-color: var(--accent);
    color: var(--primary-dark);
    border-color: var(--accent);
}

/* Shared SVG icon sizing */
.desktop-map-controls-btn svg,
.reset-button svg,
.download-button svg {
    width: 16px;
    height: 16px;
}

.download-button svg {
    margin-right: 8px;
}

/* ===== DESKTOP MAP CONTROLS DRAWER ===== */
.desktop-map-controls-drawer {
    position: absolute;
    bottom: 140px; /* Position above the map controls button */
    left: 20px;
    width: 320px;
    max-height: 60vh;
    background: var(--white);
    border: 2px solid var(--primary-dark);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 310; /* DESKTOP_DRAWER - ZIndexManager */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.desktop-map-controls-drawer.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.desktop-map-controls-header {
    position: sticky;
    top: 0;
    background: var(--white);
    padding: 12px 16px;
    border-bottom: 2px solid var(--primary-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    flex-shrink: 0;
}

.desktop-map-controls-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--primary-dark);
    flex: 1;
}

.desktop-map-controls-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary-dark);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.desktop-map-controls-close:hover {
    background-color: var(--background-light-shade);
}

.desktop-map-controls-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(60vh - 60px); /* Account for header */
}

/* Map Type Toggle in Desktop Drawer */
.desktop-map-controls-content .map-type-toggle {
    display: block !important;
    position: static;
    bottom: auto;
    left: auto;
    transform: none;
    max-width: 100%;
    width: 100%;
    background: none;
    padding: 2px;
    border: none;
    box-shadow: none;
    margin-bottom: 16px;
}

.desktop-map-controls-content .map-type-toggle .toggle-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.desktop-map-controls-content .map-type-toggle .toggle-button {
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    min-height: 40px;
    border-radius: 6px;
    text-align: center;
    border: 2px solid var(--primary-dark);
    margin: 0;
    transition: all 0.3s ease;
}

.desktop-map-controls-content .map-type-toggle .toggle-button.active {
    background-color: var(--primary-dark);
    color: var(--white);
    border-color: var(--primary-dark);
    font-weight: 600;
}

.desktop-map-controls-content .map-type-toggle .toggle-button:not(.active) {
    background-color: var(--white);
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ===== RESPONSIVE STYLES ===== */
@media screen and (max-width: 768px), screen and (max-height: 768px) {
    /* Hide desktop controls on mobile */
    .desktop-map-controls-btn,
    .desktop-map-controls-drawer {
        display: none !important;
    }
}

@media screen and (min-width: 769px) and (min-height: 769px) {
    /* Hide desktop map controls button initially - only show when dataset is selected */
    .desktop-map-controls-btn {
        display: none;
    }
    
    /* Show desktop map controls button when dataset is active */
    .desktop-map-controls-btn.data-dependent {
        display: flex;
    }
    
    /* Show desktop controls drawer on desktop */
    .desktop-map-controls-drawer {
        display: flex;
    }
}

/* ===== RESET BUTTON ===== */
#reset-container {
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 150; /* RESET_BUTTON - ZIndexManager */
}

.reset-button {
    right: 20px;
    z-index: 150; /* RESET_BUTTON - ZIndexManager */
    white-space: nowrap;
}

/* ===== DOWNLOAD BUTTON STYLES ===== */
.download-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
    font-family: var(--main-font-family);
}


.basic-report-btn {
    background-color: var(--text-muted, #6c757d);
    color: var(--white, #FFFFFF);
    margin-bottom: 10px;
}

.basic-report-btn:hover {
    background-color: var(--primary-dark, #004D42);
}

.advanced-report-btn {
    background-color: var(--primary-light);
    color: var(--white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.advanced-report-btn:hover {
    background-color: var(--white);
    color: var(--primary-light);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

