/* ═══════════════════════════════════════════════════════════════════════════
   Leaderboard Page Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Page Layout ─────────────────────────────────────────────────────────── */
.leaderboard-page {
    padding: 2rem 0 4rem;
}

.leaderboard-page .container {
    max-width: 900px;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
.leaderboard-header {
    text-align: center;
    margin-bottom: 2rem;
}

.leaderboard-header h1 {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.leaderboard-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
}

/* ─── Period Tabs ─────────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
}

.tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast), background var(--transition-fast);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--accent-primary-light);
}

.tab.active {
    color: var(--accent-primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 2px 2px 0 0;
}

/* ─── Leaderboard Table ───────────────────────────────────────────────────── */
.leaderboard-table.full {
    width: 100%;
    font-size: 0.925rem;
    border-collapse: collapse;
}

.leaderboard-table.full thead {
    background: var(--bg-tertiary);
}

.leaderboard-table.full th {
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    white-space: nowrap;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.leaderboard-table.full td {
    padding: 0.85rem 1rem;
    color: var(--text-primary);
    border-top: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.leaderboard-table.full tbody tr {
    transition: background var(--transition-fast);
}

.leaderboard-table.full tbody tr:hover {
    background: var(--accent-primary-light);
}

/* ─── Column Styling ──────────────────────────────────────────────────────── */
.col-rank {
    width: 60px;
}

.col-score,
.col-level,
.col-lines {
    text-align: right;
}

.leaderboard-table.full .rank {
    font-weight: 700;
    text-align: center;
    width: 60px;
}

.rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.medal svg {
    display: block;
}

.leaderboard-table.full .player {
    font-weight: 600;
    color: var(--text-primary);
}

.leaderboard-table.full .score {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-weight: 700;
    color: var(--accent-primary);
    text-align: right;
}

.leaderboard-table.full .level,
.leaderboard-table.full .lines {
    text-align: right;
    color: var(--text-secondary);
}

.leaderboard-table.full .date {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ─── Top 3 Row Highlights ────────────────────────────────────────────────── */
.leaderboard-table.full .top-1 td {
    background: rgba(255, 215, 0, 0.06);
}

.leaderboard-table.full .top-1:hover td {
    background: rgba(255, 215, 0, 0.12);
}

.leaderboard-table.full .top-2 td {
    background: rgba(192, 192, 192, 0.06);
}

.leaderboard-table.full .top-2:hover td {
    background: rgba(192, 192, 192, 0.12);
}

.leaderboard-table.full .top-3 td {
    background: rgba(205, 127, 50, 0.06);
}

.leaderboard-table.full .top-3:hover td {
    background: rgba(205, 127, 50, 0.12);
}

[data-theme="dark"] .leaderboard-table.full .top-1 td {
    background: rgba(255, 215, 0, 0.04);
}

[data-theme="dark"] .leaderboard-table.full .top-1:hover td {
    background: rgba(255, 215, 0, 0.08);
}

[data-theme="dark"] .leaderboard-table.full .top-2 td {
    background: rgba(192, 192, 192, 0.04);
}

[data-theme="dark"] .leaderboard-table.full .top-2:hover td {
    background: rgba(192, 192, 192, 0.08);
}

[data-theme="dark"] .leaderboard-table.full .top-3 td {
    background: rgba(205, 127, 50, 0.04);
}

[data-theme="dark"] .leaderboard-table.full .top-3:hover td {
    background: rgba(205, 127, 50, 0.08);
}

/* ─── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.empty-state-icon {
    margin-bottom: 1.5rem;
    opacity: 0.4;
}

.empty-state-icon svg {
    display: inline-block;
}

.empty-state h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ─── Loading Indicator ───────────────────────────────────────────────────── */
.leaderboard-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 0.75rem;
    color: var(--text-muted);
}

/* ─── Row Transition Animations ───────────────────────────────────────────── */
.leaderboard-table.full tbody tr {
    animation: row-fade-in 0.3s ease forwards;
}

@keyframes row-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.leaderboard-table.full tbody tr:nth-child(1) { animation-delay: 0ms; }
.leaderboard-table.full tbody tr:nth-child(2) { animation-delay: 30ms; }
.leaderboard-table.full tbody tr:nth-child(3) { animation-delay: 60ms; }
.leaderboard-table.full tbody tr:nth-child(4) { animation-delay: 90ms; }
.leaderboard-table.full tbody tr:nth-child(5) { animation-delay: 120ms; }
.leaderboard-table.full tbody tr:nth-child(6) { animation-delay: 150ms; }
.leaderboard-table.full tbody tr:nth-child(7) { animation-delay: 180ms; }
.leaderboard-table.full tbody tr:nth-child(8) { animation-delay: 210ms; }
.leaderboard-table.full tbody tr:nth-child(9) { animation-delay: 240ms; }
.leaderboard-table.full tbody tr:nth-child(10) { animation-delay: 270ms; }

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Tablet (max-width: 768px) ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .leaderboard-page {
        padding: 1.5rem 0 3rem;
    }

    .leaderboard-header {
        margin-bottom: 1.5rem;
    }

    .tabs {
        margin-bottom: 1.5rem;
    }

    .tab {
        padding: 0.65rem 1.1rem;
        font-size: 0.9rem;
    }

    .leaderboard-table.full th,
    .leaderboard-table.full td {
        padding: 0.7rem 0.75rem;
    }

    .col-date {
        display: none;
    }

    .leaderboard-table.full .date {
        display: none;
    }
}

/* ─── Phone (max-width: 480px) ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .leaderboard-page {
        padding: 1rem 0 2rem;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .leaderboard-table.full {
        font-size: 0.85rem;
    }

    .leaderboard-table.full th,
    .leaderboard-table.full td {
        padding: 0.6rem 0.5rem;
    }

    .col-lines,
    .leaderboard-table.full .lines {
        display: none;
    }

    .col-level,
    .leaderboard-table.full .level {
        display: none;
    }

    .empty-state {
        padding: 3rem 1.5rem;
    }
}

/* ─── Focus States ────────────────────────────────────────────────────────── */
.tab:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: -2px;
}

/* ─── Reduced Motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .leaderboard-table.full tbody tr {
        animation: none;
    }
}
