/**
 * 🏆 Leaderboard Styles
 * Diseño premium para el Salón de la Fama de Contribuidores
 */

/* ========================================
   LEADERBOARD CONTAINER
   ======================================== */

#leaderboard-container {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 40px;
    margin-top: 24px;
    border: 2px solid rgba(255, 215, 0, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

#leaderboard-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
    animation: leaderboardPulse 10s ease-in-out infinite;
    pointer-events: none;
}

@keyframes leaderboardPulse {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.5; }
    50% { transform: translate(-20px, -20px) scale(1.1); opacity: 0.8; }
}

#leaderboard-container h3 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: #ffd700;
    margin-bottom: 12px;
    text-align: center;
    text-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
    position: relative;
    z-index: 1;
}

#leaderboard-container > p {
    text-align: center;
    color: #b8b8d1;
    font-size: 1.15rem;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

/* ========================================
   GLOBAL STATS
   ======================================== */

.leaderboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateY(-3px);
}

.stat-item .stat-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.stat-item .stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 4px;
}

.stat-item .stat-label {
    display: block;
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========================================
   LEADERBOARD LIST
   ======================================== */

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.leaderboard-entry {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    display: grid;
    grid-template-columns: 60px 70px 1fr auto auto;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    animation: entryFadeIn 0.5s ease backwards;
}

.leaderboard-entry:nth-child(1) { animation-delay: 0.1s; }
.leaderboard-entry:nth-child(2) { animation-delay: 0.15s; }
.leaderboard-entry:nth-child(3) { animation-delay: 0.2s; }
.leaderboard-entry:nth-child(4) { animation-delay: 0.25s; }
.leaderboard-entry:nth-child(5) { animation-delay: 0.3s; }

@keyframes entryFadeIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.leaderboard-entry:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Estilos especiales para Top 3 */
.leaderboard-entry.gold {
    border-color: rgba(255, 215, 0, 0.5);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.leaderboard-entry.gold:hover {
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.3);
}

.leaderboard-entry.silver {
    border-color: rgba(192, 192, 192, 0.5);
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.leaderboard-entry.silver:hover {
    box-shadow: 0 8px 30px rgba(192, 192, 192, 0.3);
}

.leaderboard-entry.bronze {
    border-color: rgba(205, 127, 50, 0.5);
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.leaderboard-entry.bronze:hover {
    box-shadow: 0 8px 30px rgba(205, 127, 50, 0.3);
}

/* ========================================
   ENTRY COMPONENTS
   ======================================== */

.entry-rank {
    text-align: center;
}

.rank-number {
    font-size: 2rem;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.entry-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: 3px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: all 0.3s ease;
}

.avatar-circle.gold {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.avatar-circle.silver {
    border-color: #c0c0c0;
    box-shadow: 0 0 20px rgba(192, 192, 192, 0.4);
}

.avatar-circle.bronze {
    border-color: #cd7f32;
    box-shadow: 0 0 20px rgba(205, 127, 50, 0.4);
}

.leaderboard-entry:hover .avatar-circle {
    transform: scale(1.1) rotate(5deg);
}

.entry-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.entry-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}

.entry-pet {
    font-size: 0.95rem;
    color: #888;
    font-style: italic;
}

.entry-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.badge-icon {
    font-size: 1.5rem;
    cursor: help;
    transition: transform 0.2s ease;
}

.badge-icon:hover {
    transform: scale(1.3);
}

.no-badges {
    color: #555;
    font-size: 0.9rem;
}

.entry-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 100px;
}

.stat-primary {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-primary .stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #4caf50;
}

.stat-primary .stat-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
}

.stat-secondary {
    font-size: 0.85rem;
}

.approval-rate {
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.approval-rate.high {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.approval-rate.medium {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.approval-rate.low {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

.entry-points {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.points-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff6b6b;
}

.points-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.leaderboard-empty {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 24px;
    opacity: 0.5;
}

.leaderboard-empty h4 {
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 12px;
}

.leaderboard-empty p {
    font-size: 1.1rem;
    color: #888;
    margin-bottom: 32px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .leaderboard-entry {
        grid-template-columns: 50px 60px 1fr;
        gap: 12px;
    }

    .entry-badges {
        grid-column: 1 / -1;
        justify-content: center;
        margin-top: 8px;
    }

    .entry-stats,
    .entry-points {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
    }
}

@media (max-width: 768px) {
    #leaderboard-container {
        padding: 24px 16px;
    }

    #leaderboard-container h3 {
        font-size: 2rem;
    }

    .leaderboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .leaderboard-entry {
        grid-template-columns: 40px 50px 1fr;
        padding: 16px;
    }

    .rank-number {
        font-size: 1.5rem;
    }

    .avatar-circle {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .entry-name {
        font-size: 1rem;
    }

    .entry-pet {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .leaderboard-stats {
        grid-template-columns: 1fr;
    }

    .entry-badges {
        gap: 6px;
    }

    .badge-icon {
        font-size: 1.2rem;
    }
}

/* ========================================
   CLOSE BUTTON
   ======================================== */

.leaderboard-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.leaderboard-close-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.5);
    transform: rotate(90deg);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.leaderboard-entry.gold::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 215, 0, 0.2),
        transparent
    );
    animation: shimmer 3s infinite;
}
