/* -------------------------------------------
    Shop Page

 - Toolbox
    (support toolbox, toolbox-left, toolbox-right)
    (support label, select-box)
 - Toolbox Item
    (support full)
 - Layout Button
 - Select Menu
    (support as sidebar's widget < 992px)
    (support toggle)
 - Select Items
 - Toolbox Pagination
 - Toolbox Horizontal
 - Toolbox Navigation
    (support as sidebar-fixed)
    (please place sidebar before toolbox: to know sidebar's close status)
---------------------------------------------- */

@import '../config';
@import '../mixins';
@import '../direction';

/* Theme SCSS Framework */

// Top space of main content
.product-archive-page .main {
    padding-top: 4rem;
}

// Toolbox, Filter Clean Widget, Filter Price Widget
.filter-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
}

.toolbox-top {
    position: relative;
    justify-content: initial;

    .show-info {
        margin-bottom: 1rem;
    }
}
.sidebar-fixed ~ .main-content {
    .sticky-toolbox.fixed {
        padding-top: 1rem;
    }
}

.sticky-toolbox.fixed {
    padding: 1rem  calc(2 * var(--alpha-gap)) 0;
}

@include mq(xs, max) {
    .sticky-toolbox.fixed {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}
.toolbox-show-count select {
    padding-#{$left}: 1rem;
}

// Layout Button
.btn-showtype {
    line-height: 1;
    color: #dadada;
    font-size: 19px;

    &:last-child {
        padding-#{$right}: 0;
    }

    &:hover,
    &.active {
        color: var(--alpha-change-color-dark-1);
    }

    & + & {
        margin-#{$left}: 10px;
    }
}

// Toolbox Horizontal
.toolbox-horizontal {
    display: flex;
    color: var(--alpha-change-color-dark-1);
    z-index: 2;

    > .sticky-content-wrapper,
    > .toolbox {
        flex: 1;
    }

    .select-box::before {
        font-size: 1.2rem ;
        right: 1.2rem;
        margin-top: 1px;
    }
    select {
        max-width: 15.7rem;
        padding: side-values(.65em 2.55em .58em 1.2em);
        font-size: 1.2rem ;
    }

    .toolbox-toggle {
        padding: .85rem 1.3rem;
    }

    .show-info {
        margin-bottom: 1.2rem;
        color: $body-color;
        font-size: inherit;
    }
    .toolbox-show-count label {
        display: none;
    }

    .shop-sidebar {
        margin-#{$right}: 0;
    }
    &.fixed .sidebar-overlay,
    &.fixed .sidebar-content {
        min-height: 100vh;
    }

    .widget > div.wp-block-group {
        margin: 0;
    }

    @include mq(lg) {
        .widget-title,
        .wp-block-group__inner-container > h2 {
            cursor: pointer;
        }

        .sidebar .widget {
            padding: 0;
            border: none;
        }

        .widget .wc-block-product-categories.is-list {
            padding-bottom: 0;
        }
    }
}

// Select Items
.select-item {
    position: relative;
    display: inline-block;
    font-size: 1.2rem;
    padding: side-values(5px 2.4rem 5px 1rem);
    border-radius: $corner-sm;  
    color: var(--alpha-change-color-dark-1);
    background: var(--alpha-change-border-color);

    i {
        position: absolute;
        font-size: 13px;
        top: 0;
        bottom: 0;
        #{$right}: 5px;
        line-height: 29px;
    }
}

.select-items {
    display: none;
    margin-bottom: 1.5rem;

    .toolbox + & {
        font-size: 1.2rem ;
        margin: 2px 0 1.8rem;
    }

    > * {
        margin: side-values(0 .8rem .5rem 0);
    }

    .filter-clean {
        margin-#{$left}: 1.2rem;
    }
}

.filter-actions .filter-clean {
    line-height: 3.9rem;
}

// Toolbox Pagination
.toolbox-pagination {
    position: relative;
    border-top: 1px solid var(--alpha-change-color-light-2);

    &.no-pagination,
    .btn-load + & {
        padding: 0;
        border-top: none;
    }

    .pagination {
        margin: 0;
    }
    .pagination:first-child {
        width: 100%;
        text-align: center;
    }
}

.product-archive + .toolbox-pagination {
    margin-top: 3rem;
    padding-top: 3rem;
}

aside ~ .main-content .top-sidebar-toggle {
    margin-top: -50px;
}

// WooCommerce Info
.no-product {
    max-width: 100%;
    flex: 100%;
}

// Loading
.product-archive .products > p {
    margin: 0 10px;
}

@include mq(sm, max) {
    .toolbox-pagination {
        flex-direction: column;

        > *:not(:last-child) {
            margin-bottom: 1rem;
            margin-#{$right}: 0;
        }
    }
    .toolbox .toolbox-toggle {
        padding: 1rem .6rem;
    }
    .toolbox-horizontal .toolbox-toggle {
        padding: .85rem .6rem;
    }
}

@include mq(sm) {
    .toolbox-horizontal {
        .toolbox-left {
            margin-#{$right}: auto;
        }
    }
}

@include mq(lg, max) {
    // Shop Sidebar : Mobile
    .toolbox-horizontal {
        .sidebar-fixed {
            margin-#{$right}: 0;
        }
        .sidebar-content {
            display: block;
        }
    }

    // Navigation Style
    .toolbox-wrap {
        .shop-sidebar .widget-title {
            border-top: 3px solid var(--alpha-change-border-color);
        }
    }

    .sidebar-content.toolbox-left > * {
        margin-#{$right}: 0;
    }
}

@include mq(lg) {
    .toolbox .sidebar-content {
        max-width: none;
    }

    // Horizontal Style
    .toolbox-horizontal {
        font-size: 1.2rem;
        .shop-sidebar .sidebar-content {
            padding-bottom: 0;
        }
        .widget {
            position: relative;
            margin-bottom: 1rem;
            margin-#{$right}: 1rem;
            color: var(--alpha-change-color-dark-1);
    
            .wp-block-group h2,
            .widget-title {
                position: relative;
                border: 1px solid var(--alpha-change-border-color);
                padding: side-values(.65em 4.3em .58em 1.2em);
                background: var(--alpha-change-color-light-1) url(../../images/select-bg.svg) if-ltr(98%, 2%) 45%/26px 60px no-repeat;
                margin-bottom: 0;
                font-size: 1.2rem;
                line-height: 1.5;
                font-weight: 400;
                letter-spacing: 0;
                text-transform: capitalize;
                background-color: var(--alpha-change-color-light-1);
            }
    
            .wp-block-group h2 + *,
            .widget-title + * {
                position: absolute;
                top: 100%;
                z-index: 100;
                min-width: 23rem;
                margin-top: .5rem;
                padding: 1rem 2rem 1rem;
                background: var(--alpha-change-color-light-1);
                opacity: 0;
                visibility: hidden;
                box-shadow: 0 5px 16px rgba(0, 0, 0, .12);
            }
    
            &.opened {
                h3 {
                    border-color: var(--alpha-primary-color);
                }
                .widget-title + * {
                    opacity: 1;
                    visibility: visible;
                }
            }
            
            &.opened h3 {
                    border-color: var(--alpha-primary-color);
            }
            .wp-block-group__inner-container.opened {
                > h2 {
                    border-color: var(--alpha-primary-color);
                }
                > h2 + * {
                    opacity: 1;
                    visibility: visible;
                }
            }
        }

        .sidebar {
            .widget {
                // Widget list styling
                ul {
                    white-space: normal;
                    padding-bottom: 2rem;
                }

                li {
                    border-radius: $corner-sm;
                    background-color: var(--alpha-traffic-white-color);
                    margin: side-values(1rem .5rem 0 0);
                    padding: 0;
                }
                li a {
                    padding: .5em 1em;

                    &:before {
                        content: none;
                    }
                }
                li.chosen,
                li.current-cat {
                    background-color: var(--alpha-primary-color);
                    a {
                        color: var(--alpha-change-color-light-1);
                        &:before {
                            content: none;
                        }
                    }
                }
                .count {
                    display: none;
                }
            }
            .cat-item i {
                display: none;
            }
            .alpha-price-range {
                margin: -2rem 0 1rem;
            }
            &.shop-sidebar .widget li {
                display: inline-flex;
                align-items: center;
            }
        }

        .wc-block-product-categories-list-item-count {
            margin-#{$right}: 1em;
        }

        .toolbox-left .toolbox-item:not(:last-child) {
            margin-#{$right}: 2rem;
        }

        .filter-clean {
            font-size: 1.3rem;
        }
    }
}
@include mq(md, max) {
    .product-archive .category-wrap {
        --alpha-col: 3;
    }
    .toolbox label,
    .toolbox-top .show-info {
        display: none;
    }
}
@include mq(sm, max) {
    .product-archive .category-wrap {
        --alpha-col: 2;
    }
    .toolbox .toolbox-show-type {
        display: none;
    }
}
@include mq(1600px) {
    .container-fluid .sidebar-offcanvas + .main-content .product-archive .list-type-products > *,
    .container-fluid .main-content:first-child .product-archive .list-type-products > * {
        flex: 0 0 50%;
        max-width: 50%;
    }
}
// @media (min-width: 1200px) and (max-width: 1499px) {
//     .sidebar-fixed ~ .main-content .product-archive .list-type-products > * {
//         flex: 0 0 100%;
//         max-width: 100%;
//     }
// }
@media (min-width: 992px) and (max-width: 1199px) {
    .sidebar-fixed + .sidebar-fixed + .main-content .list-type-products {
        .product-media {
            max-width: 9rem;
        }
        .product-details {
            max-width: calc(100% - 11rem);
        }
    }
}