/**
 * Product Filters - Styles
 * 
 * Desktop and mobile responsive styles for product filtering system
 */

/* ==========================================================================
   Filter Panel - Desktop
   ========================================================================== */

.product-filters {
    position: relative;
}

.product-filters__mobile-toggle {
    display: none; /* Hidden on desktop */
}

.product-filters__panel {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0;
}

.product-filters__mobile-header {
    display: none; /* Hidden on desktop */
}

.product-filters__content {
    padding: 20px;
}

/* ==========================================================================
   Filter Groups
   ========================================================================== */

.filter-group {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.filter-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.breakdance .filter-group .filter-group__title h5 {
    font-size: 16px !important;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
}

/* Even more specific override for Breakdance */
.breakdance .product-filters .filter-group .filter-group__title h5,
.breakdance h5.filter-group__title,
.product-filters__panel .filter-group__title h5 {
    font-size: 16px !important;
    font-weight: 600 !important;
}

/* Direct target: h5 element that HAS the filter-group__title class */
.breakdance .filter-group h5.filter-group__title,
.breakdance .product-filters h5.filter-group__title {
    font-size: 16px !important;
    font-weight: 600 !important;
    margin: 0 0 15px 0 !important;
    color: #333 !important;
}

.filter-group__title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
}

.filter-group__content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-group__scrollable {
    min-height: 50px;
    max-height: 200px;
    overflow-y: auto;
    align-content: flex-start;
}

/* Custom scrollbar */
.filter-group__scrollable::-webkit-scrollbar {
    width: 6px;
}

.filter-group__scrollable::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.filter-group__scrollable::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.filter-group__scrollable::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ==========================================================================
   Price Range Filter
   ========================================================================== */

.filter-group--price .filter-group__content {
    gap: 15px;
}

.noUi-horizontal {
    height: 0px !important;
}

.price-range-slider {
    margin: 0px 5px 0px;
}

/* noUiSlider customization */
.price-range-slider .noUi-horizontal {
    height: 0 !important;
}

.price-range-slider .noUi-target {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.price-range-slider .noUi-connect {
    background: #253473;
    height: 7px;
}

.price-range-slider .noUi-base {
    height: 2px;
    background-color: #ececec;
}

.price-range-slider .noUi-handle {
    width: 20px;
    height: 20px;
    border: 2px solid #253473;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: none;
    top: -9px;
}

.price-range-slider .noUi-handle:hover {
    background: #f5f5f5;
}

.price-range-slider .noUi-handle:before,
.price-range-slider .noUi-handle:after {
    display: none;
}

.price-range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.price-input-wrapper {
    position: relative;
}

.price-input-wrapper label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.price-input-wrapper input {
    width: 100%;
    padding: 8px 30px 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.price-input-wrapper .currency {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    margin-top: 10px;
    color: #666;
    font-size: 14px;
    pointer-events: none;
}

/* Price histogram */
.price-histogram {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 80px;
    margin-bottom: 0;
    padding: 0 5px;
    gap: 2px;
}

.price-histogram-bar {
    flex: 1;
    background: #e0e0e0;
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    transition: background 0.2s;
    cursor: pointer;
    position: relative;
}

.price-histogram-bar:hover {
    background: #c0c0c0;
}

.price-histogram-bar.active {
    background: #253473;
}

/* Quick price filters */
.price-quick-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.price-quick-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.price-quick-filter:hover {
    background: #f0f0f0;
    border-color: #000;
}

.price-quick-filter.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

.price-quick-filter-label {
    font-weight: 500;
}

.price-quick-filter-count {
    font-size: 12px;
    color: #666;
    background: #fff;
    padding: 2px 8px;
    border-radius: 10px;
}

.price-quick-filter.active .price-quick-filter-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ==========================================================================
   Checkboxes
   ========================================================================== */

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    transition: background-color 0.2s;
    background-color: #f3f3f3;
}

.filter-checkbox:hover {
    background-color: #f9f9f9;
}

.filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.filter-checkbox .checkbox-label {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.filter-checkbox .checkbox-count {
    font-size: 12px;
    color: #999;
}

/* Brand checkboxes with images */
.filter-checkbox--brand {
    gap: 10px;
}

.filter-checkbox--brand .brand-image {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 2px;
}

/* ==========================================================================
   Filter Chips
   ========================================================================== */

.product-filters-chips {
    margin-bottom: 25px;
}

.filters-chips__container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    color: #333;
}

.filter-chip .chip-label {
    line-height: 1;
}

.filter-chip .chip-remove {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    color: #666;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.filter-chip .chip-remove:hover {
    background: #ddd;
    color: #333;
}

.filters-chips__clear-all {
    background: #333;
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.filters-chips__clear-all:hover {
    background: #555;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.products.is-loading {
    position: relative;
    min-height: 400px;
}

/* Skeleton product item - inherits grid/flex from .products UL */
li.skeleton-product {
    position: relative;
    pointer-events: none;
}

li.skeleton-product .product-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 1 / 1; /* Match Breakdance product images */
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 15px;
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-title {
    width: 80%;
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-price {
    width: 40%;
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ==========================================================================
   No Results
   ========================================================================== */

.woocommerce-no-products-found {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 4px;
}

.woocommerce-no-products-found p {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

.wc-no-results-clear-filters {
    display: inline-block;
}

/* ==========================================================================
   Mobile Styles
   ========================================================================== */

@media (max-width: 768px) {
    
    /* Show mobile toggle button */
    .product-filters__mobile-toggle {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 12px 16px;
        background: #373737;
        color: #fff;
        border: none;
        border-radius: 10px;
        font-size: 16px;
        font-weight: 500;
        cursor: pointer;
        margin-bottom: 20px;
        position: relative;
    }

    .product-filters__mobile-toggle .filter-icon {
        display: flex;
    }

    .product-filters__mobile-toggle .active-filters-count {
        position: absolute;
        right: 16px;
        background: #ff5722;
        color: #fff;
        border-radius: 12px;
        padding: 2px 8px;
        font-size: 12px;
        font-weight: 600;
        min-width: 20px;
        text-align: center;
    }

    /* Filter panel as modal */
    .product-filters__panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
        transform: translateY(100%);
        transition: transform 0.3s ease-in-out;
        border: none;
        border-radius: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .product-filters__panel.is-open {
        transform: translateY(0);
    }

    /* Mobile header */
    .product-filters__mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        background: #fff;
        border-bottom: 1px solid #e0e0e0;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .product-filters__mobile-header h3 {
        margin: 0;
        font-size: 16px !important;
        font-weight: 600;
    }

    .product-filters__close {
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #333;
    }

    /* Mobile footer */
    .product-filters__mobile-footer {
        display: block;
        padding: 16px 20px;
        background: #fff;
        border-top: 1px solid #e0e0e0;
        position: sticky;
        bottom: 0;
        z-index: 10;
    }

    .product-filters__apply-button {
        width: 100%;
        padding: 15px 5px;
        background: #333;
        color: #fff;
        border: none;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
    }

    .product-filters__apply-button:active {
        background: #555;
    }

    /* Overlay */
    .product-filters__overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    .product-filters__overlay.is-visible {
        opacity: 1;
        visibility: visible;
    }

    /* Prevent body scroll when filters open */
    body.filters-open {
        overflow: hidden;
    }

    /* Adjust filter groups spacing */
    .filter-group {
        margin-bottom: 20px;
    }

    /* Chips on mobile */
    .product-filters-chips {
        margin-bottom: 20px;
    }

    .filters-chips__container {
        gap: 8px;
    }

    .filter-chip {
        font-size: 13px;
        padding: 5px 10px;
    }

    .filters-chips__clear-all {
        font-size: 13px;
        font-weight: 600;
        padding: 7px 15px;
        width: auto;
        margin-top: 0px;
    }

    /* Skeleton image height adjustment on mobile */
    .skeleton-image {
        height: 150px;
    }

}

/* ==========================================================================
   Desktop - Hide mobile footer
   ========================================================================== */

@media (min-width: 769px) {
    .product-filters__mobile-footer {
        display: none;
    }

    .product-filters__overlay {
        display: none;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.product-filters .hidden {
    display: none !important;
}

.product-filters .disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Ensure noUiSlider tooltips don't overflow */
.price-range-slider .noUi-target {
    position: relative;
}

/* WooCommerce compatibility */
.woocommerce .product-filters-chips {
    clear: both;
}

/* Breakdance compatibility */
.breakdance-woocommerce .product-filters-chips {
    width: 100%;
    clear: both;
}

/* ==========================================================================
   Breakdance H5 Override - Must be at end of file
   ========================================================================== */

/* Ultra-specific override for Breakdance h5 styling */
.breakdance .product-filters .filter-group h5.filter-group__title,
body .breakdance h5.filter-group__title,
.breakdance h5.filter-group__title {
    font-size: 16px !important;
    font-weight: 600 !important;
    margin: 0 0 15px 0 !important;
    color: #333 !important;
    font-family: inherit !important;
}
