/**
 * Batarya Oto Lastik & Jant - Pure Code Animation System
 * Optimized for 60fps GPU acceleration (transform, opacity)
 */

/* ==========================================================================
   1. HERO STAGGERED ENTRANCES
   ========================================================================== */
@keyframes heroFadeUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 28px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes heroCardIn {
  0% {
    opacity: 0;
    transform: translate3d(30px, 20px, 0) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.25), inset 0 0 15px rgba(220, 38, 38, 0.1);
  }
  50% {
    box-shadow: 0 0 30px rgba(220, 38, 38, 0.5), inset 0 0 20px rgba(220, 38, 38, 0.2);
  }
}

.hero-anim-badge {
  animation: heroFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.hero-anim-title {
  animation: heroFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}

.hero-anim-desc {
  animation: heroFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.hero-anim-features {
  animation: heroFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.55s both;
}

.hero-anim-actions {
  animation: heroFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.7s both;
}

.hero-anim-card {
  animation: heroCardIn 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.45s both;
}

@keyframes cardEntrance {
  0% {
    opacity: 0;
    transform: translate3d(0, 24px, 0) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.card-entrance {
  animation: cardEntrance 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ==========================================================================
   2. HERO ROAD SPEED & CANVAS WRAPPER
   ========================================================================== */
.hero-canvas-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

#hero-tread-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Ambient Speed Grid Overlay */
.speed-grid-overlay {
  background-image: 
    linear-gradient(to right, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, #000 70%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, #000 70%, transparent 100%);
}

/* ==========================================================================
   3. 3D TILT TIRE CARDS & ROTATING RIM ACCENT
   ========================================================================== */
.tilt-card-wrapper {
  perspective: 1000px;
  transform-style: preserve-3d;
}

.tilt-card {
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  transform-style: preserve-3d;
  will-change: transform;
  position: relative;
  overflow: hidden;
}

.tilt-card-glare {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.15) 0%, transparent 65%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 5;
  border-radius: inherit;
}

.tilt-card:hover .tilt-card-glare {
  opacity: 1;
}

/* Rotating Wheel/Rim Accent */
.rim-rotate-icon {
  display: inline-block;
  transform-origin: center center;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

.group:hover .rim-rotate-icon,
.tilt-card:hover .rim-rotate-icon {
  transform: rotate(180deg) scale(1.1);
}

/* Tire Tread Pattern Ribbon Accent */
.tread-ribbon {
  background: repeating-linear-gradient(
    45deg,
    rgba(220, 38, 38, 0.08),
    rgba(220, 38, 38, 0.08) 6px,
    transparent 6px,
    transparent 12px
  );
}

/* ==========================================================================
   4. EU TIRE LABEL ANIMATED RATING BARS
   ========================================================================== */
.eu-bar-track {
  background: #e4e4e7;
  height: 6px;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.dark .eu-bar-track,
.bg-zinc-900 .eu-bar-track {
  background: #27272a;
}

.eu-bar-fill {
  height: 100%;
  border-radius: 9999px;
  width: 0%;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: width;
}

.eu-bar-fill.fill-green {
  background: linear-gradient(90deg, #10b981, #059669);
}

.eu-bar-fill.fill-blue {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.eu-bar-fill.fill-amber {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.eu-bar-fill.fill-red {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* ==========================================================================
   5. DYNAMIC TAB SLIDER & SPINNING TIRE FILTER WIDGET
   ========================================================================== */
.filter-tabs-nav {
  position: relative;
  display: flex;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 12px;
  padding: 4px;
}

.filter-tab-pill {
  position: relative;
  z-index: 2;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.25s ease;
  user-select: none;
}

.filter-tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  border-radius: 8px;
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
  transition: transform 0.35s cubic-bezier(0.2, 1, 0.3, 1), width 0.35s cubic-bezier(0.2, 1, 0.3, 1);
  z-index: 1;
  pointer-events: none;
}

@keyframes spinTireSlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.animate-spin-tire {
  animation: spinTireSlow 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   6. SVG STROKE ANIMATIONS & SERVICES REVEAL
   ========================================================================== */
.service-icon-box {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.service-card:hover .service-icon-box {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.2);
}

/* Laser Alignment Line Animation */
@keyframes laserSweep {
  0% {
    stroke-dashoffset: 100;
    opacity: 0.2;
  }
  50% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  100% {
    stroke-dashoffset: -100;
    opacity: 0.2;
  }
}

.laser-line-anim {
  stroke-dasharray: 20, 10;
  animation: laserSweep 2.5s linear infinite;
}

/* Air Pressure Gauge Pulse */
@keyframes gaugeNeedle {
  0%, 100% {
    transform: rotate(-25deg);
  }
  50% {
    transform: rotate(35deg);
  }
}

.gauge-needle-anim {
  transform-origin: 24px 24px;
  animation: gaugeNeedle 3s ease-in-out infinite;
}

/* Wrench Torque Micro Motion */
@keyframes wrenchTorque {
  0%, 100% {
    transform: rotate(0deg);
  }
  30% {
    transform: rotate(-15deg);
  }
  60% {
    transform: rotate(10deg);
  }
}

.service-card:hover .wrench-anim {
  animation: wrenchTorque 1.2s ease-in-out infinite;
}

/* ==========================================================================
   7. 24/7 EMERGENCY ROAD ASSISTANCE RADAR PING
   ========================================================================== */
@keyframes radarWave {
  0% {
    transform: scale(0.9);
    opacity: 0.9;
  }
  70% {
    transform: scale(2.2);
    opacity: 0.05;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

.radar-ping-ring {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background-color: inherit;
  animation: radarWave 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
  pointer-events: none;
}

.radar-ping-ring:nth-child(2) {
  animation-delay: 0.6s;
}

.radar-ping-ring:nth-child(3) {
  animation-delay: 1.2s;
}

/* Glowing Live Dot */
@keyframes glowDot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 12px #22c55e;
  }
  50% {
    opacity: 0.6;
    transform: scale(0.85);
    box-shadow: 0 0 4px #22c55e;
  }
}

.glow-live-dot {
  animation: glowDot 2s ease-in-out infinite;
}

/* ==========================================================================
   8. SCROLL REVEAL (INTERSECTION OBSERVER)
   ========================================================================== */
.reveal-on-scroll {
  opacity: 0;
  transform: translate3d(0, 32px, 0);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.stagger-delay-1 { transition-delay: 0.1s; }
.stagger-delay-2 { transition-delay: 0.2s; }
.stagger-delay-3 { transition-delay: 0.3s; }
.stagger-delay-4 { transition-delay: 0.4s; }
.stagger-delay-5 { transition-delay: 0.5s; }

/* ==========================================================================
   9. STICKY NAVBAR GLASS SCROLLED STATE
   ========================================================================== */
header.navbar-scrolled {
  background-color: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
  border-bottom-color: rgba(228, 228, 231, 0.9) !important;
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

header.navbar-scrolled .navbar-inner {
  min-height: 4.5rem !important;
  transition: min-height 0.3s ease;
}

header.navbar-scrolled .navbar-inner img {
  height: 4.5rem !important;
  transition: height 0.3s ease;
}

/* ==========================================================================
   10. FLOATING 24/7 WHATSAPP & EMERGENCY CTA
   ========================================================================== */
.floating-emergency-cta {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.emergency-btn-pulse {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.emergency-btn-pulse:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.6);
}

.floating-tooltip {
  position: absolute;
  right: 68px;
  background: #18181b;
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  border: 1px solid #27272a;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(8px, 0, 0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.floating-emergency-cta:hover .floating-tooltip {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* ==========================================================================
   11. ACCESSIBILITY / PREFERS REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
  }

  .tilt-card {
    transform: none !important;
  }

  #hero-tread-canvas {
    display: none !important;
  }
}
