/* ═══════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════ */

/* Keyframes */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

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

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

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

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-12px) rotate(3deg); }
  66%       { transform: translateY(-6px) rotate(-2deg); }
}

@keyframes floatCoin {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-80px) rotate(360deg); opacity: 0; }
}

@keyframes coinDrop {
  0%   { transform: translateY(-100px) scale(0.8); opacity: 0; }
  60%  { transform: translateY(10px) scale(1.1); opacity: 1; }
  80%  { transform: translateY(-5px) scale(0.95); }
  100% { transform: translateY(0) scale(1); opacity: 0; }
}

@keyframes ripple {
  0%   { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(3); opacity: 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes wave {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes liquidFill {
  0%   { background-position: 0% 100%; }
  100% { background-position: 0% var(--fill-pct, 50%); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow), 0 0 40px var(--accent-glow); }
  50%       { box-shadow: 0 0 40px var(--accent-glow), 0 0 80px var(--accent-glow); }
}

@keyframes badgeUnlock {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(5deg); opacity: 1; }
  80%  { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes achievementSlide {
  0%   { transform: translateX(120%); opacity: 0; }
  20%  { transform: translateX(0); opacity: 1; }
  80%  { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(120%); opacity: 0; }
}

@keyframes xpPop {
  0%   { transform: translateY(0) scale(0.5); opacity: 0; }
  30%  { transform: translateY(-20px) scale(1.2); opacity: 1; }
  70%  { transform: translateY(-40px) scale(1); opacity: 1; }
  100% { transform: translateY(-60px) scale(0.8); opacity: 0; }
}

@keyframes fireFlicker {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  25%       { transform: scale(1.1) rotate(2deg); }
  50%       { transform: scale(0.95) rotate(-1deg); }
  75%       { transform: scale(1.05) rotate(3deg); }
}

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

@keyframes borderGlow {
  0%, 100% { border-color: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
  50%       { border-color: var(--accent2); box-shadow: 0 0 20px var(--accent-glow); }
}

@keyframes progressBar {
  from { width: 0%; }
}

/* Utility Classes */
.animate-fade-in      { animation: fadeIn 0.5s ease forwards; }
.animate-scale-in     { animation: fadeInScale 0.4s ease forwards; }
.animate-slide-left   { animation: slideInLeft 0.4s ease forwards; }
.animate-slide-right  { animation: slideInRight 0.4s ease forwards; }
.animate-pulse        { animation: pulse 2s ease infinite; }
.animate-float        { animation: float 4s ease-in-out infinite; }
.animate-spin         { animation: spin 1s linear infinite; }
.animate-spin-slow    { animation: spinSlow 8s linear infinite; }
.animate-glow         { animation: glow 2s ease-in-out infinite; }

/* Stagger helpers */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* Progress bars animate in */
.progress-bar .progress-fill {
  animation: progressBar 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Vault liquid wave */
.wave {
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 300%;
  height: 60px;
  background: rgba(56,189,248,0.3);
  border-radius: 50%;
  animation: wave 3s linear infinite;
}
.wave2 {
  animation: wave 5s linear infinite reverse;
  opacity: 0.5;
  animation-delay: -1s;
}

/* Coin float effect */
.coin-float {
  animation: floatCoin 1s ease-out forwards;
  pointer-events: none;
}

/* Achievement popup */
.achievement-popup {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  animation: achievementSlide 4s ease forwards;
  display: none;
}
.achievement-popup.show {
  display: block;
}

/* XP gain popup */
.xp-popup {
  position: fixed;
  bottom: 80px;
  right: 32px;
  z-index: 9999;
  pointer-events: none;
  animation: xpPop 1.5s ease forwards;
  display: none;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--warning);
  text-shadow: 0 0 20px rgba(245,158,11,0.5);
}
.xp-popup.show {
  display: block;
}

/* Fire streak */
.streak-fire-big {
  animation: fireFlicker 0.5s ease-in-out infinite;
  display: inline-block;
}

/* Shimmer loading effect */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--surface2) 50%,
    var(--surface) 75%
  );
  background-size: 200% auto;
  animation: shimmer 1.5s linear infinite;
}

/* Page transitions */
.content-section {
  animation: fadeIn 0.4s ease forwards;
}

/* Card hover effect */
.goal-card:hover {
  transform: translateY(-4px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Badge unlock */
.achievement-badge.just-unlocked {
  animation: badgeUnlock 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Confetti canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
}
