/**
 * File tables.scss.
 * Contains styles for tables.
 */

.generaltable {
    border-top: $table-border-width solid $table-border-color;
    th,
    td {
        padding: .75rem;
        border-top: $table-border-width solid $table-border-color;
    }
}

table {
    caption-side: top;
    .sticky-column {
        position: sticky;
        left: 0;
        background-color: inherit;
    }
}

// Fix loading icon position in dynamic tables.
.table-dynamic > .loading-icon {
    position: absolute;
    left: calc(50% - 1.5rem);
    top: 200px;
    .icon {
        max-height: 3rem;
        max-width: 3rem;
        font-size: 3rem;
    }
}

/**
 * Custom styles for Bootstrap table classes.
 */

.table {
    border-top: $table-border-width solid $table-border-color;
    // Allow table cells to inherit text color and background color from table rows.
    tbody {
        td,
        th {
            color: inherit;
            background-color: inherit;
        }
    }
    // Fix hover styling for table rows.
    tbody tr:hover {
        &.dimmed_text,
        &.text-muted {
            a:not(.menu-action) {
                color: $table-hover-color;
            }
        }
        td.sticky-column {
            background-color: $table-hover-bg;
        }
    }
}

.table-responsive {
    @include thin-scrolls($gray-100);
    // Fix dropdown menu position inside responsive tables.
    .dropdown {
        position: static !important; /* stylelint-disable-line declaration-no-important */
    }
    // Fix visually hidden text in responsive tables.
    .table {
        margin-bottom: 0;
        .visually-hidden,
        .accesshide {
            position: relative !important; /* stylelint-disable-line declaration-no-important */
            display: block;
        }
    }
}
