/* ============================================
   Aura Elite Leaderboard — Styles
   ============================================ */

/* ── Animated Nebula Background ── */
.leaderboard-page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding-top: 100px;
    padding-bottom: 60px;
    overflow: hidden;
}

.nebula-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.nebula-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.18;
    animation: nebulaFloat 20s ease-in-out infinite alternate;
}

.nebula-blob.nb1 {
    width: 600px;
    height: 600px;
    top: -10%;
    right: -5%;
    background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
    animation-duration: 25s;
}

.nebula-blob.nb2 {
    width: 500px;
    height: 500px;
    bottom: -15%;
    left: -10%;
    background: radial-gradient(circle, #2563eb 0%, transparent 70%);
    animation-duration: 30s;
    animation-delay: -5s;
}

.nebula-blob.nb3 {
    width: 400px;
    height: 400px;
    top: 40%;
    left: 30%;
    background: radial-gradient(circle, #a855f7 0%, transparent 70%);
    animation-duration: 22s;
    animation-delay: -10s;
}

@keyframes nebulaFloat {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(30px, -20px) scale(1.05); }
    66%  { transform: translate(-20px, 15px) scale(0.95); }
    100% { transform: translate(10px, -10px) scale(1.02); }
}

/* ── Page Title ── */
.leaderboard-hero {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 2;
}

.leaderboard-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px;
    border-radius: 9999px;
    background: rgba(0, 200, 255, 0.08);
    border: 1px solid rgba(0, 200, 255, 0.2);
    color: #00C8FF;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.leaderboard-hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    background: linear-gradient(135deg, #00C8FF 0%, #a78bfa 60%, #FF00D4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.leaderboard-hero p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ── Filter Bar ── */
.lb-filter-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 36px;
    position: relative;
    z-index: 2;
}

.lb-filter-btn {
    padding: 8px 22px;
    border-radius: 9999px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lb-filter-btn:hover {
    border-color: rgba(0, 200, 255, 0.3);
    color: var(--text-primary);
    background: rgba(0, 200, 255, 0.06);
}

.lb-filter-btn.active {
    background: rgba(0, 200, 255, 0.12);
    border-color: #00C8FF;
    color: #00C8FF;
    box-shadow: 0 0 18px rgba(0, 200, 255, 0.2), inset 0 0 8px rgba(0, 200, 255, 0.06);
}

.lb-search-wrap {
    position: relative;
    margin-inline-start: 12px;
}

.lb-search-wrap i {
    position: absolute;
    top: 50%;
    inset-inline-start: 14px;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.lb-search-input {
    padding: 8px 16px 8px 36px;
    border-radius: 9999px;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    min-width: 200px;
    outline: none;
    transition: all 0.3s ease;
}

html[dir="rtl"] .lb-search-input {
    padding: 8px 36px 8px 16px;
}

.lb-search-input::placeholder {
    color: var(--text-muted);
}

.lb-search-input:focus {
    border-color: #00C8FF;
    box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.15);
}

/* ═══════════════════════════════
   PODIUM — Top 3 Players
   ═══════════════════════════════ */
.podium-section {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 20px;
    margin-bottom: 48px;
    position: relative;
    z-index: 2;
    padding: 0 16px;
}

/* Individual podium card */
.podium-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px 24px;
    border-radius: 24px;
    background: rgba(15, 15, 20, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: visible;
    text-align: center;
}

.podium-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.05);
}

/* ── First Place (Gold / King) ── */
.podium-card.gold {
    width: 240px;
    min-height: 320px;
    border-color: rgba(255, 200, 50, 0.25);
    box-shadow:
        0 0 40px rgba(255, 200, 50, 0.12),
        0 0 80px rgba(255, 200, 50, 0.06),
        inset 0 1px 0 rgba(255, 200, 50, 0.15);
}

.podium-card.gold:hover {
    box-shadow:
        0 0 50px rgba(255, 200, 50, 0.2),
        0 0 100px rgba(255, 200, 50, 0.1),
        inset 0 1px 0 rgba(255, 200, 50, 0.2);
    border-color: rgba(255, 200, 50, 0.4);
}

.podium-card.gold .podium-avatar-ring {
    border-color: #ffc832;
    box-shadow: 0 0 20px rgba(255, 200, 50, 0.35);
}

.podium-card.gold .podium-rank-num {
    background: linear-gradient(135deg, #ffc832, #ffaa00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Thunder icon on first place (Puzzle) */
.podium-crown {
    position: absolute;
    top: -20px;
    font-size: 2rem;
    filter: drop-shadow(0 0 12px rgba(255, 200, 50, 0.7));
    animation: crownPulse 2s ease-in-out infinite;
    z-index: 3;
    line-height: 1;
}

@keyframes crownPulse {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.1) translateY(-4px); }
}

/* ── Second Place (Silver) ── */
.podium-card.silver {
    width: 210px;
    min-height: 280px;
    border-color: rgba(192, 192, 220, 0.2);
    box-shadow:
        0 0 30px rgba(192, 192, 220, 0.08),
        inset 0 1px 0 rgba(192, 192, 220, 0.12);
}

.podium-card.silver:hover {
    box-shadow:
        0 0 40px rgba(192, 192, 220, 0.15),
        inset 0 1px 0 rgba(192, 192, 220, 0.18);
    border-color: rgba(192, 192, 220, 0.35);
}

.podium-card.silver .podium-avatar-ring {
    border-color: #c0c0dc;
    box-shadow: 0 0 15px rgba(192, 192, 220, 0.25);
}

.podium-card.silver .podium-rank-num {
    background: linear-gradient(135deg, #e0e0f0, #a0a0c0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Third Place (Bronze) ── */
.podium-card.bronze {
    width: 210px;
    min-height: 280px;
    border-color: rgba(205, 127, 50, 0.2);
    box-shadow:
        0 0 30px rgba(205, 127, 50, 0.08),
        inset 0 1px 0 rgba(205, 127, 50, 0.12);
}

.podium-card.bronze:hover {
    box-shadow:
        0 0 40px rgba(205, 127, 50, 0.15),
        inset 0 1px 0 rgba(205, 127, 50, 0.18);
    border-color: rgba(205, 127, 50, 0.35);
}

.podium-card.bronze .podium-avatar-ring {
    border-color: #cd7f32;
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.25);
}

.podium-card.bronze .podium-rank-num {
    background: linear-gradient(135deg, #cd7f32, #b8650a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Podium Avatar ── */
.podium-avatar-wrap {
    position: relative;
    margin-bottom: 12px;
}

.podium-avatar-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #555;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.podium-card.gold .podium-avatar-ring {
    width: 96px;
    height: 96px;
}

.podium-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--text-muted);
}

.podium-rank-num {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 2px;
}

.podium-card.gold .podium-rank-num {
    font-size: 2.4rem;
}

.podium-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ── Puzzle Specific Stats (Podium) ── */
.podium-stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 16px;
    padding: 0 4px;
}

.podium-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.podium-stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.podium-card.gold .podium-stat-value {
    font-size: 1.2rem;
}

.podium-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.podium-rate-bar-wrap {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 6px;
}

.podium-rate-bar {
    height: 100%;
    border-radius: 9999px;
    transition: width 1s ease-out;
}

.podium-rate-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Specular highlight on podium cards */
.podium-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    border-radius: 24px 24px 0 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, transparent 100%);
    pointer-events: none;
}

/* ═══════════════════════════════
   RANKING LIST
   ═══════════════════════════════ */
.ranking-section {
    position: relative;
    z-index: 2;
    max-width: 850px;
    margin: 0 auto;
}

.ranking-header, .ranking-row {
    display: grid;
    /* Grid: Rank (60px) | Player (1fr) | Puzzles Solved (120px) | Puzzle Rating (100px) */
    grid-template-columns: 60px 1fr 120px 100px;
    gap: 12px;
    align-items: center;
}

.ranking-header {
    padding: 10px 20px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Each player row */
.ranking-row {
    padding: 12px 20px;
    border-radius: 16px;
    background: rgba(15, 15, 20, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
}

.ranking-row:hover {
    background: rgba(0, 200, 255, 0.05);
    border-color: rgba(0, 200, 255, 0.2);
    box-shadow: 0 0 25px rgba(0, 200, 255, 0.08);
    transform: translateX(-4px);
}

html[dir="rtl"] .ranking-row:hover {
    transform: translateX(4px);
}

.ranking-row:hover .rank-avatar {
    transform: scale(1.15);
}

/* Rank number + movement arrow */
.rank-number {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rank-num {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 24px;
    text-align: center;
}

/* Player info (avatar + name + country) */
.rank-player {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.rank-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    border: 2px solid rgba(0, 200, 255, 0.25);
    object-fit: cover;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-muted);
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rank-info {
    min-width: 0;
}

.rank-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-mini-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    width: 120px;
}

.rank-mini-bar-track {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    overflow: hidden;
}

.rank-mini-bar {
    height: 100%;
    border-radius: 9999px;
    transition: width 1s ease-out;
}

.rank-mini-label {
    font-size: 0.70rem;
    color: var(--text-muted);
    font-weight: 600;
    width: 28px;
    text-align: right;
}

html[dir="rtl"] .rank-mini-label {
    text-align: left;
}

/* Puzzles Solved */
.rank-solved {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

/* ELO */
.rank-elo {
    font-size: 1.05rem;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, #00C8FF, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ═══════════════════════════════
   RESPONSIVE
   ═══════════════════════════════ */
@media (max-width: 768px) {
    .podium-section {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .podium-card.gold,
    .podium-card.silver,
    .podium-card.bronze {
        width: 100%;
        max-width: 320px;
        min-height: auto;
    }

    /* On mobile, keep gold first */
    .podium-card.silver { order: 2; }
    .podium-card.gold   { order: 1; }
    .podium-card.bronze { order: 3; }

    .ranking-header {
        display: none;
    }

    .ranking-row {
        grid-template-columns: 40px 1fr 80px;
        gap: 8px;
        padding: 10px 14px;
    }

    .rank-solved {
        display: none;
    }

    .lb-filter-bar {
        gap: 8px;
    }

    .lb-filter-btn {
        padding: 6px 16px;
        font-size: 0.82rem;
    }

    .lb-search-wrap {
        width: 100%;
        margin-inline-start: 0;
        margin-top: 10px;
    }

    .lb-search-input {
        width: 100%;
    }

    .leaderboard-page {
        padding-top: 80px;
    }
}

@media (max-width: 480px) {
    .podium-card {
        padding: 24px 16px 20px;
    }

    .podium-card.gold .podium-avatar-ring {
        width: 80px;
        height: 80px;
    }

    .podium-avatar-ring {
        width: 70px;
        height: 70px;
    }
}

/* ── No results state ── */
.lb-no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 1rem;
    position: relative;
    z-index: 2;
}

.lb-no-results i {
    font-size: 2.5rem;
    margin-bottom: 16px;
    display: block;
    opacity: 0.4;
}
