/* -------------------------------------------
    Shop Page

 - Sidebar
 - 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;
}

// Sidebar
/* -------------------------------------------
	Shop Sidebar
		- Collapsible Widget
		- Tag
		- Filter Action
		- Filter Items
			(used in Widget, Select Menu)
			(support submenu)
			(support color item)
		- Shop Sidebar
		- Widget Products
		- Fixed Sidebar for Shop Page
			(>=992px)
		- Remain Toggle for left, right sidebar
------------------------------------------- */

// Shop Sidebar
.sidebar .widget .wc-layered-nav-term,
.sidebar .widget .with-checkbox li,
.sidebar .widget .yith-wcan-list li,
.sidebar .widget .wc-layered-nav-rating {
    padding: 0;

    >a,
    &.empty span {
        position: relative;
        display: block;
        color: var(--alpha-dark-body-color);
        line-height: 1.2;
        padding: side-values(1rem 0 1rem 2em);

        &:hover {
            color: var(--alpha-primary-color);
        }

        &::before,
        img {
            content: '';
            position: absolute;
            border: 1px solid;
            border-radius: var(--alpha-corner-sm);
            width: 1.85em;
            height: 1.85em;
            top: 50%;
            transform: translateY(-50%);
            #{$left}: 0;
            color: var(--alpha-grey-color);
            font-size: .7em;
            font-weight: 900;
            font-family: 'Font Awesome 5 Free';
            text-align: center;
            line-height: calc(1.85em - 2px);

            @include only-for-retina(1.5) {
                text-indent: 0;
            }
        }

        img {
            object-fit: cover;
        }
    }
}

.sidebar .widget .wc-layered-nav-rating {
    >a {
        display: flex;
        align-items: center;

        &:hover {
            color: var(--alpha-dark-body-color);
        }
    }

    .star-rating {
        margin-#{$right}: auto;
        letter-spacing: 0.2em;
    }
}

.sidebar .widget .wc-layered-nav-term.chosen>a:before,
.sidebar .widget .with-checkbox li.chosen>a:before,
.sidebar .widget .yith-wcan-list li.chosen>a:before,
.sidebar .widget .wc-layered-nav-rating.chosen>a:before {
    content: "\f00c";
    color: var(--alpha-change-color-light-1);
    background-color: var(--alpha-primary-color);
    border-color: var(--alpha-primary-color);
}

.sidebar .widget .wc-block-product-categories a {
    color: var(--alpha-dark-body-color);

    &:hover {
        color: var(--alpha-primary-color);
    }
}

.sidebar .wc-block-product-categories-list-item {
    display: flex;
    align-items: center;
}

.sidebar .wc-block-product-categories-list-item-count {
    margin-#{$left}: auto;
}

.sidebar.shop-sidebar {
    position: relative;
    padding: var(--alpha-gap);

    .sidebar-content {
        padding: 2rem;
    }

    .filter-actions {
        margin-bottom: 3.9rem;
        padding: 0 1rem 3rem;
        border-bottom: 1px solid var(--alpha-change-border-color);

        label {
            font-size: 1.6rem;
            font-weight: 600;
            letter-spacing: -.025em;
            color: var(--alpha-change-color-dark-1);
        }

        @include mq(lg, 'max') {
            padding: 1.8rem 1rem 2.8rem;
        }
    }

    &.sidebar-offcanvas .filter-actions {
        padding-top: 1.8rem;
    }

    .filter-clean {
        color: var(--alpha-primary-color);

        &:hover {
            color: var(--alpha-primary-color-hover);
        }
    }

    .widget {
        margin-bottom: 1rem;
    }

    .widget-products .slider-wrapper {
        margin-bottom: 2.7rem;
    }

    .btn-outline:not(:hover) {
        color: var(--alpha-primary-color);
        background: var(--alpha-change-color-light-1);
    }

    .sidebar-toggle-btn {
        padding: .8em 1.04em;
        min-width: 87px;

        i {
            font-size: 13px;
        }
    }

    .yith-woo-ajax-navigation li,
    .widget .wc-layered-nav-term,
    .widget-price-filter li,
    .widget_product_categories .cat-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .yith-wcan-list .empty {
        text-decoration: line-through;
    }
}

.sidebar {
    .filter-actions+.widget {
        border-top: none;
        padding-top: 0;

        .widget-title {
            padding-top: 0;
        }
    }

    .filter-actions+.widget_block [class*=wp-block-woocommerce-] h3,
    .filter-actions+.widget_block h2 {
        padding-top: 0;
    }

    .woocommerce-widget-layered-nav-swatch {
        .wc-layered-nav-term a {
            padding-#{$left}: 2.4em;

            &:before,
            img {
                width: 2.45em;
                height: 2.45em;
                line-height: calc(2.45em - 2px);
            }
        }

        a.color {
            &:before {
                border: none;
                border-radius: 50%;
                line-height: 2.45em;
            }
        }

        a.color:before,
        .chosen>a.color:before {
            background-color: var(--alpha-swatch-color);
        }

        a.label {
            padding-#{$left}: 2.4em;

            &:before {
                padding: 0 5px;
                width: auto;
                min-width: 2.45em;
                font-weight: 400;
                color: var(--alpha-dark-body-color);
                border-color: var(--alpha-grey-color);
                transition: color .3s, border-color .3s;
            }

            &:hover:before {
                color: var(--alpha-primary-color);
                border-color: var(--alpha-primary-color);
            }
        }

        .chosen>.label:hover:before {
            color: var(--alpha-white-color);
        }

        a.label:before,
        .chosen>a.label:before {
            content: var(--alpha-swatch-label);
            font-family: inherit;
        }

        a.image:before {
            border: none;
            z-index: 1;
            line-height: 2.45em;
        }

        a.image:before,
        .chosen>a.image:before {
            background: transparent;
        }
    }

    .woocommerce-widget-layered-nav-swatch.vertical {
        .label {
            padding: side-values(.5rem 0);

            &:before {
                display: block;
                position: relative;
                font-size: .8em;
                transform: none;
            }
        }
    }

    .widget .woocommerce-widget-layered-nav-swatch.vertical {
        margin-top: 0;
        margin-bottom: 3.5rem;
    }

    .woocommerce-widget-layered-nav-swatch.horizontal {
        display: flex;
        align-items: center;
        flex-wrap: wrap;

        a {
            padding: 0;
            margin: side-values(1rem 1rem 0 0);

            &:before,
            img {
                display: block;
                position: relative;
                transform: none;
            }
        }

        .label:before {
            font-size: .9em;
        }

        a.image:before {
            position: absolute;
            background: transparent;
            top: 0;
        }
    }

    .widget .woocommerce-widget-layered-nav-swatch.horizontal {
        margin-bottom: 4rem;
    }
}

.shop-sidebar .widget>:last-child.wp-block-group>.wp-block-group__inner-container>:last-child {
    margin-bottom: 3rem;
}

.shop-sidebar.sidebar-offcanvas {
    padding: 0;
}

@include mq(lg) {
    .sidebar-fixed.left-sidebar.shop-sidebar {
        max-width: var(--alpha-left-sidebar-width, 25%);
        flex: 0 0 var(--alpha-left-sidebar-width, 25%);
    }

    .sidebar-fixed.right-sidebar.shop-sidebar {
        max-width: var(--alpha-right-sidebar-width, 25%);
        flex: 0 0 var(--alpha-right-sidebar-width, 25%);
    }

    .sidebar-fixed.left-sidebar.shop-sidebar~.main-content {
        max-width: calc(100% - var(--alpha-left-sidebar-width, 25%));
    }

    .sidebar-fixed.right-sidebar.shop-sidebar~.main-content {
        max-width: calc(100% - var(--alpha-right-sidebar-width, 25%));
    }
}

.sidebar {
    .widget.widget-price-filter .alpha-price-range-wrapper {
        margin-top: .7rem;

        ul {
            margin-bottom: 1.3rem;
        }
    }

    .alpha-product-prices {
        .chosen a {
            color: var(--alpha-primary-color);
        }
    }

    .alpha-price-range {
        input {
            color: var(--alpha-grey-color);
            border: 1px solid var(--alpha-change-color-light-3);
            border-radius: var(--alpha-corner-sm);
            width: 62px;
            height: 37px;
            padding: 3px 6px;
            line-height: 37px;
            text-align: center;
            vertical-align: middle;
        }

        button {
            margin-#{$left}: 1rem;
        }

        .delimiter {
            width: 24px;
            display: inline-block;
            vertical-align: middle;
            position: relative;

            &:before {
                content: '';
                display: block;
                width: 8px;
                height: 2px;
                margin: 0 auto;
                background-color: var(--alpha-grey-color);
            }
        }
    }
}

.sidebar-fixed .yith-wcan-reset-navigation {
    padding: 1rem;
    font-size: 11px;
    margin-top: 12px;
}

.shop-sidebar .yith-woo-ajax-reset-navigation {
    display: none !important;
}

// Filter Action, Price Slider, Filter Clean
.toolbox .btn-link {
    padding: 0;
}

.filter-clean {
    font-size: 1.4rem;
    margin-#{$left}: auto;
}

// Products Widget - Single Product Page
// .widget-products {
// 	.widget-title {
// 		display: inline-block;
// 		position: relative;
// 		z-index: 3;
// 		border-bottom: 2px solid var(--alpha-body-color);
// 	}
// 	.sidebar &.widget .widget-title {
// 		margin-bottom: -1px;
// 	}
// 	> .slider-wrapper:nth-child(2) {
// 		border-top: 1px solid var(--alpha-change-border-color);
// 		padding-top: 1rem;
// 	}
// }

// Responsive
@include mq(lg) {
    .sticky-sidebar-fixed>.filter-actions {
        visibility: hidden;
    }

    .sidebar-fixed.shop-sidebar {

        .sidebar-content {
            padding: 0 0 2rem;
        }

        // 5. Toggle Fixed Sidebar
        transition: margin .4s;

        ~.main-content {
            //transition: flex-basis .4s, max-width .4s;
            transition: flex .3s, max-width .3s;
        }
    }
}

@include mq(lg, max) {
    .horizontal-sidebar .sidebar-content {
        width: var(--alpha-left-sidebar-width, 28rem);
    }

    .sidebar.shop-sidebar {
        padding: 0;
    }
}

// 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 30px 0;
}

@include mq(xs, max) {
    .sticky-toolbox.fixed {
        padding-left: 20px;
        padding-right: 20px;
    }
}

.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: var(--alpha-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.4rem;
}

// 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: .9rem .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: var(--alpha-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);
        }
    }
}