﻿/* ======== LEADERBOARD MODAL ======== */
.lb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.lb-overlay.show {
    opacity: 1;
    visibility: visible;
}

.lb-modal {
    width: 480px;
    max-width: 95vw;
    max-height: 90vh;
    background: linear-gradient(168deg, #111827 0%, #0b0e17 100%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.6), 0 0 60px rgba(0,149,255,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(30px) scale(0.96);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.lb-overlay.show .lb-modal {
    transform: translateY(0) scale(1);
}

/* Header */
.lb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.lb-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lb-header-icon {
    font-size: 24px;
    filter: drop-shadow(0 0 6px rgba(255,215,0,0.4));
}
.lb-header-title {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffd700 0%, #ffab00 50%, #ff6d00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}
.lb-close-btn {
    background: rgba(255,255,255,0.06);
    border: none;
    color: var(--text3);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.lb-close-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* Timer Banner */
.lb-timer-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(0,149,255,0.08), rgba(139,92,246,0.08));
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 12px;
    color: var(--text2);
}
.lb-timer-icon {
    font-size: 14px;
    animation: lb-pulse 2s ease-in-out infinite;
}
@keyframes lb-pulse {
    0%,100% { opacity: 0.7; }
    50% { opacity: 1; }
}
.lb-timer-val {
    font-weight: 700;
    color: #60a5fa;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

/* ===== PODIUM / TOP 3 ===== */
.lb-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    padding: 20px 20px 10px;
    position: relative;
}

.lb-podium-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    transition: transform 0.3s;
}
.lb-podium-card:hover {
    transform: translateY(-4px);
}

/* Avatar ring */
.lb-avatar-ring {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lb-podium-card.rank-1 .lb-avatar-ring {
    width: 68px;
    height: 68px;
    background: conic-gradient(from 0deg, #ffd700, #ff8c00, #ffd700, #fff5b8, #ffd700);
    box-shadow: 0 0 20px rgba(255,215,0,0.3);
}
.lb-podium-card.rank-2 .lb-avatar-ring {
    background: conic-gradient(from 0deg, #c0c0c0, #e8e8e8, #a0a0a0, #e0e0e0, #c0c0c0);
    box-shadow: 0 0 15px rgba(192,192,192,0.25);
}
.lb-podium-card.rank-3 .lb-avatar-ring {
    background: conic-gradient(from 0deg, #cd7f32, #e6a45c, #b87333, #daa06d, #cd7f32);
    box-shadow: 0 0 15px rgba(205,127,50,0.25);
}

.lb-avatar-inner {
    width: calc(100% - 4px);
    height: calc(100% - 4px);
    border-radius: 50%;
    background: var(--bg2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--text2);
    overflow: hidden;
}
.lb-podium-card.rank-1 .lb-avatar-inner { font-size: 26px; }

/* Crown for #1 */
.lb-crown {
    position: absolute;
    top: -14px;
    font-size: 20px;
    filter: drop-shadow(0 2px 4px rgba(255,215,0,0.5));
    animation: lb-crown-bob 3s ease-in-out infinite;
    z-index: 2;
}
@keyframes lb-crown-bob {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-3px) rotate(2deg); }
}

/* Rank badge on avatar */
.lb-rank-badge {
    position: absolute;
    bottom: -4px;
    right: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    border: 2px solid var(--bg2);
    z-index: 2;
}
.lb-podium-card.rank-1 .lb-rank-badge {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    width: 24px; height: 24px; font-size: 12px;
}
.lb-podium-card.rank-2 .lb-rank-badge {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
}
.lb-podium-card.rank-3 .lb-rank-badge {
    background: linear-gradient(135deg, #cd7f32, #a0622e);
}

/* Podium Name & Profit */
.lb-podium-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    max-width: 100px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lb-podium-card.rank-1 .lb-podium-name { font-size: 13px; }

.lb-podium-profit {
    font-size: 12px;
    font-weight: 800;
    color: #00c853;
    display: flex;
    align-items: center;
    gap: 3px;
}
.lb-podium-card.rank-1 .lb-podium-profit {
    font-size: 14px;
    text-shadow: 0 0 12px rgba(0,200,83,0.3);
}

/* Podium Base */
.lb-podium-base {
    width: 80px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8px;
    font-size: 16px;
    font-weight: 800;
    margin-top: 6px;
}
.lb-podium-card.rank-1 .lb-podium-base {
    height: 60px;
    width: 90px;
    background: linear-gradient(180deg, rgba(255,215,0,0.18), rgba(255,215,0,0.04));
    border: 1px solid rgba(255,215,0,0.2);
    border-bottom: none;
    color: #ffd700;
}
.lb-podium-card.rank-2 .lb-podium-base {
    height: 44px;
    background: linear-gradient(180deg, rgba(192,192,192,0.15), rgba(192,192,192,0.03));
    border: 1px solid rgba(192,192,192,0.15);
    border-bottom: none;
    color: #c0c0c0;
}
.lb-podium-card.rank-3 .lb-podium-base {
    height: 32px;
    background: linear-gradient(180deg, rgba(205,127,50,0.15), rgba(205,127,50,0.03));
    border: 1px solid rgba(205,127,50,0.15);
    border-bottom: none;
    color: #cd7f32;
}

/* ===== FULL LIST ===== */
.lb-list-section {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 16px;
}
.lb-list-section::-webkit-scrollbar { width: 4px; }
.lb-list-section::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.lb-list-header {
    display: grid;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    padding: 10px 12px 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    margin-bottom: 4px;
    position: sticky;
    top: 0;
    background: linear-gradient(168deg, #111827 0%, #0b0e17 100%);
    z-index: 2;
}

.lb-list-item {
    display: grid;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    padding: 10px 12px;
    border-radius: 10px;
    transition: all 0.2s;
    cursor: default;
    gap: 4px;
}
.lb-list-item:hover {
    background: rgba(255,255,255,0.03);
}

/* Rank number in list */
.lb-list-rank {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: var(--text2);
    background: rgba(255,255,255,0.05);
}
.lb-list-item.top-1 .lb-list-rank {
    background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,140,0,0.15));
    color: #ffd700;
    box-shadow: 0 0 10px rgba(255,215,0,0.1);
}
.lb-list-item.top-2 .lb-list-rank {
    background: rgba(192,192,192,0.15);
    color: #c0c0c0;
}
.lb-list-item.top-3 .lb-list-rank {
    background: rgba(205,127,50,0.15);
    color: #cd7f32;
}

/* User info in list */
.lb-list-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lb-list-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.lb-list-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-list-profit {
    font-size: 13px;
    font-weight: 800;
    color: #00c853;
    text-align: right;
    white-space: nowrap;
}

/* Top 3 rows glow */
.lb-list-item.top-1 {
    background: linear-gradient(90deg, rgba(255,215,0,0.06) 0%, transparent 100%);
    border: 1px solid rgba(255,215,0,0.08);
}
.lb-list-item.top-2 {
    background: linear-gradient(90deg, rgba(192,192,192,0.04) 0%, transparent 100%);
}
.lb-list-item.top-3 {
    background: linear-gradient(90deg, rgba(205,127,50,0.04) 0%, transparent 100%);
}

/* ===== ANIMATIONS ===== */
.lb-podium-card {
    opacity: 0;
    animation: lb-slide-up 0.5s ease forwards;
}
.lb-podium-card.rank-2 { animation-delay: 0.1s; }
.lb-podium-card.rank-1 { animation-delay: 0.25s; }
.lb-podium-card.rank-3 { animation-delay: 0.15s; }

@keyframes lb-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.lb-list-item {
    opacity: 0;
    animation: lb-fade-in 0.35s ease forwards;
}
.lb-list-item:nth-child(1) { animation-delay: 0.3s; }
.lb-list-item:nth-child(2) { animation-delay: 0.35s; }
.lb-list-item:nth-child(3) { animation-delay: 0.4s; }
.lb-list-item:nth-child(4) { animation-delay: 0.45s; }
.lb-list-item:nth-child(5) { animation-delay: 0.5s; }
.lb-list-item:nth-child(6) { animation-delay: 0.55s; }
.lb-list-item:nth-child(7) { animation-delay: 0.6s; }
.lb-list-item:nth-child(8) { animation-delay: 0.65s; }
.lb-list-item:nth-child(9) { animation-delay: 0.7s; }
.lb-list-item:nth-child(10) { animation-delay: 0.75s; }

@keyframes lb-fade-in {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Confetti particle (1st place) */
.lb-confetti {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    animation: lb-confetti-fall 2.5s ease-in infinite;
    pointer-events: none;
}
@keyframes lb-confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg); }
    100% { opacity: 0; transform: translateY(60px) rotate(720deg); }
}

/* ===== MOBILE RESPONSIVE ===== */
@media(max-width:767px) {
    .lb-overlay {
        align-items: flex-end;
    }
    .lb-modal {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }
    .lb-overlay.show .lb-modal {
        transform: translateY(0);
    }
    .lb-header {
        padding: 16px 18px 12px;
    }
    .lb-header-title {
        font-size: 16px;
    }
    .lb-podium {
        gap: 8px;
        padding: 16px 12px 8px;
    }
    .lb-avatar-ring {
        width: 48px;
        height: 48px;
    }
    .lb-podium-card.rank-1 .lb-avatar-ring {
        width: 58px;
        height: 58px;
    }
    .lb-avatar-inner {
        font-size: 18px;
    }
    .lb-podium-card.rank-1 .lb-avatar-inner {
        font-size: 22px;
    }
    .lb-podium-name {
        font-size: 11px;
        max-width: 80px;
    }
    .lb-podium-profit {
        font-size: 11px;
    }
    .lb-podium-card.rank-1 .lb-podium-profit {
        font-size: 12px;
    }
    .lb-podium-base {
        width: 70px;
    }
    .lb-podium-card.rank-1 .lb-podium-base {
        width: 80px;
        height: 52px;
    }
    .lb-podium-card.rank-2 .lb-podium-base {
        height: 38px;
    }
    .lb-podium-card.rank-3 .lb-podium-base {
        height: 28px;
    }
    .lb-list-section {
        padding: 0 12px 12px;
    }
    .lb-list-item {
        padding: 8px 10px;
    }
    .lb-list-avatar {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }
    .lb-list-name {
        font-size: 12px;
    }
    .lb-list-profit {
        font-size: 12px;
    }
    .lb-crown {
        top: -12px;
        font-size: 16px;
    }
}
