/* ========================================================
   Animations & Micro-interactions
   ======================================================== */

/* ── Page Transitions ──────────────────────────────────── */
.page-enter {
  animation: page-enter var(--duration-slow) var(--ease-out);
}
@keyframes page-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fade-in var(--duration-base) var(--ease-out); }
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-up { animation: slide-up var(--duration-slow) var(--ease-out); }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.scale-in { animation: scale-in var(--duration-slow) var(--ease-spring); }
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ── Stagger Children ──────────────────────────────────── */
.stagger-children > * {
  opacity: 0;
  animation: stagger-item var(--duration-slow) var(--ease-out) forwards;
}
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 250ms; }
.stagger-children > *:nth-child(7) { animation-delay: 300ms; }
.stagger-children > *:nth-child(8) { animation-delay: 350ms; }
@keyframes stagger-item {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Count Up ──────────────────────────────────────────── */
.count-up {
  display: inline-block;
  animation: count-up-pop 0.6s var(--ease-spring);
}
@keyframes count-up-pop {
  0% { opacity: 0; transform: scale(0.5) translateY(10px); }
  60% { transform: scale(1.05) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Hover Effects ─────────────────────────────────────── */
.hover-lift { transition: transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base); }
.hover-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ── Pulse ─────────────────────────────────────────────── */
.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Spin ──────────────────────────────────────────────── */
.spin { animation: spin 1s linear infinite; }
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Notification Bell ─────────────────────────────────── */
.bell-ring { animation: bell-ring 0.5s var(--ease-spring); }
@keyframes bell-ring {
  0% { transform: rotate(0); }
  15% { transform: rotate(12deg); }
  30% { transform: rotate(-10deg); }
  45% { transform: rotate(8deg); }
  60% { transform: rotate(-6deg); }
  75% { transform: rotate(3deg); }
  100% { transform: rotate(0); }
}

/* ── Chart Entry ───────────────────────────────────────── */
.chart-enter { animation: chart-enter 0.8s var(--ease-out); }
@keyframes chart-enter {
  from { opacity: 0; transform: scaleY(0); transform-origin: bottom; }
  to { opacity: 1; transform: scaleY(1); }
}

/* ── Ripple ────────────────────────────────────────────── */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0);
  animation: ripple-anim 0.6s linear;
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

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