/* ===========================
   ANIMATIONS & TRANSITIONS
   =========================== */

/* Stagger children */
.stagger-children > * {
  animation: fadeInUp 0.3s ease both;
}
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 40ms; }
.stagger-children > *:nth-child(3) { animation-delay: 80ms; }
.stagger-children > *:nth-child(4) { animation-delay: 120ms; }
.stagger-children > *:nth-child(5) { animation-delay: 160ms; }
.stagger-children > *:nth-child(6) { animation-delay: 200ms; }
.stagger-children > *:nth-child(7) { animation-delay: 240ms; }
.stagger-children > *:nth-child(8) { animation-delay: 280ms; }

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

/* Number counter animation */
.counting {
  display: inline-block;
  transition: transform 0.15s ease;
}

/* Card tap feedback */
.press-feedback {
  transition: transform var(--transition), opacity var(--transition);
}
.press-feedback:active {
  transform: scale(0.97);
  opacity: 0.85;
}

/* Ripple effect */
.ripple-container { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transform: scale(0);
  animation: rippleAnim 0.5s linear;
  pointer-events: none;
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* Balance update flash */
@keyframes balanceFlash {
  0%   { color: var(--text-primary); }
  30%  { color: var(--income); }
  100% { color: var(--text-primary); }
}

.balance-updated {
  animation: balanceFlash 0.8s ease;
}

/* Success checkmark */
@keyframes checkIn {
  0%   { stroke-dashoffset: 100; opacity: 0; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

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

/* Slide in from bottom */
@keyframes slideInBottom {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

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

/* Pulse ring for notifications */
@keyframes pulseRing {
  0%   { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

/* Chart bar grow */
@keyframes barGrow {
  from { transform: scaleY(0); transform-origin: bottom; }
  to   { transform: scaleY(1); }
}

/* Pie rotate */
@keyframes pieIn {
  from { opacity: 0; transform: scale(0.8) rotate(-90deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Tab switch */
.page-enter { animation: pageEnter 0.22s ease-out; }
.page-exit  { animation: pageExit  0.18s ease-in forwards; }

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

@keyframes pageExit {
  to { opacity: 0; transform: translateX(-10px); }
}

/* Smooth number update */
.value-changed {
  animation: numPop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes numPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Progress fill */
.progress-bar-fill {
  transition: width 0.9s cubic-bezier(0.4,0,0.2,1);
}

/* FAB pulse for first time use */
.nav-add-btn.pulse-hint::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: pulseRing 1.5s ease-out infinite;
}

/* Hover on desktop */
@media (hover: hover) {
  .tx-item:hover { background: var(--bg-card-hover); }
  .settings-item:hover { background: var(--bg-card-hover); }
  .quick-action-btn:hover { background: var(--bg-card-hover); }
  .nav-item:hover { background: var(--bg-card); }
  .glass-card:hover { border-color: var(--border-light); }
}
