/**
 * Animation Styles - Matching Framer Motion Timings
 * Updated to exactly match React app animations
 */

@layer utilities {
    /* Fade Animations - Framer Motion standard: 0.5s */
    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

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

    .fade-in {
        animation: fadeIn 0.5s ease-out;
    }

    .fade-out {
        animation: fadeOut 0.5s ease-out;
    }

    /* Slide Animations - Matching React */
    @keyframes slideInRight {
        from {
            transform: translateX(100%);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

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

    @keyframes slideInUp {
        from {
            transform: translateY(20px); /* Framer Motion default */
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

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

    .slide-in-right {
        animation: slideInRight 0.3s ease-out;
    }

    .slide-in-left {
        animation: slideInLeft 0.3s ease-out;
    }

    .slide-in-up {
        animation: slideInUp 0.5s ease-out;
    }

    .slide-in-down {
        animation: slideInDown 0.5s ease-out;
    }

    /* Scale Animations - Framer Motion: 0.95 to 1.0 */
    @keyframes scaleIn {
        from {
            transform: scale(0.95);
            opacity: 0;
        }
        to {
            transform: scale(1);
            opacity: 1;
        }
    }

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

    .scale-in {
        animation: scaleIn 0.3s ease-out;
    }

    .pulse {
        animation: pulse 2s infinite;
    }

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

    .spin {
        animation: spin 0.8s linear infinite;
    }

    /* Bounce Animation */
    @keyframes bounce {
        0%, 100% {
            transform: translateY(0);
        }
        50% {
            transform: translateY(-10px);
        }
    }

    .bounce {
        animation: bounce 1s ease-in-out infinite;
    }

    /* Shimmer Effect for Loading */
    @keyframes shimmer {
        0% {
            background-position: -1000px 0;
        }
        100% {
            background-position: 1000px 0;
        }
    }

    .shimmer {
        background: linear-gradient(
            90deg,
            #f0f0f0 0%,
            #f8f8f8 50%,
            #f0f0f0 100%
        );
        background-size: 1000px 100%;
        animation: shimmer 1.5s infinite;
    }

    /* Transition Utilities - Matching Framer Motion */
    .transition-all-300 {
        transition: all 300ms ease;
    }

    .transition-colors-200 {
        transition: color 200ms ease, background-color 200ms ease, border-color 200ms ease;
    }

    .transition-transform-300 {
        transition: transform 300ms ease;
    }

    .transition-opacity-500 {
        transition: opacity 500ms ease;
    }

    /* Hover Effects - Matching React components */
    .hover-lift {
        transition: transform 300ms ease, box-shadow 300ms ease;
    }

    .hover-lift:hover {
        transform: translateY(-4px);
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    }

    .hover-grow {
        transition: transform 300ms ease;
    }

    .hover-grow:hover {
        transform: scale(1.05);
    }

    .hover-shrink {
        transition: transform 300ms ease;
    }

    .hover-shrink:hover {
        transform: scale(0.98);
    }

    /* Loading Spinner - Using teal color */
    .spinner {
        border: 3px solid hsla(195, 90%, 40%, 0.1);
        border-left-color: hsl(195, 90%, 40%);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        animation: spin 0.8s linear infinite;
    }

    /* Smooth Scroll Behavior */
    .smooth-scroll {
        scroll-behavior: smooth;
    }

    /* Visibility Transitions */
    .show {
        opacity: 1;
        visibility: visible;
        transition: opacity 300ms ease, visibility 300ms ease;
    }

    .hide {
        opacity: 0;
        visibility: hidden;
        transition: opacity 300ms ease, visibility 300ms ease;
    }

    /* Card Hover Effects - Matching React VehicleCard */
    .card-hover {
        transition: all 300ms ease;
    }

    .card-hover:hover {
        transform: translateY(-4px) scale(1.02);
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    }

    /* Button Press Effect */
    .btn-press {
        transition: transform 150ms ease;
    }

    .btn-press:active {
        transform: scale(0.98);
    }

    /* Entrance Animations for Scroll Reveal */
    .reveal {
        opacity: 0;
        transform: translateY(30px);
        transition: all 600ms ease;
    }

    .reveal.active {
        opacity: 1;
        transform: translateY(0);
    }

    /* Stagger Animation for Lists - EXACT Framer Motion timing */
    .stagger-item {
        opacity: 0;
        transform: translateY(20px);
        animation: fadeInUp 0.5s ease-out forwards;
    }

    /* Framer Motion stagger: index * 0.1s starting from 0 */
    .stagger-item:nth-child(1) { animation-delay: 0s; }
    .stagger-item:nth-child(2) { animation-delay: 0.1s; }
    .stagger-item:nth-child(3) { animation-delay: 0.2s; }
    .stagger-item:nth-child(4) { animation-delay: 0.3s; }
    .stagger-item:nth-child(5) { animation-delay: 0.4s; }
    .stagger-item:nth-child(6) { animation-delay: 0.5s; }
    .stagger-item:nth-child(7) { animation-delay: 0.6s; }
    .stagger-item:nth-child(8) { animation-delay: 0.7s; }
    .stagger-item:nth-child(9) { animation-delay: 0.8s; }
    .stagger-item:nth-child(10) { animation-delay: 0.9s; }

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

    /* Hero Section Animations */
    @keyframes heroFadeIn {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .hero-animate {
        animation: heroFadeIn 0.8s ease-out;
    }

    /* Vehicle Card Image Zoom */
    .image-zoom {
        overflow: hidden;
    }

    .image-zoom img {
        transition: transform 300ms ease;
    }

    .image-zoom:hover img {
        transform: scale(1.1);
    }

    /* Modal Animations */
    @keyframes modalIn {
        from {
            opacity: 0;
            transform: scale(0.95);
        }
        to {
            opacity: 1;
            transform: scale(1);
        }
    }

    @keyframes modalOut {
        from {
            opacity: 1;
            transform: scale(1);
        }
        to {
            opacity: 0;
            transform: scale(0.95);
        }
    }

    .modal-enter {
        animation: modalIn 300ms ease-out;
    }

    .modal-exit {
        animation: modalOut 300ms ease-in;
    }

    /* Toast/Notification Animations */
    @keyframes toastSlideIn {
        from {
            transform: translateX(100%);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

    @keyframes toastSlideOut {
        from {
            transform: translateX(0);
            opacity: 1;
        }
        to {
            transform: translateX(100%);
            opacity: 0;
        }
    }

    .toast-enter {
        animation: toastSlideIn 300ms ease-out;
    }

    .toast-exit {
        animation: toastSlideOut 300ms ease-in;
    }

    /* Framer Motion Spring Animations (simulated) */
    .spring-bounce {
        animation: springBounce 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    }

    @keyframes springBounce {
        from {
            transform: scale(0.3);
            opacity: 0;
        }
        to {
            transform: scale(1);
            opacity: 1;
        }
    }
}