/* ==========================================================================
   Tables -- Sortable stat tables, responsive, sticky header, red sort
   indicator, alternating rows
   ========================================================================== */

.stat-table-wrapper {
    overflow-x: auto;
    margin: var(--s-24) 0;
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
}

.stat-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    font-size: 0.875rem;
}

.stat-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.stat-table th {
    background: var(--c-surface);
    color: var(--c-text-dim);
    font-family: var(--f-body);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--s-12) var(--s-16);
    text-align: left;
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
    cursor: default;
    user-select: none;
}

.stat-table th[data-sortable] {
    cursor: pointer;
    transition: color var(--dur) var(--ease);
}

.stat-table th[data-sortable]:hover {
    color: var(--c-text);
}

.stat-table th[aria-sort]::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: var(--s-8);
    vertical-align: middle;
}

.stat-table th[aria-sort="ascending"]::after {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 5px solid var(--c-accent);
}

.stat-table th[aria-sort="descending"]::after {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--c-accent);
}

.stat-table td {
    padding: var(--s-12) var(--s-16);
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text);
}

.stat-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.stat-table tbody tr:hover {
    background: var(--c-surface-2);
}

/* Position highlight */
.stat-table td:first-child {
    font-weight: 600;
    color: var(--c-text-dim);
}

.stat-table tbody tr:first-child td:first-child {
    color: var(--c-podium);
}
