/* ============================================
   ANIMATIONS — Keyframes, transitions, loaders
   ============================================ */

/* ── Fade ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Scale ── */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes scaleOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.9); }
}

/* ── Slide ── */
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
@keyframes slideInBottom {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ── Shimmer (Skeleton Loader) ── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Pulse ── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

/* ── Bounce ── */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ── Aurora Glow (Generation Progress) ── */
@keyframes auroraGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Ripple ── */
@keyframes ripple {
  0% { transform: scale(0); opacity: 0.5; }
  100% { transform: scale(4); opacity: 0; }
}

/* ── Progress Bar ── */
@keyframes progressIndeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ── Heart Beat ── */
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(1); }
  75% { transform: scale(1.1); }
}

/* ── Float ── */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ── Glow Pulse ── */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(16, 185, 129, 0.2); }
  50% { box-shadow: 0 0 24px rgba(16, 185, 129, 0.5); }
}

/* ── Toast Slide ── */
@keyframes toastIn {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0) scale(1); opacity: 1; }
  to { transform: translateX(100%) scale(0.9); opacity: 0; }
}

/* ── Image Reveal ── */
@keyframes imageReveal {
  0% { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

/* ── Dots Loading ── */
@keyframes dotsLoading {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ── Utility Classes ── */
.animate-fade-in { animation: fadeIn var(--transition-base) forwards; }
.animate-fade-in-up { animation: fadeInUp var(--transition-slow) forwards; }
.animate-fade-in-down { animation: fadeInDown var(--transition-slow) forwards; }
.animate-scale-in { animation: scaleIn var(--transition-base) forwards; }
.animate-slide-in-right { animation: slideInRight var(--transition-slow) forwards; }
.animate-slide-in-bottom { animation: slideInBottom var(--transition-slow) forwards; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-bounce { animation: bounce 1.5s ease-in-out infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-glow { animation: glowPulse 2s ease-in-out infinite; }
.animate-heart { animation: heartBeat 0.5s ease-in-out; }
.animate-image-reveal { animation: imageReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

/* ── Skeleton Shimmer ── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-skeleton) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    var(--bg-skeleton) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* ── Spinner ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-top-color: var(--color-primary-400);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner--sm { width: 14px; height: 14px; }
.spinner--lg { width: 32px; height: 32px; border-width: 3px; }

/* ── Dots Loader ── */
.dots-loader {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.dots-loader span {
  width: 6px;
  height: 6px;
  background: var(--color-primary-400);
  border-radius: 50%;
  animation: dotsLoading 1.4s ease-in-out infinite both;
}
.dots-loader span:nth-child(1) { animation-delay: -0.32s; }
.dots-loader span:nth-child(2) { animation-delay: -0.16s; }

/* ── Aurora Progress Bar ── */
.aurora-bar {
  height: 3px;
  background: linear-gradient(90deg,
    var(--color-primary-500),
    var(--color-accent-400),
    var(--color-primary-300),
    var(--color-accent-500)
  );
  background-size: 300% 100%;
  animation: auroraGlow 2s ease infinite;
  border-radius: var(--radius-full);
}

/* ── Progress Indeterminate ── */
.progress-indeterminate {
  position: relative;
  height: 3px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-indeterminate::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 30%;
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  animation: progressIndeterminate 1.5s ease-in-out infinite;
}

/* ── Stagger Children ── */
.stagger-children > * {
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.5s; }
