/**
 * Alvasco Pro - Product Search Widget Styles
 * Version: 4.0.0
 */

/* ============================================
   Container Styles
   ============================================ */
.alvasco-search-widget {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* ============================================
   Form Layout - Horizontal Style
   ============================================ */
.alvasco-search-horizontal .alvasco-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.alvasco-search-horizontal .alvasco-search-field {
    flex: 1;
    min-width: 180px;
}

/* ============================================
   Form Layout - Compact Style
   ============================================ */
.alvasco-search-compact .alvasco-search-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 15px;
}

.alvasco-search-compact .alvasco-search-field {
    flex: 1;
    min-width: 150px;
}

/* ============================================
   Form Layout - Vertical Style
   ============================================ */
.alvasco-search-vertical .alvasco-search-field {
    margin-bottom: 20px;
}

/* ============================================
   Field Styles
   ============================================ */
.alvasco-search-field {
    display: flex;
    flex-direction: column;
}

.alvasco-search-field label {
    font-size: 13px;
    font-weight: 600;
    color: #1e3a5f;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alvasco-search-field input[type="text"],
.alvasco-search-field select {
    width: 100%;
    padding: 12px 15px;
    font-size: 15px;
    color: #1e3a5f;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.alvasco-search-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231e3a5f' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.alvasco-search-field input[type="text"]:focus,
.alvasco-search-field select:focus {
    outline: none;
    border-color: #ff6b35;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.alvasco-search-field input[type="range"] {
    width: 100%;
    margin-top: 10px;
}

/* ============================================
   Smart Dynamic Filters Styling
   ============================================ */

/* Disabled filter options */
.alvasco-search-form select option:disabled {
    color: #999;
    font-style: italic;
}

/* Hidden unavailable options */
.alvasco-search-form select option[style*="display: none"] {
    display: none !important;
}

/* Count badges in options */
.alvasco-search-form select option {
    font-size: 14px;
}

/* Loading state for filters */
.alvasco-search-form.loading select {
    opacity: 0.6;
    pointer-events: none;
}

/* ============================================
   Advanced Filters Section
   ============================================ */
.alvasco-search-advanced {
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
    margin-top: 20px;
}

.alvasco-search-advanced .alvasco-search-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* ============================================
   Action Buttons
   ============================================ */
.alvasco-search-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
}

.alvasco-search-submit,
.alvasco-search-toggle-advanced,
.alvasco-search-reset {
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Search Button (Primary CTA) */
.alvasco-search-submit {
    background: #ff6b35;
    color: #ffffff;
    flex-grow: 1;
}

.alvasco-search-submit:hover {
    background: #32cd32;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(50, 205, 50, 0.3);
}

/* Advanced Toggle Button */
.alvasco-search-toggle-advanced {
    background: transparent;
    color: #1e3a5f;
    border: 2px solid #1e3a5f;
    padding: 13px 30px;
}

.alvasco-search-toggle-advanced:hover {
    background: #1e3a5f;
    color: #ffffff;
}

.alvasco-search-toggle-advanced.active {
    background: #1e3a5f;
    color: #ffffff;
}

/* Reset Button */
.alvasco-search-reset {
    background: transparent;
    color: #6c757d;
    border: 2px solid #dee2e6;
    padding: 13px 25px;
}

.alvasco-search-reset:hover {
    background: #6c757d;
    color: #ffffff;
    border-color: #6c757d;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 992px) {
    .alvasco-search-horizontal .alvasco-search-row,
    .alvasco-search-compact .alvasco-search-row {
        flex-direction: column;
    }
    
    .alvasco-search-field {
        min-width: 100%;
    }
    
    .alvasco-search-actions {
        flex-direction: column;
    }
    
    .alvasco-search-submit,
    .alvasco-search-toggle-advanced,
    .alvasco-search-reset {
        width: 100%;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .alvasco-search-widget {
        padding: 20px;
    }
    
    .alvasco-search-field label {
        font-size: 12px;
    }
    
    .alvasco-search-field input[type="text"],
    .alvasco-search-field select {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .alvasco-search-submit,
    .alvasco-search-toggle-advanced,
    .alvasco-search-reset {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* ============================================
   Loading State
   ============================================ */
.alvasco-search-widget.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.alvasco-search-widget.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ff6b35;
    border-radius: 50%;
    animation: alvasco-spin 1s linear infinite;
}

@keyframes alvasco-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   Filter Count Badges
   ============================================ */
.filter-count {
    display: inline-block;
    margin-left: 5px;
    font-size: 0.85em;
    opacity: 0.6;
    font-weight: normal;
}

/* ============================================
   Elementor Editor Styles
   ============================================ */
.elementor-editor-active .alvasco-search-widget {
    pointer-events: none;
}

.elementor-editor-active .alvasco-search-submit,
.elementor-editor-active .alvasco-search-toggle-advanced,
.elementor-editor-active .alvasco-search-reset {
    pointer-events: none;
}

/* ============================================
   DYNAMIC FILTER LOADING STATE
   ============================================ */
.alvasco-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.alvasco-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top-color: #333;
    border-radius: 50%;
    animation: alvasco-spin 0.6s linear infinite;
}

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

/* Hide filter options with 0 count (fallback) */
.sidebar-filter-option[data-count="0"]:not(:has(input:checked)) {
    display: none !important;
}

/* ============================================
   Parent-Child Category Hierarchy
   ============================================ */

/* Subcategory section */
.alvasco-subcategory-section {
    border-top: 1px solid #e5e5e5;
    margin-top: 0;
    transition: all 0.3s ease;
}

.alvasco-subcategory-section .sidebar-section-title {
    font-size: 14px;
    font-weight: 600;
    padding: 12px 16px;
}

/* Indent subcategory options slightly */
.alvasco-subcategory-section .subcategory-option {
    padding-left: 8px;
}

/* Parent category when checked — bold like Logomark */
.sidebar-filter-option[data-is-parent="true"] input:checked + span {
    font-weight: 700;
}

/* Smooth transitions for subcategory visibility */
.subcategory-option {
    transition: opacity 0.2s ease, max-height 0.3s ease;
}


/* Hide subcategory section by default on page load */
.alvasco-subcategory-section.subcategory-hidden {
    display: none;
}
