/* ============================================================
   fp-sortable-table.css
   Universal sortable table component styling.
   Used by <FpSortableTable> + <FpColumn>.
   Class namespace: .fp-st-*
   Theme tokens only — no hardcoded hex.
   ============================================================ */

.fp-st-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.fp-st-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--border-dim);
    background: var(--bg-row);
}

.fp-st-picker-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.72rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.fp-st-picker-btn:hover {
    background: var(--bg-row-alt);
    color: var(--text-primary);
}

.fp-st-picker-dropdown {
    position: absolute;
    right: 0.5rem;
    margin-top: 0.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    padding: 0.5rem;
    z-index: 50;
    min-width: 180px;
    max-height: 320px;
    overflow-y: auto;
}

.fp-st-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 3px;
}

.fp-st-picker-item:hover {
    background: var(--bg-row);
}

.fp-st-picker-item input[type="checkbox"] {
    margin: 0;
}

.fp-st-scroll {
    overflow-x: auto;
}

table.fp-st {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

table.fp-st thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

table.fp-st thead th.fp-st-align-right { text-align: right; }
table.fp-st thead th.fp-st-align-center { text-align: center; }

table.fp-st thead th button.fp-st-sort {
    all: unset;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
}

table.fp-st thead th button.fp-st-sort:focus-visible {
    outline: 2px solid var(--sidebar-active-text, var(--cam-yellow));
    outline-offset: 1px;
    border-radius: 2px;
}

.fp-st-chevron {
    font-size: 0.68rem;
    opacity: 0.6;
    margin-left: 0.125rem;
}

table.fp-st thead th button.fp-st-sort[aria-sort="ascending"] .fp-st-chevron,
table.fp-st thead th button.fp-st-sort[aria-sort="descending"] .fp-st-chevron {
    opacity: 1;
    color: var(--sidebar-active-text, var(--cam-yellow));
}

table.fp-st tbody tr {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-dim);
    transition: background 0.1s ease;
}

table.fp-st tbody tr:nth-child(even) {
    background: var(--bg-row);
}

table.fp-st tbody tr:hover {
    background: color-mix(in srgb, var(--accent) 6%, var(--bg-card));
}

table.fp-st tbody tr.fp-st-clickable {
    cursor: pointer;
}

table.fp-st tbody td {
    padding: 6px 10px;
    color: var(--text-primary);
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 340px;
}

table.fp-st tbody td.fp-st-align-right { text-align: right; font-variant-numeric: tabular-nums; }
table.fp-st tbody td.fp-st-align-center { text-align: center; }

.fp-st-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.82rem;
}

.fp-st-loading {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ── Row left-rail column (attention indicator) ── */
table.fp-st th.fp-st-rail-col,
table.fp-st td.fp-st-rail-col {
    width: var(--fp-attention-rail-width, 3px);
    padding: 0 !important;
    background-clip: padding-box;
}

table.fp-st td.fp-st-rail-col {
    border-bottom: none;
}
