/* ===== Leaderboard Page Styles ===== */

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 20px;
}

.page-header h1 {
    font-size: 2rem;
    margin: 0 0 4px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    color: var(--text-secondary);
    margin: 0;
}

.your-rank {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 16px 24px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.your-rank-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.your-rank-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* ===== Filters ===== */
.leaderboard-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.period-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 6px;
    border-radius: var(--radius-lg);
}

.period-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.period-tab:hover {
    color: var(--text-primary);
}

.period-tab.active {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: var(--card-shadow);
}

.filter-options {
    display: flex;
    align-items: center;
    gap: 20px;
}

.toggle-item.compact {
    padding: 0;
    border: none;
    gap: 12px;
}

.toggle-item.compact .toggle-label {
    font-size: 0.9375rem;
    font-weight: 500;
}

.sort-select select {
    padding: 10px 40px 10px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all var(--transition-fast);
}

.sort-select select:hover {
    border-color: var(--primary);
}

.sort-select select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ===== Podium ===== */
.podium-section {
    margin-bottom: 48px;
}

.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 20px;
    padding: 40px 20px 0;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.podium-crown {
    position: absolute;
    top: -40px;
    color: #f59e0b;
    animation: crown-bounce 2s ease-in-out infinite;
}

@keyframes crown-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.podium-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: visible;
    position: relative;
    margin-bottom: 12px;
}

.podium-item.first .podium-avatar {
    width: 100px;
    height: 100px;
}

.podium-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid var(--border-color);
    background: var(--card-bg);
}

.podium-item.first .podium-avatar img {
    border-color: #f59e0b;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.3);
}

.podium-item.second .podium-avatar img {
    border-color: #94a3b8;
}

.podium-item.third .podium-avatar img {
    border-color: #b45309;
}

.podium-badge {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.875rem;
    border: 3px solid var(--card-bg);
}

.podium-item.first .podium-badge {
    background: #f59e0b;
    color: white;
    width: 32px;
    height: 32px;
}

.podium-item.second .podium-badge {
    background: #94a3b8;
    color: white;
}

.podium-item.third .podium-badge {
    background: #b45309;
    color: white;
}

.podium-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.podium-item.first .podium-name {
    font-size: 1.125rem;
}

.podium-score {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.podium-stand {
    width: 120px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.podium-stand.first {
    height: 100px;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.15) 0%, var(--card-bg) 100%);
    border-color: rgba(245, 158, 11, 0.3);
    width: 140px;
}

.podium-stand.second {
    height: 70px;
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.15) 0%, var(--card-bg) 100%);
    border-color: rgba(148, 163, 184, 0.3);
}

.podium-stand.third {
    height: 50px;
    background: linear-gradient(180deg, rgba(180, 83, 9, 0.15) 0%, var(--card-bg) 100%);
    border-color: rgba(180, 83, 9, 0.3);
}

/* ===== Leaderboard Table ===== */
.leaderboard-table {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 80px 1fr 100px 100px 100px;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-list {
    padding: 8px 0;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 80px 1fr 100px 100px 100px;
    gap: 16px;
    padding: 16px 24px;
    align-items: center;
    transition: all var(--transition-fast);
}

.leaderboard-row:hover {
    background: var(--bg-tertiary);
}

.leaderboard-row.friend {
    background: rgba(99, 102, 241, 0.05);
}

.leaderboard-row.friend:hover {
    background: rgba(99, 102, 241, 0.1);
}

.leaderboard-row.you {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary);
}

.col-rank {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.leaderboard-row.you .col-rank {
    color: var(--primary);
}

.col-player {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: visible;
    position: relative;
    flex-shrink: 0;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.friend-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary);
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    color: white;
}

.player-info {
    display: flex;
    flex-direction: column;
}

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

.player-level {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.col-stat {
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.leaderboard-header .col-stat {
    text-align: center;
}

/* Separator */
.leaderboard-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 4px;
}

/* Actions */
.leaderboard-actions {
    display: flex;
    justify-content: center;
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 60px 1fr 80px 80px;
    }

    .leaderboard-header .col-stat:nth-child(4),
    .leaderboard-row .col-stat:nth-child(4) {
        display: none;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .your-rank {
        align-items: flex-start;
        width: 100%;
    }

    .leaderboard-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .period-tabs {
        justify-content: center;
        flex-wrap: wrap;
    }

    .period-tab {
        padding: 8px 16px;
        font-size: 0.875rem;
    }

    .filter-options {
        justify-content: space-between;
    }

    .podium {
        gap: 12px;
        padding: 30px 10px 0;
    }

    .podium-avatar {
        width: 60px;
        height: 60px;
    }

    .podium-item.first .podium-avatar {
        width: 76px;
        height: 76px;
    }

    .podium-crown svg {
        width: 24px;
        height: 24px;
    }

    .podium-stand {
        width: 90px;
    }

    .podium-stand.first {
        width: 100px;
        height: 80px;
    }

    .podium-stand.second {
        height: 55px;
    }

    .podium-stand.third {
        height: 40px;
    }

    .podium-name {
        font-size: 0.875rem;
    }

    .podium-item.first .podium-name {
        font-size: 1rem;
    }

    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 50px 1fr 70px;
        gap: 12px;
        padding: 12px 16px;
    }

    .leaderboard-header .col-stat:nth-child(3),
    .leaderboard-row .col-stat:nth-child(3),
    .leaderboard-header .col-stat:nth-child(5),
    .leaderboard-row .col-stat:nth-child(5) {
        display: none;
    }

    .player-avatar {
        width: 36px;
        height: 36px;
    }

    .player-name {
        font-size: 0.9375rem;
    }

    .player-level {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .period-tabs {
        width: 100%;
    }

    .period-tab {
        flex: 1;
        padding: 8px 10px;
        font-size: 0.8125rem;
        text-align: center;
    }
}
