/**
 * Map Filters Panel Styles
 */

.map-filters-panel {
    background: rgba(255, 255, 255, 0.98); /* ✅ Slightly opaque for better contrast */
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); /* ✅ Stronger shadow */
    animation: slideDown 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.08); /* ✅ Subtle border */
    position: relative; /* For close button positioning */
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Close Button for Filters Panel */
.filters-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    color: #475569;
    font-size: 16px;
}

.filters-close-btn:hover {
    background: #e2e8f0;
    transform: scale(1.1);
    color: #0f172a;
}

.filters-close-btn:active {
    transform: scale(0.95);
}

[data-theme="dark"] .filters-close-btn {
    background: rgba(51, 65, 85, 0.8);
    color: #cbd5e1;
}

[data-theme="dark"] .filters-close-btn:hover {
    background: rgba(71, 85, 105, 0.9);
    color: #f8fafc;
}

.filter-row {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-item {
    flex: 1;
    min-width: 200px;
}

.filter-label {
    display: block;
    font-size: 15px; /* ✅ Slightly larger */
    font-weight: 700; /* ✅ Extra bold for better readability */
    color: #0f172a; /* ✅ Explicit dark color instead of var */
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8); /* ✅ Subtle white shadow for depth */
}

.filter-label i {
    color: var(--primary-color);
    margin-right: 6px;
}

#radiusValue {
    color: var(--primary-color);
    font-weight: 600;
}

/* Radius Slider */
.radius-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #e0e7ff 0%, var(--primary-color) 100%);
    outline: none;
    -webkit-appearance: none;
}

.radius-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
}

.radius-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.6);
}

.radius-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
    transition: all 0.2s ease;
}

.radius-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.6);
}

/* Toggle Switch */
.filter-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.filter-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 24px;
    background: #e5e7eb;
    border-radius: 24px;
    transition: background 0.3s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.filter-toggle input[type="checkbox"]:checked + .toggle-slider {
    background: var(--primary-color);
}

.filter-toggle input[type="checkbox"]:checked + .toggle-slider::after {
    transform: translateX(24px);
}

.toggle-label {
    font-size: 15px; /* ✅ Slightly larger */
    font-weight: 700; /* ✅ Extra bold */
    color: #0f172a; /* ✅ Explicit dark color */
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8); /* ✅ Better readability */
}

.toggle-label i {
    color: var(--primary-color);
    margin-right: 4px;
}

/* Filter Button */
.btn-filter {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px; /* ✅ Larger padding */
    font-size: 15px; /* ✅ Larger font */
    font-weight: 600; /* ✅ Bolder */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3); /* ✅ Stronger shadow */
}

.btn-filter:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-filter:active {
    transform: translateY(0);
}

.btn-filter i {
    font-size: 14px;
}

/* Filter Stats */
.filter-stats {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    font-size: 15px; /* ✅ Larger */
    font-weight: 700; /* ✅ Extra bold */
    color: #0f172a; /* ✅ Darker color for better contrast */
    text-align: center;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

#filteredUsersCount {
    font-weight: 500;
    color: var(--primary-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .map-filters-panel {
        padding: 16px;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .filter-item {
        width: 100%;
        min-width: 0;
    }
    
    .btn-filter {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* Loading State */
.btn-filter.loading {
    opacity: 0.7;
    pointer-events: none;
}

.btn-filter.loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== DARK THEME SUPPORT ===== */
[data-theme="dark"] .map-filters-panel {
    background: rgba(15, 23, 42, 0.95); /* ✅ Slightly transparent dark background */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1); /* ✅ Subtle white border */
}

[data-theme="dark"] .filter-label {
    color: #f8fafc; /* ✅ Bright white */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); /* ✅ Dark shadow for depth */
}

[data-theme="dark"] .toggle-label {
    color: #f8fafc; /* ✅ Bright white */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .filter-stats {
    color: #f8fafc; /* ✅ Bright white instead of secondary */
    border-top-color: var(--border-color);
    font-weight: 600; /* ✅ Extra bold for dark theme */
}

[data-theme="dark"] .toggle-slider {
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.1); /* ✅ Border for visibility */
}

[data-theme="dark"] #radiusValue {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
