/**
 * Advanced Filter Widget Styles
 * Additional styles for different widget configurations
 */

/* Widget Admin Form Styles */
.lebasino-widget-admin-form .checkbox {
    margin-left: 5px;
}

.lebasino-widget-admin-form p {
    margin-bottom: 10px;
}

.lebasino-widget-admin-form hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 15px 0;
}

.lebasino-widget-admin-form strong {
    color: #333;
    font-weight: 600;
}

.lebasino-advanced-filter-widget.collapsed-sections .filter-header .toggle-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.lebasino-advanced-filter-widget.collapsed-sections .filter-header .toggle-icon.rotated {
    transform: rotate(90deg);
}
/* Default state - content is visible */
.lebasino-advanced-filter-widget .filter-content.expanded {
    display: block;
    max-height: none;
    opacity: 1;
    padding: 15px;
    overflow:visible;
}

/* Collapsed state - content is hidden */
.lebasino-advanced-filter-widget .filter-content.collapsed {
    display: none;
    max-height: 0;
    opacity: 0;
    padding: 0 15px;
}

/* Non-collapsed mode - always show content */
.lebasino-advanced-filter-widget:not(.collapsed-sections) .filter-content {
    display: block !important;
    max-height: none !important;
    opacity: 1 !important;
    padding: 15px !important;
    padding-top:0 !important;
}

/* Override for non-collapsed mode headers */
.lebasino-advanced-filter-widget:not(.collapsed-sections) .filter-header {
    cursor: default !important;
}

/* Auto Apply Mode - Hide action buttons */
.lebasino-advanced-filter-widget.auto-apply .filter-actions {
    display: none !important;
}

/* Auto Apply Mode - Add visual feedback */
.lebasino-advanced-filter-widget.auto-apply .filter-option.option-changed,
.lebasino-advanced-filter-widget.auto-apply .quick-filter-item.option-changed,
.lebasino-advanced-filter-widget.auto-apply .attribute-checkbox.option-changed,
.lebasino-advanced-filter-widget.auto-apply .category-item.option-changed {
    background: rgba(74, 144, 226, 0.1);
    border-color: #4a90e2;
    transition: all 0.3s ease;
}

/* AJAX Mode Loading States */
.lebasino-advanced-filter-widget.ajax-mode.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.lebasino-advanced-filter-widget.ajax-mode.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.lebasino-advanced-filter-widget.ajax-mode.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Product Count Styles */
.filter-count,
.term-count,
.category-count {
    color: #999;
    font-size: 12px;
    margin-right: 5px;
}

.lebasino-advanced-filter-widget .quick-filter-item .filter-count {
    margin-right: 0;
    margin-left: 5px;
}


/* Responsive Adjustments */
@media (max-width: 768px) {
    .lebasino-advanced-filter-widget .filter-header {
        padding: 8px 12px;
    }
    
    .lebasino-advanced-filter-widget .filter-content {
        padding: 12px;
    }
    
    .filter-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-apply-filters,
    .btn-reset-filters {
        width: 100%;
        text-align: center;
    }

    /* Hide tooltips on mobile */
    .color-swatch::before,
    .color-swatch::after,
    .size-button::before,
    .size-button::after {
        display: none !important;
    }
}

/* Beautiful Tooltips for Color and Size Filters */
.color-swatch,
.size-button {
    position: relative;
    cursor: pointer;
}

/* Tooltip Base Styles */
.color-swatch::before,
.color-swatch::after,
.size-button::before,
.size-button::after {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

/* Tooltip Arrow */
.color-swatch::before,
.size-button::before {
    content: '';
    border: 6px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.9);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Tooltip Content */
.color-swatch::after,
.size-button::after {
    content: attr(data-tooltip);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
}

/* Show tooltip on hover */
.color-swatch:hover::before,
.color-swatch:hover::after,
.size-button:hover::before,
.size-button:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}



/* Hide color name visually but keep for screen readers */
.color-swatch .color-name.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Special styling for size buttons */
.size-button {
    margin: 2px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

/* Touch device tooltip support */
.color-swatch.touch-tooltip-active::before,
.color-swatch.touch-tooltip-active::after,
.size-button.touch-tooltip-active::before,
.size-button.touch-tooltip-active::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

/* Enhanced hover state */
.color-swatch.tooltip-hover,
.size-button.tooltip-hover {
    z-index: 1001;
}

/* Accessibility improvements */
.color-swatch:focus-within::before,
.color-swatch:focus-within::after,
.size-button:focus-within::before,
.size-button:focus-within::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

/* Better contrast for accessibility */
@media (prefers-contrast: high) {
    .color-swatch::after,
    .size-button::after {
        background: #000;
        border: 1px solid #fff;
    }
    
    .color-swatch::before,
    .size-button::before {
        border-bottom-color: #000;
    }
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .color-swatch::before,
    .color-swatch::after,
    .size-button::before,
    .size-button::after {
        transition: none;
    }
    
    .color-swatch:hover::after,
    .size-button:hover::after {
        animation: none;
    }
    
    .color-swatch .color-preview,
    .size-button {
        transition: none;
    }
}

/* Visual Feedback for Changes */
.filter-option.option-changed,
.quick-filter-item.option-changed,
.attribute-checkbox.option-changed,
.category-item.option-changed {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

/* Better Focus States */
.lebasino-advanced-filter-widget input[type="checkbox"]:focus + .checkmark,
.lebasino-advanced-filter-widget input[type="checkbox"]:focus + .quick-filter-content,
.lebasino-advanced-filter-widget input[type="checkbox"]:focus + span {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Apply Button Highlighting */
.btn-apply-filters.highlight-apply {
    background: #4a90e2 !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
    transform: scale(1.05);
    transition: all 0.3s ease;
}

/* Loading Animation for Filter Changes */
.lebasino-advanced-filter-widget.applying-filter {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.lebasino-advanced-filter-widget.applying-filter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    border-radius: 8px;
}

.lebasino-advanced-filter-widget.applying-filter::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}
