/* ------------------------------------ *
 *  FILTERING SIDEBAR LAYOUT
 * ------------------------------------ */

/* Base container – generic, desktop-like defaults */
.woocommerce-sidebar-mobile,
.slideupBox {
    float: left;
    padding-right: 30px;
    padding-left: 0px;
    margin-top: 0px;
}


.filters-parent {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

/* Each individual checkbox row */
.filters-parent div {
    display: flex;
    gap: 8px;
}

/* Label & count */
.filters-parent label {
    font-size: 14px;
    color: #707070;
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.filters-parent label span.term-count-text {
    color: var(--color-gray-400);
}

/* Checkboxes inside the filter groups */
.filter-wrapper input[type="checkbox"] {
    min-height: auto;
    width: 20px !important;
    height: 20px !important;
    min-width: 10px !important;
    min-height: 10px !important;
    max-width: 30px !important;
    padding: 3px 2px !important;
    margin-top: 1px;
    border-radius: 4px !important;
    margin-right: 0px;
}

/* Section header row (title + arrow) */
.filter-header-wrapper {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.filter-header-wrapper h4 {
    margin-bottom: 6px;
}

/* Arrow on the right of the header */
.filter-header-wrapper::after {
    height: 15px;
    width: 15px;
    color: #707070;
    content: "";
    border: solid black;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 5px;
    transform: rotate(225deg);
    transition: all .2s ease;
    z-index: 0;
    margin-top: -5px;
}

/* Rotated arrow when wrapper has .closed */
.filter-wrapper.closed .filter-header-wrapper::after {
    transform: rotate(45deg);
}

/* Open-filters “bar” at bottom of viewport */
.mobile-show {
    position: fixed;
    bottom: 0;
    width: 100%;
    left: 0;
    padding: 20px;
    background: white;
    z-index: 10;
    box-shadow: 0px 3px 15px rgb(0 0 0 / 50%);
}

/* The button itself */
.mobile-show button {
    width: 100%;
    padding: 21px 40px;
    border-radius: 8px;
    background: var(--color-brand-light);
    font-size: 14px;
    text-transform: uppercase;
    border: none !important;
    color: white !important;
    font-weight: 700;
}

.mobile-submit {
    display: none;
}

.shop-filters-bottom-sheet #shop-filtering {
    display: flex;
    flex-direction: column;
    gap: 18px;
}


/* ------------------------------------ *
 *  DESKTOP SIDEBAR (NO BOTTOM SHEET)
 * ------------------------------------ */

@media only screen and (min-width: 768px) {

    .woocommerce-sidebar-mobile,
    .slideupBox {
        overflow: unset !important;
        top: 0 !important;
        position: relative;
        background: transparent;
    }

    .mobile-show {
        display: none !important;
    }

    .filter-submit-wrapper {
        position: sticky;
        bottom: 0px;
        margin-left: -15px;
        z-index: 999999999999999999999;
        width: calc(100% + 30px);
        padding: 10px 15px 20px;
        background: white;
    }

    .filter-submit-wrapper #woo-filtering-submit {
        font-weight: 700;
        color: white;
        box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.15) !important;
        background: var(--color-green);
        width: 100%;
        border: none;
    }

    .filter-submit-wrapper::after {
        content: "";
        position: absolute;
        left: 0;
        top: -16px;
        height: 16px;
        width: 100%;
        background: linear-gradient(360deg, white, transparent);
    }

    .woocommerce-sidebar-mobile,
    .slideupBox {
        z-index: 99999;
    }

    .woocommerce-sidebar-mobile {
        float: left;
        display: block !important;
        padding: 0px 30px 0px 0px;
        width: 28%;
        height: auto;
        z-index: 0;
        top: 0;
    }
}

/* ------------------------------------ *
 *  MOBILE BOTTOM SHEET
 * ------------------------------------ */

@media only screen and (max-width: 769px) {
    /* Full-screen overlay that slides up */
    .woocommerce-sidebar-mobile {
        position: fixed !important;
        z-index: 9999999;
        left: 0;
        right: 0;
        width: 100%;
        height: 100%;
        bottom: -100%;
        top: auto;
        padding: 0 !important;
        background: rgba(0, 0, 0, 0);
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        transition: bottom .2s ease .2s, background .2s ease 0s;
    }

    /* When filters are open (class added via JS) */
    .woocommerce-sidebar-mobile.mobile-filters-open {
        bottom: 0;
        background: rgb(0 0 0 / 20%);
        transition: bottom .2s ease 0s, background .4s ease .2s;
    }

    /* White rounded card that contains the filter UI */
    .shop-filters-bottom-sheet {
        background: var(--color-white);
        padding: 24px 24px 30px 24px;
        border-top-right-radius: 12px;
        border-top-left-radius: 12px;
        box-shadow: 0px -6px 10px rgba(0, 0, 0, 0.10);
        max-height: calc(100vh - 90px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        gap: 18px;
    }


    .filter-header-wrapper::after {
        height: 10px;
        width: 10px;
    }


    /* Big Search button inside sheet (mobile version) */
    .filter-submit-wrapper {
        display: none !important;
    }

    .mobile-submit {
        display: block;
        margin-top: -36px;
        width: 100%;
    }

}

@media only screen and (min-width: 1500px) {
    .filter-submit-wrapper {
        padding: 10px 15px 50px;
    }
}


/* ------------------------------------ *
 *  AJAX LOADER
 * ------------------------------------ */

.loader-wrapper {
    position: fixed;
    background: rgb(255 255 255 / 50%);
    top: 0;
    left: 0;
    height: 100vh;
    width: 100vw;
    display: none;
    align-items: center;
    z-index: 1;
    justify-content: center;
}

.loader-wrapper.show {
    display: flex;
}

.loader-filtering {
    width: 48px;
    height: 48px;
    border: 5px solid var(--color-brand-light);
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

/* Title above filters on desktop */
h4.shop-filtering-title {
    margin-bottom: 30px;
}

/* Spinner keyframes */
@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}