/* WC Product Filter Pro - Professionelles Design */

/* Reset & Base */
.wc-filter-pro-wrapper {
    font-family: 'Archivo', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #333;
    line-height: 1.6;
}

.wc-filter-pro-wrapper * {
    box-sizing: border-box;
}

/* Desktop Filter Container */
.wc-filter-pro-desktop {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 24px;
}

/* Filter Header */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #fff);
    border-bottom: 1px solid #e0e0e0;
}

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

.filter-header h3:after {
    content: '';
    display: block;
    width: 30px;
    height: 3px;
    background: linear-gradient(to right, #d12500, #ff8c00);
    margin-top: 6px;
    border-radius: 2px;
}

.filter-results-count {
    font-size: 14px;
    color: #666;
    font-weight: normal;
}

/* Überschreibe Zählungen */
.filter-results-count,
.item-count,
.color-count {
    display: inline !important;
    background: none !important;
    border: none !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Filter Sections */
.filter-section {
    border-bottom: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.filter-section:last-child {
    border-bottom: none;
}

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

.filter-title {
    margin: 0;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    position: relative;
}

.filter-title:hover {
    background: #f0f0f0;
}

.toggle-icon {
    display: inline-block;
    width: 20px;
    text-align: center;
    font-size: 18px;
    line-height: 1;
    color: #666;
    transition: transform 0.3s ease;
    margin-right: 10px;
}

.active-filter-indicator {
    margin-left: auto;
    color: #d12500;
    font-size: 12px;
}

.filter-content {
    padding: 16px 20px;
    background: #fff;
}

/* Price Slider */
.price-slider-container {
    padding: 10px 0;
}

#price-slider,
#mobile-price-slider {
    margin: 20px 10px;
}

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

.price-inputs input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

.price-inputs input:focus {
    border-color: #d12500;
    outline: none;
    box-shadow: 0 0 0 2px rgba(209, 37, 0, 0.1);
}

.price-separator {
    color: #666;
    font-weight: 500;
}

.price-currency {
    font-weight: 500;
    color: #666;
}

/* jQuery UI Slider Customization */
.ui-slider {
    background: #e0e0e0;
    border: none;
    height: 6px;
    border-radius: 3px;
}

.ui-slider-range {
    background: linear-gradient(to right, #d12500, #ff8c00);
    border-radius: 3px;
}

.ui-slider-handle {
    width: 18px;
    height: 18px;
    background: #fff;
    border: 2px solid #d12500;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    top: -6px;
}

.ui-slider-handle:active {
    cursor: grabbing;
    transform: scale(1.1);
}

/* Price Quick Links */
.price-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.price-link {
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #555;
    font-size: 13px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.price-link:hover {
    background: #fff9f7;
    border-color: #d12500;
    color: #d12500;
}

.price-link.active {
    background: #d12500;
    color: #fff;
    border-color: #d12500;
}

/* Checkbox Items */
.filter-checkbox-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-checkbox-item:hover {
    color: #d12500;
}

.filter-checkbox-item input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.label-text {
    flex: 1;
}

.item-count {
    font-size: 13px;
    color: #999 !important;
    margin-left: 10px;
}

.filter-checkbox-item:hover .item-count {
    color: #d12500 !important;
}

/* Color Grid */
.color-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 4px 0;
}

.color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
    background: #fff;
    border: 1px solid transparent;
    cursor: pointer;
}

.color-item:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.color-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.color-item input[type="checkbox"]:checked + .color-swatch {
    transform: scale(1.1);
    border-color: #d12500;
    box-shadow: 0 0 0 3px rgba(209, 37, 0, 0.2);
}

.color-item input[type="checkbox"]:checked ~ .color-name {
    color: #d12500;
    font-weight: 600;
}

.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.color-name {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
}

.color-count {
    font-size: 11px;
    color: #999 !important;
    font-weight: 400;
}

/* Active Filters */
.active-filters-container {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.active-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.active-filters-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.clear-all-filters {
    background: #fff;
    border: 1px solid #ddd;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

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

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid #d12500;
    color: #d12500;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 13px;
}

.active-filter-tag .remove-filter {
    background: none;
    border: none;
    color: #d12500;
    font-size: 18px;
    line-height: 1;
    margin-left: 5px;
    cursor: pointer;
    padding: 0 2px;
}

.active-filter-tag .remove-filter:hover {
    color: #a01d00;
}

/* Loading Overlay */
.filter-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.wc-filter-pro-wrapper.loading .filter-loading-overlay {
    display: flex;
}

.filter-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #d12500;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Mobile Styles */
.wc-filter-mobile-trigger {
    display: none;
}

/* Mobile Popup - KORRIGIERT */
.wc-filter-mobile-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
}

body.filter-popup-open .wc-filter-mobile-popup {
    display: block !important;
}

.popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.popup-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    z-index: 99999;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #fff);
    border-bottom: 1px solid #e0e0e0;
}

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

.popup-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

.popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.popup-footer {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.reset-filters-mobile {
    width: 100%;
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-filters-mobile:hover {
    background: #f8f9fa;
    color: #333;
}

/* NEUE MOBILE FILTER BUTTON STYLES - GLASS EFFECT WIE MWST TOGGLE */
@media (max-width: 991px) {
    .wc-filter-mobile-trigger {
        display: flex !important;
        position: fixed;
        top: 20px; /* Gleiche Höhe wie MwSt Toggle */
        left: 20px; /* Links positioniert */
        background: rgba(20, 20, 20, 0.7) !important; /* Glass Effect */
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        color: rgba(255, 255, 255, 0.9) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 30px !important;
        padding: 6px 12px !important;
        font-size: 12px !important;
        font-weight: 500 !important;
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 0 80px rgba(0, 0, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1),
            inset 0 -1px 0 rgba(0, 0, 0, 0.3) !important;
        z-index: 9999;
        align-items: center;
        gap: 8px;
        transition: all 0.5s ease-out;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-60px); /* Von oben einfliegen wie MwSt Toggle */
        line-height: 1;
        height: auto !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }
    
    /* Zeige Button mit Verzögerung */
    .wc-filter-mobile-trigger.show-with-mwst {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
        animation: slideInTop 0.5s ease-out;
    }
    
    /* Verstecke wenn Header sichtbar */
    .wc-filter-mobile-trigger.header-visible {
        opacity: 0;
        transform: translateY(-60px);
        pointer-events: none;
    }
    
    /* Hover Effect */
    .wc-filter-mobile-trigger:hover {
        background: rgba(30, 30, 30, 0.8) !important;
        box-shadow: 
            0 12px 40px rgba(0, 0, 0, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.15),
            inset 0 -1px 0 rgba(0, 0, 0, 0.4) !important;
        transform: translateY(-1px);
    }
    
    .wc-filter-mobile-trigger svg {
        width: 12px !important;
        height: 12px !important;
        color: rgba(255, 255, 255, 0.9) !important;
    }
    
    .filter-count {
        background: rgba(255, 255, 255, 0.9) !important;
        color: rgba(20, 20, 20, 0.9) !important;
        min-width: 18px !important;
        height: 18px !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 9px;
        font-size: 11px !important;
        font-weight: 600;
        padding: 0 5px;
        margin-left: 4px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
}

/* Animation von oben */
@keyframes slideInTop {
    from {
        opacity: 0;
        transform: translateY(-60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Kleinere Screens */
@media (max-width: 480px) {
    .wc-filter-mobile-trigger {
        top: 15px !important;
        left: 15px !important;
        padding: 5px 10px !important;
        font-size: 11px !important;
        gap: 6px !important;
    }
    
    .wc-filter-mobile-trigger svg {
        width: 11px !important;
        height: 11px !important;
    }
    
    .filter-count {
        min-width: 16px !important;
        height: 16px !important;
        font-size: 10px !important;
        padding: 0 4px;
    }
}

/* Farbintegration mit Color Toggle System */
.wc-filter-mobile-trigger[data-theme-color] {
    transition: all 0.3s ease;
}

/* Standard Orange */
.wc-filter-mobile-trigger[data-theme-color] .filter-count {
    background: #FF6B35 !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Dynamische Farben vom Color Toggle */
.wc-filter-mobile-trigger[data-theme-color="gelb"] .filter-count {
    background: #FEF422 !important;
    color: #D38802 !important;
}

.wc-filter-mobile-trigger[data-theme-color="blau"] .filter-count {
    background: #22FEF5 !important;
    color: #0243D3 !important;
}

.wc-filter-mobile-trigger[data-theme-color="tuerkis"] .filter-count {
    background: #02D3A5 !important;
    color: #045F81 !important;
}

.wc-filter-mobile-trigger[data-theme-color="pink"] .filter-count {
    background: #E447FC !important;
    color: #640429 !important;
}

.wc-filter-mobile-trigger[data-theme-color="gruen"] .filter-count {
    background: #C6FF27 !important;
    color: #0A6802 !important;
}

.wc-filter-mobile-trigger[data-theme-color="schwarz"] .filter-count {
    background: #666666 !important;
    color: #000000 !important;
}

/* Responsive */
@media (max-width: 991px) {
    .wc-filter-pro-desktop {
        display: none;
    }
    
    .color-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 480px) {
    .color-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .popup-content {
        max-height: 90vh;
    }
}

/* Sidebar Anpassungen */
.elementor-widget-container .wc-filter-pro-wrapper {
    max-width: 100%;
}

.elementor-widget-container .color-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.elementor-widget-container .color-swatch {
    width: 32px;
    height: 32px;
}

.elementor-widget-container .filter-content {
    padding: 12px 16px;
}

/* Category Navigation */
.back-to-main-categories {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-to-main-categories:hover {
    background: #e0e0e0;
}

.subcategory-list {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Hidden items */
.filter-checkbox-item[style*="display: none"] {
    display: none !important;
}

/* No Products Message */
#no-products-message {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    color: #666;
    font-size: 16px;
    margin: 20px 0;
}

/* Mobile Popup Filter Sichtbarkeit FIX */
@media (max-width: 991px) {
    /* Original Desktop Filter verstecken */
    .wc-filter-pro-wrapper > .wc-filter-pro-desktop {
        display: none !important;
    }
    
    /* ABER: Geklonte Filter im Popup ANZEIGEN */
    .wc-filter-mobile-popup .wc-filter-pro-desktop {
        display: block !important;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        margin: 0;
    }
    
    .wc-filter-mobile-popup .filter-section {
        display: block !important;
    }
    
    /* Stelle sicher dass alles im Popup sichtbar ist */
    .wc-filter-mobile-popup .mobile-clone * {
        visibility: visible !important;
    }
    
    /* Anpassungen für Mobile */
    .wc-filter-mobile-popup .filter-header {
        display: none; /* Header im Popup nicht nötig */
    }
    
    .wc-filter-mobile-popup .filter-section {
        background: #fff;
        margin-bottom: 10px;
        border-radius: 8px;
        overflow: hidden;
    }
    
    /* Stelle sicher dass geklonte Filter sichtbar sind */
    .wc-filter-mobile-popup .mobile-clone .filter-section {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Filter Content - respektiere collapsed/active Status */
    .wc-filter-mobile-popup .filter-section.collapsed .filter-content {
        display: none !important;
    }
    
    .wc-filter-mobile-popup .filter-section.active .filter-content {
        display: block !important;
    }
    
    /* Filter Title ist immer klickbar */
    .wc-filter-mobile-popup .filter-title {
        cursor: pointer !important;
        user-select: none;
    }
    
    /* Subcategory Navigation */
    .wc-filter-mobile-popup .subcategory-list {
        display: none;
    }
    
    .wc-filter-mobile-popup .subcategory-list.active {
        display: block;
    }
    
    /* Mobile Price Slider Styles */
    .wc-filter-mobile-popup .ui-slider {
        background: #e0e0e0;
        border: none;
        height: 6px;
        border-radius: 3px;
    }
    
    .wc-filter-mobile-popup .ui-slider-range {
        background: linear-gradient(to right, #d12500, #ff8c00);
        border-radius: 3px;
    }
    
    .wc-filter-mobile-popup .ui-slider-handle {
        width: 18px;
        height: 18px;
        background: #fff;
        border: 2px solid #d12500;
        border-radius: 50%;
        cursor: grab;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        top: -6px;
        touch-action: none;
    }
    
    /* Color Grid im Mobile Popup */
    .wc-filter-mobile-popup .color-grid {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    /* Kleinere Color Swatches auf Mobile */
    .wc-filter-mobile-popup .color-swatch {
        width: 30px;
        height: 30px;
    }
    
    .wc-filter-mobile-popup .color-name {
        font-size: 11px;
    }
    
    /* Mobile Clone spezifische Styles */
    .mobile-clone .filter-section {
        border-bottom: 1px solid #e0e0e0;
        margin-bottom: 0;
    }
    
    .mobile-clone .filter-content {
        max-height: 300px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Scrollbar Styling */
    .mobile-clone .filter-content::-webkit-scrollbar {
        width: 6px;
    }
    
    .mobile-clone .filter-content::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    .mobile-clone .filter-content::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }
    
    /* Zeige alle Filter-Inhalte standardmäßig */
    .wc-filter-mobile-popup .filter-checkbox-item,
    .wc-filter-mobile-popup .color-item,
    .wc-filter-mobile-popup .price-slider-container,
    .wc-filter-mobile-popup .price-quick-links {
        display: flex !important;
        visibility: visible !important;
    }
    
    /* Color Grid anpassen */
    .wc-filter-mobile-popup .color-grid {
        display: grid !important;
    }
}

/* Z-Index Fixes für Elementor */
.elementor-widget .wc-filter-mobile-trigger {
    z-index: 9999 !important;
}

.elementor-widget .wc-filter-mobile-popup {
    z-index: 99999 !important;
}


/* Loading States */
body.wcfilter-loading {
    overflow-x: hidden;
}

body.wcfilter-loading::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #FCAE00, #E30613);
    z-index: 99999;
    animation: loadingBar 1.5s ease-in-out infinite;
}

@keyframes loadingBar {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Prevent layout shift */
.wc-products-grid {
    min-height: 400px;
}

/* Smooth transitions */
.product-card {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Koordination mit anderen Toggles */
.wc-filter-mobile-trigger.toggle-wrapper-shared {
    /* Gemeinsame Klasse für synchronisierte Toggles */
}

/* Stelle sicher dass der Filter-Button nicht mit MwSt Toggle überlappt */
@media (max-width: 768px) and (min-width: 480px) {
    /* Wenn MwSt Toggle rechts ist, bleibt Filter links */
    .mwst-toggle-wrapper.show-mobile ~ .wc-filter-mobile-trigger,
    body:has(.mwst-toggle-wrapper.show-mobile) .wc-filter-mobile-trigger {
        /* Position bleibt links */
    }
}

/* Sehr kleine Screens - beide Buttons nebeneinander */
@media (max-width: 380px) {
    .wc-filter-mobile-trigger {
        left: 10px !important;
    }
    
    /* Falls beide sichtbar sind, MwSt Toggle weiter rechts */
    .wc-filter-mobile-trigger.show-with-mwst ~ .mwst-toggle-wrapper,
    body:has(.wc-filter-mobile-trigger.show-with-mwst) .mwst-toggle-wrapper {
        right: auto !important;
        left: 85px !important; /* Platz für Filter Button */
    }
}