/* =========================================
   ANIMATIONS & TRANSITIONS
   Premium SaaS Transition Library
   ========================================= */

/* ── Custom Cubic Bezier Keyframes ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

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

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

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes borderGlow {
  from { border-color: var(--border-color); box-shadow: none; }
  to { border-color: var(--accent-green); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08); }
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ── Animation Utility Classes ── */
.animate-fadeIn { 
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
}
.animate-fadeOut { 
  animation: fadeOut 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
}
.animate-slideInLeft { 
  animation: slideInLeft 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
}
.animate-slideInRight { 
  animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
}
.animate-slideInUp { 
  animation: slideInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
}
.animate-slideInDown { 
  animation: slideInDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
}
.animate-spin { 
  animation: spin 0.8s linear infinite; 
}
.animate-pulse { 
  animation: pulse 2s ease-in-out infinite; 
}
.animate-float { 
  animation: float 4s ease-in-out infinite; 
}

/* Live Pulse Indicator Dot animations */
.pulse-green {
  animation: pulseGlow 2s infinite;
  border-radius: 50%;
}

/* ── Transition Utilities ── */
.transition-all { 
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1); 
}
.transition-colors { 
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; 
}
.transition-transform { 
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); 
}
.transition-opacity { 
  transition: opacity 0.15s ease; 
}

/* ── Hover Lift (Soft and luxurious translate + shadow) ── */
.hover-lift {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(16, 185, 129, 0.25);
}

.hover-scale {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.hover-scale:hover { 
  transform: scale(1.02); 
}

/* ── Page Transition ── */
.page-enter {
  animation: fadeIn 0.25s ease forwards, slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.page-exit {
  animation: fadeOut 0.2s ease forwards;
}

/* ── Stagger Animation for Lists ── */
.stagger-item {
  opacity: 0;
  animation: slideInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 60ms; }
.stagger-item:nth-child(3) { animation-delay: 120ms; }
.stagger-item:nth-child(4) { animation-delay: 180ms; }
.stagger-item:nth-child(5) { animation-delay: 240ms; }
.stagger-item:nth-child(6) { animation-delay: 300ms; }

/* ── Scan animation for QR Code ── */
.qr-scanning::after {
  content: '';
  position: absolute;
  left: 8px;
  width: calc(100% - 16px);
  height: 2px;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: scan 2.5s ease-in-out infinite;
}
@keyframes scan {
  0% { top: 8px; }
  50% { top: calc(100% - 10px); }
  100% { top: 8px; }
}

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