/* ====================================================================================================
   SORT TABLE
   Defensive generic styling for tables with [sort_table]
   - Self-contained sticky header + filter row
   - Hardened against page-level table CSS conflicts
   - Modern input / select styling
   ==================================================================================================== */

.sort_table_host {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    box-sizing: border-box;
}

.sort_table_scroller {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: auto;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

table[sort_table].sort_table_enhanced {
    position: relative;
    box-sizing: border-box;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    --sort_table_header_bg: #ffffff;
    --sort_table_filter_bg: #f8fafc;
    --sort_table_text: #172033;
    --sort_table_muted_text: #667085;
    --sort_table_border: #d9e2ec;
    --sort_table_border_strong: #c3cfdb;
    --sort_table_shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --sort_table_shadow_focus: 0 0 0 3px rgba(59, 130, 246, 0.18);
    --sort_table_control_bg: #ffffff;
    --sort_table_control_text: #172033;
    --sort_table_control_placeholder: #98a2b3;
    --sort_table_control_border: #cbd5e1;
    --sort_table_control_border_hover: #94a3b8;
    --sort_table_control_border_focus: #3b82f6;
    --sort_table_control_shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    --sort_table_control_radius: 5px;
    --sort_table_sort_active_bg: rgba(59, 130, 246, 0.08);
    --sort_table_sort_active_text: #0f172a;
    --sort_table_filter_row_top: var(--sort_table_header_height, 44px);
}

table[sort_table].sort_table_enhanced thead {
    display: table-header-group;
    visibility: visible;
}

table[sort_table].sort_table_enhanced thead tr {
    visibility: visible;
}

table[sort_table].sort_table_enhanced thead th {
    position: sticky;
    top: 0;
    /* z-index: 30; */
    visibility: visible;
    opacity: 1;
    /* background: var(--sort_table_header_bg); */
    /* color: var(--sort_table_text); */
    background-clip: padding-box;
    box-sizing: border-box;
    vertical-align: middle;
    /* border-bottom: 1px solid var(--sort_table_border); */
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
    padding: 8px;
}

table[sort_table].sort_table_enhanced thead tr:first-child th {
    /* z-index: 30; */
}

table[sort_table].sort_table_enhanced thead tr.sort_table_filter_row th {
    top: var(--sort_table_filter_row_top);
    /* z-index: 29; */
    /* background: var(--sort_table_filter_bg); */
    /* border-bottom: 1px solid var(--sort_table_border); */
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

table[sort_table].sort_table_enhanced .sort_table_header_cell {
    cursor: pointer;
    user-select: none;
    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease;
}

table[sort_table].sort_table_enhanced .sort_table_header_cell:hover {
    /* background: rgba(15, 23, 42, 0.03); */
}

table[sort_table].sort_table_enhanced .sort_table_header_cell.sort_column_active {
    /* background: var(--sort_table_sort_active_bg); */
    /* color: var(--sort_table_sort_active_text); */
}

table[sort_table].sort_table_enhanced .sort_table_header_inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    /* min-height: 44px; */
    width: 100%;
    box-sizing: border-box;
    /* padding: 10px 12px; */
}

table[sort_table].sort_table_enhanced .sort_table_header_text {
    display: inline-block;
    min-width: 0;
    font-weight: 600;
    /* line-height: 1.3; */
    word-break: break-word;
}

table[sort_table].sort_table_enhanced .sort_table_sort_icon {
    position: relative;
    flex: 0 0 auto;
    width: 12px;
    height: 14px;
    opacity: 0.85;
}

table[sort_table].sort_table_enhanced .sort_table_sort_icon::before,
table[sort_table].sort_table_enhanced .sort_table_sort_icon::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.60;
    transition: opacity 0.18s ease;
}

table[sort_table].sort_table_enhanced .sort_table_sort_icon::before {
    top: 0;
    border-bottom: 5px solid currentColor;
}

table[sort_table].sort_table_enhanced .sort_table_sort_icon::after {
    bottom: 0;
    border-top: 5px solid currentColor;
}

table[sort_table].sort_table_enhanced .sort_table_header_cell:hover .sort_table_sort_icon::before,
table[sort_table].sort_table_enhanced .sort_table_header_cell:hover .sort_table_sort_icon::after {
    opacity: 0.60;
}

table[sort_table].sort_table_enhanced .sort_table_header_cell.sort_direction_asc .sort_table_sort_icon::before {
    opacity: 1;
}

table[sort_table].sort_table_enhanced .sort_table_header_cell.sort_direction_desc .sort_table_sort_icon::after {
    opacity: 1;
}

table[sort_table].sort_table_enhanced .sort_table_filter_cell {
    padding: 8px;
    vertical-align: top;
    box-sizing: border-box;
}


table[sort_table].sort_table_enhanced .sort_table_filter_empty {
    /* min-height: 42px; */
}

table[sort_table].sort_table_enhanced .sort_table_filter_control {
    display: block;
    width: 100%;
    min-width: 0;
    /* height: 38px; */
    box-sizing: border-box;
    /* margin: 0;
    padding: 0 12px; */
    padding: 4px 8px;
    border: 1px solid var(--sort_table_control_border);
    border-radius: var(--sort_table_control_radius);
    /* background: var(--sort_table_control_bg); */
    /* color: var(--sort_table_control_text); */
    font: inherit;
    font-size: 14px;
    /* line-height: 1.2; */
    box-shadow: var(--sort_table_control_shadow);
    outline: none;
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease,
        color 0.18s ease;
}

table[sort_table].sort_table_enhanced .sort_table_filter_control:hover {
    /* border-color: var(--sort_table_control_border_hover); */
    /* background: #ffffff; */
}

table[sort_table].sort_table_enhanced .sort_table_filter_control:focus {
    /* border-color: var(--sort_table_control_border_focus); */
    box-shadow:
        var(--sort_table_control_shadow),
        var(--sort_table_shadow_focus);
    /* background: #ffffff; */
}

table[sort_table].sort_table_enhanced .sort_table_filter_input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 12px;
}

table[sort_table].sort_table_enhanced .sort_table_filter_input::placeholder {
    /* color: var(--sort_table_control_placeholder); */
    opacity: 1;
}

table[sort_table].sort_table_enhanced .sort_table_filter_select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 36px;
    background-image:
        linear-gradient(45deg, transparent 50%, #64748b 50%),
        linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 12px) calc(50% - 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

table[sort_table].sort_table_enhanced .sort_table_filter_select::-ms-expand {
    display: none;
}

table[sort_table].sort_table_enhanced .sort_table_header_cell:focus {
    outline: 2px solid rgba(59, 130, 246, 0.25);
    outline-offset: -2px;
}

table[sort_table].sort_table_enhanced th,
table[sort_table].sort_table_enhanced td {
    box-sizing: border-box;
}

/* Optional subtle enhancement for sticky layers */
.sort_table_scroller table[sort_table].sort_table_enhanced thead tr:first-child th,
.sort_table_scroller table[sort_table].sort_table_enhanced thead tr.sort_table_filter_row th {
    backdrop-filter: saturate(1.05) blur(2px);
}

/* Darker disabled / empty visual consistency */
table[sort_table].sort_table_enhanced .sort_table_filter_empty {
    border-radius: var(--sort_table_control_radius);
    /* background: transparent; */
}











/* =========================================
   SORT TABLE – CONTROL ROW (minimal)
   ========================================= */

.sort_table_control_bar {
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 12px;
    flex-wrap: wrap;
    /* padding: 6px 8px; */
    font-size: 12px;
}

/* sections */

.sort_table_control_left,
.sort_table_control_middle,
.sort_table_control_right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =========================================
   RESET BUTTON
   ========================================= */
.sort_table_copy_button,
.sort_table_export_button,
.sort_table_reset_button {
    padding: 3px 6px;
    border: 1px solid #bbb;
    background: #f6f6f6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.sort_table_copy_button:hover,
.sort_table_export_button:hover,
.sort_table_reset_button:hover {
    background: #eaeaea;
}

/* =========================================
   PAGINATION
   ========================================= */


.sort_table_pagination_nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sort_table_page_button {
    min-width: 28px;
    padding: 3px 6px;
    border: 1px solid #bbb;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.sort_table_page_button:hover:not(:disabled) {
    background: #f0f0f0;
}

.sort_table_page_button:disabled {
    opacity: 0.5;
    cursor: default;
}

.sort_table_page_button_active {
    background: #dfe9ff;
    border-color: #6a8cff;
}

/* pagination dots */

.sort_table_page_dots {
    padding: 0 4px;
    font-size: 12px;
    opacity: 0.7;
}

/* =========================================
   ROWS PER PAGE
   ========================================= */

.sort_table_page_size_wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sort_table_page_size_select {
    padding: 3px 6px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
}

/* =========================================
   INFO TEXT
   ========================================= */

.sort_table_summary,
.sort_table_page_info {
    font-size: 12px;
}




/* Smaller screens */
/* @media (max-width: 767px) {
    table[sort_table].sort_table_enhanced .sort_table_header_inner {
        min-height: 40px;
        padding: 8px 10px;
    }

    table[sort_table].sort_table_enhanced .sort_table_filter_cell {
        padding: 6px;
    }

    table[sort_table].sort_table_enhanced .sort_table_filter_control {
        height: 36px;
        font-size: 12px;
    }
} */