@import 'variables';
@import 'common';

.table-grid {
    &__cell {
        color: var(--ngx-table-cell-color);
        background: var(--ngx-table-cell-even-background);
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        word-break: break-word;
        border-bottom: 1px solid var(--ngx-table-cell-border-color);
        min-height: var(--ngx-table-cell-height);
        max-height: var(--ngx-table-cell-height);
        display: flex;
        overflow: hidden;
        justify-content: center;
        padding: var(--ngx-table-cell-padding);

        &--body {
            position: absolute;
        }

        &--custom-cell:not(&--is-model-cell) {
            padding: 0;
        }

        &--empty-head {
            .table-grid__cell--content {
                display: none;
            }
        }

        &--content {
            overflow: hidden;

            @extend .vertical-align;

            &:not(.table-grid__cell--content-sortable) {
                width: 100%;
            }

            .table-grid__cell--inner-content {
                overflow: hidden;
            }
        }

        &--text-bold {
            font-weight: bold;
        }

        &--disable {
            pointer-events: none;
        }

        &--disable,
        &--disable.table-grid__cell--strip {
            background: #fbe4e3;
        }

        &--nowrap,
        &--nowrap .table-grid__cell--inner-content {
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        &--enable-selection {
            cursor: pointer;
        }

        &--strip {
            background: var(--ngx-table-cell-odd-background);
        }

        &--selected {
            background: var(--ngx-table-cell-selected-background);
            transition: background 0.3s;
        }

        &--settings {
            margin-left: 10px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
    }

    &__header-cell {
        top: 0;
        z-index: 99;
        position: sticky;
        background: var(--ngx-table-header-cell-background);
        fill: var(--ngx-table-header-cell-color);
        stroke: var(--ngx-table-header-cell-color);
        color: var(--ngx-table-header-cell-color);
        box-sizing: border-box;
        text-overflow: ellipsis;
        border-bottom: 1px solid var(--ngx-table-cell-border-color);
        transition: box-shadow 0.3s ease-in-out;
        display: flex;
        flex: 1 1 80px;

        &--content {
            overflow: hidden;
            margin: auto 3px;
            word-break: keep-all;
        }

        &--is-clickable:active {
            background: var(--ngx-table-header-cell-active-background);
            fill: var(--ngx-table-header-cell-active-color);
            stroke: var(--ngx-table-header-cell-active-color);
            color: var(--ngx-table-header-cell-active-color);
        }

        &--min-width {
            .table-grid__header-cell--content:not(.table-grid__cell--content-sortable-is-active) {
                cursor: default;
            }

            .table-grid__column--draggable,
            .table-grid__column--sortable:not(.table-grid__column--sortable-active),
            .table-grid__column--filterable:not(.table-grid__column--filterable-active) {
                display: none;
            }
        }

        &-head--settings {
            display: flex;
            align-items: center;
        }

        &:hover .table-grid__column--draggable {
            opacity: 0.2;
        }
    }

    &__cell-overflow-content {
        position: fixed;
        background: var(--ngx-table-tooltip-background-color);
        color: var(--ngx-table-tooltip-color);
        border-radius: 4px;
        opacity: 0;
        visibility: hidden;
        white-space: pre-wrap;
        word-break: break-word;
        line-height: 20px;
        z-index: 1000000 !important;
        box-shadow: 0 0 10px 2px var(--ngx-table-tooltip-shadow-color);
        transition:
            visibility 100ms linear,
            opacity 100ms linear;
        max-height: 300px;
        max-width: 300px;
        overflow: auto;
        overflow-x: hidden;
        margin-top: -10px;
        margin-left: -50px;
        font-weight: 400;
        font-size: 15px;
        padding: 10px 35px 10px 10px;
    }

    &__cell-overflow-content.visible {
        visibility: visible;
        transition:
            visibility 100ms linear,
            opacity 100ms linear;
        opacity: 1;
        transform: translate(0);
    }
}
