/* ==========================================================================
   MFS Product Filter — Minotaur Fight Store
   ========================================================================== */

/* === Filter Bar === */
.mfs-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    border-bottom: 1px solid #e5e5e5;
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 100;
}

.mfs-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid #000;
    border-radius: 0;
    background: #fff;
    color: #000;
    font-family: 'Lato', Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.15s ease;
}
.mfs-filter-btn:hover,
.mfs-filter-btn.is-active {
    background: #000;
    color: #fff;
}
.mfs-filter-btn__arrow {
    font-size: 10px;
    transition: transform 0.2s;
}
.mfs-filter-btn.is-active .mfs-filter-btn__arrow {
    transform: rotate(180deg);
}
.mfs-filter-btn__count {
    background: #000;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.mfs-filter-btn.is-active .mfs-filter-btn__count {
    background: #fff;
    color: #000;
}

.mfs-filter-bar__spacer { flex: 1; }

.mfs-filter-bar__results {
    font-size: 13px;
    color: #767676;
    margin-right: 10px;
}

.mfs-sort-select {
    padding: 10px 30px 10px 14px;
    border: 1px solid #dbdbdb;
    border-radius: 0;
    font-family: 'Lato', Arial, sans-serif;
    font-size: 13px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23000' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 10px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}
.mfs-sort-select:focus {
    outline: none;
    border-color: #000;
}

/* Hide WooCommerce default ordering - our sort replaces it */
.woocommerce-ordering {
    display: none !important;
}

/* === Dropdowns === */
.mfs-filter-dropdown {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e5e5e5;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    padding: 20px;
    min-width: 280px;
    z-index: 200;
    margin-top: 8px;
}
.mfs-filter-dropdown.is-open { display: block !important; }

.mfs-filter-dropdown__title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 14px;
    letter-spacing: 0.04em;
}

/* === Colour Swatches === */
.mfs-colour-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}
.mfs-colour-item {
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.mfs-colour-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #e5e5e5;
    transition: all 0.15s;
    flex-shrink: 0;
}
.mfs-colour-swatch[style*="ffffff"] {
    border-color: #ccc;
}
.mfs-colour-swatch:hover { border-color: #000; }
.mfs-colour-swatch.is-selected {
    border-color: #000;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #000;
}
.mfs-colour-swatch__label {
    font-size: 10px;
    color: #767676;
    line-height: 1.2;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Size Buttons === */
.mfs-size-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.mfs-size-grid:last-child {
    margin-bottom: 0;
}
.mfs-size-btn {
    padding: 8px 12px;
    border: 1px solid #dbdbdb;
    background: #fff;
    font-family: 'Lato', Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 44px;
    text-align: center;
    text-transform: uppercase;
}
.mfs-size-btn:hover { border-color: #000; }
.mfs-size-btn.is-selected {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* === Checkbox List === */
.mfs-check-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
    margin: 0;
    padding: 0;
}
.mfs-check-list li {
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
}
.mfs-check-list li:hover { font-weight: 600; }
.mfs-check-list input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #000;
    pointer-events: none;
}
.mfs-check-list .count {
    color: #999;
    font-size: 12px;
    margin-left: auto;
}

/* === Price Slider (dual handle) === */
.mfs-price-slider { padding: 10px 0; }
.mfs-price-slider__track {
    position: relative;
    height: 4px;
    background: #dbdbdb;
    border-radius: 2px;
    margin: 20px 0 10px;
}
.mfs-price-slider__range {
    position: absolute;
    height: 100%;
    background: #000;
    border-radius: 2px;
}
.mfs-price-slider input[type="range"] {
    position: absolute;
    width: 100%;
    top: -8px;
    height: 20px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
}
.mfs-price-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #000;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.mfs-price-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #000;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.mfs-price-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
}

/* === Toggle Switch === */
.mfs-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    cursor: pointer;
}
.mfs-toggle__switch {
    width: 44px;
    height: 24px;
    background: #dbdbdb;
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.mfs-toggle__switch::after {
    content: '';
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.mfs-toggle.is-on .mfs-toggle__switch { background: #000; }
.mfs-toggle.is-on .mfs-toggle__switch::after { transform: translateX(20px); }

/* === Active Filter Pills === */
.mfs-active-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    flex-wrap: wrap;
}
.mfs-active-filters:empty { display: none; padding: 0; }

.mfs-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f5f5f5;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.15s;
}
.mfs-pill:hover { background: #e5e5e5; }
.mfs-pill__x {
    font-size: 14px;
    font-weight: 400;
    color: #999;
}

.mfs-clear-all {
    font-size: 12px;
    color: #999;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 8px;
}
.mfs-clear-all:hover { color: #000; }

/* === Filter items with no matching products === */
.mfs-no-results {
    opacity: 0.3;
    pointer-events: none;
}
.mfs-check-list li.mfs-no-results {
    opacity: 0.4;
    pointer-events: auto;
    text-decoration: line-through;
}

/* === No Results === */
.mfs-filter-no-results {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: #767676;
}

/* === Loading State === */
ul.products { transition: opacity 0.2s ease; }

/* === Mobile === */
.mfs-mobile-filter-btn {
    display: none;
}

@media (max-width: 768px) {
    .mfs-filter-bar { display: none; }
    .mfs-active-filters { padding: 10px 0; }

    .mfs-mobile-filter-btn {
        display: flex;
        position: fixed;
        bottom: 20px;
        /* Centred via auto margins, NOT left:50% + translateX(-50%): a transform on this
           fixed button breaks Chrome's compositor hit-testing here (button paints but taps
           fall through to the page), leaving the panel unopenable. */
        left: 0;
        right: 0;
        margin-left: auto;
        margin-right: auto;
        width: -moz-fit-content;
        width: fit-content;
        padding: 13px 26px;
        background: #000;
        color: #fff;
        border: none;
        border-radius: 999px;
        font-family: 'Lato', Arial, sans-serif;
        font-size: 14px;
        font-weight: 700;
        line-height: 1;
        white-space: nowrap; /* was wrapping "FILTER & SORT" onto 2 lines -> chunky 74px pill */
        text-transform: uppercase;
        letter-spacing: 0.05em;
        z-index: 1000;
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
        cursor: pointer;
        gap: 8px;
        align-items: center;
        justify-content: center;
    }
    .mfs-mobile-filter-btn__count {
        background: #fff;
        color: #000;
        font-size: 11px;
        padding: 2px 8px;
        border-radius: 10px;
    }

    .mfs-mobile-overlay {
        display: none !important;
        position: fixed;
        inset: 0;
        background: #fff;
        z-index: 2000;
        overflow-y: auto;
    }
    .mfs-mobile-overlay.is-open { display: block !important; }

    .mfs-mobile-overlay__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        border-bottom: 1px solid #e5e5e5;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 10;
    }
    .mfs-mobile-overlay__title {
        font-size: 18px;
        font-weight: 700;
        text-transform: uppercase;
    }
    .mfs-mobile-overlay__close {
        font-size: 28px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px;
        line-height: 1;
    }
    .mfs-mobile-overlay__body { padding: 20px; }

    .mfs-mobile-section {
        border-bottom: 1px solid #f0f0f0;
        padding: 16px 0;
    }
    .mfs-mobile-section__title {
        font-size: 14px;
        font-weight: 700;
        text-transform: uppercase;
        margin-bottom: 12px;
    }

    .mfs-sort-select.mfs-sort-mobile { width: 100%; }

    .mfs-mobile-overlay__footer {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 16px 20px;
        border-top: 1px solid #e5e5e5;
        display: flex;
        gap: 10px;
    }
    .mfs-mobile-apply {
        flex: 1;
        padding: 14px;
        background: #000;
        color: #fff;
        border: none;
        font-family: 'Lato', Arial, sans-serif;
        font-size: 14px;
        font-weight: 700;
        text-transform: uppercase;
        cursor: pointer;
    }
    .mfs-mobile-clear {
        padding: 14px 20px;
        background: #fff;
        color: #000;
        border: 1px solid #000;
        font-family: 'Lato', Arial, sans-serif;
        font-size: 14px;
        font-weight: 700;
        text-transform: uppercase;
        cursor: pointer;
    }
}
