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

@mobile-cart-padding: 15px;
@cart-price-color: @color-gray40;
@cart-item-cell-padding-top: 20px;
//
//  Common
//  _____________________________________________

& when (@media-common = true) {

    //
    //  Shopping cart
    //  ---------------------------------------------

    .checkout-cart-index {
        .page-title-wrapper {
            .page-title {
              font-size: 1.25rem;
              font-weight: 700;
              letter-spacing: -.03em;
              margin-bottom: 15px;
            }
        }
    }

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

    //  Summary block
    .cart-summary {
        @border-color__base: #e7e7e7;
        &:extend(.abs-add-box-sizing all);
        .lib-css(background, @sidebar__background-color);
        background: #fff;
        border-radius: 0;
        padding: 0 18px;
        border: 2px solid #e7e7e7;
        margin-bottom: 22.5px;
        > .title {
            font-size: 2.4rem;
            display: block;
            font-weight: 300;
            margin: 12px 0;
            line-height: 1.4;
            padding: 0;
        }
        .block {
            form:not(:last-of-type) {
                .fieldset {
                    margin: 0 0 10px;
                }
            }
            .price {
                font-weight: @font-weight__bold;
            }
            .field {
                margin: 0 0 10px;
                &.note {
                    display: none;
                }
            }
            .actions-toolbar {
                > .primary {
                    text-align: left;
                    .action.primary {
                        &:extend(.abs-revert-to-action-secondary all);
                        width: auto;
                    }
                }
            }

            .fieldset.estimate {
                > .legend,
                > .legend + br {
                    &:extend(.abs-no-display all);
                }
            }
            &:extend(.abs-cart-block all);
            .title {
                border-color: @border-color__base;
                border-top: 1px solid #ccc;
                cursor: pointer;
                margin-bottom: 0;
                position: relative;
                display: block;
                text-decoration: none;
                padding: 9px 36px 9px 0;

                &:after {
                    position: absolute;
                    right: 3px;
                    -webkit-font-smoothing: antialiased;
                    -moz-osx-font-smoothing: grayscale;
                    font-size: 12px;
                    line-height: 12px;
                    color: inherit;
                    content: '\f807';
                    font-family: 'porto-icons';
                    margin: 3px 0 0;
                    vertical-align: middle;
                    display: inline-block;
                    font-weight: normal;
                    overflow: hidden;
                    speak: none;
                    text-align: center;
                }
                strong {
                  letter-spacing: -.01em;
                  font-size: 14px;
                  font-weight: 600;
                }
            }
            .item-options {
                margin: 0 0 9px;
                .field {
                    .radio {
                        float: left;
                        margin-right: 8px;
                    }
                    .radio {
                        + .label {
                            display: block;
                            margin: 0;
                            overflow: hidden;
                            font-weight: 400;
                            line-height: 1.2;
                        }
                    }
                }
            }
        }
        .page-main & {
            .block {
                margin-bottom: 0;
            }
        }
        .checkout-methods-items {
            &:extend(.abs-reset-list all);
            margin: @indent__base 0 0;
            text-align: center;
            .action.primary.checkout {
                &:extend(.abs-button-l all);
                width: 100%;
                font-size: 15px;
                letter-spacing: normal;
                color: #fff;
                border: none;
            }
            .item {
                margin-bottom: @indent__m;
                &:last-child {
                    margin-bottom: 0;
                }
            }
        }
        .message {
            padding-left: @indent__base;
            > *:first-child:before {
                display: none;
            }
        }
        &:extend(.abs-adjustment-incl-excl-tax all);
    }

    //  Totals block
    .cart-totals {
        @border-color__base: #e7e7e7;
        font-size: 13px;
        padding-top: 10px;
        border-top: 1px solid #ccc;
        &:extend(.abs-sidebar-totals all);
        tbody,
        tfoot {
          .grand.totals {
            .amount,.mark {
              border-color: @border-color__base;
            }
            .mark {
                text-align: left;
                font-weight: 600;
                line-height: 1.4;
                border-top: 1px solid #ccc;
                font-size: 1.8rem;
                padding: 11px 9px 11px 0;
            }
            .amount {
                color: #222529;
                text-align: right;
                font-weight: 700;
                font-size: 18px;
                line-height: 1.4;
                padding: 11px 0 19px;
            }
            strong {
              margin: 0;
              font-weight: inherit;
              line-height: inherit;
              padding: 3px 0 0;
            }
          }
        }
    }

    //  Products table
    .cart {
      @border-color__base: #e7e7e7;
        &.table-wrapper {
            .product-item-name > a {
                font-size: 14px;
                font-weight: 500;
                margin-bottom: 0;
                white-space: normal;
                &, &:hover {
                    color: #08c;
                }
            }
            .product-image-container {
                background: none;
                display: block;
                border: 1px solid #ccc;
                border-radius: 5px;
                padding: 3px;
                aspect-ratio: unset;
            }
            .cart {
                thead {
                  tr th.col {
                    border-bottom: @border-width__base solid @border-color__base;
                      padding: 24px 10px 12px;
                      font-size: 14px;
                    font-weight: 600;
                    text-align: center;
                      &.item {
                          text-align: left;
                      }
                  }
                }
                tbody {
                    td {
                        border: 0;
                    }
                }
                > .item {
                    border-bottom: @border-width__base solid @border-color__base;
                    position: relative;
                }
            }
            .col {
                vertical-align: middle;
                &.price,
                &.subtotal,
                &.msrp {
                    font-size: 14px;
                    text-align: center;
                    .price {
                        font-size: 13px;
                        font-weight: inherit;
                        color: #444;
                    }
                }
                &.subtotal {
                  text-align: center;
                  .price {
                    color: #08c !important;
                    font-size: 13px;
                  }
                }
                &.qty {
                    text-align: center;
                    .label {
                        &:extend(.abs-visually-hidden all);
                    }
                    .field.qty {
                      position: relative;
                      display: block;
                      min-width: 67px;
                        .qty-changer {
                            display: inline-block;
                            vertical-align: middle;
                        }
                    }
                }
                > .price {
                    .lib-font-size(10);
                }
            }

            .item-actions {
                td {
                    padding-bottom: 0;
                    padding-left: @mobile-cart-padding;
                    padding-right: @mobile-cart-padding;
                    white-space: normal;
                }
            }
            .item {
                .col.item {
                    display: block;
                    min-height: 75px;
                    padding: 20px 10px;
                    position: relative;
                }
            }

            .actions-toolbar {
                &:extend(.abs-add-clearfix all);
                min-height: 20px;
                padding-bottom: 30px;
                position: relative;
                > .action-edit,
                > .action-delete {
                    position: absolute;
                    right: 16px;
                    top: 0;
                    .lib-icon-font(
                    @icon-edit,
                    @_icon-font-size: 18px,
                    @_icon-font-line-height: 20px,
                    @_icon-font-text-hide: true,
                    @_icon-font-color-hover: @primary__color,
                    @_icon-font-color-active: @minicart-icons-color
                    );
                }
                > .action-delete {
                    &:extend(.abs-action-button-as-link all);
                    right: 0;
                    .lib-icon-font-symbol(
                    @_icon-font-content: @icon-trash
                    );
                }
            }
            .action {
                margin-right: 15px;
                &:last-child {
                    margin-right: 0;
                }
                &.help.map {
                    &:extend(.abs-action-button-as-link all);
                    font-weight: @font-weight__regular;
                }
            }

            .product {
                &-item-photo {
                    display: block;
                    left: @mobile-cart-padding;
                    max-width: 80px;
                    padding: 0;
                    position: absolute;
                    top: 15px;
                    width: 100%;
                    border: 0;
                    border-radius: 0;
                    &:hover {
                      box-shadow: none;
                    }
                }
                &-item-name {
                    .lib-font-size(10);
                    display: block;
                    margin: 0;
                    margin-top: 10px;
                }
            }
            .gift-registry-name-label {
                &:after {
                    content: ':';
                }
            }

            //  Product options
            .item-options {
                margin-bottom: 0;
                &:extend(.abs-product-options-list all);
                &:extend(.abs-add-clearfix all);
            }

            .product-item-name + .item-options {
                margin-top: 8px;
            }

            .cart-tax-total {
                &:extend(.abs-tax-total all);
                &-expanded {
                    &:extend(.abs-tax-total-expanded all);
                }
            }
            .product-image-wrapper {
                &:extend(.abs-reset-image-wrapper all);
            }
            .action.configure {
                display: inline-block;
                margin: @indent__s 0 0;
            }
            .item .message {
                margin-top: @indent__base;
            }
        }
        &.actions {
          &:extend(.abs-action-cart-button all);
        }
    }

    //  Discount
    .cart-discount {
        border-bottom: @border-width__base solid @border-color__base;
        clear: left;
        &:extend(.abs-discount-block all);
        margin-top: 0;
        .actions-toolbar {
          &:extend(.abs-action-cart-button all);
        }
    }

    //  Empty cart
    .cart-empty {
        padding-left: 10px;
        padding-right: 10px;
    }

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

    .block-minicart {
        .block-content {
            >.actions {
                >.primary {
                    .action.primary {
                        display: block;
                        width: 100%;
                        padding: 10px 15px;
                        font-weight: 400;
                        text-transform: uppercase;
                        font-size: 15px;
                    }
                }
            }

            .minicart-items-wrapper {
                margin: 0 -15px;
            }

            .product-item {
                padding: 18px 0;
            }

            .product-item-photo {
                max-width: 76px;
                width: 100%;
            }

            .product-item-name {
                a {
                    font-size: 14px;
                }
            }

            .product-item-details {
                padding-left: 95px;
                text-align: left;
            }

            .product.actions {
                float: right;
                .primary {
                    margin-right: 15px;
                }

                .action {
                    > span {
                        border: 0;
                        clip: rect(0, 0, 0, 0);
                        height: 1px;
                        margin: -1px;
                        overflow: hidden;
                        padding: 0;
                        position: absolute;
                        width: 1px;
                    }

                    &:before {
                        -webkit-font-smoothing: antialiased;
                        -moz-osx-font-smoothing: grayscale;
                        color: #08c;
                        content: '\f826';
                        font-family: 'porto-icons';
                        vertical-align: middle;
                        display: inline-block;
                        font-weight: normal;
                        overflow: hidden;
                        speak: none;
                        text-align: center;
                        font-size: 16px;
                        line-height: inherit;
                    }
                }

                .delete {
                    &:before {
                        content: '\f81a';
                        font-size: 18px;
                        line-height: 20px;
                    }
                }
            }
        }
    }
}

//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    .cart {
        .table.items {
            .col.item,
            .item-actions td {
                &:extend(.abs-col-no-prefix all);
            }
            .col.qty {
                text-align: center;
            }
            tbody > tr > td:last-child {
                &:extend(.abs-no-border-bottom-top all);
            }
        }
    }
    .cart-totals {
        .totals {
            &:extend(.abs-sidebar-totals-mobile all);
        }
    }
}

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
    .checkout-cart-index {
        .page-main {
            padding-left: 0;
            padding-right: 0;

            .page-title-wrapper {
                padding-left: 15px;
                padding-right: 15px;
            }

            .cart-summary {
                padding: 1px 0 22.5px;
                border-width: 1px;

                .summary.title {
                    display: none;
                }

                .title {
                    padding: 9px 36px 9px 15px;
                }

                .cart-totals {
                    padding-left: 15px;
                    padding-right: 15px;
                }

                .checkout-methods-items {
                    margin: 18px 0 0;
                    padding: 0 15px;
                    text-align: center;

                }
            }

            .block.discount {
                .title {
                    border-top: 1px solid @border-color__base;
                    cursor: pointer;
                    margin-bottom: 0;
                    position: relative;
                    padding: 9px 36px 9px 15px;
                    display: block;
                    text-decoration: none;

                    &:after {
                        position: absolute;
                        right: 18px;
                        top: 9px;
                        -webkit-font-smoothing: antialiased;
                        -moz-osx-font-smoothing: grayscale;
                        font-size: 12px;
                        line-height: 12px;
                        color: #858585;
                        content: '\f807';
                        font-family: 'porto-icons';
                        margin: 3px 0 0;
                        vertical-align: middle;
                        display: inline-block;
                        font-weight: normal;
                        overflow: hidden;
                        speak: none;
                        text-align: center;
                    }
                }

                .content {
                    padding: 5px 15px 23px;
                }
            }
        }
    }
    //  Cart container
    @border-color__base: #e7e7e7;
    .cart-container {
        .form-cart {
            .actions.main {
                text-align: center;
            }
        }
    }

    .cart-discount {
        border-bottom: @border-width__base solid @border-color__base;
        margin-top: 0;
    }

    .cart {
        &.table-wrapper {
          border-top: @border-width__base solid @border-color__base;
          thead {
              .col {
                  &.item,
                  &.qty,
                  &.price,
                  &.subtotal,
                  &.msrp {
                      display: none;
                  }
              }
          }
          .col {
              &.qty,
              &.price,
              &.subtotal,
              &.msrp {
                  box-sizing: border-box;
                  display: block;
                  float: left;
                  white-space: nowrap;
                  width: 33%;
                  text-align: center;
                  &:before {
                      content: attr(data-th);
                      display: block;
                      font-weight: @font-weight__semibold;
                      padding-bottom: 10px;
                  }
              }
              &.msrp {
                  white-space: normal;
              }
          }
          .item .col.item {
              display: flex;
              align-items: center;
              gap: 10px;
              padding-bottom: 0;
          }
          tbody > tr > td:last-child {
              border: 0;
          }
          .product-item-photo {
            position: relative;
            left: 0;
            top: 0;
            margin: 0;
            min-height: auto;
          }
          .product-item-name + .item-options {
              margin-top: 0;
              text-align: center;
              display: inline-block;
          }
          .product-item-details {
            text-align: center;
          }
        }
    }

    .cart-totals {
        .table-wrapper {
            border-top: 0;
        }
        .totals {
            tbody > tr:not(:last-child) > td:last-child {
                border: 0;
            }
        }
    }
}

//
//  Common
//  _____________________________________________

& when (@media-common = true) {
    //  Cross sell
    .block {
        &.crosssell {
            .lib-css(padding, 0 @mobile-cart-padding);
            margin-top: 70px;
            .product-item-info {
                width: 200px;
            }
        }
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .checkout-cart-index {
        .page-main {
            padding-left: 15px;
            padding-right: 15px;
        }
        .page-title-wrapper {
            &:extend(.abs-revert-side-paddings all);
        }
    }

    //  Cart container
    .cart-container {
        &:extend(.abs-add-clearfix-desktop all);
        .form-cart {
            &:extend(.abs-shopping-cart-items-desktop all);
            .actions.main {
                text-align: right;
            }
        }
        .widget {
            float: left;
        }
    }

    //  Summary block
    .cart-summary {
        .lib-layout-column(2, 2, @layout-column-checkout__width-left);
        padding: 1px 18px 22.5px;
        > .title {
            display: block;
        }
        .fieldset {
            .actions-toolbar {
                margin-left: 0;
                > .secondary {
                    float: none;
                }
            }
        }
        .block {
            .content {
                padding-left: 10px;
                padding-right: 10px;
            }
            .fieldset {
                .field {
                    .lib-form-field-type-revert(@_type: block);
                    margin: 0 0 @indent__s;
                }
            }
        }
        .checkout-methods-items {
            padding: 0;
        }
    }

    //  Products table
    .cart {
        &.table-wrapper {
            .items { // Google Chrome version 44.0.2403.107 m fix
                min-width: 100%;
                width: auto;
            }
            tbody td {
                padding-top: @cart-item-cell-padding-top;
            }

            .item {
                .col.item {
                    padding: 20px 8px 18px 0;
                }
            }

            .item-actions td {
                padding: 0;
            }

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

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

    //  Discount
    .cart-discount {
        &:extend(.abs-discount-block-desktop all);
        .lib-layout-column(2, 1, @layout-column-checkout__width-main);
        border: 0;
        box-sizing: border-box;
        padding-right: 4%;
    }

    //  Empty cart
    .cart-empty {
        &:extend(.abs-revert-side-paddings all);
    }

    //  Cross sell
    .block {
        &.crosssell {
            .lib-layout-column(2, 1, @layout-column-checkout__width-main);
            &:extend(.abs-add-box-sizing-desktop all);
            padding: 0 4% 0 0;
            .products-grid .product-item {
                width: (100%/4);
            }
        }
    }
}
