/* Optimized Index Page Styles - Performance Enhanced */
/* Consolidated and optimized for better loading */

/* Hero Section Optimization */
.hero-slide {
    transition: opacity 0.6s ease-in-out;
}

.hero-slide.active {
    animation: slideIn 0.8s ease-out;
}

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

/* Button Optimization - Consolidated into .btn-primary */
.btn-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    color: white;
    text-decoration: none;
}

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* Card Hover Effects - Optimized with hardware acceleration */
.car-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

.car-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* FAQ Optimizations */
.faq-answer {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.faq-answer.hidden {
    max-height: 0;
    opacity: 0;
}

.faq-answer:not(.hidden) {
    max-height: 500px;
    opacity: 1;
}

/* Image Loading Optimization */
.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy.loaded {
    opacity: 1;
}

/* Performance Optimizations */
* {
    box-sizing: border-box;
}

/* Reduce repaints for frequently animated elements */
.slide-indicator,
.hero-slide,
.car-card {
    will-change: transform, opacity;
}

/* Optimize font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Critical CSS for above-the-fold content */
.hero-section {
    min-height: 60vh;
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Mobile-first responsive optimizations */
@media (max-width: 768px) {
    .hero-section {
        background-attachment: scroll; /* Better performance on mobile */
        min-height: 50vh;
    }
    
    .car-card:hover {
        transform: none; /* Disable hover effects on touch devices */
    }
    
    .btn-primary {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
}

/* Preload critical resources */
@media (min-width: 769px) {
    .hero-section::before {
        content: '';
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.6));
        z-index: 1;
    }
}

/* Grid optimizations */
.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    contain: layout;
}

/* Loading states */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}