/* ==========================================================================
   Vegarix v3 Custom Animations & Micro-Interactions
   Express Truck Delivery Animation, Add-to-Cart Particle & Morph, Smooth Drawers
   ========================================================================== */

/* 1. Order Tracking Express Truck & Highway Animation */
.truck-animation-container {
  background: linear-gradient(180deg, #F8FAFC 0%, #F1F5F9 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 20px 20px;
  margin-bottom: 24px;
  overflow: hidden;
  position: relative;
}

.truck-scene {
  position: relative;
  width: 100%;
  height: 60px;
  margin-bottom: 8px;
}

/* The Animated Road */
.truck-road {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  height: 6px;
  background: #334155;
  border-radius: 3px;
  overflow: hidden;
}

.truck-road-dashes {
  position: absolute;
  top: 2px;
  left: 0;
  width: 200%;
  height: 2px;
  background: repeating-linear-gradient(90deg, #FFFFFF, #FFFFFF 14px, transparent 14px, transparent 28px);
  animation: moveRoad 0.75s linear infinite;
}

@keyframes moveRoad {
  0% { transform: translateX(0); }
  100% { transform: translateX(-28px); }
}

/* The Animated Truck */
.animated-truck-wrapper {
  position: absolute;
  bottom: 12px;
  display: flex;
  align-items: center;
  transition: left 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: truckBounce 0.4s ease-in-out infinite alternate;
}

@keyframes truckBounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-2px); }
}

.truck-smoke {
  position: absolute;
  left: -8px;
  bottom: 8px;
  width: 6px;
  height: 6px;
  background: #CBD5E1;
  border-radius: 50%;
  opacity: 0;
  animation: smokePuff 0.8s ease-out infinite;
}

@keyframes smokePuff {
  0% { transform: scale(0.6) translate(0, 0); opacity: 0.8; }
  100% { transform: scale(2.4) translate(-14px, -8px); opacity: 0; }
}

.truck-milestone-points {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-top: 10px;
}

.milestone-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.milestone-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #E2E8F0;
  border: 2px solid #FFFFFF;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.milestone-node.active .milestone-dot {
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.15);
  transform: scale(1.15);
}

.milestone-node.completed .milestone-dot {
  background: #16A34A;
  box-shadow: 0 0 0 3px #DCFCE7;
}

.milestone-text {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.milestone-node.active .milestone-text {
  color: var(--primary);
}

.milestone-node.completed .milestone-text {
  color: #16A34A;
}

/* 2. Interactive Add to Cart Button Feedback Animation */
.btn-v3.btn-loading,
.btn-card-order.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn-v3.btn-loading::after,
.btn-card-order.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin: -9px 0 0 -9px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
}

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

.btn-v3.btn-success-flash,
.btn-card-order.btn-success-flash {
  background-color: #16A34A !important;
  color: #FFFFFF !important;
  transform: scale(1.03);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* 3. Smooth Off-Canvas Drawer Menu Animation */
.mobile-menu-drawer {
  transform: translateX(-100%) !important;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease !important;
  visibility: hidden !important;
  will-change: transform !important;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15) !important;
}

.mobile-menu-drawer.open {
  transform: translateX(0) !important;
  visibility: visible !important;
}

.mobile-menu-overlay {
  opacity: 0 !important;
  visibility: hidden !important;
  transition: opacity 0.3s ease, visibility 0.3s ease !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  background: rgba(15, 23, 42, 0.45) !important;
}

.mobile-menu-overlay.active {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Stagger animation for mobile nav items */
.mobile-menu-drawer.open .mobile-nav-item {
  animation: navItemFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* ==========================================================================
   4. Live Express Delivery Highway Animation on Order Track
   ========================================================================== */
.track-active-highway {
  background: #0F172A;
  border-radius: 12px;
  padding: 24px 20px;
  margin-top: 20px;
  color: #FFFFFF;
  text-align: center;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.2);
  position: relative;
  overflow: hidden;
}

.highway-scene {
  position: relative;
  height: 70px;
  margin-bottom: 12px;
}

.highway-track {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  height: 8px;
  background: #334155;
  border-radius: 4px;
  overflow: hidden;
}

.highway-dashes {
  position: absolute;
  top: 3px;
  left: 0;
  width: 200%;
  height: 2px;
  background: repeating-linear-gradient(90deg, #FFFFFF, #FFFFFF 16px, transparent 16px, transparent 32px);
  animation: moveHighway 0.55s linear infinite;
}

@keyframes moveHighway {
  0% { transform: translateX(0); }
  100% { transform: translateX(-32px); }
}

.highway-truck {
  position: absolute;
  bottom: 14px;
  left: 45%;
  animation: truckSpeedDrive 0.35s ease-in-out infinite alternate;
}

@keyframes truckSpeedDrive {
  0% { transform: translateY(0) rotate(0.5deg); }
  100% { transform: translateY(-3px) rotate(-0.5deg); }
}

.truck-exhaust {
  position: absolute;
  left: -10px;
  bottom: 8px;
  width: 8px;
  height: 8px;
  background: #94A3B8;
  border-radius: 50%;
  opacity: 0;
  animation: exhaustPuff 0.6s ease-out infinite;
}

@keyframes exhaustPuff {
  0% { transform: scale(0.5) translate(0, 0); opacity: 0.9; }
  100% { transform: scale(3) translate(-22px, -12px); opacity: 0; }
}

.highway-text {
  font-size: 13.5px;
  font-weight: 600;
  color: #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
  animation: pulseDot 1s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   5. Cart Pop and Quantity Stepper Animations
   ========================================================================== */
@keyframes cartBadgePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.cart-pop {
  animation: cartBadgePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.btn-added-bounce {
  animation: addBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes addBounce {
  0% { transform: scale(1); }
  35% { transform: scale(0.94); }
  70% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
