/* ==================== ENHANCED KEYFRAME ANIMATIONS ==================== */

/* Road Movement Animations - Enhanced */
@keyframes roadMoveSmooth {
    0% {
        transform: translateX(0) scale(1);
    }
    100% {
        transform: translateX(-200px) scale(1.01);
    }
}

@keyframes curvedRoadMove {
    0% {
        transform: translateX(0) rotate(0deg);
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        transform: translateX(-300px) rotate(-2deg);
        opacity: 0.3;
    }
}

@keyframes vehiclePassEnhanced {
    0% {
        transform: translateX(-250px) scale(0.8) rotate(2deg);
        opacity: 0;
    }
    5% {
        opacity: 0.15;
    }
    15% {
        transform: translateX(-100px) scale(0.9) rotate(1deg);
        opacity: 0.2;
    }
    50% {
        transform: translateX(50vw) scale(1) rotate(0deg);
        opacity: 0.25;
    }
    85% {
        transform: translateX(calc(100vw - 100px)) scale(0.9) rotate(-1deg);
        opacity: 0.2;
    }
    95% {
        opacity: 0.15;
    }
    100% {
        transform: translateX(calc(100vw + 250px)) scale(0.8) rotate(-2deg);
        opacity: 0;
    }
}

@keyframes motorcycleZoom {
    0% {
        transform: translateX(-300px) scale(0.6) rotate(5deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    50% {
        transform: translateX(50vw) scale(0.8) rotate(0deg);
        opacity: 0.4;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateX(calc(100vw + 300px)) scale(0.6) rotate(-5deg);
        opacity: 0;
    }
}

/* Hero Section Enhanced Animations */
@keyframes fadeInUpStaggered {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeInRightBounce {
    0% {
        opacity: 0;
        transform: translateX(80px) scale(0.9);
    }
    60% {
        transform: translateX(-10px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideInDownBounce {
    0% {
        transform: translateY(-100%) scale(0.9);
        opacity: 0;
    }
    60% {
        transform: translateY(10px) scale(1.05);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Enhanced Counter Animation */
@keyframes countUpBounce {
    0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(5deg);
        opacity: 0.8;
    }
    75% {
        transform: scale(0.95) rotate(-2deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Icon Animations - Using Your Assets */
@keyframes gearSpinSmooth {
    0% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(90deg) scale(1.05);
    }
    50% {
        transform: rotate(180deg) scale(1);
    }
    75% {
        transform: rotate(270deg) scale(1.05);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes wrenchTilt {
    0%, 100% {
        transform: rotate(-15deg) scale(1);
    }
    25% {
        transform: rotate(15deg) scale(1.1);
    }
    50% {
        transform: rotate(-10deg) scale(1.05);
    }
    75% {
        transform: rotate(20deg) scale(1.1);
    }
}

@keyframes steeringWheelTurn {
    0% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(-45deg) scale(1.05);
    }
    50% {
        transform: rotate(0deg) scale(1.1);
    }
    75% {
        transform: rotate(45deg) scale(1.05);
    }
    100% {
        transform: rotate(0deg) scale(1);
    }
}

/* Enhanced Interactive Animations */
@keyframes rippleEnhanced {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        transform: scale(6);
        opacity: 0;
    }
}

@keyframes magneticPull {
    0% {
        transform: translateX(0) translateY(0) scale(1);
    }
    100% {
        transform: translateX(var(--mouse-x, 0)) translateY(var(--mouse-y, 0)) scale(1.05);
    }
}

@keyframes cardTiltEnhanced {
    0% {
        transform: perspective(1000px) rotateX(0) rotateY(0) translateZ(0);
    }
    100% {
        transform: perspective(1000px) rotateX(var(--rotate-x, 0)) rotateY(var(--rotate-y, 0)) translateZ(20px);
    }
}

/* Enhanced Hover Effects */
@keyframes hoverLift {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    100% {
        transform: translateY(-12px) scale(1.02);
        box-shadow: 0 20px 30px rgba(0, 0, 0, 0.15);
    }
}

@keyframes brandGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(185, 28, 28, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(185, 28, 28, 0.5);
    }
}

@keyframes shineEffect {
    0% {
        transform: translateX(-100%) skewX(-15deg);
    }
    100% {
        transform: translateX(300%) skewX(-15deg);
    }
}

/* Loading and State Animations */
@keyframes loadingPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.05);
    }
}

@keyframes skeletonShimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

@keyframes progressFill {
    0% {
        width: 0%;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        width: 100%;
        opacity: 1;
    }
}

/* Notification Animations */
@keyframes notificationSlideIn {
    0% {
        transform: translateX(100%) scale(0.8);
        opacity: 0;
    }
    60% {
        transform: translateX(-10px) scale(1.05);
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes notificationSlideOut {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(100%) scale(0.8);
        opacity: 0;
    }
}

/* Floating and Breathing Effects */
@keyframes floatGentle {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-8px) rotate(1deg);
    }
    66% {
        transform: translateY(4px) rotate(-1deg);
    }
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* ==================== APPLIED ENHANCED ANIMATIONS ==================== */

/* Road Background - Enhanced */
.road-strip {
    animation: roadMoveSmooth 12s linear infinite;
    will-change: transform;
}

.strip-1 {
    animation-delay: 0s;
    animation-duration: 10s;
}

.strip-2 {
    animation-delay: -3s;
    animation-duration: 14s;
}

/* Vehicle Animations - Using Your Assets */
.road-vehicle {
    animation: vehiclePassEnhanced 20s linear infinite;
    will-change: transform;
}

.vehicle-1 {
    animation-delay: 0s;
    animation-duration: 18s;
}

.vehicle-2 {
    animation-delay: -6s;
    animation-duration: 22s;
}

.vehicle-3 {
    animation-delay: -12s;
    animation-duration: 25s;
}

/* Special Motorcycle Animation */
.road-vehicle.motorcycle {
    animation: motorcycleZoom 15s ease-in-out infinite;
    animation-delay: -8s;
}

/* Navigation - Enhanced */
.navbar {
    animation: slideInDownBounce 1s ease-out;
    backdrop-filter: blur(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-logo i {
    animation: breathe 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

.nav-link {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(185, 28, 28, 0.1), transparent);
    transition: left 0.6s ease;
}

.nav-link:hover::before {
    left: 100%;
}

/* Hero Section - Enhanced Staggered Animation */
.title-line {
    animation: fadeInUpStaggered 1s ease-out forwards;
}

.title-line:nth-child(1) {
    animation-delay: 0.2s;
}

.title-line:nth-child(2) {
    animation-delay: 0.4s;
}

.title-line:nth-child(3) {
    animation-delay: 0.6s;
}

.hero-description {
    animation: fadeInUpStaggered 1s ease-out 0.8s forwards;
}

.hero-search {
    animation: fadeInUpStaggered 1s ease-out 1s forwards;
}

.hero-buttons {
    animation: fadeInUpStaggered 1s ease-out 1.2s forwards;
}

.hero-stats {
    animation: fadeInRightBounce 1s ease-out 1.4s forwards;
}

/* Enhanced Search Animation */
.search-container {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.search-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(185, 28, 28, 0.1), transparent);
    transition: left 0.8s ease;
}

.search-container:focus-within {
    transform: scale(1.02);
    box-shadow: 0 15px 35px rgba(185, 28, 28, 0.15);
}

.search-container:focus-within::before {
    left: 100%;
}

/* Enhanced Button Animations */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px) scale(1.02);
}

.btn:active {
    transform: translateY(-1px) scale(0.98);
    transition: all 0.1s ease;
}

.btn i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover i {
    transform: translateX(8px) scale(1.1);
}

/* Enhanced Stats Counter Animation */
.stat-number {
    animation: countUpBounce 0.8s ease-out;
    transition: all 0.3s ease;
}

.stat-number.animating {
    animation: brandGlow 0.6s ease-in-out;
}

/* Enhanced Brand Cards */
.brand-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    will-change: transform;
}

.brand-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.8s ease;
}

.brand-card:hover {
    animation: hoverLift 0.4s ease-out forwards;
}

.brand-card:hover::before {
    left: 100%;
}

.brand-logo {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-card:hover .brand-logo {
    animation: floatGentle 2s ease-in-out infinite;
}

/* Brand-Specific Enhanced Hover Effects */
.brand-card[data-brand="mercedes"]:hover {
    border-color: #00d4aa;
    box-shadow: 0 20px 40px rgba(0, 212, 170, 0.2);
}

.brand-card[data-brand="bmw"]:hover {
    border-color: #0066cc;
    box-shadow: 0 20px 40px rgba(0, 102, 204, 0.2);
}

.brand-card[data-brand="audi"]:hover {
    border-color: #bb0a30;
    box-shadow: 0 20px 40px rgba(187, 10, 48, 0.2);
}

.brand-card[data-brand="jaguar"]:hover {
    border-color: #0c4b33;
    box-shadow: 0 20px 40px rgba(12, 75, 51, 0.2);
}

/* Enhanced Category Cards */
.category-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    will-change: transform;
}

.category-card:hover {
    animation: hoverLift 0.4s ease-out forwards;
}

.card-icon {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.category-card[data-category="engine"]:hover .card-icon {
    animation: gearSpinSmooth 2s ease-in-out infinite;
}

.category-card[data-category="body"]:hover .card-icon {
    animation: floatGentle 2s ease-in-out infinite;
}

.category-card[data-category="electrical"]:hover .card-icon {
    animation: brandGlow 1.5s ease-in-out infinite;
}

.category-card[data-category="transmission"]:hover .card-icon {
    animation: wrenchTilt 1.5s ease-in-out infinite;
}

.category-card[data-category="suspension"]:hover .card-icon {
    animation: steeringWheelTurn 2s ease-in-out infinite;
}

.category-card[data-category="universal"]:hover .card-icon {
    animation: breathe 1.5s ease-in-out infinite;
}

/* Enhanced Parts and Cars Cards */
.part-card,
.car-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    will-change: transform;
}

.part-card:hover,
.car-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.part-badge,
.car-badge {
    animation: breathe 3s ease-in-out infinite;
}

/* Enhanced Feature Items */
.feature-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.feature-item:hover {
    animation: floatGentle 3s ease-in-out infinite;
}

.feature-icon {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-item:hover .feature-icon {
    animation: gearSpinSmooth 2s ease-in-out infinite, brandGlow 2s ease-in-out infinite;
}

/* Enhanced Contact Form */
.form-input {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.form-input:focus {
    transform: scale(1.02);
    box-shadow: 0 10px 25px rgba(185, 28, 28, 0.1);
}

.form-group {
    position: relative;
    overflow: hidden;
}

.form-group.focused::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #B91C1C, #DC2626);
    animation: progressFill 0.5s ease-out forwards;
}

/* Enhanced Footer */
.footer {
    animation: fadeInUpStaggered 1s ease-out;
}

.social-links a {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.social-links a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.social-links a:hover {
    animation: hoverLift 0.3s ease-out forwards;
}

.social-links a:hover::before {
    left: 100%;
}

/* Enhanced Scroll Reveal */
.scroll-reveal {
    opacity: 0;
    transform: translateY(60px) scale(0.95);
    transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Enhanced Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(185, 28, 28, 0.3);
    transform: scale(0);
    animation: rippleEnhanced 0.8s linear;
    pointer-events: none;
}

/* Enhanced Toggle Buttons */
.toggle-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(185, 28, 28, 0.2), transparent);
    transition: left 0.6s ease;
}

.toggle-btn:hover::before,
.toggle-btn.active::before {
    left: 100%;
}

.toggle-btn.active {
    animation: hoverLift 0.4s ease-out forwards;
}

/* Enhanced Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(185, 28, 28, 0.2), transparent);
    animation: shineEffect 2s infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeletonShimmer 1.5s infinite;
}

/* Enhanced Magnetic Effect */
.btn-magnetic {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.btn-magnetic:hover {
    animation: magneticPull 0.3s ease-out forwards;
}

/* Enhanced 3D Tilt Effect */
.card-3d {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    will-change: transform;
}

.card-3d:hover {
    animation: cardTiltEnhanced 0.3s ease-out forwards;
}

/* Enhanced Mobile Optimizations */
@media (max-width: 768px) {
    .road-vehicle {
        animation-duration: 25s;
    }
    
    .category-card:hover,
    .brand-card:hover,
    .part-card:hover,
    .car-card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .btn:hover {
        transform: translateY(-2px) scale(1.01);
    }
    
    .feature-item:hover {
        animation: none;
        transform: translateY(-4px);
    }
    
    /* Reduce animation intensity on mobile */
    .card-icon {
        animation-duration: 3s !important;
    }
}

/* Enhanced Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .road-strip,
    .road-vehicle {
        animation: none !important;
    }
    
    .scroll-reveal {
        opacity: 1;
        transform: none;
    }
    
    .btn:hover,
    .card:hover {
        transform: none !important;
    }
}

/* Enhanced Performance Optimizations */
.brand-card,
.category-card,
.part-card,
.car-card,
.feature-item,
.btn,
.nav-link,
.road-vehicle,
.road-strip {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Enhanced Notification System */
.notification {
    animation: notificationSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.3s ease;
}

.notification.hide {
    animation: notificationSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Success/Error States */
.success {
    animation: hoverLift 0.6s ease-out, brandGlow 1s ease-in-out;
}

.error {
    animation: wrenchTilt 0.5s ease-in-out;
}

/* Enhanced Staggered Grid Animations */
.brand-card:nth-child(1) { animation-delay: 0.1s; }
.brand-card:nth-child(2) { animation-delay: 0.2s; }
.brand-card:nth-child(3) { animation-delay: 0.3s; }
.brand-card:nth-child(4) { animation-delay: 0.4s; }

.category-card:nth-child(1) { animation-delay: 0.1s; }
.category-card:nth-child(2) { animation-delay: 0.2s; }
.category-card:nth-child(3) { animation-delay: 0.3s; }
.category-card:nth-child(4) { animation-delay: 0.4s; }
.category-card:nth-child(5) { animation-delay: 0.5s; }
.category-card:nth-child(6) { animation-delay: 0.6s; }

/* Enhanced Brand-Specific Vehicle Colors */
.vehicle-brand-red {
    filter: hue-rotate(0deg) saturate(1.2);
}

.vehicle-brand-gray {
    filter: grayscale(0.3) brightness(0.9);
}

.vehicle-brand-dark {
    filter: brightness(0.7) contrast(1.1);
}

/* Enhanced Auto-Tech Theme Integration */
.autotech-primary {
    color: #B91C1C;
}

.autotech-accent {
    color: #DC2626;
}

.autotech-bg {
    background: linear-gradient(135deg, #B91C1C 0%, #DC2626 100%);
}

.autotech-border {
    border-color: #B91C1C;
}

.autotech-shadow {
    box-shadow: 0 10px 30px rgba(185, 28, 28, 0.2);
}

/* Enhanced Intersection Observer Animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Enhanced Custom Animation Delays */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }
.animate-delay-6 { animation-delay: 0.6s; }
.animate-delay-7 { animation-delay: 0.7s; }
.animate-delay-8 { animation-delay: 0.8s; }

/* Enhanced GPU Acceleration Classes */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Enhanced Theme Consistency */
:root {
    --autotech-primary: #B91C1C;
    --autotech-secondary: #DC2626;
    --autotech-accent: #F59E0B;
    --animation-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --animation-ease-bounce: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Enhanced Final Performance Optimizations */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Enhanced Print Styles */
@media print {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}