
/* ==========================================================
   RunXpert Premium Light Theme for Tabulator
   File: runxpert-tabulator-premium-light.css

   Load AFTER the official Tabulator stylesheet.
   Designed for Tabulator 5.x / 6.x
   ========================================================== */

/* ----------------------------------------------------------
   1. Theme tokens
   ---------------------------------------------------------- */

:root {
    --rx-table-bg: #ffffff;
    --rx-table-text: #263449;
    --rx-table-muted: #64748b;

    --rx-header-top: #f8fafc;
    --rx-header-bottom: #e9eef5;
    --rx-header-text: #334155;
    --rx-header-border: #dce3ec;

    --rx-row-even: #ffffff;
    --rx-row-odd: #f8fafc;
    --rx-row-hover: #eff6ff;
    --rx-row-selected: #dbeafe;
    --rx-row-selected-hover: #bfdbfe;

    --rx-border: #e2e8f0;
    --rx-border-strong: #cbd5e1;

    --rx-primary: #2563eb;
    --rx-primary-hover: #1d4ed8;
    --rx-primary-soft: #eff6ff;
    --rx-focus-ring: rgba(37, 99, 235, 0.16);

    --rx-control-bg: #ffffff;
    --rx-control-text: #334155;
    --rx-control-radius: 7px;
    --rx-radius: 10px;

    --rx-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 3px 10px rgba(15, 23, 42, 0.025);

    --rx-font-family:
        Inter, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Helvetica, Arial, sans-serif;

    --rx-font-size: 13px;
    --rx-transition: 150ms ease;
}

/* ----------------------------------------------------------
   2. Global table wrapper
   ---------------------------------------------------------- */

.tabulator {
    width: 100%;
    min-width: 0;
    overflow: hidden;

    color: var(--rx-table-text);
    background: var(--rx-table-bg);

    font-family: var(--rx-font-family);
    font-size: var(--rx-font-size);
    line-height: 1.45;

    border: 1px solid var(--rx-border);
    border-radius: var(--rx-radius);
    box-shadow: var(--rx-shadow);

    box-sizing: border-box;
}

.tabulator *,
.tabulator *::before,
.tabulator *::after {
    box-sizing: border-box;
}

/* ----------------------------------------------------------
   3. Premium column headers
   ---------------------------------------------------------- */

.tabulator .tabulator-header {
    color: var(--rx-header-text);

    background: linear-gradient(
        180deg,
        var(--rx-header-top) 0%,
        var(--rx-header-bottom) 100%
    );

    border-bottom: 1px solid var(--rx-header-border);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.tabulator .tabulator-header .tabulator-col {
    color: var(--rx-header-text);
    background: transparent;

    border-right: 1px solid rgba(203, 213, 225, 0.55);
    border-bottom: none;

    min-height: 52px;
}

.tabulator .tabulator-header .tabulator-col:last-child {
    border-right: none;
}

.tabulator .tabulator-header .tabulator-col-content {
    padding: 12px 12px;
    padding-top: 20px !important;
}

.tabulator .tabulator-header .tabulator-col-title {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.065em;
    line-height: 1.35;
    text-transform: uppercase;

    white-space: normal;
    overflow-wrap: anywhere;
}

/* Keep header alignment controlled by headerHozAlign. */
.tabulator .tabulator-header .tabulator-col-title-holder {
    width: 100%;
}

/* Header hover */
.tabulator .tabulator-header .tabulator-col:hover {
    background: rgba(255, 255, 255, 0.65);
}

/* Frozen columns */
.tabulator .tabulator-header .tabulator-col.tabulator-frozen {
    background: var(--rx-header-bottom);
}

/* ----------------------------------------------------------
   4. Sorting indicators
   ---------------------------------------------------------- */

.tabulator .tabulator-header .tabulator-col .tabulator-col-sorter {
    color: #94a3b8;
    opacity: 0.8;
}

.tabulator .tabulator-header .tabulator-col
.tabulator-col-sorter .tabulator-arrow {
    border-top-color: #94a3b8;
    border-bottom-color: #94a3b8;
    opacity: 0.75;
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover
.tabulator-col-sorter {
    color: var(--rx-primary);
    opacity: 1;
}

.tabulator .tabulator-header .tabulator-col[aria-sort="ascending"]
.tabulator-arrow,
.tabulator .tabulator-header .tabulator-col[aria-sort="descending"]
.tabulator-arrow {
    border-bottom-color: var(--rx-primary);
    border-top-color: var(--rx-primary);
    opacity: 1;
}

/* Compatibility with Tabulator versions that use classes. */
.tabulator .tabulator-header
.tabulator-col.tabulator-sortable[aria-sort="ascending"]
.tabulator-col-sorter .tabulator-arrow {
    border-bottom-color: var(--rx-primary);
}

.tabulator .tabulator-header
.tabulator-col.tabulator-sortable[aria-sort="descending"]
.tabulator-col-sorter .tabulator-arrow {
    border-top-color: var(--rx-primary);
}

/* ----------------------------------------------------------
   5. Table body and clean rows
   ---------------------------------------------------------- */

.tabulator .tabulator-tableholder {
    background: var(--rx-table-bg);
}

.tabulator .tabulator-table {
    color: var(--rx-table-text);
    background: var(--rx-table-bg);
}

.tabulator .tabulator-row {
    color: var(--rx-table-text);
    background: var(--rx-row-even);

    border-bottom: 1px solid var(--rx-border);

    min-height: 42px;
    transition:
        background-color var(--rx-transition),
        box-shadow var(--rx-transition);
}

.tabulator .tabulator-row:last-child {
    border-bottom: none;
}

/* Zebra striping */
.tabulator .tabulator-row:nth-child(even) {
    background: var(--rx-row-even);
}

.tabulator .tabulator-row:nth-child(odd) {
    background: var(--rx-row-odd);
}

/* Cell styling */
.tabulator .tabulator-row .tabulator-cell {
    padding: 10px 12px;

    border-right: 1px solid rgba(226, 232, 240, 0.65);

    color: inherit;
    line-height: 1.45;
}

.tabulator .tabulator-cell.vcenter {
    display: inline-flex;
    align-items: center;
}


.tabulator .tabulator-row .tabulator-cell:last-child {
    border-right: none;
}

/* Preserve cell alignment from hozAlign. */
.tabulator .tabulator-row .tabulator-cell[tabulator-field] {
    text-align: inherit;
}

/* Hover */
.tabulator .tabulator-row:hover {
    background: var(--rx-row-hover);
}

/* Selected row */
.tabulator .tabulator-row.tabulator-selected {
    background: var(--rx-row-selected);
}

.tabulator .tabulator-row.tabulator-selected:hover {
    background: var(--rx-row-selected-hover);
}

/* Avoid unwanted theme overlays on frozen cells. */
.tabulator .tabulator-row .tabulator-cell.tabulator-frozen {
    background: inherit;
}

/* Row and cell focus */
.tabulator .tabulator-row:focus-visible {
    outline: 2px solid var(--rx-primary);
    outline-offset: -2px;
}

/* ----------------------------------------------------------
   6. Vertical alignment utility
   ---------------------------------------------------------- */

/*
   Use cssClass: "vcenter" on a column definition.
   Tabulator's vertAlign: "middle" is the recommended
   default for all columns.
*/

.tabulator .tabulator-cell.vcenter {
    vertical-align: middle;
}

/* Useful for custom formatter wrappers. */
.tabulator .tabulator-cell.vcenter > * {
    vertical-align: middle;
}

/* Optional flex helper for custom cell content. */
.tabulator .rx-vcenter {
    display: inline-flex;
    align-items: center;
    min-height: 100%;
}

/* ----------------------------------------------------------
   7. Filters, editors and form controls
   ---------------------------------------------------------- */

.tabulator .tabulator-header
.tabulator-col input,
.tabulator .tabulator-header
.tabulator-col select,
.tabulator .tabulator-header
.tabulator-col textarea,
.tabulator .tabulator-cell input,
.tabulator .tabulator-cell select,
.tabulator .tabulator-cell textarea,
.tabulator .tabulator-editing {
    max-width: 100%;
    min-width: 0;

    color: var(--rx-control-text);
    background: var(--rx-control-bg);

    font-family: inherit;
    font-size: 12px;
    line-height: 1.4;

    border: 1px solid var(--rx-border-strong);
    border-radius: var(--rx-control-radius);

    padding: 7px 9px;
    outline: none;

    transition:
        border-color var(--rx-transition),
        box-shadow var(--rx-transition),
        background-color var(--rx-transition);
}

/* Filter input spacing */
.tabulator .tabulator-header
.tabulator-col .tabulator-header-filter {
    padding-top: 8px;
}

.tabulator .tabulator-header
.tabulator-col .tabulator-header-filter input,
.tabulator .tabulator-header
.tabulator-col .tabulator-header-filter select {
    width: 100%;
}

/* Focus rings */
.tabulator .tabulator-header
.tabulator-col input:focus,
.tabulator .tabulator-header
.tabulator-col select:focus,
.tabulator .tabulator-header
.tabulator-col textarea:focus,
.tabulator .tabulator-cell input:focus,
.tabulator .tabulator-cell select:focus,
.tabulator .tabulator-cell textarea:focus {
    border-color: var(--rx-primary);
    box-shadow: 0 0 0 3px var(--rx-focus-ring);
}

/* Editing cells */
.tabulator .tabulator-cell.tabulator-editing {
    padding: 4px;
    border: 1px solid var(--rx-primary);
    box-shadow: inset 0 0 0 1px var(--rx-primary);
}

.tabulator .tabulator-cell.tabulator-editing input,
.tabulator .tabulator-cell.tabulator-editing select,
.tabulator .tabulator-cell.tabulator-editing textarea {
    width: 100%;
    border-color: transparent;
    box-shadow: none;
}

/* Placeholder */
.tabulator input::placeholder,
.tabulator textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

/* ----------------------------------------------------------
   8. Pagination and page-size selector
   ---------------------------------------------------------- */

.tabulator .tabulator-footer {
    color: var(--rx-table-muted);
    background: #ffffff;

    border-top: 1px solid var(--rx-border);
    padding: 10px 12px;

    font-size: 12px;
}

.tabulator .tabulator-footer .tabulator-footer-contents {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.tabulator .tabulator-footer .tabulator-paginator {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 5px;
}

.tabulator .tabulator-footer .tabulator-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 32px;
    height: 32px;
    padding: 0 9px;

    color: #475569;
    background: #ffffff;

    border: 1px solid var(--rx-border);
    border-radius: 7px;

    font-family: inherit;
    font-size: 12px;
    font-weight: 500;

    cursor: pointer;

    transition:
        color var(--rx-transition),
        background-color var(--rx-transition),
        border-color var(--rx-transition),
        box-shadow var(--rx-transition);
}

.tabulator .tabulator-footer .tabulator-page:not(:disabled):hover {
    color: var(--rx-primary);
    background: var(--rx-primary-soft);
    border-color: #bfdbfe;
}

.tabulator .tabulator-footer .tabulator-page.active {
    color: #ffffff;
    background: var(--rx-primary);
    border-color: var(--rx-primary);
    font-weight: 600;
}

.tabulator .tabulator-footer .tabulator-page:disabled {
    color: #cbd5e1;
    background: #f8fafc;
    cursor: not-allowed;
    opacity: 0.7;
}

.tabulator .tabulator-footer .tabulator-page:focus-visible,
.tabulator .tabulator-footer .tabulator-page-size:focus-visible {
    outline: none;
    border-color: var(--rx-primary);
    box-shadow: 0 0 0 3px var(--rx-focus-ring);
}

/* Page-size selector */
.tabulator .tabulator-footer .tabulator-page-size {
    min-height: 32px;
    padding: 6px 28px 6px 10px;

    color: var(--rx-control-text);
    background-color: var(--rx-control-bg);

    border: 1px solid var(--rx-border-strong);
    border-radius: 7px;

    font-family: inherit;
    font-size: 12px;
    outline: none;
}

/* Page counter */
.tabulator .tabulator-footer .tabulator-page-counter {
    color: var(--rx-table-muted);
    font-size: 12px;
}

/* ----------------------------------------------------------
   9. Empty state and loading overlay
   ---------------------------------------------------------- */

.tabulator .tabulator-placeholder {
    color: var(--rx-table-muted);
    background: #ffffff;
}

.tabulator .tabulator-placeholder
.tabulator-placeholder-contents {
    padding: 28px 16px;
    font-size: 13px;
}

.tabulator .tabulator-loader {
    background: rgba(248, 250, 252, 0.78);
}

.tabulator .tabulator-loader .tabulator-loader-msg {
    color: var(--rx-table-text);
    background: #ffffff;

    border: 1px solid var(--rx-border);
    border-radius: 9px;

    padding: 12px 16px;
    box-shadow: var(--rx-shadow);
}

/* ----------------------------------------------------------
   10. Group headers, calculations and frozen rows
   ---------------------------------------------------------- */

.tabulator .tabulator-row.tabulator-group {
    color: #334155;
    background: #f1f5f9;

    border-bottom: 1px solid var(--rx-border-strong);
    font-weight: 600;
}

.tabulator .tabulator-row.tabulator-group:hover {
    background: #eaf0f7;
}

.tabulator .tabulator-calcs-holder {
    color: #334155;
    background: #f1f5f9;
    border-bottom: 1px solid var(--rx-border);
}

.tabulator .tabulator-calcs {
    font-weight: 600;
}

.tabulator .tabulator-row.tabulator-calcs {
    background: #f1f5f9;
    border-top: 1px solid var(--rx-border-strong);
}

.tabulator .tabulator-frozen-rows-holder {
    border-bottom: 1px solid var(--rx-border-strong);
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04);
}

/* ----------------------------------------------------------
   11. Horizontal scrolling and mobile support
   ---------------------------------------------------------- */

/*
   Keep responsiveLayout: false in JavaScript.
   Do not set columns to display:none at mobile breakpoints.
   The containing page must allow the table to scroll.
*/

.tabulator {
    max-width: 100%;
}

.tabulator .tabulator-tableholder {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

/*
   Apply .rx-table-scroll to a parent when the page layout
   needs an explicit horizontal scrolling boundary.
*/

.rx-table-scroll {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

/* Preserve readable controls on smaller screens. */
@media (max-width: 768px) {
    .tabulator {
        border-radius: 8px;
        font-size: 12px;
    }

    .tabulator .tabulator-header .tabulator-col-content {
        padding: 10px;
    }

    .tabulator .tabulator-row .tabulator-cell {
        padding: 9px 10px;
    }

    .tabulator .tabulator-footer {
        padding: 10px;
    }

    .tabulator .tabulator-footer .tabulator-footer-contents {
        align-items: flex-start;
    }

    .tabulator .tabulator-footer .tabulator-paginator {
        justify-content: flex-start;
    }
}

/* ----------------------------------------------------------
   12. Accessibility and reduced motion
   ---------------------------------------------------------- */

.tabulator button:focus-visible,
.tabulator select:focus-visible,
.tabulator input:focus-visible,
.tabulator textarea:focus-visible {
    outline: 2px solid var(--rx-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .tabulator *,
    .tabulator *::before,
    .tabulator *::after {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}