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

//
//  Common
//  _____________________________________________

// Gobal product style
& when (@media-common = true) {

    //
    //  Shopping cart
    //  ---------------------------------------------
    .column.main{
        .cart-summary .block > .title, 
        .paypal-review-discount .block > .title{
            text-align: left;
            padding-left: 2rem;
            line-height: 1;
            padding-top: 1.7rem;
            padding-bottom: 1.7rem;
            strong{
                font-weight: @heading__font-weight__base;
                .lib-font-size(15);
            }
            &:after{
                right: 10px;
            }
        }
    }
    //  Summary block
    .cart-summary {
        background: @color-white;
        &:extend(.abs-add-box-sizing all);
        border: 1px solid @border-color__base;
        margin-bottom: @indent__m; 
        > .title {
            display: block;
            .lib-heading(h3);
            padding-left: 2rem;
            padding-top: 2rem;
            text-align: left;
            .lib-font-size(18);
        }

        .block {
            &:extend(.abs-discount-block all);
            margin-bottom: 0;
            margin-top: 10px;
            .item-options {
                margin-left: 0;

            }
             > .title{
                &:after{
                    top: 50% !important;
                    @transform: translateY(-50%);
                    .lib-css(transform, @transform, 1);
                }
             }
            .fieldset {
                margin: 15px 0 15px;
                &.rate{
                    margin-top: 0;
                }
                .field {
                    margin: 0 0 @indent__s;

                    &.note {
                        font-size: @font-size__s;
                    }
                }

                .methods {
                    .field {
                        > .label {
                            display: inline;
                        }
                    }
                }
            }

            .fieldset.estimate {
                > .legend,
                > .legend + br {
                    &:extend(.abs-no-display all);
                }
            }
        }
        .actions-toolbar {
            > .primary {
                button {
                    &:extend(.abs-revert-secondary-color all);
                }
            }
        }
        &:extend(.abs-adjustment-incl-excl-tax all);
        #block-shipping,
        .block.discount{
            .table-wrapper,
            .content{
                padding-left: 16px;
                padding-right: 16px;
            }
        }
        .block.discount{
            > .title{
                padding-top: 15px;
                padding-bottom: 15px;
            }
        }
    }

    //  Totals block
    .cart-totals {
        border-top: 1px solid @border-color__base;
        padding-top: @indent__s;
        padding-left: 16px;
        padding-right: 16px;
        &:extend(.abs-sidebar-totals all);

        .table-wrapper {
            margin-bottom: 0;
            overflow: inherit;
        }
        .discount.coupon {
            display: none;
        }
        .grand .mark,
        .mark{
            padding-top: 8px;
        }
        .grand .amount,
        .amount{
            padding-top: 8px;
        }
    }
    .block.discount{
        #discount-coupon-form{
            margin-bottom: 3rem;
        }
    }
    //  Products table
    .cart.table-wrapper {
        margin-bottom: 3rem;
        .items {
            border: 1px solid @border-color__base;
            thead + .item {
                border-top: @border-width__base solid @border-color__base;
            }

            > .item {
                border-bottom: @border-width__base solid @border-color__base;
                position: relative;
                background: @color-white;
            }
        }
        tbody,
        tr{
            th{
                border-bottom: 0;
            }
            th,
            td{
                border: 1px solid @border-color__base;

            }
            td{
                &:first-child{
                    border: 0;
                }
            }
        }
        .col {
            padding-top: 0.5rem;
            &.qty {
                .input-text {
                    margin-top: -5px;
                    &:extend(.abs-input-qty all);
                }

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

        .item {
            &-actions td {
                padding-bottom: @indent__s;
                text-align: center;
                white-space: normal;
            }

            .col {
                &.item {
                    display: block;
                    min-height: 75px;
                    padding: @indent__m 0 @indent__s 75px;
                    position: relative;
                }
            }
        }
        .box-tocart .up-down{
            margin: auto;
        }
        .actions-toolbar {
            &:extend(.abs-add-clearfix all);

            > .action {
                &:extend(button all);
                .lib-link-as-button();
                margin-bottom: @indent__s;
                margin-right: @indent__s;

                &:last-child {
                    margin-right: 0;
                }
            }
            a{
                display: block;
                font-size: 0;
                .lib-icon-font(
                    @icon-wishlist-empty,
                    @_icon-font-size: 24px,
                    @_icon-font-line-height: 24px,
                    @_icon-font-text-hide: true,
                    @_icon-font-color: @heading__color__base,
                );
                &.action-edit{
                    .lib-icon-font(
                        @icon-settings,
                        @_icon-font-size: 20px,
                        @_icon-font-line-height: 24px,
                        @_icon-font-color: @heading__color__base,
                    );
                }
               
                &.action-delete{
                    .lib-icon-font-symbol(
                        @icon-remove,
                    );
                }
            }
        }

        .action {
            &.help.map {
                &:extend(.abs-action-button-as-link all);
                font-weight: @font-weight__regular;
            }
        }

        .product {
            &-item-photo {
                display: block;
                left: 0;
                max-width: 60px;
                padding: 0;
                position: absolute;
                top: 15px;
                width: 100%;
            }

            &-item-details {
                white-space: normal;
            }

            &-item-name {
                display: inline-block;
                font-weight: @font-weight__regular;
                margin-top: -6px;
            }
        }

        .gift-registry-name-label {
            &:after {
                content: ':';
            }
        }

        //  Product options
        .item-options {
            font-size: @font-size__s;
            margin-bottom: @indent__s;
            &:extend(.abs-product-options-list all);
            &:extend(.abs-add-clearfix all);
            dt{
                color: @heading__color__base;
            }
        }

        .product-item-name + .item-options {
            margin-top: @indent__s;
        }

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

        .action.configure {
            display: inline-block;
            margin: 0 0 @indent__base;
        }
    }

    .cart-container {
        .form-cart {
            &:extend(.abs-shopping-cart-items all);
        }

        .checkout-methods-items {
            &:extend(.abs-reset-list all);
            text-align: center;
            padding: 0 1.6rem 2rem;
            margin-top: 2rem;
            .action.primary {
                &:extend(.abs-button-l all);
                width: 100%;
                padding-left: 1rem;
                padding-right: 1rem;
            }

            .item {
                & + .item {
                    margin-top: 12px;
                }
                .action{
                    &:not(:hover){
                        color: @button__color;
                    }
                    &.multicheckout{
                        &:not(:hover){
                            color: @heading__color__base;
                        }
                    }
                }
            }
        }
    }

    //  Products pager
    .cart-products-toolbar {
        .toolbar-amount {
            margin: @indent__m 0 15px;
            padding: 0;
            text-align: center;
        }

        .pages {
            margin: 0 0 @indent__m;
            text-align: center;

            .items {
                > .item {
                    border-bottom: 0;
                }
            }
        }
    }

    .cart-products-toolbar-top {
        border-bottom: @border-width__base solid @border-color__base;
    }

    //
    //  Cross sell
    //  ---------------------------------------------

    .block.crosssell {
        margin-top: 70px;
    }

    .cart-tax-info,
    .cart .cart-tax-info {
        + .cart-tax-total {
            display: block;
        }
    }

    .cart.table-wrapper {
        .col{
            text-align: center;
        }
    }
    .account{
        .order-items.table-wrapper {
            .col{
                text-align: left;
                border: 1px solid @border-color__base;
                padding: 1rem 1.5rem;
                width: auto;
            }
            thead{
                tr{
                    th.col{
                        border-bottom: 0;
                    }
                }
            }
        }
        .order-details-items{
            border-bottom: 0;
            .item-options {
                margin-bottom: 0;
                dd{
                    margin-bottom: 0.8rem;
                }
            }
        }
    }
}

//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
    body .cart {
        &.table-wrapper {
            overflow: inherit;
            border: 1px solid @border-color__base;
            padding: 1rem;
            #shopping-cart-table{
                border: 0;
            }
            thead {
                .col {
                    &:not(.item) {
                        display: none;
                    }
                    &.item{
                        background: @border-color__base;
                        padding-top: 1rem;
                        padding-bottom: 1rem;
                    }
                }
            }
            tbody,
            tr{
                td{
                    border: 0;
                }
            }
            .cart.item{
                padding: 0 10px 10px;
            }
            .col {
                &.qty,
                &.price,
                &.subtotal,
                &.msrp {
                    box-sizing: border-box;
                    display: block;
                    float: left;
                    text-align: center;
                    white-space: nowrap;
                    width: 33%;

                    &[data-th]:before {
                        content: attr(data-th) ':';
                        display: block;
                        font-weight: @font-weight__bold;
                        padding-bottom: @indent__s;
                    }
                }

                &.msrp {
                    white-space: normal;
                }
            }
            .item {
                .flex();
                flex-direction: column;
                .item-actions{
                    position: absolute;
                    top: 0;
                    right: 8px;
                }
                .col.item {
                   text-align: left;
                   border-bottom: 1px solid @border-color__base;
                }
            }
            .product {
                &-item-photo {
                    top: 50%;
                    @transform: translateY(-50%);
                    .lib-css(transform, @transform, 1);
                }
            }
        }
    }

    .cart-container {
        .form-cart {
            &:extend(.abs-shopping-cart-items-mobile all);
            .actions{
                .flex();
                align-items: center;
                justify-content: space-around;
                .action{
                    margin: 10px;
                }
            }
        }
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .cart-container {
        &:extend(.abs-add-clearfix-desktop all);
        .form-cart {
            &:extend(.abs-shopping-cart-items-desktop all);
        }

        .widget {
            float: left;
        }
    }

    .cart-summary {
        float: right;
        position: relative;
        width: 23%;
        .actions-toolbar {
            .column.main & {
                &:extend(.abs-reset-left-margin-desktop all);
                > .secondary {
                    float: none;
                }
            }
        }

        .block {
            .fieldset {
                .field {
                    .lib-form-field-type-revert(@_type: block);
                    margin: 0 0 @indent__s;
                }
            }
        }
    }

    .cart {
        &.table-wrapper {
            .items { // Google Chrome version 44.0.2403.107 m fix
                min-width: 100%;
                width: auto;
            }

            .item {
                .col {
                    &.item {
                        padding: 12px 8px @indent__s;
                    }
                }

                &-actions {
                    td {
                        text-align: right;
                    }
                }
            }

            .product {
                &-item-photo {
                    display: table-cell;
                    max-width: 100%;
                    padding-right: @indent__base;
                    position: static;
                    vertical-align: top;
                    width: 1%;
                }

                &-item-details {
                    display: table-cell;
                    vertical-align: top;
                    white-space: normal;
                    width: 99%;
                }
            }

            .item-actions {
                @_transform: translateY(-120%);
                position: absolute;
               .lib-css(transform, @_transform, @_prefix: 1);
                z-index: 1;
                right: 0;
                .actions-toolbar {
                    text-align: left;
                    &:extend(.abs-reset-left-margin-desktop all);
                }
            }
        }

        .action {
            margin-bottom: @indent__s;
        }
    }

    //  Products pager
    .cart-products-toolbar {
        .toolbar-amount {
            line-height: 30px;
            margin: 0;
        }

        .pages {
            float: right;
            margin: 0 0 1px;

            .item {
                &:last-child {
                    margin-right: 0;
                }
            }
        }
    }

    .cart.table-wrapper {
        .cart-products-toolbar {
            + .cart {
                thead {
                    tr {
                        th.col {
                            padding-bottom: 7px;
                            padding-top: 8px;
                        }
                    }
                }
            }
        }

        .cart {
            + .cart-products-toolbar {
                margin-top: @indent__m;
            }
        }
    }
}
