/**
 * Bull Filters - Frontend Styles
 *
 * @author Bullmade
 * @license MIT
 */

/* =========================================================================
   Block Container
   ========================================================================= */

.bm-filters {
    position: relative;
    font-size: 0.875rem;
}


.bm-filters--loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    z-index: 10;
    pointer-events: none;
}

/* =========================================================================
   Panel
   ========================================================================= */

.bm-filters__panel {
    padding: 0;
}

.bm-filters__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e5e5;
}

.bm-filters__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #232323;
}

.bm-filters__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: #666;
}

/* =========================================================================
   Active Filters Summary
   ========================================================================= */

.bm-filters__active {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #e5e5e5;
    background: #f8f9fa;
}

.bm-filters__active-header {
    display: flex;
    justify-content: flex-end;
}

.bm-filters__clear-all,
.bm-filters-active__clear-all {
    font-size: 0.8125rem;
    color: #c0392b;
    text-decoration: none;
    cursor: pointer;
}

.bm-filters__clear-all:hover,
.bm-filters-active__clear-all:hover {
    text-decoration: underline;
}

/* =========================================================================
   Filter Groups
   ========================================================================= */

.bm-filters__group {
    border-bottom: 1px solid #e5e5e5;
}

.bm-filters__group:last-child {
    border-bottom: none;
}

.bm-filters__group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s;
}

.bm-filters__group-header:hover {
    background-color: #f8f9fa;
}

.bm-filters__group-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
}

.bm-filters__group-toggle {
    width: 10px;
    height: 10px;
    border-right: 1px solid #666;
    border-bottom: 1px solid #666;
    transform: rotate(45deg);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.bm-filters__group--collapsed .bm-filters__group-toggle {
    transform: rotate(-45deg);
}

.bm-filters__group-body {
    padding: 0 1.25rem 1rem;
}

/* =========================================================================
   Filter Lists (Checkbox & Radio)
   ========================================================================= */

.bm-filters__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (min-width: 992px) {
    #bm-filters-block.bm-filters--horizontal .bm-filters__group-body .bm-filters__show-more,
    #bm-filters-block.bm-filters--horizontal .bm-filters__group-body ul.bm-filters__list,
    #bm-filters-block.bm-filters--horizontal .bm-filters__group-body .bm-filters__slider {
        background: #fff;
        border-radius: 4px;
        min-width: 200px;
        padding: 0.75rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
}

.bm-filters__item {
    margin-bottom: 0.25rem;
}

.bm-filters__item--disabled {
    opacity: 0.4;
    pointer-events: none;
}

.bm-filters__label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0;
    line-height: 1.3;
    color: #333;
    font-weight: 400;
}

.bm-filters__label:hover {
    color: #000;
}

.bm-filters__input {
    flex-shrink: 0;
    margin: 0;
}

.bm-filters__text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bm-filters__count {
    flex-shrink: 0;
    color: #999;
    font-size: 0.8125rem;
}

/* =========================================================================
   Color Swatches
   ========================================================================= */

.bm-filters__color {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

/* =========================================================================
   Select / Dropdown
   ========================================================================= */

.bm-filters__select {
    width: 100%;
    font-size: 0.875rem;
}

/* =========================================================================
   Range Slider
   ========================================================================= */

.bm-filters__slider {
    padding: 0.5rem 0;
}

.bm-filters__slider-track {
    position: relative;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    margin: 1rem 0 0.75rem;
}

.bm-filters__slider-range {
    position: absolute;
    height: 100%;
    background: #444;
    border-radius: 3px;
    top: 0;
}

.bm-filters__slider-input {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    height: 0;
}

.bm-filters__slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #db041f;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
}

.bm-filters__slider-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2fb5d2;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
}

.bm-filters__slider-values {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    color: #555;
}

.bm-filters__slider-separator {
    margin: 0 0.5rem;
}

/* =========================================================================
   Show More / Less
   ========================================================================= */

.bm-filters__show-more {
    background: none;
    border: none;
    color: #2fb5d2;
    cursor: pointer;
    font-size: 0.8125rem;
    padding: 0.25rem 0;
    display: block;
    margin-top: 0.25rem;
}

.bm-filters__show-more:hover {
    text-decoration: underline;
}

/* =========================================================================
   Mobile
   ========================================================================= */

.bm-filters__mobile-toggle {
    width: 100%;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.bm-filters__mobile-toggle-icon::before {
    content: '\2630';
}

.bm-filters__footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e5e5;
}

.bm-filters__footer .bm-filters__apply {
    width: 100%;
}

.bm-filters__overlay {
    display: none;
}

/* =========================================================================
   Mobile Panel (< lg breakpoint)
   ========================================================================= */

@media (max-width: 991.98px) {
    .bm-filters--compact-mobile .bm-filters__panel {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 360px;
        height: 100vh;
        z-index: 1050;
        overflow-y: auto;
        transition: left 0.3s ease;
        border-radius: 0;
        border: none;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
        background: #fff;
    }

    .bm-filters--compact-mobile.bm-filters--mobile-open .bm-filters__panel {
        left: 0;
    }

    .bm-filters--compact-mobile .bm-filters__overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1040;
        display: none;
    }

    .bm-filters--compact-mobile.bm-filters--mobile-open .bm-filters__overlay {
        display: block;
    }
}

/* Body lock when mobile panel is open */
body.bm-filters-body-lock {
    overflow: hidden;
}

/* =========================================================================
   Horizontal Layout (desktop only)
   ========================================================================= */

@media (min-width: 992px) {
    .bm-filters--horizontal .bm-filters__header,
    .bm-filters--horizontal .bm-filters__active {
        display: none;
    }

    .bm-filters--horizontal .bm-filters__groups {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .bm-filters--horizontal .bm-filters__group {
        background: #fff;
        border-radius: 4px;
        border-bottom: none;
        flex: 0 0 auto;
        position: relative;
    }

    .bm-filters--horizontal .bm-filters__group:last-child {
        border-right: none;
    }

    .bm-filters--horizontal .bm-filters__group-body {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 100;
        padding: 0;
        padding-top: 0.5rem;
    }

    .bm-filters--horizontal .bm-filters__group.bm-filters__group--open .bm-filters__group-body {
        display: block;
    }

    .bm-filters--horizontal .bm-filters__group-header {
        padding: 0.75rem 1rem;
        cursor: pointer;
    }

    .bm-filters--horizontal .bm-filters__group-toggle {
        transform: rotate(45deg);
        width: 6px;
        height: 6px;
        margin-left: 0.5rem;
        translate: 0 -2px;
    }
}

/* =========================================================================
   Loading State for Product List
   ========================================================================= */

.bm-filters-loading {
    position: relative;
    min-height: 100px;
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* =========================================================================
   Active Filters Bar (rendered outside the filter block)
   ========================================================================= */

.bm-filters-active {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
}

.bm-filters-active__label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #333;
}

.bm-filters-active__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.bm-filters-active__item {
    display: inline-block;
}

.bm-filters-active__remove {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #f0f0f0;
    border-radius: 3px;
    color: #333;
    font-size: 0.8125rem;
    text-decoration: none;
    transition: background-color 0.15s;
}

.bm-filters-active__remove:hover {
    background: #e0e0e0;
    color: #000;
    text-decoration: none;
}

.bm-filters-active__key {
    font-weight: 500;
    text-transform: capitalize;
}

.bm-filters-active__close {
    font-size: 1rem;
    line-height: 1;
    color: #999;
    margin-left: 0.125rem;
}

/* =========================================================================
   No Products Message
   ========================================================================= */

.bm-filters-no-products {
    text-align: center;
    padding: 2rem;
}

/* =========================================================================
   Infinite Scroll Loader
   ========================================================================= */

.bm-filters-scroll-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
}

.bm-filters-scroll-loader__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #333;
    border-radius: 50%;
    animation: bmf-spin 0.7s linear infinite;
}

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

.bm-filters-scroll-sentinel {
    pointer-events: none;
}

/* =========================================================================
   Load More Button
   ========================================================================= */

.bm-filters-load-more {
    display: flex;
    justify-content: center;
    padding: 1.5rem 0;
}

.bm-filters-load-more__btn {
    min-width: 200px;
}

.bm-filters-load-more__btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* =========================================================================
   SEO Page Styles
   ========================================================================= */

.bmf-seo-page-header {
    margin-bottom: 1.5rem;
}

.bmf-seo-page-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.bmf-seo-page-short-description {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.bmf-seo-page-long-description {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e5e5;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
}

.bmf-seo-page-long-description h2,
.bmf-seo-page-long-description h3 {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.bmf-seo-page-long-description p {
    margin-bottom: 0.75rem;
}
