/* ============================================
   ANIMATIONS.CSS — Micro-animations
   ============================================ */

/* Page transitions */
.page-enter {
  animation: fadeSlideIn 0.22s ease forwards;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Number counter animation */
.count-up { transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1); }

/* Chart appear */
.chart-appear {
  animation: chartReveal 0.5s ease forwards;
}
@keyframes chartReveal {
  from { opacity: 0; transform: scaleY(0.95); transform-origin: bottom; }
  to   { opacity: 1; transform: scaleY(1); }
}

/* Profit/Loss flash */
.flash-profit {
  animation: flashGreen 0.5s ease;
}
.flash-loss {
  animation: flashRed 0.5s ease;
}
@keyframes flashGreen {
  0%   { background-color: transparent; }
  30%  { background-color: var(--color-profit-light); }
  100% { background-color: transparent; }
}
@keyframes flashRed {
  0%   { background-color: transparent; }
  30%  { background-color: var(--color-loss-light); }
  100% { background-color: transparent; }
}

/* Slide up for cards */
.slide-up {
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp 0.4s ease forwards;
}
.slide-up:nth-child(1) { animation-delay: 0ms; }
.slide-up:nth-child(2) { animation-delay: 60ms; }
.slide-up:nth-child(3) { animation-delay: 120ms; }
.slide-up:nth-child(4) { animation-delay: 180ms; }
.slide-up:nth-child(5) { animation-delay: 240ms; }
.slide-up:nth-child(6) { animation-delay: 300ms; }

@keyframes slideUp {
  to { opacity: 1; transform: translateY(0); }
}

/* Fade in */
.fade-in { animation: fadeIn 0.3s ease forwards; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Price tick */
.tick-up { color: var(--color-profit); transition: color 0.3s; }
.tick-down { color: var(--color-loss); transition: color 0.3s; }

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

/* Collapse/Expand */
.collapsible {
  overflow: hidden;
  transition: max-height var(--transition-slow), opacity var(--transition-base);
}
.collapsible.closed { max-height: 0; opacity: 0; }
.collapsible.open { max-height: 2000px; opacity: 1; }

/* Stagger animation for table rows */
.table tbody tr {
  animation: rowIn 0.2s ease both;
}
.table tbody tr:nth-child(1)  { animation-delay: 0ms; }
.table tbody tr:nth-child(2)  { animation-delay: 30ms; }
.table tbody tr:nth-child(3)  { animation-delay: 60ms; }
.table tbody tr:nth-child(4)  { animation-delay: 90ms; }
.table tbody tr:nth-child(5)  { animation-delay: 120ms; }
.table tbody tr:nth-child(6)  { animation-delay: 150ms; }
.table tbody tr:nth-child(7)  { animation-delay: 180ms; }
.table tbody tr:nth-child(8)  { animation-delay: 210ms; }
.table tbody tr:nth-child(9)  { animation-delay: 240ms; }
.table tbody tr:nth-child(10) { animation-delay: 270ms; }
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Theme transition */
body { transition: background-color 0.3s, color 0.3s; }
.card, .sidebar, .header, .modal, .stat-card {
  transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}
