/**
 * Youth UI/UX Modernization
 * Celebratory Animations Styles
 * 
 * Styles for confetti, achievement celebrations, and milestone animations.
 * 
 * Requirements: 23.5
 */

/* ===================================
   Achievement Celebration Overlay
   =================================== */

.achievement-celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  animation: fadeIn var(--duration-base) var(--ease-out);
  padding: var(--space-4);
}

.achievement-celebration-overlay.fade-out {
  animation: fadeOut var(--duration-base) var(--ease-out);
}

.achievement-celebration-content {
  background: var(--color-background);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  max-width: 500px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-2xl);
  animation: scaleInBounce var(--duration-slow) var(--ease-bounce);
  position: relative;
  overflow: hidden;
}

.achievement-celebration-content::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  right: -50%;
  bottom: -50%;
  background: radial-gradient(circle, var(--color-primary-100) 0%, transparent 70%);
  animation: pulse 2s ease-in-out infinite;
  opacity: 0.3;
}

[data-theme="dark"] .achievement-celebration-content::before {
  background: radial-gradient(circle, var(--color-primary-900) 0%, transparent 70%);
}

.achievement-icon {
  font-size: 6rem;
  margin-bottom: var(--space-4);
  animation: bounceIn 0.8s var(--ease-bounce);
  display: inline-block;
}

.achievement-title {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.achievement-description {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
  line-height: var(--line-height-relaxed);
}

.achievement-close-btn {
  padding: var(--space-3) var(--space-6);
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  box-shadow: var(--shadow-lg);
}

.achievement-close-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

/* ===================================
   Milestone Celebration Overlay
   =================================== */

.milestone-celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  animation: fadeIn var(--duration-base) var(--ease-out);
  padding: var(--space-4);
}

.milestone-celebration-overlay.fade-out {
  animation: fadeOut var(--duration-base) var(--ease-out);
}

.milestone-celebration-content {
  background: var(--color-background);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  max-width: 600px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-2xl);
  animation: scaleInBounce var(--duration-slow) var(--ease-bounce);
  position: relative;
  overflow: visible;
}

.milestone-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.burst-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 3px solid var(--color-primary-500);
  border-radius: 50%;
  opacity: 0;
}

.burst-ring-1 {
  width: 100px;
  height: 100px;
  animation: burstExpand 1.5s ease-out;
}

.burst-ring-2 {
  width: 100px;
  height: 100px;
  animation: burstExpand 1.5s ease-out 0.2s;
}

.burst-ring-3 {
  width: 100px;
  height: 100px;
  animation: burstExpand 1.5s ease-out 0.4s;
}

.milestone-icon {
  font-size: 8rem;
  margin-bottom: var(--space-4);
  animation: rotateIn 1s var(--ease-bounce);
  display: inline-block;
  position: relative;
  z-index: 1;
}

.milestone-title {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 1;
}

.milestone-message {
  font-size: var(--font-size-xl);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
  line-height: var(--line-height-relaxed);
  position: relative;
  z-index: 1;
}

.milestone-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  position: relative;
  z-index: 1;
}

.milestone-stat {
  padding: var(--space-3);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-border);
}

.milestone-stat .stat-value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-500);
  margin-bottom: var(--space-1);
}

.milestone-stat .stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.milestone-close-btn {
  padding: var(--space-3) var(--space-8);
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
}

.milestone-close-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-2xl);
}

/* ===================================
   Quick Celebration Message
   =================================== */

.quick-celebration-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: white;
  background: var(--gradient-primary);
  padding: var(--space-6) var(--space-8);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  z-index: 10001;
  opacity: 0;
  transition: all var(--duration-base) var(--ease-bounce);
}

.quick-celebration-message.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* ===================================
   Firework Effects
   =================================== */

.firework {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
}

.firework-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

/* ===================================
   Sparkle Effect
   =================================== */

.sparkle-effect {
  position: fixed;
  width: 50px;
  height: 50px;
  pointer-events: none;
  z-index: 10000;
  animation: sparkleRotate 1s ease-out;
}

.sparkle-ray {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 25px;
  background: linear-gradient(to bottom, var(--color-warning-400), transparent);
  transform-origin: center top;
  animation: sparkleRay 0.6s ease-out;
}

/* ===================================
   Star Burst
   =================================== */

.star-burst {
  position: fixed;
  width: 100px;
  height: 100px;
  pointer-events: none;
  z-index: 10000;
  animation: starBurstRotate 1.5s ease-out;
}

.burst-star {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: var(--font-size-2xl);
  transform-origin: center;
  animation: burstStarFly 1s ease-out forwards;
}

/* ===================================
   Animations
   =================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes scaleInBounce {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.2) rotate(20deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes rotateIn {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-360deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.1) rotate(20deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.5;
  }
}

@keyframes burstExpand {
  0% {
    width: 100px;
    height: 100px;
    opacity: 1;
  }
  100% {
    width: 400px;
    height: 400px;
    opacity: 0;
  }
}

@keyframes sparkleRotate {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(180deg);
    opacity: 0;
  }
}

@keyframes sparkleRay {
  0% {
    height: 0;
    opacity: 1;
  }
  50% {
    height: 25px;
    opacity: 1;
  }
  100% {
    height: 25px;
    opacity: 0;
  }
}

@keyframes starBurstRotate {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5) rotate(360deg);
    opacity: 0;
  }
}

@keyframes burstStarFly {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) translateY(-100px) scale(0.5);
    opacity: 0;
  }
}

/* ===================================
   Reduced Motion Support
   =================================== */

@media (prefers-reduced-motion: reduce) {
  .achievement-celebration-overlay,
  .milestone-celebration-overlay,
  .quick-celebration-message,
  .achievement-icon,
  .milestone-icon,
  .burst-ring,
  .sparkle-effect,
  .star-burst,
  .firework {
    animation: none !important;
  }
  
  .achievement-celebration-content,
  .milestone-celebration-content {
    animation: fadeIn var(--duration-base) var(--ease-out);
  }
  
  .quick-celebration-message.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    transition: opacity var(--duration-base) var(--ease-out);
  }
}

/* ===================================
   Responsive Adjustments
   =================================== */

@media (max-width: 640px) {
  .achievement-celebration-content,
  .milestone-celebration-content {
    padding: var(--space-6);
  }
  
  .achievement-icon {
    font-size: 4rem;
  }
  
  .milestone-icon {
    font-size: 5rem;
  }
  
  .achievement-title {
    font-size: var(--font-size-2xl);
  }
  
  .milestone-title {
    font-size: var(--font-size-3xl);
  }
  
  .achievement-description,
  .milestone-message {
    font-size: var(--font-size-base);
  }
  
  .quick-celebration-message {
    font-size: var(--font-size-2xl);
    padding: var(--space-4) var(--space-6);
  }
  
  .milestone-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
