/**
 * Copyright Â© 2021 O2TI. All rights reserved.
 * @author  Bruno Elisei <brunoelisei@o2ti.com>
 * See LICENSE.txt for license details.
 */

//
//  Common
//  _____________________________________________

& when (@media-common = true) {
    .theme-full-checkout-payment-additional {
        &:extend(.abs-theme-full-checkout-title-collapsible all);

        .theme-full-checkout-form-discount {
            &:extend(.abs-theme-full-checkout-discount-code all);
        }
    }

    .body-full-checkout {
        .full-checkout {
            .opc-block-summary {
                .lib-css(background, unset);
                .lib-css(margin, 0 0 @theme-full-checkout-sidebar__margin);
                .lib-css(padding, @theme-full-checkout-summary__padding);
                &:extend(.abs-add-box-sizing all);

                > .title {
                    &:extend(.abs-checkout-title all);

                    display: block;
                }

                .block {
                    .lib-css(margin-bottom, 0);
                }

                //  Totals table
                .table-totals {
                    &:extend(.abs-sidebar-totals all);
                    .lib-css(border-top, unset);
                }

                .mark {
                    .value {
                        .lib-css(color, @theme-full-checkout-summary-mark-value__color);

                        display: block;
                    }
                }

                .grand.incl {
                    & + .grand.excl {
                        .mark,
                        .amount {
                            border-top: 0;
                            .lib-font-size(14);

                            padding-top: 0;

                            strong {
                                font-weight: @font-weight__regular;
                            }
                        }
                    }
                }

                .not-calculated {
                    font-style: italic;
                }

                .items-in-cart {
                    &:extend(.abs-theme-full-checkout-title-collapsible all);

                    .product {
                        padding: 0;
                        position: relative;

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

                .minicart-items-wrapper {
                    .lib-css(margin, 0 -(@theme-full-checkout-summary-items__padding) 0 0);
                    .lib-css(max-height, @theme-full-checkout-summary-items__max-height);
                    .lib-css(padding, @theme-full-checkout-summary-items__padding @theme-full-checkout-summary-items__padding 0 0);

                    border: 0;
                }

                .column.main & {
                    .product-item {
                        padding: 0;
                        .lib-css(padding-top, @indent__base);

                        &::first-child {
                            .lib-css(padding-top, 0);
                        }
                    }
                }

                .product-item {
                    .lib-font-size(13);

                    .product-item-details {
                        &:extend(.abs-add-clearfix all);

                        padding-left: 0;
                        width: 100%;
                    }

                    .product-image-container {
                        flex: 1;
                        flex-shrink: 1;
                        margin: 0;
                    }

                    .product-item-inner {
                        align-items: center;
                        box-sizing: border-box;
                        display: flex;
                        flex-direction: row;
                        justify-content: space-around;
                    }

                    .product-item-name-block {
                        display: block;
                        flex: 3;
                        flex-shrink: 3;
                        margin-left: @indent__base;
                        padding-right: @indent__xs;
                        text-align: left;

                        .product-item-name {
                            font-size: 1.5rem;
                        }
                    }

                    .subtotal {
                        display: block;
                        flex: 1;
                        flex-shrink: 1;
                        text-align: left;
                    }

                    .price {
                        .lib-font-size(13);

                        font-weight: @font-weight__regular;
                    }

                    .price-including-tax {
                        & + .price-excluding-tax {
                            .price {
                                .lib-font-size(10);
                            }
                        }
                    }

                    .message {
                        margin-top: 10px;
                    }
                }

                .actions-toolbar {
                    position: relative;
                    z-index: 1;

                    .secondary {
                        border-top: @border-width__base solid @border-color__base;
                        display: block;
                        margin: -1px 0 0;
                        padding: 0;
                        text-align: center;
                        width: 100%;

                        .action {
                            margin: 0;
                            line-height: 2;
                        }
                    }
                }
            }

            .opc-block-previous-steps-information {
                padding: @theme-full-checkout-summary__padding;

                .previous-steps-information-block {
                    &:extend(.abs-theme-full-checkout-title-collapsible all);

                    .previous-steps-information-block-items {
                        margin-top: @indent__base;
                    }

                    .previous-steps-information-title,
                    .identification-information-title,
                    .shipping-information-title {
                        .lib-font-size(14);
                        .lib-css(line-height, 40px);
                    }

                    .opc-block-identification-information,
                    .opc-block-shipping-information {
                        padding-left: 0;
                        padding-right: 0;
                    }
                }
            }
        }
    }
}

//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    .body-full-checkout {

        .full-checkout {

            .opc-block-summary {

                .lib-css(margin, @indent__base @indent__base + @indent__s 0 @indent__base);
                .lib-css(padding, 0);

                > .title {
                    &:extend(.abs-theme-full-checkout-title-sessions all);
                }

                .totals {
                    &:extend(.abs-sidebar-totals-mobile all);
                }

                .minicart-items {
                    .lib-css(background, @color-white);
                }
            }

            .opc-block-previous-steps-information {
                .lib-css(margin, @indent__base @indent__base + @indent__s 0 @indent__base);
                .lib-css(padding, 0);
            }

            .opc-block-summary .minicart-items .product-item .product .product-image-container .product-image-wrapper img {
                max-width: 100px;
            }
        }
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .body-full-checkout {
        .full-checkout {
            .opc-summary-wrapper {
                .modal-header {
                    .action-close {
                        display: none;
                    }
                }
            }
        }
    }
}

//
//  Tablet
//  _____________________________________________

@media only screen and (max-width: @screen__m) {
    .body-full-checkout {
        .full-checkout {
            .opc-block-summary {
                .product-item {
                    .product-item-inner {
                        display: flex;
                    }

                    .product-item-name-block {
                        display: block;
                        text-align: left;
                    }

                    .subtotal {
                        display: block;
                        text-align: left;
                    }
                }
            }
        }
    }
}
