/**
 * Evonomy Advanced Product Filters - Main Stylesheet
 * Professional, modern filtering interface with responsive design
 */

/* ============================================
   CSS Variables for Easy Customization
   ============================================ */
:root {
    --eaf-primary-color: #0073aa;
    --eaf-primary-hover: #005a87;
    --eaf-text-color: #333333;
    --eaf-text-light: #666666;
    --eaf-border-color: #e0e0e0;
    --eaf-bg-color: #ffffff;
    --eaf-bg-hover: #f5f5f5;
    --eaf-transition: all 0.3s ease;
    --eaf-radius: 6px;
    --eaf-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Filter Wrapper & Layout
   ============================================ */
.eaf-filters-wrapper {
    background: var(--eaf-bg-color);
    border-radius: var(--eaf-radius);
    padding: 20px;
    box-shadow: var(--eaf-shadow);
}

.eaf-layout-sidebar {
    max-width: 320px;
}

.eaf-layout-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 100%;
}

.eaf-layout-horizontal .eaf-filter-section {
    flex: 1 1 200px;
    min-width: 200px;
}

/* ============================================
   Search Section
   ============================================ */
.eaf-search-section {
    margin-bottom: 25px;
}

.eaf-search-box {
    position: relative;
    display: flex;
    align-items: center;
    border: 2px solid var(--eaf-border-color);
    border-radius: var(--eaf-radius);
    overflow: hidden;
    transition: var(--eaf-transition);
}

.eaf-search-box:focus-within {
    border-color: var(--eaf-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.eaf-search-input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    outline: none;
    font-size: 15px;
    background: transparent;
}

.eaf-search-btn {
    padding: 12px 18px;
    background: var(--eaf-primary-color);
    border: none;
    color: white;
    cursor: pointer;
    transition: var(--eaf-transition);
}

.eaf-search-btn:hover {
    background: var(--eaf-primary-hover);
}

.eaf-search-btn i {
    font-size: 16px;
}

/* ============================================
   Active Filters Display
   ============================================ */
.eaf-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.eaf-active-filters:empty {
    display: none;
}

.eaf-active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--eaf-primary-color);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: var(--eaf-transition);
}

.eaf-active-filter-tag:hover {
    background: var(--eaf-primary-hover);
}

.eaf-active-filter-remove {
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.eaf-active-filter-remove:hover {
    opacity: 1;
}

/* ============================================
   Filter Sections
   ============================================ */
.eaf-filter-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--eaf-border-color);
}

.eaf-filter-section:last-of-type {
    border-bottom: none;
}

.eaf-filter-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 15px;
    padding: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--eaf-text-color);
    cursor: pointer;
    user-select: none;
}

.eaf-toggle-icon {
    width: 20px;
    height: 20px;
    position: relative;
    transition: transform 0.3s ease;
}

.eaf-toggle-icon::before,
.eaf-toggle-icon::after {
    content: '';
    position: absolute;
    background: var(--eaf-text-light);
    transition: var(--eaf-transition);
}

.eaf-toggle-icon::before {
    width: 12px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.eaf-toggle-icon::after {
    width: 2px;
    height: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.eaf-filter-section.collapsed .eaf-toggle-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.eaf-filter-section.collapsed .eaf-filter-content {
    display: none;
}

/* ============================================
   Checkbox Lists
   ============================================ */
.eaf-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.eaf-checkbox-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: var(--eaf-transition);
    position: relative;
}

.eaf-checkbox-item:hover {
    background: var(--eaf-bg-hover);
}

.eaf-checkbox-item input[type="checkbox"],
.eaf-checkbox-item input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0 10px 0 0;
    cursor: pointer;
    accent-color: var(--eaf-primary-color);
}

.eaf-checkbox-label {
    flex: 1;
    font-size: 14px;
    color: var(--eaf-text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.eaf-count {
    font-size: 12px;
    color: var(--eaf-text-light);
    margin-left: 8px;
}

/* Subcategories */
.eaf-subcategories {
    margin-left: 28px;
    margin-top: 8px;
    padding-left: 15px;
    border-left: 2px solid var(--eaf-border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ============================================
   Price Slider
   ============================================ */
.eaf-price-slider-wrapper {
    padding: 10px 5px;
}

.eaf-price-slider {
    height: 6px;
    background: var(--eaf-border-color);
    border-radius: 3px;
    position: relative;
    margin-bottom: 20px;
}

.eaf-price-slider .ui-slider-range {
    background: var(--eaf-primary-color);
    border-radius: 3px;
}

.eaf-price-slider .ui-slider-handle {
    width: 18px;
    height: 18px;
    background: white;
    border: 3px solid var(--eaf-primary-color);
    border-radius: 50%;
    cursor: pointer;
    top: 50%;
    transform: translateY(-50%);
    transition: var(--eaf-transition);
    outline: none;
}

.eaf-price-slider .ui-slider-handle:hover,
.eaf-price-slider .ui-slider-handle:focus {
    box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.2);
}

.eaf-price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.eaf-price-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    border: 1px solid var(--eaf-border-color);
    border-radius: var(--eaf-radius);
    padding: 8px 12px;
    background: white;
    transition: var(--eaf-transition);
}

.eaf-price-input-group:focus-within {
    border-color: var(--eaf-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.eaf-currency {
    font-size: 14px;
    color: var(--eaf-text-light);
    margin-right: 5px;
}

.eaf-price-min,
.eaf-price-max {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    width: 100%;
    min-width: 0;
}

.eaf-price-separator {
    color: var(--eaf-text-light);
    font-weight: 500;
}

/* ============================================
   Rating Filter
   ============================================ */
.eaf-rating-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.eaf-rating-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: var(--eaf-transition);
}

.eaf-rating-item:hover {
    background: var(--eaf-bg-hover);
}

.eaf-rating-item input[type="radio"] {
    margin-right: 10px;
    accent-color: var(--eaf-primary-color);
}

.eaf-rating-stars {
    color: #ffa500;
    font-size: 16px;
    margin-right: 8px;
    letter-spacing: 2px;
}

.eaf-rating-text {
    font-size: 14px;
    color: var(--eaf-text-color);
}

/* ============================================
   Special Checkboxes (Sale, Stock)
   ============================================ */
.eaf-special-checkbox {
    padding: 12px;
    border: 2px solid var(--eaf-border-color);
    border-radius: var(--eaf-radius);
    margin-bottom: 10px;
}

.eaf-special-checkbox:hover {
    border-color: var(--eaf-primary-color);
}

.eaf-sale-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e74c3c;
    color: white;
    font-size: 11px;
    font-weight: bold;
    border-radius: 3px;
    margin-right: 8px;
}

/* ============================================
   Filter Actions
   ============================================ */
.eaf-filter-actions {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--eaf-border-color);
}

.eaf-clear-all {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    border: 2px solid var(--eaf-border-color);
    color: var(--eaf-text-color);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--eaf-radius);
    cursor: pointer;
    transition: var(--eaf-transition);
}

.eaf-clear-all:hover {
    background: var(--eaf-primary-color);
    border-color: var(--eaf-primary-color);
    color: white;
}

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

.eaf-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid var(--eaf-border-color);
    border-top-color: var(--eaf-primary-color);
    border-radius: 50%;
    animation: eaf-spin 0.8s linear infinite;
}

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

/* ============================================
   Product Results Container
   ============================================ */
.eaf-products-container {
    position: relative;
    min-height: 300px;
}

.eaf-products-container.eaf-loading {
    opacity: 0.5;
}

.eaf-no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--eaf-text-light);
}

.eaf-results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--eaf-bg-hover);
    border-radius: var(--eaf-radius);
}

.eaf-results-count {
    font-size: 14px;
    color: var(--eaf-text-color);
    font-weight: 500;
}

.eaf-sort-select {
    padding: 8px 12px;
    border: 1px solid var(--eaf-border-color);
    border-radius: var(--eaf-radius);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: var(--eaf-transition);
}

.eaf-sort-select:focus {
    border-color: var(--eaf-primary-color);
}

/* ============================================
   Pagination
   ============================================ */
.eaf-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding: 20px 0;
}

.eaf-pagination a,
.eaf-pagination span {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid var(--eaf-border-color);
    border-radius: var(--eaf-radius);
    color: var(--eaf-text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--eaf-transition);
}

.eaf-pagination a:hover {
    background: var(--eaf-primary-color);
    border-color: var(--eaf-primary-color);
    color: white;
}

.eaf-pagination .current {
    background: var(--eaf-primary-color);
    border-color: var(--eaf-primary-color);
    color: white;
}

/* ============================================
   Style Variations
   ============================================ */

/* Minimal Style */
.eaf-style-minimal .eaf-filters-wrapper {
    box-shadow: none;
    border: 1px solid var(--eaf-border-color);
}

.eaf-style-minimal .eaf-filter-section {
    border-bottom: none;
    padding-bottom: 15px;
}

.eaf-style-minimal .eaf-checkbox-item:hover {
    background: transparent;
    padding-left: 12px;
}

/* Modern Style */
.eaf-style-modern {
    --eaf-radius: 12px;
}

.eaf-style-modern .eaf-filter-section {
    background: var(--eaf-bg-hover);
    padding: 15px;
    border-radius: var(--eaf-radius);
    margin-bottom: 15px;
    border: none;
}

.eaf-style-modern .eaf-checkbox-item {
    border-radius: 8px;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
    .eaf-layout-horizontal {
        flex-direction: column;
    }
    
    .eaf-layout-horizontal .eaf-filter-section {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .eaf-filters-wrapper {
        padding: 15px;
    }
    
    .eaf-filter-title {
        font-size: 15px;
    }
    
    .eaf-checkbox-label {
        font-size: 13px;
    }
    
    .eaf-price-inputs {
        flex-direction: column;
        width: 100%;
    }
    
    .eaf-price-input-group {
        width: 100%;
    }
    
    .eaf-results-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* ============================================
   Accessibility
   ============================================ */
.eaf-checkbox-item:focus-within,
.eaf-rating-item:focus-within {
    outline: 2px solid var(--eaf-primary-color);
    outline-offset: 2px;
}

/* Screen reader only content */
.eaf-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
