// /**
//  * Copyright Â© Magento, Inc. All rights reserved.
//  * See COPYING.txt for license details.
//  */

//
//  Variables
//  _____________________________________________

@minicart__border-color: @color-gray80;
@minicart__padding-horizontal: @indent__base;

@minicart-qty__height: 24px;

//
//  Common
//  _____________________________________________

& when (@media-common = true) {

    //
    //  Minicart
    //  ---------------------------------------------

    .block-minicart {
        .items-total {
            float: left;
            margin: 0 @indent__s;

            .count {
                font-weight: @font-weight__bold;
            }
        }

        .subtotal {
            margin: 0 @indent__s @indent__s;
            text-align: right;

            .label {
                &:extend(.abs-colon all);
            }
        }

        .amount {
            .price-wrapper {
                &:first-child {
                    .price {
                        font-size: @font-size__l;
                        font-weight: @font-weight__bold;
                    }
                }
            }
        }

        .subtitle {
            display: none;

            &.empty {
                display: block;
                font-size: 14px;
                padding: @indent__l 0 @indent__base;
                text-align: center;
            }
        }

        dl {
            &.product.options.list {
                display: inline-block;
                vertical-align: top;
            }
        }

        .text {
            &.empty {
                text-align: center;
            }
        }

        .block-content {
            > .actions {
                margin-top: 15px;

                > .secondary {
                    text-align: center;
                }

                > .primary {
                    margin: 0 @indent__s 15px;

                    .action {
                        &.primary {
                            &:extend(.abs-button-l all);
                            display: block;
                            width: 100%;
                        }
                    }
                }

                .paypal-logo {
                    margin-top: 15px;
                    text-align: center;
                }
            }
        }

        .block-category-link,
        .block-product-link,
        .block-cms-link,
        .block-banners {
            margin: 15px 0 0;
            text-align: center;
        }
    }

    .minicart-wrapper {
        .lib-dropdown(
            @_toggle-selector: ~'.action.showcart',
            @_options-selector: ~'.block-minicart',
            @_dropdown-list-width: 320px,
            @_dropdown-list-position-right: -10px,
            @_dropdown-list-pointer-position: right,
            @_dropdown-list-pointer-position-left-right: 12px,
            @_dropdown-list-z-index: 101,
            @_dropdown-toggle-icon-content: @icon-cart,
            @_dropdown-toggle-active-icon-content: @icon-cart,
            @_dropdown-list-item-padding: false,
            @_dropdown-list-item-hover: false,
            @_icon-font-position: before,
            @_icon-font-size: 22px,
            @_icon-font-line-height: 28px,
            @_icon-font-color: @minicart-icons-color,
            @_icon-font-color-hover: @minicart-icons-color-hover,
            @_icon-font-color-active: @minicart-icons-color
        );
        float: right;

        .block-minicart {
            .lib-css(padding, 25px @minicart__padding-horizontal);

            .block-title {
                display: none;
            }
        }

        .product {
            .actions {
                float: right;
                margin: -24px 0 0;

                > .primary,
                > .secondary {
                    display: inline;

                    &:not(:last-child) {
                        margin-right: 15px;
                    }
                }
            }
        }

        .action {
            &.close {
                height: 30px;
                position: absolute;
                right: 0;
                top: 0;
                width: 25px;
                .lib-button-reset();
                .lib-button-icon(
                    @icon-remove,
                    @_icon-font-color: @minicart-icons-color,
                    @_icon-font-size: 14px,
                    @_icon-font-line-height: 14px,
                    @_icon-font-text-hide: true
                );
            }

            &.showcart {
                white-space: nowrap;

                .text {
                    &:extend(.abs-visually-hidden all);
                }

                .counter.qty {
                    .lib-css(background, @active__color);
                    .lib-css(color, @page__background-color);
                    .lib-css(height, @minicart-qty__height);
                    .lib-css(line-height, @minicart-qty__height);
                    border-radius: 2px;
                    display: inline-block;
                    margin: 3px 0 0;
                    min-width: 18px;
                    overflow: hidden;
                    padding: 0 3px;
                    text-align: center;
                    white-space: normal;

                    &.empty {
                        display: none;
                    }

                    .loader {
                        > img {
                            .lib-css(max-width, @minicart-qty__height);
                        }
                    }
                }

                .counter-number {
                    text-shadow: 0 0 7px rgba(0, 0, 0, 1);
                }

                .counter-label {
                    &:extend(.abs-visually-hidden all);
                }
            }
        }

        .minicart-widgets {
            margin-top: 15px;
        }
    }

    .minicart-items-wrapper {
        .lib-css(border, 1px solid @minicart__border-color);
        .lib-css(margin, 0 -@minicart__padding-horizontal);
        border-left: 0;
        border-right: 0;
        overflow-x: auto;
        padding: 15px;
    }

    .minicart-items {
        .lib-list-reset-styles();

        .product-item {
            padding: @indent__base 0;

            &:not(:first-child) {
                .lib-css(border-top, 1px solid @minicart__border-color);
            }

            &:first-child {
                padding-top: 0;
            }

            > .product {
                &:extend(.abs-add-clearfix all);
            }
        }

        .product-image-wrapper {
            &:extend(.abs-reset-image-wrapper all);
        }

        .product-item-pricing {
            .label {
                display: inline-block;
            }
        }

        .price-minicart {
            margin-bottom: @indent__xs;
        }

        .product-item-name {
            font-weight: @font-weight__regular;
            margin: 0 0 @indent__s;

            a {
                .lib-css(color, @link__color);
            }
        }

        .product-item-details {
            padding-left: 88px;

            .price {
                font-weight: @font-weight__bold;
            }

            .price-including-tax,
            .price-excluding-tax {
                margin: @indent__xs 0;
            }

            .weee[data-label] {
                .lib-font-size(11);
                .label {
                    &:extend(.abs-no-display all);
                }
            }

            .details-qty {
                margin-top: @indent__s;
            }

            .product {
                .options {
                    &.list {
                        &:extend(.abs-product-options-list all);
                        &:extend(.abs-add-clearfix all);
                    }
                }
            }
        }

        .product {
            > .product-item-photo,
            > .product-image-container {
                float: left;
            }

            .toggle {
                &:extend(.abs-toggling-title all);
                border: 0;
                padding: 0 0 @indent__xs 0;
                white-space: nowrap;

                &:after {
                    .lib-css(color, @color-gray56);
                    margin: 0 0 0 @indent__xs;
                    position: static;
                }
            }

            .active {
                > .toggle {
                    .lib-icon-font-symbol(
                        @_icon-font-content: @icon-up,
                        @_icon-font-position: after
                    );
                }
            }

            &.pricing {
                margin-top: 3px;
            }

            &.options {
                .toggle {
                    &.tooltip {
                        .lib-icon-font(
                            @icon-down,
                            @_icon-font-size: 12px,
                            @_icon-font-line-height: 12px,
                            @_icon-font-text-hide: true,
                            @_icon-font-margin: -3px 0 0 7px,
                            @_icon-font-position: after
                        );
                    }

                    > span {
                        &:extend(.abs-visually-hidden-reset all);
                    }
                }

                .details {
                    display: none;
                }
            }
        }

        .details-qty,
        .price-minicart {
            .label {
                &:extend(.abs-colon all);
            }
        }

        .item-qty {
            text-align: center;
            width: 60px;
        }

        .update-cart-item {
            .lib-font-size(11);
            vertical-align: top;
        }

        .subtitle {
            display: none;
        }

        .action {
            &.edit,
            &.delete {
                .lib-icon-font(
                    @icon-edit,
                    @_icon-font-size: 18px,
                    @_icon-font-line-height: 20px,
                    @_icon-font-text-hide: true,
                    @_icon-font-color: @minicart-icons-color,
                    @_icon-font-color-hover: @primary__color,
                    @_icon-font-color-active: @minicart-icons-color
                );
            }

            &.delete {
                .lib-icon-font-symbol(
                    @_icon-font-content: @icon-trash
                );
            }
        }
    }
}

//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__xs) {
    .minicart-wrapper .block-minicart {
        width: 290px;
    }
}

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
    .minicart-wrapper {
        margin-top: @indent__s;
        .lib-clearfix();
        .product {
            .actions {
                float: left;
                margin: 10px 0 0 0;
            }
        }
        .update-cart-item {
            float: right;
        }
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .minicart-wrapper {
        margin-left: 13px;

        .block-minicart {
            width: 390px;
        }
    }
    .minilist .action.delete,
    .minicart-wrapper .action.edit {
        .lib-icon-font-size(
            @_icon-font-size: 16px
        );
    }
}
