/* ───────────────────────────────────────────────────────────────────────────
   Tournament Player / Team stat leaderboards
   Horizontal scrolling sub-tabs (Goals, Assists, Shots, …) → one 20-row table.
   Standalone & revertable: remove the <link> to fall back cleanly.
─────────────────────────────────────────────────────────────────────────── */

/* ── Sub-tab bar (scrolls horizontally) ── */
.lb-subtabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;          /* Firefox — hide scrollbar */
    -ms-overflow-style: none;       /* IE/Edge legacy */
    padding: 4px 2px 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.lb-subtabs::-webkit-scrollbar { height: 0; width: 0; display: none; }  /* WebKit — invisible */

.lb-subtab {
    flex: 0 0 auto;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, .1);
    background: #11151c;
    color: #aeb6bf;
    font-size: .85rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.lb-subtab:hover { color: #f0f3f6; border-color: rgba(0,230,118,.4); }
.lb-subtab.active {
    background: #00e676;
    color: #05241a;
    border-color: #00e676;
}

/* ── Table ── */
.lb-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    background: #11151c;
    border: 1px solid rgba(255, 255, 255, .06);
}
.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}
.lb-table thead th {
    text-align: right;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7480;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: #0d1117;
    position: sticky;
    top: 0;
}
.lb-table th.lb-rank { text-align: center; width: 42px; }
.lb-table th.lb-ent-cell { text-align: left; }

.lb-table tbody tr { border-bottom: 1px solid rgba(255, 255, 255, .045); }
.lb-table tbody tr:last-child { border-bottom: none; }
.lb-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, .015); }
.lb-table td {
    padding: 10px 14px;
    text-align: right;
    vertical-align: middle;
}

.lb-rank {
    text-align: center !important;
    width: 42px;
    color: #8b93a0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.lb-ent-cell {
    text-align: left !important;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 170px;
}
.lb-badge {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
    flex: 0 0 auto;
}
.lb-badge-empty { background: rgba(255,255,255,.06); }
.lb-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.lb-name {
    font-weight: 600;
    color: #f0f3f6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lb-team {
    font-size: .76rem;
    color: #7d8590;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-sec { color: #9aa3ad; font-variant-numeric: tabular-nums; width: 64px; }
.lb-diff { font-weight: 600; font-variant-numeric: tabular-nums; width: 58px; }
.lb-diff.pos { color: #00e676; }
.lb-diff.neg { color: #ff5a5f; }
.lb-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    width: 56px;
}

/* ── Metric info icon + popover (xG / xA / xGc) ── */
.lb-table th.lb-sec { white-space: nowrap; }
.lb-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 5px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 230, 118, .14);
    color: #00e676;
    cursor: pointer;
    vertical-align: middle;
    transition: background .15s ease;
}
.lb-info-btn:hover { background: rgba(0, 230, 118, .28); }

/* The panel is the positioning context for the popover */
#tabPlayerstats, #tabTeamstats { position: relative; }

.lb-pop {
    position: absolute;
    z-index: 40;
    width: min(300px, calc(100vw - 32px));
    background: #0c1f17;                      /* our dark-green surface */
    border: 1px solid rgba(0, 230, 118, .35);
    border-radius: 12px;
    padding: 13px 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}
.lb-pop[hidden] { display: none; }
.lb-pop-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    color: #00e676;
    font-weight: 700;
    font-size: .95rem;
}
.lb-pop p {
    margin: 0;
    font-size: .85rem;
    line-height: 1.5;
    color: #d6dde2;
}

@media (max-width: 480px) {
    .lb-ent-cell { min-width: 140px; }
    .lb-name { font-size: .88rem; }
    .lb-val { font-size: 1rem; }
}
