/* ── tables.css ─ Sortable stat tables ────────────────────── */

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

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

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

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

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

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

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

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

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

/* Alternating rows */
.stat-table tbody tr:nth-child(even) {
    background: var(--c-surface);
}

.stat-table tbody tr:nth-child(odd) {
    background: var(--c-bg);
}

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

/* Position column */
.stat-table td:first-child {
    font-weight: 600;
    color: var(--c-text-dim);
    width: 48px;
    text-align: center;
}

/* Team/player name */
.stat-table__name {
    font-weight: 600;
    color: var(--c-text);
}

/* Positive/negative values */
.stat-table__positive {
    color: var(--c-win);
}

.stat-table__negative {
    color: var(--c-loss);
}

/* Table context + takeaway */
.table-context {
    font-size: 0.9375rem;
    color: var(--c-text-dim);
    line-height: 1.7;
    margin-bottom: var(--s-16);
    max-width: 780px;
}

.table-takeaway {
    font-size: 0.9375rem;
    color: var(--c-text-dim);
    line-height: 1.7;
    margin-top: var(--s-16);
    padding-top: var(--s-16);
    border-top: 1px solid var(--c-border);
    max-width: 780px;
    font-style: italic;
}
