/* ============================================
   Animations & Transitions
   ============================================ */

/* === Keyframes === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideUp {
  from { transform: translateY(100%) translateX(-50%); }
  to { transform: translateY(0) translateX(-50%); }
}

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

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

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

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

@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-100%); opacity: 0; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

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

@keyframes scaleOut {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.9); opacity: 0; }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  15% { transform: scale(1.3); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
  60% { transform: scale(1); }
}

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

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

@keyframes confetti {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-200px) rotate(720deg); opacity: 0; }
}

@keyframes ripple {
  0% { transform: scale(0); opacity: 0.5; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes flyToCart {
  0% { transform: scale(1) translate(0, 0); opacity: 1; }
  80% { transform: scale(0.3) translate(var(--fly-x), var(--fly-y)); opacity: 0.8; }
  100% { transform: scale(0) translate(var(--fly-x), var(--fly-y)); opacity: 0; }
}

@keyframes notificationSlide {
  0% { transform: translateY(-100%); opacity: 0; }
  10% { transform: translateY(0); opacity: 1; }
  90% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-100%); opacity: 0; }
}

/* === Animation Classes === */
.animate-fade-in { animation: fadeIn var(--transition-normal); }
.animate-fade-out { animation: fadeOut var(--transition-normal); }
.animate-slide-up { animation: slideUpSimple var(--transition-normal); }
.animate-slide-in-right { animation: slideInRight var(--transition-normal); }
.animate-slide-in-left { animation: slideInLeft var(--transition-normal); }
.animate-scale-in { animation: scaleIn var(--transition-normal); }
.animate-bounce { animation: bounce var(--transition-spring); }
.animate-heart { animation: heartBeat 0.6s ease; }
.animate-count-up { animation: countUp 0.4s ease; }

/* === Transition Classes (for router) === */
.screen-enter {
  animation: slideInRight var(--transition-normal) forwards;
}

.screen-enter-back {
  animation: slideInLeft var(--transition-normal) forwards;
}

.screen-exit {
  animation: slideOutLeft var(--transition-normal) forwards;
}

.screen-exit-back {
  animation: slideOutRight var(--transition-normal) forwards;
}

/* === Notification Popup === */
.notification-popup {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 428px;
  padding: var(--space-md);
  z-index: var(--z-notification);
  animation: notificationSlide 5s ease forwards;
}

.notification-popup__card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: var(--space-md);
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

/* === Confetti Effect === */
.confetti-container {
  position: fixed;
  top: 50%;
  left: 50%;
  pointer-events: none;
  z-index: var(--z-notification);
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti 1.5s ease forwards;
}

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