/**
 * Child Application Animations
 * Celebration animations, confetti, and playful transitions
 */

/* Confetti Animation */
@keyframes confetti {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  animation: confetti 3s ease-out forwards;
  z-index: 10000;
  pointer-events: none;
}

/* Pulse Animation (for celebration emoji) */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* Shake Animation (for celebration title) */
@keyframes shake {
  0%, 100% {
    transform: translateX(0) rotate(0deg);
  }
  25% {
    transform: translateX(-10px) rotate(-5deg);
  }
  75% {
    transform: translateX(10px) rotate(5deg);
  }
}

/* Bounce Animation */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

/* Wiggle Animation */
@keyframes wiggle {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-10deg);
  }
  75% {
    transform: rotate(10deg);
  }
}

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade Out Animation */
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Slide In from Bottom */
@keyframes slideInFromBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Scale In Animation */
@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Checkmark Check Animation */
@keyframes checkmark {
  0% {
    transform: scale(0) rotate(0deg);
  }
  50% {
    transform: scale(1.3) rotate(180deg);
  }
  100% {
    transform: scale(1) rotate(360deg);
  }
}

/* Brief Celebration Toast */
.brief-celebration {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #F47920 0%, #F7931E 100%);
  color: white;
  padding: 30px 60px;
  border-radius: 20px;
  font-size: 36px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(244, 121, 32, 0.5);
  z-index: 9999;
  animation: scaleIn 0.3s ease, fadeOut 0.3s ease 1.2s forwards;
  pointer-events: none;
}

/* Star Burst */
@keyframes starBurst {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 1;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: scale(3) rotate(180deg);
    opacity: 0;
  }
}

.star-burst {
  position: fixed;
  width: 50px;
  height: 50px;
  font-size: 50px;
  animation: starBurst 1s ease-out forwards;
  z-index: 9998;
  pointer-events: none;
}

/* Rainbow Background */
@keyframes rainbowBg {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.rainbow-bg {
  background: linear-gradient(
    45deg,
    #F47920,
    #F7931E,
    #FFD700,
    #4CAF50,
    #00BCD4,
    #9C27B0
  );
  background-size: 400% 400%;
  animation: rainbowBg 3s ease infinite;
}

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

.animate-wiggle {
  animation: wiggle 0.5s ease;
}

.animate-pulse {
  animation: pulse 1s ease infinite;
}

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

.animate-fade-in {
  animation: fadeIn 0.5s ease;
}

.animate-slide-in {
  animation: slideInFromBottom 0.5s ease;
}

/* Hover Effects */
.hover-grow {
  transition: transform 0.2s ease;
}

.hover-grow:hover {
  transform: scale(1.05);
}

.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Step Celebration Overlay (GIF after each task) */
@keyframes stepCelebrationIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.step-celebration-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9995;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  animation: stepCelebrationIn 0.3s ease forwards;
}

.step-celebration-overlay.hidden {
  display: none;
}

.step-celebration-video {
  width: 280px;
  border-radius: 20px;
  display: block;
}

.step-celebration-message {
  margin-top: 12px;
  background: linear-gradient(135deg, #F47920 0%, #F7931E 100%);
  color: white;
  padding: 12px 28px;
  border-radius: 20px;
  font-size: 28px;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(244, 121, 32, 0.5);
  text-align: center;
}

/* Audio button states */
.audio-btn.active .audio-icon::after { content: ''; }
.audio-btn.muted  { opacity: 0.7; }
