/* =============================================
   ZWET RIDE — SHARED ANIMATIONS LIBRARY
   Premium micro-interactions & transitions
   ============================================= */

/* ── Keyframe Animations ── */

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

/* Fade Up */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Fade Down */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Slide In from Right */
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Slide In from Left */
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Slide Up (Bottom Sheet) */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

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

/* Scale Bounce */
@keyframes scaleBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

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

/* Pulse */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Pulse Scale */
@keyframes pulseScale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Ping (for notifications) */
@keyframes ping {
  0% { transform: scale(1); opacity: 1; }
  75%, 100% { transform: scale(2); opacity: 0; }
}

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

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

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

/* Radar Scan (for finding driver) */
@keyframes radarScan {
  0% { transform: scale(0.3); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* Marker Bounce (map) */
@keyframes markerBounce {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-15px); }
  50% { transform: translateY(0); }
  70% { transform: translateY(-7px); }
}

/* Shake */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

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

/* Glow */
@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px var(--primary-glow); }
  50% { box-shadow: 0 0 20px var(--primary-glow), 0 0 40px var(--primary-glow); }
}

/* Gradient Shift */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Typewriter Cursor */
@keyframes blink {
  0%, 100% { border-color: transparent; }
  50% { border-color: var(--text); }
}

/* Counter Up (for numbers) */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Confetti */
@keyframes confetti {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(600px) rotate(720deg); opacity: 0; }
}

/* Slide to complete */
@keyframes slideComplete {
  0% { width: 0; }
  100% { width: 100%; }
}

/* Dot Loading */
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Progress Bar */
@keyframes progressBar {
  from { width: 0%; }
  to { width: 100%; }
}

/* ── Animation Utility Classes ── */

.animate-fadeIn { animation: fadeIn 0.4s ease-out forwards; }
.animate-fadeUp { animation: fadeUp 0.5s ease-out forwards; }
.animate-fadeDown { animation: fadeDown 0.5s ease-out forwards; }
.animate-slideRight { animation: slideInRight 0.4s ease-out forwards; }
.animate-slideLeft { animation: slideInLeft 0.4s ease-out forwards; }
.animate-slideUp { animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.animate-scaleIn { animation: scaleIn 0.3s ease-out forwards; }
.animate-scaleBounce { animation: scaleBounce 0.5s ease-out forwards; }
.animate-bounce { animation: bounce 2s infinite; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-pulseScale { animation: pulseScale 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-glow { animation: glow 2s ease-in-out infinite; }
.animate-shake { animation: shake 0.5s ease; }

/* Stagger Delays */
.delay-1 { animation-delay: 50ms; }
.delay-2 { animation-delay: 100ms; }
.delay-3 { animation-delay: 150ms; }
.delay-4 { animation-delay: 200ms; }
.delay-5 { animation-delay: 250ms; }
.delay-6 { animation-delay: 300ms; }
.delay-7 { animation-delay: 350ms; }
.delay-8 { animation-delay: 400ms; }

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-tertiary) 25%,
    var(--bg-secondary) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: var(--radius-xs);
}
.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }

.skeleton-circle {
  border-radius: var(--radius-full);
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
}

/* Ripple Effect */
.ripple-container {
  position: relative;
  overflow: hidden;
}
.ripple-container::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
}
.ripple-container:active::after {
  animation: ripple 0.6s ease-out;
}

/* Tap Scale */
.tap-scale {
  transition: transform var(--transition-fast);
}
.tap-scale:active {
  transform: scale(0.95);
}

/* 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);
}

/* Radar Scanner */
.radar-ring {
  position: absolute;
  border: 2px solid var(--primary);
  border-radius: 50%;
  animation: radarScan 2s ease-out infinite;
}
.radar-ring:nth-child(2) { animation-delay: 0.5s; }
.radar-ring:nth-child(3) { animation-delay: 1s; }
.radar-ring:nth-child(4) { animation-delay: 1.5s; }

/* Loading Dots */
.loading-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: dotBounce 1.4s infinite ease-in-out both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* Progress */
.progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* Page Transition Classes */
.page-enter {
  animation: slideInRight 0.3s ease-out forwards;
}
.page-exit {
  animation: slideInLeft 0.3s ease-out forwards reverse;
}

/* Bottom Sheet */
.bottom-sheet-enter {
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Toast */
.toast-enter {
  animation: fadeDown 0.3s ease-out forwards, fadeUp 0.3s ease-in 2.5s forwards;
}

/* Map Marker */
.marker-enter {
  animation: markerBounce 0.6s ease-out;
}

/* Number Counter Animation */
.counter-animate {
  animation: countUp 0.5s ease-out;
  display: inline-block;
}

/* Gradient Background Animation */
.animated-gradient {
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}

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