* {
    box-sizing: border-box;
}

:root {
    --primary-color: #002fa9;
    --primary-light: #edf3ff;
    --price-color: #ef172c;
    --text-color: #101828;
    --muted-color: #667085;
    --border-color: #e4e7ec;
    --background-color: #f4f6f8;
    --white-color: #ffffff;
    --label-background: #f1f1f1;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text-color);
    background: var(--background-color);
}

.car-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* width: min(1500px, 98%); */
    margin: 0 auto;

    a {
        text-decoration: none;
        color: #002fa9;
    }
    
img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

}

.vehicle-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1.5% auto;
}

/* Card */

.car-card {
    display: grid;
    grid-template-columns: minmax(350px, 30%) minmax(0, 1fr);
    gap: 20px;
    padding: 18px;
    background: var(--white-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(16, 24, 40, 0.06);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.car-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.1);
}

/* Gallery */

.car-gallery {
    display: grid;
    grid-template-columns: minmax(0, 2.4fr) minmax(105px, 1fr);
    gap: 5px;
    height: 220px;
    min-height: 0;
}

.car-main-image {
    position: relative;
    overflow: hidden;
    background: #eeeeee;
    border-radius: 8px;
}

.car-thumbnails {
    display: grid;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    height: 100%;
    gap: 5px;
    min-width: 0;
}

.car-thumbnails img {
    overflow: hidden;
    border-radius: 8px;
}

.thumb_btn {
    cursor: pointer;
}

.photo-count {
    position: absolute;
    left: 12px;
    bottom: 12px;
    padding: 8px 12px;
    color: #ffffff;
    background: rgba(16, 24, 40, 0.75);
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    backdrop-filter: blur(5px);
}

/* Details */

.car-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.car-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 5px 0 14px;
    border-bottom: 1px solid var(--border-color);
}

.car-title {
    min-width: 0;
    margin: 0;
    color: var(--primary-color);
    font-size: clamp(19px, 1.6vw, 25px);
    line-height: 1.3;
    text-transform: uppercase;
}

.car-type {
    flex-shrink: 0;
    padding: 7px 11px;
    color: var(--primary-color);
    background: var(--primary-light);
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
}

/* Main specifications */

.car-specifications {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.car-spec {
    min-width: 0;
    padding: 0 15px;
    text-align: center;
    border-right: 1px solid var(--border-color);
}

.car-spec:first-child {
    padding-left: 0;
}

.car-spec:last-child {
    padding-right: 0;
    border-right: 0;
}

.spec-label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted-color);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.spec-value {
    display: block;
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.car-price {
    color: var(--price-color);
    font-size: 17px;
}

/* Detail table */

/* ===================================
   DESKTOP TABLE
=================================== */

.car-info-table-wrap {
    width: 100%;
    margin-top: auto;
    padding-top: 12px;
}

.car-info-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #ffffff;
    font-size: 12px;
}

.car-info-table th,
.car-info-table td {
    height: 38px;
    padding: 8px 10px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.car-info-table th {
    width: 11%;
    color: #475467;
    background: var(--primary-light);
    font-weight: 600;
    white-space: nowrap;
}

.car-info-table td {
    width: 14%;
    color: #101828;
    background: #ffffff;
    font-weight: 600;
}

.car-info-table tr:last-child th,
.car-info-table tr:last-child td {
    border-bottom: 0;
}

.car-info-table tr > *:last-child {
    border-right: 0;
}

/* Tablet */
@media screen and (max-width: 1300px) {
    .car-info-table {
        display: block;
        table-layout: auto;
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .car-info-table tbody {
        display: block;
    }

    .car-info-table tr {
        display: grid;
        grid-template-columns:
            minmax(95px, 120px) minmax(0, 1fr)
            minmax(95px, 120px) minmax(0, 1fr);

        margin-bottom: 8px;
        overflow: hidden;
        border: 1px solid var(--border-color);
        border-radius: 5px;
        background: #ffffff;
    }

    .car-specifications{
        padding: 10px 0;
    }

    .car-info-table tr:last-child {
        margin-bottom: 0;
    }

    .car-info-table th,
    .car-info-table td {
        display: flex;
        align-items: center;
        width: auto;
        min-width: 0;
        min-height: 38px;
        height: auto;
        padding: 8px 10px;
        border: 0;
        border-right: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
    }

    .car-info-table tr:last-child th,
.car-info-table tr:last-child td {
     border-right: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
}

    /* Remove right border from each value cell */
    .car-info-table td:nth-child(4n) {
        border-right: 0;
    }

    /* Remove bottom border from last four cells */
    /* .car-info-table tr > *:nth-last-child(-n + 4) {
        border-bottom: 0;
    } */

    .car-info-table th {
        font-size: 11px;
        white-space: normal;
    }

    .car-info-table td {
        font-size: 12px;
        overflow-wrap: anywhere;
    }
}
@media screen and (max-width: 1050px) {
    body {
        padding: 15px;
    }

    .car-list,
    .vehicle-header {
        width: 100%;
    }

    .car-card {
        grid-template-columns: minmax(300px, 40%) minmax(0, 1fr);
        gap: 15px;
        padding: 14px;
    }

    .car-gallery {
        height: 215px;
    }

    .car-specifications {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-bottom: 8px;
    }

    .car-spec {
        padding: 5px;
    }

    .car-spec:nth-child(2) {
        border-right: 0;
    }

    .car-spec:nth-child(3),
    .car-spec:nth-child(4) {
        border-top: 1px solid var(--border-color);
    }

      .car-info-table th,
    .car-info-table td {
        min-height: 28px;
        padding: 8px 9px;
        border-bottom: 1px solid var(--border-color);
    }
}

/* Small tablet */

@media screen and (max-width: 890px) {
     .car-card {
        grid-template-columns: 1fr;
    }

    .car-gallery {
        height: 320px;
        min-height: 320px;
        max-height: 320px;
    }
}

/* Mobile */

@media screen and (max-width: 700px) {
    .car-info-table-wrap {
        padding-top: 10px;
    }

    .car-info-table tr {
        grid-template-columns: minmax(100px, 38%) minmax(0, 62%);
    }

   

    .car-info-table th {
        border-right: 1px solid var(--border-color);
        font-size: 10px;
    }

    .car-info-table td {
        border-right: 0;
        font-size: 11px;
        white-space: normal;
    }

    /* Reset desktop/tablet border rules */
    .car-info-table td:nth-child(4n) {
        border-right: 0;
    }

    .car-info-table tr > *:nth-last-child(-n + 4) {
        border-bottom: 1px solid var(--border-color);
    }

    /* Only final label and value have no bottom border */
    .car-info-table tr > *:nth-last-child(-n + 2) {
        border-bottom: 0;
    }
}

@media screen and (max-width: 600px) {
    body {
        padding: 10px;
    }

    .car-list {
        gap: 12px;
    }

    .car-card {
        gap: 13px;
        padding: 10px;
        border-radius: 13px;
    }

     .car-gallery {
        height: 230px;
        min-height: 230px;
        max-height: 230px;
    }

    .car-main-image {
        height: 100%;
    }

    /* .car-thumbnails {
        display: none;
    } */

    .car-title-row {
        align-items: flex-start;
        padding: 3px 2px 12px;
    }

    .car-title {
        font-size: 17px;
    }

    .car-type {
        max-width: 105px;
        padding: 6px 8px;
        overflow: hidden;
        font-size: 9px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .car-specifications {
        grid-template-columns: repeat(4, minmax(75px, 1fr));
        padding: 12px 0;
        overflow-x: auto;
    }

    .car-spec {
        padding: 0 7px;
    }

    .car-spec:nth-child(2) {
        border-right: 1px solid var(--border-color);
    }

    .car-spec:nth-child(3),
    .car-spec:nth-child(4) {
        border-top: 0;
    }

    .spec-label {
        margin-bottom: 5px;
        font-size: 8px;
        white-space: nowrap;
    }

    .spec-value {
        font-size: 11px;
    }

    .car-price {
        font-size: 12px;
    }

    .car-info-table-wrap {
        padding-top: 12px;
    }

    .car-info-table {
        /* min-width: 680px; */
        font-size: 12px;
    }

    .car-info-table th,
    .car-info-table td {
        padding: 8px;
    }
}

@media screen and (max-width: 380px) {
    .car-info-table tr {
        grid-template-columns: 95px minmax(0, 1fr);
    }

    .car-info-table th,
    .car-info-table td {
        padding: 7px 8px;
    }

    .car-info-table th {
        font-size: 9px;
    }

    .car-info-table td {
        font-size: 10px;
    }
}