/* * Ratna Gems Custom Filter Widget Styling
 * VERSION: FINAL - Optimized for Layout & Branding
 */

/* --- Brand Color Palette --- */
:root {
    --brand-primary: #004E81; /* Your Brand Blue */
    --brand-success: #2E7D32; /* Your Brand Green */
    --brand-secondary: #f0f0f0;
    --text-color: #333;
    --border-color: #ddd;
    --disabled-color: #9e9e9e;
}

/* --- Main Widget Container --- */
.ratna_gems_filter_widget {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: #fff; /* Clean white background */
}

/* --- FIX: Hide the redundant widget title inside the Astra sidebar --- */
.ast-side-cart-wrap .widget-title {
    display: none;
}

/* --- Filter Group Styling (More Compact) --- */
.filter-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}
.filter-group:last-of-type {
    border-bottom: none;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
.filter-group h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1em;
    font-weight: 600;
}

/* --- Origin Filter List --- */
.origin-list {
    list-style: none; margin: 0; padding: 0;
    max-height: 150px; /* Reduced height for compactness */
    overflow-y: auto;
}
.origin-list li { margin-bottom: 8px; }
.origin-list li label { display: flex; align-items: center; cursor: pointer; font-weight: normal; }
.origin-list input[type="checkbox"] { margin-right: 10px; height: 16px; width: 16px; }

/* --- jQuery UI Slider Styling --- */
.filter-slider { margin: 20px 5px 10px; }
.slider-values { display: flex; justify-content: space-between; font-size: 0.9em; color: #555; }

.ui-slider {
    position: relative; text-align: left;
    background: var(--brand-secondary); border-radius: 5px;
    height: 6px; border: 1px solid var(--border-color);
}
.ui-slider .ui-slider-handle {
    position: absolute; z-index: 2;
    width: 20px; height: 20px;
    cursor: pointer; background: #ffffff;
    border: 2px solid var(--brand-primary);
    border-radius: 50%; top: -8px; margin-left: -10px;
    outline: none; transition: box-shadow 0.2s;
}
.ui-slider .ui-slider-handle:hover, .ui-slider .ui-slider-handle:focus {
    box-shadow: 0 0 0 4px rgba(0, 78, 129, 0.2);
}
.ui-slider .ui-slider-range {
    position: absolute; z-index: 1;
    display: block; border: 0; 
    background: var(--brand-primary);
    border-radius: 5px;
}

/* --- Buttons & Loading States --- */
.filter-buttons { display: flex; gap: 10px; margin-top: 15px; }
.filter-buttons .button {
    flex: 1; display: flex; justify-content: center; align-items: center;
    padding: 10px; text-decoration: none; text-align: center;
    border: 1px solid transparent; border-radius: 4px;
    transition: background-color 0.2s, opacity 0.2s;
}
#apply-filters-button {
    background-color: var(--brand-success) !important;
    color: #fff !important;
}
#apply-filters-button:hover:not(:disabled) { background-color: #1b5e20 !important; }
#apply-filters-button:disabled { 
    background-color: var(--disabled-color) !important; 
    cursor: not-allowed; 
    opacity: 0.7; 
}
#apply-filters-button.loading .result-count,
.result-count .loading-spinner {
    display: inline-block;
    width: 1em; height: 1em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%; border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    text-indent: -9999px; /* Hide the number while loading */
}
.reset-button {
    background-color: #a4a4a4 !important;
    color: #fff !important;
}
.reset-button:hover { background-color: #8c8c8c !important; }

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

/* --- AJAX Loading Overlay for Product Grid --- */
.ast-woocommerce-container.loading-active, .woocommerce-shop-container.loading-active {
    position: relative;
    opacity: 0.5;
    transition: opacity 0.3s;
}

/* --- Mobile-First Adjustments for Larger Touch Targets --- */
@media (max-width: 768px) {
    .ui-slider .ui-slider-handle {
        width: 28px;
        height: 28px;
        top: -12px;
        margin-left: -14px;
    }
}
