/* ==========================================================================
   Scrollable Table — QuickGridPlus-matched styling
   Reusable table component that mirrors the visual design of QuickGridPlus.
   Usage: add class="scrollable-table" to <table> and class="scrollable-tbody"
   to <tbody>.
   ========================================================================== */

/* --- Outer wrapper -------------------------------------------------------- */
.scrollable-table-container {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    border-radius: 10px;
}

/* --- Table shell ---------------------------------------------------------- */
.scrollable-table {
    border-collapse: separate;
    border-spacing: 0;
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.10), 0 2px 8px 0 rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    background: #F8F8FF;
    border: 1px solid rgba(0, 0, 0, 0.06);
    max-width: 100dvw;
    width: 100%;
}

/* --- Shared cell baseline ------------------------------------------------- */
.scrollable-table th,
.scrollable-table td {
    padding: 0.35rem 0.5rem !important;
    border: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    line-height: 1.8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.18s, background 0.18s;
    vertical-align: middle;
}

.scrollable-table td {
    font-variant-numeric: tabular-nums;
}

/* --- Head ----------------------------------------------------------------- */
.scrollable-table thead,
.scrollable-table tfoot {
    display: table;
    width: 100%;
    table-layout: fixed;
}

table.scrollable-table thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    border-top: none;
    color: #1e293b;
    font-weight: 600;
    line-height: 1.8;
    letter-spacing: 0.025em;
    border-bottom: 2px solid var(--mid-blue);
    background: #e5ecf5 !important;
    overflow: visible;
    text-overflow: clip;
    padding-right: 1rem !important;
}

table.scrollable-table thead th:first-child {
    border-radius: 0.5rem 0 0 0;
}

table.scrollable-table thead th:last-child {
    border-radius: 0 0.5rem 0 0;
}

/* --- Foot ----------------------------------------------------------------- */
table.scrollable-table tfoot td {
    background: #e5ecf5 !important;
    color: #1e293b;
    padding-right: 1rem !important;
}

table.scrollable-table tfoot tr:first-child td {
    border-top: 2px solid var(--mid-blue);
}

/* --- Scrollable body ------------------------------------------------------ */
.scrollable-tbody {
    display: flex !important;
    flex-direction: column !important;
    overflow-y: scroll !important;
    background: rgb(245, 246, 248);
}

.scrollable-tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.scrollable-tbody td,
.scrollable-tbody th {
    width: auto;
}

/* --- Row striping --------------------------------------------------------- */
.scrollable-table tbody tr.odd td {
    background-color: #ffffff;
}

.scrollable-table tbody tr.even td {
    background-color: #f0f5fb;
}

/* --- Row hover ------------------------------------------------------------ */
.scrollable-table tbody tr {
    transition: background 0.18s ease;
}

.scrollable-table tbody tr:hover td {
    background: #d6ecfa !important;
}

.scrollable-table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 0 var(--mid-blue), 0 2px 8px rgba(0, 123, 180, 0.10);
}

/* --- Utilities ------------------------------------------------------------ */
.scrollable-table th label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: bold;
}

.scrollable-table tr:last-child td {
    border-bottom: none;
    margin-bottom: 0.5rem;
}
