/* Animations CSS for Names of Allah Game */

@keyframes sparkle {
    0% {
        background-position: 0% 0%;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        background-position: 100% 100%;
        opacity: 0;
    }
}

.sparkle {
    position: relative;
    overflow: hidden;
}

.sparkle::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../assets/images/sparkle.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    animation: sparkle 1.5s ease forwards;
    pointer-events: none;
    z-index: 10;
}

/* Sparkle element animations */
@keyframes twinkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.1) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

.sparkle-element {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #FFD700;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px rgba(255, 215, 0, 0.7);
    animation: twinkle 1s infinite ease-in-out;
    pointer-events: none;
}

/* Ensure each sparkle has a slightly different animation */
.sparkle-element:nth-child(2n) {
    animation-duration: 0.8s;
    animation-delay: 0.1s;
}

.sparkle-element:nth-child(3n) {
    animation-duration: 1.2s;
    animation-delay: 0.2s;
}

.sparkle-element:nth-child(5n) {
    animation-duration: 1.5s;
    animation-delay: 0.3s;
}

/* Add star shape to some sparkles */
.sparkle-element:nth-child(3n+1) {
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

@keyframes bounce {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-5px);
    }
    40%, 80% {
        transform: translateX(5px);
    }
}

.bounce {
    animation: bounce 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.completion-message.show {
    display: block;
    animation: fadeIn 1s ease forwards;
}

/* Character animations */
@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.show-character {
    display: block !important;
    animation: popIn 0.5s ease forwards;
}
