//
//  Mixins
//  ----------------------------------

.am-flex-justify-content(
    @_value: flex-start
) {
    -ms-flex-pack: @_value;
    -webkit-justify-content: @_value;
    justify-content: @_value;
}

//
//  Common
//  ---------------------------------

& when (@media-common = true) {
    .amasty_xlanding-page-view {
        .products-grid .product-item {
            width: 100% / 3;
        }

        .products-grid .product-item-info {
            width: 240px;
        }

        .product-item-info {
            max-width: 100%;
        }
    }
}

//
//  Mobile +
//  --------------------------------------------

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    .amasty_xlanding-page-view .products-grid .product-item {
        & {
            margin-left: 0;
            width: 50%;
        }

        &:nth-of-type(2n) {
            .am-flex-justify-content(flex-end);
        }

        &:nth-of-type(2n + 1) {
            .am-flex-justify-content(flex-start);
        }
    }
}

//
//  Tablet
//  ------------------------------------

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .page-layout-empty .filter-options {
        margin-top: 10px;
    }

    .page-layout-empty .filter-options-item {
        & {
            position: relative;
            display: inline-block;
            margin-right: 25px;
            border: 0;
        }

        .filter-options-title {
            & {
                padding: 0 20px 0 0;
            }

            &:after {
                top: 3px;
                right: 2px;
            }
        }

        .filter-options-content {
            & {
                position: absolute;
                top: 100%;
                z-index: 3;
                display: none;
                padding: 5px;
                width: 180px;
                border: 1px solid #ccc;
                background: #fff;
                box-shadow: 0 3px 5px 0 rgba(50, 50, 50, .75);
            }

            &:before,
            &:after {
                position: absolute;
                top: -16px;
                left: 5px;
                z-index: 2;
                display: block;
                width: 0;
                height: 0;
                border: 8px solid transparent;
                border-bottom-color: #000;
                content: '';
            }

            &:after {
                z-index: 4;
                margin-top: 0;
                border-bottom-color: #fff;
            }
        }

        .item {
            & {
                margin: 0;
                padding: 5px;
            }

            &:hover {
                background-color: #e8e8e8;
            }

            a {
                margin-left: 0;
            }
        }
    }

    .amasty_xlanding-page-view .products-grid .product-items {
        & {
            .lib-vendor-prefix-display(flex);
            .lib-vendor-prefix-flex-wrap(wrap);
        }

        .product-item {
            .lib-vendor-prefix-display(flex);
            .am-flex-justify-content(center);
        }
    }

    .amasty-xlanding-columns3.amasty_xlanding-page-view .products-grid .product-items {
        .product-item {
            & {
                margin-left: 0;
                width: 100% / 3;
            }

            &:nth-of-type(3n) {
                .am-flex-justify-content(flex-end);
            }

            &:nth-of-type(3n + 1) {
                .am-flex-justify-content(flex-start);
            }
        }
    }

    .amasty-xlanding-columns4.amasty_xlanding-page-view .products-grid .product-items .product-item {
        & {
            margin-left: 0;
            width: 25%;
        }

        &:nth-of-type(4n) {
            .am-flex-justify-content(flex-end);
        }

        &:nth-of-type(4n + 1) {
            .am-flex-justify-content(flex-start);
        }
    }

    .amasty-xlanding-columns5.amasty_xlanding-page-view .products-grid .product-items {
        .product-item {
            & {
                margin-left: 0;
                width: 20%;
            }

            &:nth-of-type(5n) {
                .am-flex-justify-content(flex-end);
            }

            &:nth-of-type(5n + 1) {
                .am-flex-justify-content(flex-start);
            }
        }
    }
}

//
//  Desktop
//  -----------------------------------

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) {
    .amasty_xlanding-page-view .products-grid .product-items {
        margin: 0;
    }
}
