/* ==========================================================================  
   PREVIOUSLY SOLD CARS - Styled Like Gallery Section  
   ========================================================================== */  

.previous-cars {
    padding: var(--space-xl) var(--space-md);
    background-color: var(--bg-light);
}

.previous-title {
    text-align: center;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: var(--space-xl);
    color: var(--primary-color);
    position: relative;
}

.previous-title::after {
    content: '';
    display: block;
    width: 100px;
    height: 4px;
    background-color: var(--secondary-color);
    margin: var(--space-md) auto 0;
}

.cars-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-md) var(--space-xl);
}

.car-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    will-change: transform;
}

.car-card:hover {
    transform: translateY(-7px);
    box-shadow: var(--shadow-lg);
}

.car-title {
    padding: var(--space-md);
    background-color: var(--primary-color);
    color: white;
    font-size: 1.5rem;
    text-align: center;
}

.car-gallery {
    position: relative;
    padding: var(--space-sm);
    background-color: #f5f5f5;
}

.main-image-container {
    aspect-ratio: 16/9;
    overflow: hidden;
    max-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f5f5f5;
}

.main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
    display: block;
}

.car-card:hover .main-image {
    transform: scale(1.05);
}

.thumbnail-gallery {
    display: flex;
    scroll-snap-type: x mandatory;
    gap: var(--space-xs);
    padding: var(--space-xs);
    overflow-x: auto;
    scrollbar-width: thin;
    justify-content: flex-start;
    width: 100%;
}

.thumbnail {
    width: 80px;
    height: 60px;
    border: none;
    padding: 0;
    scroll-snap-align: start;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    opacity: 0.7;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.thumbnail:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

.thumbnail.active {
    opacity: 1;
    border: 2px solid var(--primary-color);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.car-details {
    padding: var(--space-md);
    text-align: center;
}

.car-description {
    font-size: 1.1rem;
    color: var(--text-medium);
    margin-bottom: var(--space-md);
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.sold-price {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 1.2rem;
    font-weight: bold;
    justify-content: center;
}

.price-label {
    color: var(--text-medium);
}

.price-amount {
    color: var(--primary-dark);
}

/* Tablets (769px-1024px) - 2 columns */
@media (min-width: 769px) and (max-width: 1024px) {
    .previous-cars {
        padding: var(--space-lg) var(--space-sm);
    }

    .cars-container {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
        max-width: 95%;
        padding: 0 var(--space-sm) var(--space-lg);
        justify-items: center; /* Add this to center grid items */
    }

    .car-card {
        width: 100%; /* Ensure cards take full width of their grid cell */
        max-width: 400px; /* Optional: Set a max-width for better proportions */
    }

    .car-title {
        font-size: 1.3rem;
    }

    .car-description {
        font-size: 1rem;
        max-width: 90%;
    }

    .sold-price {
        font-size: 1.1rem;
    }
}
/* Phones and Small Tablets (≤768px) - 1 column */
@media (max-width: 768px) {
    .main-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 250px; /* you already have this for ≤768px */
}
    .previous-cars {
        padding: var(--space-md) var(--space-xs);
    }

    .cars-container {
        grid-template-columns: 1fr;
        gap: var(--space-md);
        max-width: 100%;
        padding: 0 var(--space-xs) var(--space-md);
    }

    .car-card {
        max-width: 100%; /* Changed from 400px to 100% */
        margin: 0 auto;
        width: calc(100% - var(--space-xs) * 2); /* Account for padding */
    }

}

/* Small Phones (≤480px) */
@media (max-width: 480px) {
    .main-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 250px; /* you already have this for ≤768px */
}
    .previous-cars {
        padding: var(--space-sm) var(--space-xs);
    }

    .cars-container {
        padding: 0 var(--space-xs) var(--space-sm);
    }

    .car-card {
        width: calc(100% - var(--space-xs) * 2); /* Account for padding */
    }
}
.main-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 400px;
    background-color: #f5f5f5;
    width: 100%;
    box-sizing: border-box;
}

.main-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    margin: auto;
    display: block;
}
@media (max-width: 768px) {
  .main-image-container {
    max-height: 250px;
  }
}

@media (max-width: 480px) {
  .main-image-container {
    max-height: 250px;
  }
}