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

//
//  Common
//  _____________________________________________

& when (@media-common = true) {
    .table-wrapper {
        margin-bottom: @indent__base;
    }

    table {
        .lib-table-caption();
    }

    .table {
        &:not(.cart) {
            &:not(.totals) {
                .lib-table-bordered(
                @_table_type: light,
                @_table_border-width: @table__border-width
                );

                tfoot {
                    > tr {
                        &:first-child {
                            th,
                            td {
                                border-top: @table__border-width @table__border-style @table__border-color;
                                padding-top: @indent__base;
                            }
                        }
                    }

                    .mark {
                        font-weight: @font-weight__regular;
                        text-align: right;
                    }
                }
            }
        }
    }
    .overflow-y{
        overflow-y: auto;
    }
    .table-bordered{
        table {
            tr{
                th,
                td{
                    padding: 16px 25px;
                    border-bottom: 1px solid #eaeaea;
                }                
                &:last-of-type{
                    td{
                       border-bottom: none; 
                    }                        
                }                
                th{
                    line-height: 1;
                    text-transform: uppercase;
                }
            }
        }
    }
    .table-header-border{
        table {
            thead{
                tr{
                    th{
                        line-height: 1;
                        border-bottom: 2px solid #000;
                    }
                }
            }
        }
    }
    .table-header-bg{
        table {
            thead{
                tr{
                    th{
                        line-height: 1;
                        padding: 16px 25px;
                        color:#fff;
                        background: #000;
                    }
                }
            }
        }
    }
}

//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    .table-wrapper {
        .lib-table-overflow();
        position: relative; // To hide unnecessary horizontal scrollbar in Safari

        .table {
            &:not(.cart) {
                &:not(.totals) {
                    &:not(.table-comparison) {
                        .lib-table-responsive();
                        > tbody > tr td[data-th]:before,
                        > tbody > tr th[data-th]:before{
                            padding: 8px 15px 3px 0;
                            text-transform: uppercase;
                        }
                        tbody > tr {
                            > td:first-child {
                                padding-top: @indent__base;
                            }

                            > td:last-child {
                                padding-bottom: @indent__base;
                            }
                        }

                        &.additional-attributes {
                            tbody {
                                th {
                                    &:extend(.abs-no-display-s all);
                                }

                                td {
                                    &:last-child {
                                        border: none;
                                        padding: 0 0 @indent__xs;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        .table {
            &:not(.totals) {
                &:not(.table-comparison) {
                    tfoot {
                        display: block;

                        tr {
                            display: block;
                            &:extend(.abs-add-clearfix-mobile all);

                            &:first-child {
                                th,
                                td {
                                    padding-top: @indent__base;
                                }
                            }
                        }

                        th {
                            box-sizing: border-box;
                            float: left;
                            padding-left: 0;
                            padding-right: 0;
                            text-align: left;
                            width: 70%;
                        }

                        td {
                            box-sizing: border-box;
                            float: left;
                            padding-left: 0;
                            padding-right: 0;
                            text-align: right;
                            width: 30%;
                        }
                    }
                }
            }
        }
    }

    .data-table-definition-list {
        thead {
            display: none;
        }

        tbody th {
            padding-bottom: 0;
        }

        tbody th,
        tbody td {
            display: block;
            padding-left: 0;
            padding-right: 0;
        }
    }
}
