/*!
 * Copyright 2023 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
.k-dropdowngrid-popup {
    overflow: hidden;
}
.k-dropdowngrid-popup > .k-data-table {
    border-width: 0;
}
.k-dropdowngrid-popup .k-virtual-wrap {
    margin: 0;
}


// Table
.k-table {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    border-width: 1px;
    border-style: solid;
    border-collapse: collapse;
    border-spacing: 0;
    empty-cells: show;
    outline: none;
    font-size: inherit;
    line-height: inherit;
    text-align: left;
}


// Data table
.k-data-table {
    border-width: 1px;
    border-style: solid;

    .k-table {
        table-layout: fixed;
    }
}


// Table native parts
.k-table-thead,
.k-table-tbody,
.k-table-tfoot,
.k-table-row,
.k-table-alt-row {
    border-color: inherit;
    text-align: inherit;
}
.k-table-th,
.k-table-td {
    padding: @grid-cell-padding-y @grid-cell-padding-x;
    border-width: 0 0 1px 1px;
    border-style: solid;
    border-color: inherit;
    box-sizing: border-box;
    font-weight: normal;
    text-align: inherit;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: table-cell;
    overflow: hidden;
    position: relative;

    &:first-child {
        border-left-width: 0;
    }
}
.k-table-th {
    border-bottom-width: 1px;
}


// Table header
.k-table-header {
    padding-inline-end: var(--kendo-scrollbar-width);
    border-width: 0 0 1px 0;
    border-style: solid;
    box-sizing: border-box;

    .k-table {
        border-width: 0;
    }
}
.k-table-header-wrap {
    margin-right: -1px;
    width: 100%;
    border-width: 0 1px 0 0;
    border-style: solid;
    border-color: inherit;
    overflow: hidden;
}
.k-table-header,
.k-table-header-wrap {
    > .k-table {
        margin-bottom: -1px;
    }
}
.k-table-group-sticky-header {
    font-size: inherit;
    line-height: inherit;
    flex: none;

    .k-table-th {
        display: flex;
        flex-flow: row nowrap;
        align-items: center;
        align-content: center;
    }
}


// Table list
.k-table-list {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: none;
    border-width: 0;
    display: table;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
    empty-cells: show;
    list-style: none;
    outline: none;

    .k-table-row,
    .k-table-group-row {
        width: 100%;
        box-sizing: border-box;
        display: table-row;
        position: relative;
    }
    .k-table-row.k-first {
        border-top: 1px solid currentColor;
    }

    .k-table-th,
    .k-table-td {
        vertical-align: middle;
    }

    .k-table-group-row {

        &::before {
            content: "\200b";
            padding: @grid-cell-padding-y 0;
            width: 0;
            display: block;
            overflow: hidden;
        }

        .k-table-th {
            width: 100%;
            border-color: inherit;
            color: inherit;
            background-color: inherit;
            position: absolute;
            top: 0;
        }
    }

    .k-table-spacer-td {
        padding: 0 !important; // sass-lint:disable-line no-important
        width: 0 !important; // sass-lint:disable-line no-important
        border-left-width: 0 !important; // sass-lint:disable-line no-important
        border-right-width: 0 !important; // sass-lint:disable-line no-important
    }
    .k-table-group-td {
        padding: 0 !important; // sass-lint:disable-line no-important
        width: 0 !important; // sass-lint:disable-line no-important
        border-left-width: 0 !important; // sass-lint:disable-line no-important
        border-right-width: 0 !important; // sass-lint:disable-line no-important
        overflow: visible; // sass-lint:disable-line no-important

        > span {
            padding: 0 ( @grid-cell-padding-x / 2 );
            font-size: .75em;
            position: absolute;
            top: 0;
            right: 0;
        }
    }
}


// Virtualization
.k-virtual-table .k-table-row,
.k-virtual-table .k-table-group-row {
    position: absolute;
    width: 100%;
}


// Table scroller
.k-table-scroller {
    position: relative;
    overflow: auto;

    > .k-table {
        border-width: 0;
    }
}


// Table footer
.k-table-footer {
    padding-inline-end: var(--kendo-scrollbar-width);
    border-width: 1px 0 0 0;
    border-style: solid;
    box-sizing: border-box;

    .k-table {
        border-width: 0;
    }
}
.k-table-footer-wrap {
    margin-right: -1px;
    width: 100%;
    border-width: 0 1px 0 0;
    border-style: solid;
    border-color: inherit;
    overflow: hidden;
}


// RTL
.k-rtl,
[dir="rtl"] {
    &.k-table,
    .k-table {
        text-align: right;

        .k-table-th,
        .k-table-td {
            border-left-width: 0;
            border-right-width: 1px;

            &:first-child {
                border-right-width: 0;
            }
        }

        .k-table-header-wrap,
        .k-table-footer-wrap {
            margin-right: 0;
            margin-left: -1px;
            border-left-width: 1px;
            border-right-width: 0;
        }
    }

    .k-table-list {
        .k-table-group-td > span {
            left: 0;
            right: auto;
        }
    }
}
