/* SpellingBee Animation Styles */

/* Keyframe Animations */
@keyframes badgeGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 255, 255, 0.6);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -30px, 0);
    }
    70% {
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
    }
    to {
        transform: scale(1);
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-200deg);
    }
    to {
        opacity: 1;
        transform: rotate(0);
    }
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

@keyframes confetti {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

@keyframes starTwinkle {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: scale(1.2) rotate(90deg);
        opacity: 0.8;
    }
    50% {
        transform: scale(0.8) rotate(180deg);
        opacity: 1;
    }
    75% {
        transform: scale(1.1) rotate(270deg);
        opacity: 0.9;
    }
}

@keyframes letterDance {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(-5deg);
    }
    50% {
        transform: translateY(-20px) rotate(0deg);
    }
    75% {
        transform: translateY(-10px) rotate(5deg);
    }
}

@keyframes wordGlow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
        color: inherit;
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
        color: #FFD700;
    }
}

@keyframes rainbow {
    0% { color: #ff0000; }
    16.66% { color: #ff8000; }
    33.33% { color: #ffff00; }
    50% { color: #00ff00; }
    66.66% { color: #0080ff; }
    83.33% { color: #8000ff; }
    100% { color: #ff0000; }
}

/* Animation Classes */
.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out;
}

.animate-slideInLeft {
    animation: slideInLeft 0.5s ease-out;
}

.animate-slideInRight {
    animation: slideInRight 0.5s ease-out;
}

.animate-zoomIn {
    animation: zoomIn 0.6s ease-out;
}

.animate-rotateIn {
    animation: rotateIn 0.6s ease-out;
}

.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

.animate-starTwinkle {
    animation: starTwinkle 2s ease-in-out infinite;
}

.animate-letterDance {
    animation: letterDance 1s ease-in-out;
}

.animate-wordGlow {
    animation: wordGlow 1.5s ease-in-out;
}

.animate-rainbow {
    animation: rainbow 3s linear infinite;
}

/* Celebration Animations */
.celebration-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    animation: confetti 3s linear infinite;
}

.confetti-piece:nth-child(2n) {
    background: #4ecdc4;
    animation-delay: 0.5s;
    animation-duration: 2.5s;
}

.confetti-piece:nth-child(3n) {
    background: #ffe66d;
    animation-delay: 1s;
    animation-duration: 3.5s;
}

.confetti-piece:nth-child(4n) {
    background: #a8e6cf;
    animation-delay: 1.5s;
    animation-duration: 2s;
}

.confetti-piece:nth-child(5n) {
    background: #ff8b94;
    animation-delay: 2s;
    animation-duration: 4s;
}

/* Success Feedback Animations */
.success-feedback {
    position: absolute;
    font-size: 2rem;
    font-weight: bold;
    color: #4CAF50;
    animation: zoomIn 0.5s ease-out;
    pointer-events: none;
    z-index: 100;
}

.error-feedback {
    position: absolute;
    font-size: 2rem;
    font-weight: bold;
    color: #f44336;
    animation: shake 0.5s ease-in-out;
    pointer-events: none;
    z-index: 100;
}

/* Letter Animation Classes for Games */
.letter-correct {
    background: linear-gradient(45deg, #4CAF50, #45a049) !important;
    color: white !important;
    animation: bounce 0.6s ease-out;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.letter-incorrect {
    background: linear-gradient(45deg, #f44336, #da190b) !important;
    color: white !important;
    animation: shake 0.5s ease-in-out;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

.letter-highlight {
    background: linear-gradient(45deg, #FFD700, #FFA500) !important;
    color: #333 !important;
    animation: pulse 1s infinite;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

/* Word Building Animations */
.word-building-letter {
    transition: all 0.3s ease;
    cursor: pointer;
}

.word-building-letter:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.word-building-letter.dragging {
    transform: rotate(5deg) scale(1.1);
    opacity: 0.8;
    z-index: 1000;
}

.drop-zone {
    transition: all 0.3s ease;
    border: 2px dashed transparent;
}

.drop-zone.drag-over {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
    transform: scale(1.05);
}

.drop-zone.correct {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
    animation: pulse 0.5s ease-out;
}

.drop-zone.incorrect {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.2);
    animation: shake 0.5s ease-in-out;
}

/* Progress Bar Animations */
.progress-fill {
    transition: width 1s ease-out;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, .2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, .2) 50%,
        rgba(255, 255, 255, .2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 50px 50px;
    animation: progressStripes 1s linear infinite;
}

@keyframes progressStripes {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

/* Button Hover Effects */
.play-btn, .settings-btn, .progress-btn, .help-btn {
    position: relative;
    overflow: hidden;
}

.play-btn::before, .settings-btn::before, .progress-btn::before, .help-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.play-btn:active::before, .settings-btn:active::before, 
.progress-btn:active::before, .help-btn:active::before {
    width: 300px;
    height: 300px;
}

/* Loading Animation */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Delayed Animations for Staggered Effects */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

/* Reduced Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
