/* Fluent Data Grid Base Styling */
.fluent-data-grid {
    height: unset !important;
    padding-bottom: var(--t-padding-paper);

    .fluent-data-grid-row:nth-child(odd) td {
        background: var(--t-base-50);
    }

    td {
        min-height: 4rem;
        padding-left: 0;

        & > * {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        &:has(fluent-anchor), &:has(fluent-badge), &:has(fluent-button) {
            overflow: unset;
            text-overflow: unset;
        }

        &:has(.t-paper) {
            height: unset !important;
        }

        &.expandable.scrollable > * {
            text-overflow: unset;
        }

        /*Expandable cell*/
        &.expandable {
            position: relative;

            &:not(.scrollable):hover {
                overflow: visible;

                * {
                    background-color: white;
                    padding-right: 2rem;
                    position: absolute;
                    top: 21px;
                }
            }

            &.scrollable *:hover {
                overflow-x: auto;
                position: unset;
                text-overflow: unset;
            }
        }

        fluent-tooltip {
            overflow: visible;
        }

        .stack-horizontal {
            width: auto !important;
        }
    }

    th:first-child,
    td:first-child {
        padding-left: var(--t-padding-page) !important;
    }

    th:not(:first-child) {
        padding-left: calc(var(--t-padding-page) / 2) !important
    }

    .col-title {
        padding-left: 0 !important; 
        width: unset !important;
    }
}

/* Data Grid with 't-datagrid' Class */
.fluent-data-grid.t-datagrid {
    background-color: white;
    padding: var(--t-padding-paper) var(--t-padding-page);

    .column-header {
        align-items: center;
        background-color: #f7f7f7;
        display: flex;
        margin-bottom: 0.5rem;
        min-height: 4rem !important;

        &:first-child {
            border-top-left-radius: 0.5rem;
            border-bottom-left-radius: 0.5rem;
            padding-left: var(--t-padding-page) !important;
        }

        &:last-child {
            border-top-right-radius: 0.5rem;
            border-bottom-right-radius: 0.5rem;
        }
    }

    .fluent-data-grid-row {
        td {
            background: white !important;
        }

        &:not([row-type="default"]):first-child,
        &[row-type="header"] + .fluent-data-grid-row {
            td {
                border-top: 1px solid var(--neutral-stroke-rest);
            }

            td:first-child {
                border-top-left-radius: 0.5rem;
            }

            td:last-child {
                border-top-right-radius: 0.5rem;
            }
        }

        td:first-child {
            border-left: 1px solid var(--neutral-stroke-rest);
        }

        td:last-child {
            border-right: 1px solid var(--neutral-stroke-rest);
        }

        &:last-child {
            td:first-child {
                border-bottom-left-radius: 0.5rem;
            }

            td:last-child {
                border-bottom-right-radius: 0.5rem;
            }
        }
    }
}

/* Non-Styling Data Grid */
.fluent-data-grid.t-datagrid-non-styling {
    background: transparent;
    border: none;
    padding-block: calc(var(--t-padding-page) / 2);

    td {
        background: transparent !important;

        .t-paper {
            box-shadow: unset;
        }

        .t-paper-content .fluent-data-grid-row:nth-child(odd) td {
            background: var(--t-base-50) !important;
            --neutral-fill-stealth-rest: var(--t-base-50);
        }

        .t-paper-content .fluent-data-grid.t-datagrid td {
            background: transparent !important;
        }
    }
}

/* Subline Data Grid */
.subline-table-container {
    background-color: #f7f7f7;
    padding: 0 1rem 1rem;
}

.fluent-data-grid.subline-table {
    .fluent-data-grid-row {
        td,
        th {
            border: none;
        }

        th.column-header:first-child,
        td:first-child {
            padding-left: calc(var(--t-padding-page) - 1rem) !important;
            border: none;
        }

        td:last-child {
            border-right: none;
        }

        &:not([row-type="default"]):first-child {
            td {
                border: none;
            }

            td:first-child {
                border-top-left-radius: 0.5rem;
            }

            td:last-child {
                border-top-right-radius: 0.5rem;
            }
        }
    }

    .column-header .col-sort-button {
        width: 100% !important;
    }

    fluent-button.stealth {
        --neutral-fill-stealth-rest: #f7f7f7;
    }
}

/* No Data Styling */
.no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4rem;
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 0.5rem;
    font-weight: 500;
}
