/* ============================================================
   Valoex — Animations & Transitions
   ============================================================ */

/* ── Page Transitions ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-24px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes scaleInSpring {
  0%   { opacity: 0; transform: scale(0.7); }
  70%  { opacity: 1; transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* ── Skeleton Loading ── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

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

/* ── Bounce ── */
@keyframes bounceIn {
  0%   { transform: scale(0); opacity: 0; }
  55%  { transform: scale(1.05); opacity: 1; }
  70%  { transform: scale(0.95); }
  85%  { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* ── Check Mark ── */
@keyframes checkDraw {
  from { stroke-dashoffset: 100; }
  to   { stroke-dashoffset: 0; }
}

@keyframes checkCircle {
  from { stroke-dashoffset: 283; }
  to   { stroke-dashoffset: 0; }
}

/* ── Confetti pieces ── */
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(80px) rotate(720deg); opacity: 0; }
}

/* ── Progress Bar Fill ── */
@keyframes progressFill {
  from { width: 0%; }
  to   { width: var(--progress-width, 0%); }
}

/* ── Count Up ── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── FAB entrance ── */
@keyframes fabIn {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ── Modal/Sheet ── */
@keyframes modalBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes bottomSheetIn {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

/* ── Toast ── */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-16px) scale(0.95); }
}

/* ── Number flicker ── */
@keyframes valueUpdate {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ── Star rating ── */
@keyframes starPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* ── Floating label ── */
@keyframes labelFloat {
  from { top: 50%; transform: translateY(-50%); font-size: 1rem; }
  to   { top: 8px; transform: translateY(0); font-size: 0.75rem; }
}

/* ── Progress ring ── */
@keyframes ringFill {
  from { stroke-dashoffset: 283; }
  to   { stroke-dashoffset: var(--ring-offset, 283); }
}

/* ── Success check ── */
@keyframes successScale {
  0%   { transform: scale(0) rotate(-45deg); }
  60%  { transform: scale(1.15) rotate(5deg); }
  80%  { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* ── Card entrance stagger ── */
.anim-fade-in    { animation: fadeIn var(--transition-base) both; }
.anim-slide-up   { animation: slideInUp 300ms cubic-bezier(.2,0,0,1) both; }
.anim-slide-down { animation: slideInDown 300ms cubic-bezier(.2,0,0,1) both; }
.anim-slide-left { animation: slideInLeft 300ms cubic-bezier(.2,0,0,1) both; }
.anim-scale-in   { animation: scaleIn 240ms cubic-bezier(.2,0,0,1) both; }
.anim-spring     { animation: scaleInSpring var(--transition-spring) both; }

.stagger-1 { animation-delay: 0ms; }
.stagger-2 { animation-delay: 60ms; }
.stagger-3 { animation-delay: 120ms; }
.stagger-4 { animation-delay: 180ms; }
.stagger-5 { animation-delay: 240ms; }
.stagger-6 { animation-delay: 300ms; }
.stagger-7 { animation-delay: 360ms; }
.stagger-8 { animation-delay: 420ms; }

/* ── Skeleton Loader ── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--md-surface-container) 25%,
    var(--md-surface-container-high) 50%,
    var(--md-surface-container) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-md);
}

/* ── Ripple effect ── */
.ripple-container {
  position: relative;
  overflow: hidden;
}

.ripple-container::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0);
  pointer-events: none;
}

.ripple-container.rippling::after {
  animation: ripple 600ms linear;
}

/* ── Page enter ── */
.page-enter {
  animation: slideInUp 280ms cubic-bezier(.2,0,0,1) both;
}

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