/* ========================================== */
/* CAR CARDS AND SECTIONS */
/* ========================================== */

/* Car sections */
.cars-section {
    max-width: var(--container-width);
    margin: 0 auto 80px auto;
    padding: 0 20px;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--color-text-main);
    margin-bottom: 40px;
    padding: 20px 0;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
    border-radius: 2px;
}

.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 350px);
    gap: 30px;
    justify-content: center;
}

/* Card entrance animation - CSS only for better performance */
.car-card.card-enter {
    opacity: 0;
    transform: translateZ(0) translateY(20px);
}

.car-card.card-enter.visible {
    opacity: 1;
    transform: translateZ(0) translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Disable entrance animation on mobile to prevent glitching */
@media (max-width: 1400px) {
    .car-card.card-enter {
        opacity: 1 !important;
        transform: translateZ(0) !important;
    }
    
    .car-card.card-enter.visible {
        opacity: 1 !important;
        transform: translateZ(0) !important;
        transition: none !important;
    }
}

.car-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    position: relative;
    /* Remove sticky hover/active states on mobile */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Performance optimizations for mobile */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    contain: layout style paint;
}

.car-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(217, 56, 41, 0.05), rgba(242, 82, 82, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

/* Touch feedback with automatic reset - mobile optimized */
.car-card:active {
    transform: translateZ(0) scale(0.98);
    box-shadow: 0 4px 16px rgba(217, 56, 41, 0.2);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

/* Only apply hover effects on devices that support hover */
@media (hover: hover) {
    .car-card:hover {
        transform: translateZ(0);
        box-shadow: 0 20px 40px rgba(220, 38, 38, 0.25), 0 0 0 2px rgba(220, 38, 38, 0.2);
        cursor: pointer;
        border: 1px solid transparent !important;
    }
}

.car-image {
    height: 220px;
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 4rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.car-info {
    padding: 25px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.car-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--color-text-main);
    margin-bottom: 10px;
    min-height: 3.2em;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.car-details {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.5;
    flex: 1;
}

.car-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-primary);
    text-align: right;
    margin-top: auto;
}

/* No cars available message */
.no-cars-message {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    padding: 2rem;
}

.no-cars-content {
    text-align: center;
    color: var(--color-text-muted);
}

.no-cars-content p {
    font-size: 1.2rem;
    margin: 0;
    font-style: italic;
}

/* Pointer cursor for clickable images and zoom effects */
.carousel-slide img, .car-image img {
    cursor: pointer;
    transform: scale(1);
    transition: transform 0.6s ease;
}

@media (hover: hover) {
    .car-card:hover .carousel-slide img,
    .car-card:hover .car-image img {
        transform: scale(1.05);
        transition-delay: 0.1s;
    }
}

/* Car card cursor */
.car-card {
    cursor: pointer;
}
