/* NepalEVs Car Listings Styles */

/* Car Listings Grid */
.car-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* Car Card */
.car-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure cards stretch to equal height */
}

.car-card:hover {
    transform: translateY(-5px);
}

/* Car Image */
.car-image {
    position: relative;
    height: 200px; /* Fixed height for consistency */
    overflow: hidden;
}

.car-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.no-image {
    width: 100%;
    height: 180px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777;
}

/* Latest Launch Badge */
.latest-launch-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #cc0000; /* Deeper red background for visibility */
    color: #fff; /* White text */
    font-size: 12px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 10; /* Ensure badge is above other elements */
}

/* Car Title */
.car-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 10px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 40px; /* Fixed height for title */
    line-height: 20px; /* Center text vertically */
}

/* Car Details */
.car-details {
    padding: 15px;
    flex-grow: 1; /* Ensure details stretch to fill remaining space */
}

/* Car Price */
.car-price {
    font-size: 20px;
    font-weight: 700;
    color: #000;
    margin: 0 0 10px 0;
}

/* Car Specs */
.car-specs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f5f9;
    padding: 10px;
    border-radius: 4px;
}

.spec-item {
    flex: 1;
    text-align: center;
    font-size: 14px;
    color: #555;
    padding: 5px;
    border-right: 1px solid #ddd;
}

.spec-item:last-child {
    border-right: none;
}

.spec-item .value-suffix {
    display: block;
    font-weight: 500;
}

/* Filters Wrapper */
.filters-wrapper {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.filters-wrapper h3 {
    margin: 0 0 15px 0;
    font-size: 22px;
    color: #333;
}

.filter-toggle {
    display: none;
    font-size: 16px;
    color: #007bff;
    cursor: pointer;
    margin-bottom: 10px;
}

#car-listings-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    font-size: 14px;
    color: #555;
    margin-bottom: 5px;
}

.filter-group select,
.filter-group input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-button,
.reset-button,
.load-more-button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.filter-button {
    background: #007bff;
    color: #fff;
}

.reset-button {
    background: #dc3545;
    color: #fff;
    text-decoration: none;
}

.load-more-button {
    background: #28a745;
    color: #fff;
    margin: 20px auto;
    display: block;
}

.load-more-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Load More Wrapper */
.load-more-wrapper {
    text-align: center;
    margin-top: 20px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .car-listings-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .filters-wrapper {
        position: relative;
    }

    .filter-toggle {
        display: block;
    }

    #car-listings-filter {
        display: none;
    }

    #car-listings-filter.active {
        display: flex;
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .filter-buttons {
        justify-content: center;
    }

    .latest-launch-badge {
        font-size: 10px; /* Smaller badge text on mobile */
        padding: 4px 8px; /* Adjusted padding for mobile */
    }
}