//
//  Amasty JetTheme compatibility
//  ____________________________________________

//
//  Variables
//  ---------------------------------------------

@theme-slick-arrows__size: 40px;
@theme-checked-label__size: 15px;
@theme-sorter-icon__size: 16px;
@theme-sorter__background: url('../svg/@{amtheme__icons__color-mode-prefix}/@{amtheme__icons__mode}/sort-view.svg') no-repeat 100% center/@theme-sorter-icon__size;
@theme-checked-checkbox__background: @form-element-checkbox__active__background @form-element-checkbox__checked__background-image center/@form-element-checkbox-icon__height no-repeat;
@amrev-comments-btn__color: @button__background;
@amrev-comments__active__color: @button__background;

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

& when (@media-common = true) {
    .amasty-jet-theme.amtheme-ismobile {
        .data.item.content .amrev-title-block.amreview-customer-review.pages {
            display: none;
        }
    }

    .amasty-jet-theme {
        .amreview-recommend-wrap,
        .amreview-gdpr-wrap {
            > .amreview-checkboxlabel:before,
            > .amreview-checkbox:checked ~ .amreview-checkboxlabel:after {
                margin: 0;
            }

            > .amreview-checkbox:checked ~ .amreview-checkboxlabel:before,
            > .amreview-checkbox:checked ~ .amreview-checkboxlabel:after {
                .lib-css(width, @form-element-choice__width);
                .lib-css(height, @form-element-choice__width);

                left: 0;
                margin: 0;
                padding: 0;
                top: 0;
            }

            > .amreview-checkbox:checked ~ .amreview-checkboxlabel:before {
                .lib-css(border, @form-element-choice__border);
            }

            > .amreview-checkbox:checked ~ .amreview-checkboxlabel:after {
                .lib-css(background, @theme-checked-checkbox__background);
            }

            > .amreview-checkboxlabel {
                padding-left: 30px;
                padding-right: 0;
            }

            > .amreview-checkboxlabel:before {
                left: 0;
                right: auto;
            }

            .mage-error[generated] {
                position: static;
            }
        }

        .amrev-reply .amrev-repbtn {
            padding: 4px 15px;
        }

        .amrev-reply .amrev-repbtn:before {
            display: none;
        }

        .amreview-gdpr-wrap .amreview-checkbox:not(:checked) {
            ~ .label-gdpr:after {
                background: unset;
                content: '';
            }
        }

        .amrev-voteqty,
        .amreview-helpful,
        .amreview-description,
        .amreview-checkboxlabel,
        .amreview-recommend-wrap,
        .amreview-adminanswer-block,
        .amreview-label > .amreview-stars,
        .amreview-summary-info .amreview-count,
        .amrev-comment-form .amrev-label,
        .review-field-image .amrev-input,
        .amrev-comment-form .amrev-input,
        .review-field-rating > .label,
        .amreview-summary-info .amreview-summary {
            .lib-css(color, @amtheme__text-secondary__color);
        }

        .amrev-sorting,
        .amreview-add-new,
        .amrev-comment-list,
        .amrev-comment-block,
        .amrev-toolbar-container,
        .amreview-widget-container.-summary-widget,
        .amreview-widget-container .amreview-review-items .amreview-review-wrapper.review-item {
            .lib-css(background, @amtheme__background-primary__color);
            .lib-css(color, @amtheme__text-secondary__color);
        }

        .amreview-title,
        .amreview-toolbar-wrap strong.page,
        .amreview-pages-items .amreview-item.-current {
            .lib-css(color, @amtheme__text-secondary__color);

            background: transparent;
        }

        .amrev-comment-form .amrev-input {
            .lib-css(background, @amtheme__background-tertiary__color);
            .lib-css(border-color, @amtheme__border__color);
        }

        .amrev-input:checked + .amrev-label:before {
            .lib-css(border-color, @amtheme__border__color);
        }

        .amreview-widget-container.-summary-widget .amreview-name {
            .lib-css(color, @amtheme__link__color);
        }

        .amreview-images.slick-slider .slick-arrow {
            background-size: auto !important; // use theme sizes and background
            filter: invert(.8);
            height: @theme-slick-arrows__size;
            width: @theme-slick-arrows__size;
        }

        .amshowmore-container .amshowmore-text:after {
            box-shadow: inset 0 -15px 10px 0 fade(@amtheme__background-tertiary__color, 70%);
        }

        .amreview-summary-details > .amreview-label:last-child > .amreview-bar {
            margin-left: 23px;
        }

        .amrev-label:before,
        .amrev-label:after {
            margin: 0;
        }

        .amrev-label:after {
            background-size: inherit;
            height: @theme-checked-label__size;
            width: @theme-checked-label__size;
        }

        .amrev-sorting {
            align-items: center;
            display: flex;
            flex-wrap: wrap;
        }

        .amrev-sorting .sorter-action:before {
            .lib-css(background, @theme-sorter__background);

            content: '';
            height: @theme-sorter-icon__size;
            left: 50%;
            position: absolute;
            top: 50%;
            transform: translate(-50%, -50%);
            width: @theme-sorter-icon__size;
        }

        .amrev-sorting .sorter-action {
            &:extend(.toolbar-sorter .amtheme-icon all);

            border-radius: 50%;
            box-sizing: border-box;
            position: relative;
        }

        .amrev-sorting .sorter-action:hover {
            opacity: .7;
        }

        .amrev-repbtn {
            background: @amtheme__background-primary__color;
        }

        .amreview-add-new .amreview-label {
            margin-bottom: 0;
        }
    }
}

//
//  Mobile
//  ---------------------------------------------

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
    body:not(.amtheme-ismobile) {
        .amtheme-reviews-aside.-amrev {
            display: none;
        }
    }
}

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

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) {
    .amasty-jet-theme {
        .amreview-add-new {
            flex-grow: .4;
            text-align: right;
        }
    }
}

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .amtheme-reviews-aside.-amrev {
        display: none;
    }

    .amrev-toolbar-container .amrev-sorting {
        flex-basis: 265px;
    }

    .amasty-jet-theme.-amcaret-enabled .amreview-add-new {
        text-align: left;
    }

    .amasty-jet-theme.-amcaret-enabled .amreview-label {
        padding-top: 5px;
    }
}
