/**
 * 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: 0px solid #e0e0e0;
    border-radius: 10px;
    padding: 0;
}

.product-filters__mobile-header {
    display: none; /* Hidden on desktop */
}

.product-filters__content {
    padding: 20px;
}

/* ==========================================================================
   Filter Groups
   ========================================================================== */

.filter-group {
    /* Kortelė: pilnas rėmelis + tarpai iš visų pusių */
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid #ededed;
    border-radius: 5px;
}

/* Paskutinė grupė: kortelės rėmelio ir tarpų neatimame – tik apačios tarpo nereikia */
.filter-group:last-child {
    margin-bottom: 0;
}

.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__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 – IŠIMTA (2026-09-21)
   ==========================================================================
   Kainos filtro nebėra, todėl ir jo stiliai (noUiSlider, price-input) pašalinti.
   Jei kainos filtrą grąžinsite: atkurkite markupą class-filter-renderer.php,
   stilius čia ir noUiSlider įkėlimą index.php.
   ========================================================================== */

/* ==========================================================================
   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: 10px;
    font-size: 13px;
    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: 20px;
    height: 19px;
    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: 8px 10px;
    border-radius: 10px;
    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: #253473;
        color: #fff;
        border: none;
        border-radius: 4px;
        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: 18px;
        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: 14px;
        background: #333;
        color: #fff;
        border: none;
        border-radius: 4px;
        font-size: 16px;
        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;
        padding: 15px 15px;
        width: 100%;
        margin-top: 5px;
    }

    /* 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;
}

/* Kainos filtro (noUiSlider) stiliai pašalinti kartu su filtru (2026-09-21). */

/* 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;
}

/* ==========================================================================
   Filter Group Accordion (atidaryti / uždaryti + chevron)
   ==========================================================================
   BE JS: visos grupės atidarytos (turinys matomas) – saugus variantas.
   JS prideda:
     .has-accordion  ant .product-filters  → visos grupės suskleidžiamos,
     .is-open        ant .filter-group     → tik atidarytos grupės
   Numatytai atidarytos tik grupės su aktyviais (pažymėtais) filtrais.
   ========================================================================== */

/* Grupės pavadinimas – paspaudžiamas mygtukas per visą plotį */
body .product-filters .filter-group__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font: inherit;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #333 !important;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

body .product-filters .filter-group__title-text {
    flex: 1 1 auto;
    min-width: 0;
}

body .product-filters .filter-group__toggle:hover .filter-group__title-text {
    color: #253473 !important;
}

body .product-filters .filter-group__toggle:focus-visible {
    outline: 2px solid #253473;
    outline-offset: 2px;
}

/* Chevron: ↑ kai atidaryta, ↓ kai uždaryta (per .has-accordion) */
body .product-filters .filter-group__chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    color: #666;
    transform: rotate(180deg);
    transition: transform 0.2s ease, color 0.2s ease;
}

body .product-filters .filter-group__chevron svg {
    display: block;
}

body .product-filters .filter-group__toggle:hover .filter-group__chevron {
    color: #253473;
}

body .product-filters.has-accordion .filter-group:not(.is-open) .filter-group__chevron {
    transform: rotate(0deg);
}

/* Uždaryta grupė: paslėpiamas turinys ir nuimamas antraštės tarpas */
body .product-filters.has-accordion .filter-group:not(.is-open) .filter-group__content {
    display: none;
}

body .product-filters.has-accordion .filter-group:not(.is-open) h5.filter-group__title {
    margin-bottom: 0 !important;
}

/* Grupė su aktyviais filtrais – paryškinamas pavadinimas (be JS, per :has) */
body .product-filters .filter-group:has(input[type="checkbox"]:checked) .filter-group__title-text {
    color: #253473 !important;
}

body .product-filters .filter-group:has(input[type="checkbox"]:checked) .filter-group__chevron {
    color: #253473;
}
