/* ============================================================
   animations.css — Keyframes and Transition Utilities
   Personal Expense Tracker
   ============================================================ */

/* ── Float Animation (hero illustration) ───────────────────── */
@keyframes float {
  0%   { transform: translateY(0px); }
  50%  { transform: translateY(-14px); }
  100% { transform: translateY(0px); }
}

/* ── Fade In Up (for cards on load) ────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Fade In (generic) ─────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Slide In Right (toast) ────────────────────────────────── */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(60px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* ── Slide Out Right (toast remove) ────────────────────────── */
@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(60px) scale(0.85);
  }
}

/* ── Scale In (expense item added) ─────────────────────────── */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Pulse Glow (CTA button) ────────────────────────────────── */
@keyframes pulseGlow {
  0%   { box-shadow: 0 6px 20px rgba(91, 141, 239, 0.4); }
  50%  { box-shadow: 0 8px 30px rgba(91, 141, 239, 0.65); }
  100% { box-shadow: 0 6px 20px rgba(91, 141, 239, 0.4); }
}

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

/* ── Bounce In (success state) ─────────────────────────────── */
@keyframes bounceIn {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Shake (error state) ────────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

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

/* ── Animation Utility Classes ──────────────────────────────── */
.animate-fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

.animate-fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.animate-scale-in {
  animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-bounce-in {
  animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-shake {
  animation: shake 0.4s ease;
}

.animate-pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

/* ── Staggered Animation Delays ────────────────────────────── */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* ── Section Entry Animation ────────────────────────────────── */
.section-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.section-animate.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ── Hover Lift ─────────────────────────────────────────────── */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ── Expense Delete Animation ───────────────────────────────── */
.expense-item.deleting {
  animation: fadeOut 0.3s ease forwards;
  pointer-events: none;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
    max-height: 200px;
  }
  to {
    opacity: 0;
    transform: scale(0.92);
    max-height: 0;
    padding: 0;
    margin: 0;
  }
}

/* ── New Expense Highlight ──────────────────────────────────── */
.expense-item.new-item {
  animation: newItemHighlight 1.5s ease forwards;
}

@keyframes newItemHighlight {
  0%   { background: #EBF2FF; transform: scale(1.01); }
  30%  { background: #EBF2FF; }
  100% { background: white;   transform: scale(1); }
}

/* ── Number Count Up ────────────────────────────────────────── */
.count-up {
  display: inline-block;
  transition: transform 0.1s ease;
}
