/* Product Attribute Filter Styles - Enhanced Version */

.product-attribute-filter {
    background: #fff;
    padding: 20px;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    margin-bottom: 30px;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e1e1;
}

.filter-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.clear-filters {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 4px 10px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.clear-filters:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.filter-group {
    margin-bottom: 20px;
    transition: opacity 0.3s ease, max-height 0.3s ease, transform 0.3s ease;
    transform-origin: top;
    overflow: hidden;
}

.filter-group:last-child {
    margin-bottom: 0;
}

/* Animation for hiding entire filter groups */
.filter-group[style*="display: none"] {
    animation: fadeOutGroup 0.2s ease-out;
}

@keyframes fadeOutGroup {
    0% {
        opacity: 1;
        transform: scaleY(1);
    }
    100% {
        opacity: 0;
        transform: scaleY(0);
    }
}

.filter-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #555;
    text-transform: capitalize;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

/* Enhanced animation for individual filter options */
.filter-option[style*="display: none"] {
    animation: slideOut 0.2s ease-out;
}

@keyframes slideOut {
    0% {
        opacity: 1;
        transform: translateX(0);
        max-height: 40px;
    }
    50% {
        opacity: 0.5;
        transform: translateX(-10px);
    }
    100% {
        opacity: 0;
        transform: translateX(-20px);
        max-height: 0;
    }
}

/* Disabled state for unavailable options (alternative approach) */
.filter-option.unavailable {
    opacity: 0.3;
    pointer-events: none;
}

.filter-option.unavailable input[type="checkbox"] {
    cursor: not-allowed;
}

.filter-option.unavailable span {
    text-decoration: line-through;
    color: #999;
}

.filter-option:hover:not(.unavailable) {
    color: #2271b1;
    background: rgba(34, 113, 177, 0.05);
    padding-left: 5px;
}

.filter-option input[type="checkbox"] {
    margin: 0 10px 0 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.filter-option span {
    font-size: 14px;
    line-height: 1.4;
}

/* Loading indicator */
.filter-loading {
    text-align: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    margin-top: 15px;
    font-style: italic;
    color: #666;
    position: relative;
}

.filter-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* No products message */
.no-products-message {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.no-products-message p {
    margin: 0;
    color: #856404;
    font-size: 15px;
}

/* Filter counter badge (optional enhancement) */
.filter-title .filter-count {
    display: inline-block;
    background: #2271b1;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    margin-left: 8px;
    min-width: 18px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-attribute-filter {
        padding: 15px;
    }
    
    .filter-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .clear-filters {
        width: 100%;
    }
    
    .filter-option {
        padding: 8px 0;
    }
}

/* Sidebar Widget Styles */
.widget .product-attribute-filter {
    border: none;
    padding: 0;
}

.widget .filter-header {
    margin-bottom: 15px;
}

/* Elementor Widget Compatibility */
.elementor-widget-container .product-attribute-filter {
    margin-bottom: 20px;
}

/* Hide pagination when filters are active */
body.filters-active .woocommerce-pagination,
body.filters-active .elementor-pagination,
body.filters-active nav.navigation {
    display: none !important;
}

/* Helper text for variation attributes */
.filter-group .variation-note {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin-top: 5px;
    padding: 8px 10px;
    background: #f9f9f9;
    border-radius: 3px;
    border-left: 3px solid #2271b1;
}

/* Animation for filtered products */
.products .product,
ul.products > li,
.elementor-loop-container > .elementor-element,
.elementor-loop-container > article,
.elementor-posts-container > .elementor-post,
.e-loop-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.products .product[style*="display: none"],
ul.products > li[style*="display: none"],
.elementor-loop-container > .elementor-element[style*="display: none"],
.elementor-loop-container > article[style*="display: none"],
.elementor-posts-container > .elementor-post[style*="display: none"],
.e-loop-item[style*="display: none"] {
    opacity: 0;
    transform: scale(0.95);
}

/* Enhanced visual feedback for active filters */
.filter-option input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: #2271b1;
}

/* Visual indicator for filters with active selections */
.filter-group.has-active-filters .filter-title {
    color: #2271b1;
    font-weight: 700;
}

.filter-group.has-active-filters .filter-title::after {
    content: ' ✓';
    color: #27ae60;
    font-size: 14px;
}

/* Smooth transitions for all filter states */
* {
    transition-property: opacity, transform, max-height;
    transition-duration: 0.2s;
    transition-timing-function: ease-out;
}

/* Tooltip for disabled filters (optional) */
.filter-option.unavailable::after {
    content: 'No products with this option';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-left: 10px;
}

.filter-option.unavailable:hover::after {
    opacity: 1;
}
