/**
 * CodeStreak - Animaciones y Efectos Visuales
 */

/* Animación de confetti */
@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Animación de estrella para streaks */
@keyframes streakStarAnimation {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 0.8;
    }
}

@keyframes streakMessageAnimation {
    0% {
        transform: translateY(20px) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateY(0) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.streak-animation-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10000;
}

.streak-star {
    position: absolute;
    font-size: 2em;
    animation: streakStarAnimation 1.5s ease-out forwards;
}

.streak-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
    font-weight: bold;
    color: #FF9800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    animation: streakMessageAnimation 1.5s ease-out forwards;
}

/* Animación de bienvenida */
@keyframes welcomeFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes welcomeFadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes welcomeParticleFloat {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) translateX(20px) rotate(360deg);
        opacity: 0;
    }
}

.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: welcomeFadeIn 0.5s ease-out;
}

.welcome-content {
    text-align: center;
    color: white;
    position: relative;
}

.welcome-logo {
    font-size: 5em;
    margin-bottom: 20px;
    animation: pulse 1s ease-in-out infinite;
}

.welcome-title {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #4CAF50;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.welcome-subtitle {
    font-size: 1.2em;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 30px;
}

.welcome-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.welcome-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: welcomeParticleFloat 3s ease-out infinite;
}

/* Animación de XP ganada */
@keyframes xpGainAnimation {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -150%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -200%) scale(1);
        opacity: 0;
    }
}

.xp-popup {
    position: fixed;
    font-size: 1.5em;
    font-weight: bold;
    color: #4CAF50;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 10001;
    animation: xpGainAnimation 1.5s ease-out forwards;
}

/* Animación de pulso */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Animación de logro */
@keyframes achievementSlideIn {
    0% {
        transform: translateX(400px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes achievementSlideOut {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(400px);
        opacity: 0;
    }
}

.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10000;
    min-width: 300px;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.5s ease-out;
}

.achievement-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.achievement-icon {
    font-size: 3em;
    animation: pulse 1s ease-in-out infinite;
}

.achievement-content {
    flex: 1;
}

.achievement-title {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 5px;
}

.achievement-text {
    font-size: 0.9em;
    opacity: 0.95;
}

/* Animación de fuego para streaks */
@keyframes fireAnimation {
    0% {
        transform: translateX(-50%) translateY(0) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translateX(-50%) translateY(-20px) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(-40px) scale(1);
        opacity: 0;
    }
}

.fire-animation {
    position: fixed;
    font-size: 2em;
    pointer-events: none;
    z-index: 10000;
    animation: fireAnimation 2s ease-out forwards;
}

/* Animación de entrada para elementos */
@keyframes fadeInUp {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInDown {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeInScale {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Animación de shake para errores */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Animación de brillo para elementos destacados */
@keyframes shine {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.shine-effect {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    background-size: 200% 100%;
    animation: shine 2s ease-in-out infinite;
}

/* Efecto de partículas para nivel up */
.level-up-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.level-up-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #4CAF50;
    border-radius: 50%;
    animation: levelUpParticle 2s ease-out forwards;
}

@keyframes levelUpParticle {
    0% {
        transform: scale(0) translateY(0);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(-100px);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .welcome-title {
        font-size: 1.8em;
    }
    
    .welcome-logo {
        font-size: 3.5em;
    }
    
    .achievement-notification {
        min-width: 250px;
        padding: 15px 20px;
    }
    
    .streak-message {
        font-size: 1.2em;
    }
}

