/*
 * Таблица в прокручиваемом контейнере (.table-scroll): тонкие рамки, скругление,
 * закреплённая шапка. Высота подгоняется под окно скриптом /js/table-scroll-fit.js.
 *
 * Разметка:
 *   <div class="page-header table-app-toolbar table-scroll-toolbar"> … </div>
 *   <div class="table-scroll"><table class="table …"> … </table></div>
 *   <div class="text-center table-scroll-pagination"> … </div>   (необязательно)
 */

.table-scroll {
    width         : 100%;
    max-height    : calc(100vh - 260px); /* уточняется скриптом по положению таблицы */
    border        : 1px solid #ddd;
    border-radius : 6px;
    overflow      : auto;
}

.table-scroll .table {
    min-width       : 600px;
    margin-top      : 0 !important;
    /* separate вместо collapse: рамки закреплённой шапки не пропадают и не меняют толщину при прокрутке */
    border-collapse : separate !important;
    border-spacing  : 0;
    border          : 0 !important;
}

/* Внешнюю рамку рисует контейнер, внутри — только разделители. */
.table-scroll .table > thead > tr > th,
.table-scroll .table > tbody > tr > td {
    border-width : 0 1px 1px 0 !important;
    border-style : solid !important;
    border-color : #ddd !important;
}

.table-scroll .table > thead > tr > th:last-child,
.table-scroll .table > tbody > tr > td:last-child {
    border-right-width : 0 !important;
}

.table-scroll .table > tbody > tr:last-child > td {
    border-bottom-width : 0 !important;
}

.table-scroll .table > tbody > tr > td {
    vertical-align : middle !important;
}

.table-scroll .table thead {
    position : sticky;
    top      : 0;
    z-index  : 1;
}

/* Шапка страницы над таблицей: без разделителя, с боковыми отступами. */
.page-header.table-scroll-toolbar {
    /* Симметричные отступы: сверху 19px padding контейнера (.well) + 5px, снизу 24px до таблицы. */
    margin-bottom  : 24px;
    padding-top    : 5px;
    padding-bottom : 0;
    padding-left   : 15px;
    padding-right  : 15px;
    border-bottom  : 0;
}

/* Пагинация под таблицей: компактные отступы. */
.table-scroll-pagination {
    line-height : 0; /* убирает пустую строку под inline-block списком */
}

.table-scroll-pagination .pagination {
    display        : inline-flex;
    margin         : 12px 0 0 !important;
    line-height    : 1.42857;
    vertical-align : top;
}

/* Меньший нижний padding белого контейнера, если под таблицей есть пагинация. */
.well:has(.table-scroll-pagination) {
    padding-bottom : 18px;
    margin-bottom  : 0;
}

/* Скругление белого контейнера со списком (в общих стилях .well — 3px). */
.well:has(.table-scroll) {
    border-radius : 10px;
}

/* Стрелки пагинации «‹ ›» вместо текстовых « » (Bootstrap Icons): прячем текст, рисуем иконку. */
.table-scroll-pagination .pagination > li:first-child > a,
.table-scroll-pagination .pagination > li:first-child > span,
.table-scroll-pagination .pagination > li:last-child > a,
.table-scroll-pagination .pagination > li:last-child > span {
    font-size   : 0;
    line-height : 20px; /* в px: при font-size 0 относительный line-height схлопнул бы высоту кнопки */
}

.table-scroll-pagination .pagination > li:first-child > a::before,
.table-scroll-pagination .pagination > li:first-child > span::before,
.table-scroll-pagination .pagination > li:last-child > a::before,
.table-scroll-pagination .pagination > li:last-child > span::before {
    display     : inline-block;
    font-family : 'bootstrap-icons';
    font-size   : 14px;
    font-style  : normal;
    line-height : 20px;
    vertical-align : top;
}

.table-scroll-pagination .pagination > li:first-child > a::before,
.table-scroll-pagination .pagination > li:first-child > span::before {
    content : "\f284"; /* bi-chevron-left */
}

.table-scroll-pagination .pagination > li:last-child > a::before,
.table-scroll-pagination .pagination > li:last-child > span::before {
    content : "\f285"; /* bi-chevron-right */
}
