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

//
//  Common
//  _____________________________________________

& when (@media-common = true) {

    .order-links {
        .item {
            box-sizing: border-box;
            float: none;
            width: 100%;
            margin: 0 0 5px;
            display: block;
            strong,
            a {                
                height: 50px;
                line-height: 38px;
                font-size: 1.6rem;
                color: #fff;
                background: #000;

                text-decoration: none;                
                letter-spacing: -0.03em;
                overflow: hidden;
                text-transform: uppercase;
                position: relative;
                display: block;
                z-index: 2;
                padding:6px 20px;
                border: none;
                border-bottom: none;
                font-weight: @font-weight__black;
            }
            &.current{
                strong{
                    background:@main-color;
                    color:#000;
                }
            }
        }
    }
    .account .column.main .order-details-items {
        margin-bottom: 40px;
    }
    .order-details-items {
        background:#f8f8f8;
        margin-bottom: 40px;
        padding: 25px;
        .actions-toolbar {
            > .secondary {
                .action.back {
                    display: none;
                }
            }
            .action{
                font-weight: @font-weight__bold;
                font-size: 14px;
                text-transform: uppercase;
                margin-bottom: 10px;
                padding:0;
                display: inline-block;
                border-bottom: 1px solid;
            }
        }
        .table:not(.cart):not(.totals) > thead > tr > th,
        .table > thead > tr > th{
                line-height: 1;
                border-bottom: 2px solid;
                padding: 16px;
                text-transform: uppercase;
                white-space: nowrap;
                text-overflow: ellipsis;
        }
        .order-title { 
            &:extend(.abs-block-title all);

            .action {
                display: inline-block;
                font-weight: @font-weight__bold;
                font-size: 14px;
                text-transform: uppercase;
                margin-bottom: 10px;
                padding:0;
                display: inline-block;
                border-bottom: 1px solid;
            }
        }

        .table-wrapper {
            margin: 0;
            overflow-y: auto;
            + .actions-toolbar {
                display: none;
            }

            &:not(:last-child) {
                margin-bottom: @indent__l;
            }
        }
        .table-order-items:not(.cart):not(.totals) tfoot > tr:first-child{
            th,
            td{
                border-top: 2px solid;
            }
        }
        .table-order-items {
            &.data.table{
                thead{
                    background:none;
                }
            }
            .grand_total{
                font-size: 18px;
            }
            tbody {
                & + tbody {
                    border-top: 1px solid @border-color__base;
                }

                .account & {
                    tr:nth-child(even) td {
                        background: none;
                    }
                }

                td {
                    padding-bottom: 20px;
                    padding-top: 20px;
                    white-space: nowrap;
                    text-overflow: ellipsis;                    
                }
                tr:not(:last-child){
                    td{
                        border-bottom: 1px solid @border-color__base;
                    }
                }

                .col {
                    &.label {
                        font-weight: @font-weight__bold;
                        padding-bottom: 5px;
                        padding-top: 0;
                    }

                    &.options {
                        padding: 10px 10px 15px;
                    }
                }

                > .item-parent {
                    td {
                        padding-bottom: 5px;
                    }

                    + tr td {
                        padding-top: 5px;
                    }
                }

                .item-options-container td {
                    padding-bottom: 15px;
                    padding-top: 0;
                }
            }

            .product-item-name {
                margin: 0 0 10px;
            }
        }

        .item-options {
            margin: 0;
            text-transform: uppercase;
            font-weight: @font-weight__bold;
            line-height: 1.2;
            dt {
                margin: 0;
            }

            dd {
                margin: 0 0 15px;
                &:last-child {
                    margin-bottom: 0;
                }
            }

            &.links {
                dt {
                    display: inline-block;

                    &:after {
                        content: ': ';
                    }
                }

                dd {
                    margin: 0;
                }
            }
        }

        thead {
            .col.qty {
                text-align: center;
            }
        }

        .col {
            &.price,
            &.subtotal {
                &:extend(.abs-incl-excl-tax all);
            }

        }

        .cart-tax-total {
            &:extend(.abs-tax-total all);
            &-expanded {
                &:extend(.abs-tax-total-expanded all);
            }
        }

        tfoot {
            &:extend(.abs-account-summary all);
        }
        .action {
            &.show {
                .lib-icon-font(
                    @icon-down,
                    @_icon-font-size: 10px,
                    @_icon-font-line-height: 10px,
                    @_icon-font-text-hide: true,
                    @_icon-font-position: after,
                    @_icon-font-display: inline-block
                );
                .lib-css(color, @primary__color);

                &.expanded {
                    .lib-icon-font-symbol(
                        @_icon-font-content: @icon-up,
                        @_icon-font-position: after
                    );
                }
            }
        }

        .product-item-name {
            .lib-font-size(16);
            font-weight: @font-weight__black;
            text-transform: uppercase;
        }

        .items-qty {
            &:extend(.abs-reset-list all);
            .item {
                white-space: nowrap;
            }

            .title {
                &:after {
                    content: ': ';
                }
            }
        }

        .pages-items {
            .item {
                &:first-child,
                &:last-child {
                    margin-right: 0;
                }
            }
        }
    }

    .block-order-details {
        &-comments {
            margin: 0 0 40px;

            .comment-date {
                font-weight: @font-weight__semibold;
            }

            .comment-content {
                line-height: 1.6;
                margin: 0 0 20px;
            }
        }

        &-view {
            .block-content .box {
                margin-bottom: 30px;
            }

            .box-title {
                font-weight: @font-weight__semibold;
            }

            .box-content {
                .payment-method {
                    .title {
                        font-weight: @font-weight__regular;
                    }

                    .content {
                        margin: 0;

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

                            &:after {
                                content: ': ';
                            }
                        }
                    }
                }
            }
        }

        &-gift-message {
            .column.main .order-details-items & {
                margin: 40px 0 0;
            }

            + .actions-toolbar {
                display: none;
            }
        }
    }

    .order-tracking {
        .order-title + & {
            border-bottom: 2px solid;
        }

        margin: 0;
        padding: 20px 0;

        .tracking-title {
            display: inline-block;
        }

        .tracking-content {
            display: inline-block;
            margin: 0 0 0 5px;
        }
    }

    .order-actions-toolbar {
        margin-bottom: 25px;

        .action {
            margin-right: 30px;

            &.print {
                &:extend(.abs-action-print all);
                display: none;
                margin: 0;
            }
            &.order{
                border-bottom: 2px solid;
                font-weight: @font-weight__bold;
                text-transform: uppercase;
            }    
        }
    }

    .order-status {
        &:extend(.abs-status all);
    }

    .account,
    [class^='sales-guest-'],
    .sales-guest-view,
    .magento-rma-guest-returns {
        &:extend(.abs-title-orders all);
    }

    .form-orders-search {
        .field {
            &:last-child {
                margin-bottom: @indent__base;
            }
        }
    }

    .block-reorder {
        .block-title {
            &:extend(.abs-block-widget-title all);
        }

        .actions-toolbar {
            margin: 17px 0 0 0;
            > div{
                display:inline-block;
                vertical-align: middle;
            }
            .action.view{
                margin-left: 15px;
                border-bottom: 2px solid;
                font-weight: @font-weight__bold;
                text-transform: uppercase;
                padding: 0;
                background: none;
                color: #000;
                font-family: inherit;
                font-size: 14px;
                line-height: 20px;
                letter-spacing: -0.03em;
                &:after,
                &:before{
                    content:none;
                }
            }
        }

        .product-item-name {
            float: left;
            width: ~"calc(100% - 20px)";
        }
        .product-item::after {
            clear: both;
            content: '';
            display: table;
        }
        .product-item {
            .label {
                &:extend(.abs-visually-hidden all);
            }

            .field.item {
                float: left;
                width: 20px;
            }
        }
    }

    //
    //  Guest order view page
    //  ---------------------------------------------

    [class^='sales-guest-'],
    .sales-guest-view {
        .column.main {
            .block:not(.widget) {
                &:extend(.abs-account-blocks all);
            }
        }
    }

    .magento-rma-guest-returns {
        .column.main {
            .order-details-items {
                .table-wrapper {
                    .data.table {
                        &:extend(.abs-table-striped all);
                    }
                }
            }
        }
    }
}

//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    .table-wrapper {
        &.orders-recent {
            &:extend(.abs-account-table-margin-mobile all);
            &:extend(.abs-no-border-top all);
            .table-order-items {
                &.table {
                    tbody {
                        > tr {
                            > td.col {
                                padding-left: 0;
                            }
                        }
                    }
                }
            }
        }
    }
    .account{
        .data.table{
            .col{
                &:first-child {
                     border-top: 1px solid @table__border-color;
                }
            }            
        }
    }
    .order-details-items {
        thead {
            display: block;

            tr {
                display: block;
            }
        }
    }

    .order-pager-wrapper {
        display: block;
    }

    .account {
        .table-order-items {
            tbody tr {
                display: block;
            }

            .product-item-name {
                display: block;                
            }

            .action.show {
                margin-top: 0;
            }

            .col {
                &.actions,
                &.options {
                    &:extend(.abs-col-no-prefix all);
                }
            }
        }
        .table-wrapper.order-items{
            .col{
                &.subtotal,
                &.qty,
                &.price{
                    text-align:left;
                }                
            }
            
        }
    }

    .account,
    [class^='sales-guest-'],
    .sales-guest-view {
        &:extend(.abs-title-orders-mobile all);
    }

    .order-details-items {
        .table-wrapper {
            &:extend(.abs-no-border-top all);
            overflow-y: auto;
        }

        .order-title {
            strong {
                display: block;
            }
        }

        .action {
            .lib-css(margin-top, @indent__s);
        }

        .items-qty {
            display: inline-block;
            vertical-align: baseline;
        }

        .col {
            &.price,
            &.subtotal {
                .price-including-tax,
                .price-excluding-tax {
                    display: inline-block;
                }
            }
        }

        .data.table .col.options {
            padding: 0 10px 15px;
            &:before {
                display: none;
            }
        }

        .table-order-items .options-label {
            &:extend(.abs-no-display-s all);
        }

        .options-label + .item-options-container,
        .item-options-container + .item-options-container {
            &[data-th]:before {
                content: attr(data-th) ':';
                display: block;
                font-weight: @font-weight__bold;
                padding-left: 10px;
            }

            .col {
                .lib-font-size(12);
                padding: 0 10px;

                &:first-child {
                    padding-top: 3px;
                }

                &:last-child {
                    padding-bottom: 20px;
                }
            }
        }
    }
}

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
    .order-pager-wrapper {
        .toolbar-amount {
            left: inherit;
            position: relative;
            text-align: center;
            top: inherit;
        }

        .pages {
            text-align: center;
        }

        .action.previous,
        .action.next {
            margin: 0;
        }
    }
    .order-details-items tfoot {
        .amount,
        .mark{
            text-align: right;
        }
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) {
    .order-details-items {
        .order-title {
            .action {
                margin: 0 0 0 15px;

                &.track {
                    float: right;
                }
            }
        }
    }
}

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .table-wrapper.orders-recent {
        &:extend(.abs-account-table-margin-desktop all);
    }

    .order-links {
        &:extend(.abs-add-clearfix-desktop all);
        .item {
            float: left;
            margin: 0;
            width: auto;
            strong,
            a{
                color: #000;
                background: none;
                line-height: 30px;
                height: 30px;                
                font-size: 1.5rem;
                box-sizing: content-box;
            }
            a {
                &:before {
                    .ba-block();
                    transform: translateY(39px);
                    transition: all 0.25s ease;
                    background: #000000;
                    will-change:transform;
                }
                &:after {
                    .ba-block();
                    transform: translateY(100%);
                    transition: all 0.4s ease;
                    background: @main-color;
                    will-change:transform;
                }
                &:visited {
                    color: #000;
                    text-decoration: none;
                }
                &:focus,
                &:hover {
                    color: #fff;
                    text-decoration: none;
                    background: none;
                    &:before{
                        transform: translateY(0);
                    }
                } 
            }
            &.current{
                strong{
                    transition: color 200ms 100ms;
                    &:after {
                        transform: translateY(0);
                        transition: transform 0.3s ease;
                    }
                    &:before{
                        transform: translateY(0);
                    }
                }
            }
            /*a {
                padding: @tab-control__padding-top @indent__base;
            }*/
            /*
            strong {
                border-bottom: 0;
                margin-bottom: -1px;
                padding: @tab-control__padding-top @indent__base @tab-control__padding-bottom + 1 @indent__base;
            }*/
        }
    }

    .order-actions-toolbar {
        .actions{
            display: block;
            width: 100%;
        }
        .action.print {
                display: inline-block;
                float: right;
        }
    }

    .account,
    [class^='sales-guest-'],
    .sales-guest-view {
        &:extend(.abs-title-orders-desktop all);
        .column.main .block.block-order-details-view {
            &:extend(.abs-add-clearfix-desktop all);
            .block-content:not(.widget) .box {
                &:extend(.abs-add-box-sizing-desktop all);
                clear: none;
                float: left;
                width: 100%/4;
            }
        }
    }

    .block-order-details-comments {
        margin: 0 0 60px;

        .comment-date {
            clear: left;
            float: left;
            margin-right: 50px;
            max-width: 90px;
        }

        .comment-content {
            overflow: hidden;
        }
    }

    .order-details-items {       
        padding: 40px;

        .col {
            &.price {
                text-align: center;
            }

            &.subtotal {
                text-align: right;
            }
        }

        tbody td {
            padding-bottom: 20px;
            padding-top: 20px;
        }

        tfoot {
            .amount,
            .mark {
                text-align: right;
            }
        }

        &.ordered {
            .order-title {
                display: none;
            }
        }
    }

    .order-pager-wrapper {
        .order-pager-wrapper-top {
            padding-left: 0;
            padding-right: 0;
        }

        .toolbar-amount {
            position: relative;
        }

        .pages {
            float: right;
        }
    }

    .table-order-items {
        tbody {
            .col {
                &.label,
                &.value {
                    padding-left: 0;
                }
            }
        }

        &.invoice,
        &.shipment {
            .col.qty {
                text-align: center;
            }
        }

        &.creditmemo {
            .col {
                &.qty,
                &.discount,
                &.subtotal {
                    text-align: center;
                }

                &.total {
                    text-align: right;
                }
            }
        }
    }
}
/*
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) { 
    .order-links {
        .item {
            margin: 0 @tab-control__margin-right 0 0;

            a {
                padding: @tab-control__padding-top @tab-control__padding-right;
            }

            strong {
                padding: @tab-control__padding-top @tab-control__padding-right @tab-control__padding-bottom + 1 @tab-control__padding-left;
            }
        }
    }
}
*/