/* Team stats leaderboard */

.team-stats-page {
    max-width: 100%;
}

.team-stats-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.team-stats-subnav {
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.2rem;
    border: 1px solid #dee2e6;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.02);
}

.team-stats-subtab {
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    cursor: pointer;
}

.team-stats-subtab.is-active {
    background: #fff;
    color: #1a2332;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.team-stats-note {
    font-size: 0.78rem;
    color: #6c757d;
    margin-bottom: 0.75rem;
}

.team-stats-table-wrap {
    overflow: auto;
    max-height: calc(100vh - 220px);
    border: 1px solid #dee2e6;
    border-radius: 10px;
    background: #fff;
    isolation: isolate;
}

.team-stats-table {
    width: max-content;
    min-width: 100%;
    margin-bottom: 0;
    font-size: 0.82rem;
    border-collapse: separate;
    border-spacing: 0;
}

.team-stats-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8f9fb;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    vertical-align: bottom;
    padding: 0.5rem 0.65rem;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #495057;
    box-shadow: 0 1px 0 #dee2e6;
}

.team-stats-table thead th.ts-sticky-col,
.team-stats-table tbody td.ts-sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
}

.team-stats-table thead th.ts-sticky-col {
    z-index: 5;
    background: #f8f9fb;
}

.team-stats-table thead th.ts-sticky-col-2,
.team-stats-table tbody td.ts-sticky-col-2 {
    position: sticky;
    left: var(--ts-rank-col-width, 2.5rem);
    z-index: 2;
    background: #fff;
}

.team-stats-table thead th.ts-sticky-col-2 {
    z-index: 5;
    background: #f8f9fb;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}

.team-stats-table tbody td.ts-sticky-col-2 {
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}

.team-stats-table tbody tr:hover td {
    background: #f8fafc;
}

.team-stats-table tbody tr:hover td.ts-sticky-col,
.team-stats-table tbody tr:hover td.ts-sticky-col-2 {
    background: #f3f6f9;
}

.team-stats-table td {
    padding: 0.42rem 0.65rem;
    vertical-align: middle;
    border-bottom: 1px solid #f0f2f5;
    white-space: nowrap;
    background: #fff;
}

.team-stats-table thead th {
    background: #f8f9fb;
}

.ts-sortable {
    cursor: pointer;
    user-select: none;
}

.ts-sortable:hover {
    background: #eef2f6 !important;
}

.ts-sortable.is-sorted-asc::after,
.ts-sortable.is-sorted-desc::after {
    margin-left: 0.25rem;
    font-size: 0.65rem;
    color: #1e3a5f;
}

.ts-sortable.is-sorted-asc::after {
    content: '▲';
}

.ts-sortable.is-sorted-desc::after {
    content: '▼';
}

.ts-col-group-head {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.ts-expand-col {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    font-size: 0.7rem;
    line-height: 1;
    cursor: pointer;
    color: #495057;
}

.ts-expand-col:hover {
    background: #f1f3f5;
}

.ts-expand-col.is-expanded::before {
    transform: rotate(90deg);
    display: inline-block;
}

.ts-split-col {
    background: #fbfcfd !important;
    font-size: 0.72rem;
}

.ts-split-col[hidden] {
    display: none;
}

.ts-team-col {
    min-width: 200px;
    max-width: 220px;
}

.ts-team-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ts-team-cell a {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.ts-team-cell a:hover {
    color: #1e3a5f;
    text-decoration: underline;
}

.ts-team-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
}

.ts-team-logo--empty {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e9ecef;
}

.ts-conf-cell {
    color: #6c757d;
    min-width: 52px;
}

.ts-rank-cell {
    color: #6c757d;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    width: 2.5rem;
    min-width: 2.5rem;
    max-width: 2.5rem;
    text-align: center;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

.ts-stat-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ts-stat-val {
    font-weight: 600;
}

.ts-stat-val--good {
    color: #146c43;
}

.ts-stat-val--bad {
    color: #b02a37;
}

.ts-stat-rank {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: #adb5bd;
}

.ts-group-offense {
    border-top: 3px solid rgba(25, 135, 84, 0.35);
}

.ts-group-defense {
    border-top: 3px solid rgba(220, 53, 69, 0.35);
}

.team-stats-message {
    padding: 2rem 1rem;
    text-align: center;
    color: #6c757d;
}

@media (max-width: 768px) {
    .team-stats-table thead th.ts-sticky-col-2,
    .team-stats-table tbody td.ts-sticky-col-2 {
        position: static;
        left: auto;
        box-shadow: none;
    }
}
