/* ═══════════════════════════════════════════════════════════════
   DRIVE57 — Vehicle Cards CSS  v4.0
   Fixes: badge, trust pills, CTA button, image, footer layout
   SEO:   Schema.org Product markup in PHP
═══════════════════════════════════════════════════════════════ */

/* ── Grid ── */
.d57-vehicles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    margin-bottom: 36px;
    width: 100%;
}
.d57-cols-2 { grid-template-columns: repeat(2, 1fr); }
.d57-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Card ── */
.d57-vc {
    background: #1A1814;
    border: 1px solid #2E2B24;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.d57-vc:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(201,168,76,.15);
    border-color: rgba(201,168,76,.5);
}
.d57-vc.d57-unavailable {
    opacity: .6;
    pointer-events: none;
}

/* ── Image ── */
.d57-vc-img {
    position: relative;
    height: 210px;
    overflow: hidden;
    background: #1C1A16;
    display: flex;
    align-items: center;
    justify-content: center;
}
.d57-vc-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    padding: 20px 24px;
    background: #1C1A16;
    transition: transform .45s ease;
    display: block;
}
.d57-vc:hover .d57-vc-img img { transform: scale(1.04); }

/* Placeholder when no image uploaded */
.d57-vc-img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 100%;
    color: #3a3530;
    font-size: 52px;
    background: linear-gradient(135deg, #1C1A16 0%, #1A1814 100%);
    user-select: none;
}

/* ── Badge ── */
.d57-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #C9A84C;
    color: #0E0D0B;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 5px 11px;
    border-radius: 6px;
    z-index: 2;
    line-height: 1;
    white-space: nowrap;
}
html[dir="rtl"] .d57-badge { left: auto; right: 12px; }
.d57-badge-unavail { background: #b0280c; color: #fff; }

/* Unavailable overlay */
.d57-unavail-overlay {
    position: absolute;
    inset: 0;
    background: rgba(14,13,11,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #F2EDE4;
    letter-spacing: .1em;
    text-transform: uppercase;
    z-index: 3;
}

/* ── Body ── */
.d57-vc-body {
    padding: 16px 18px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Title block */
.d57-vc-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #26231C;
}
.d57-vc-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 19px;
    font-weight: 700;
    color: #F2EDE4;
    line-height: 1.15;
    margin-bottom: 4px;
}
.d57-vc-sub {
    font-size: 11.5px;
    color: #6B6255;
    line-height: 1.4;
    letter-spacing: .02em;
}

/* ── Specs grid ── */
.d57-vc-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 8px;
    padding: 10px 0 12px;
    margin-bottom: 10px;
    list-style: none;
}
.d57-vs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #B0A898;
    line-height: 1.3;
    white-space: nowrap;
}
html[dir="rtl"] .d57-vs { flex-direction: row-reverse; }
.d57-vs-icon {
    font-size: 13px;
    flex-shrink: 0;
    opacity: .7;
    width: 16px;
    text-align: center;
}
.d57-vs-highlight {
    color: #C9A84C;
    font-weight: 600;
}
.d57-vs-highlight .d57-vs-icon { opacity: 1; }

/* ── Trust pills ── */
.d57-vc-trust {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: nowrap;
    overflow: hidden;
}
html[dir="rtl"] .d57-vc-trust { flex-direction: row-reverse; }

.d57-trust-pill {
    font-size: 10px;
    font-weight: 600;
    color: #5a9e6f;
    background: rgba(76,175,80,.1);
    border: 1px solid rgba(76,175,80,.2);
    padding: 4px 9px;
    border-radius: 20px;
    white-space: nowrap;
    line-height: 1.3;
}

/* Dot separator between pills */
.d57-trust-sep {
    font-size: 10px;
    color: #3a3530;
    flex-shrink: 0;
    line-height: 1;
}

/* ── Card footer ── */
.d57-vc-ft {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #26231C;
}
/* RTL d57-vc-ft → handled in responsive block */

/* Price block */
.d57-price-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex-shrink: 0;
}
html[dir="rtl"] .d57-price-block { text-align: right; }

/* ── Single-line price: "À partir de 300 DH / Jour" ── */
.d57-price-line {
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: nowrap;
    white-space: nowrap;
}
html[dir="rtl"] .d57-price-line { flex-direction: row-reverse; }

.d57-price-from {
    font-size: 11px;
    font-weight: 500;
    color: #6B6255;
    white-space: nowrap;
    flex-shrink: 0;
}
.d57-price-row {
    display: flex;
    align-items: baseline;
    gap: 2px;
}
.d57-price-amt {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22px;
    font-weight: 800;
    color: #F2EDE4;
    line-height: 1;
    flex-shrink: 0;
}
.d57-price-unit {
    font-size: 11px;
    color: #6B6255;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
}

/* "Prix à discuter" badge */
.d57-price-discuter {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #C9A84C;
    background: rgba(201,168,76,.1);
    border: 1.5px solid rgba(201,168,76,.28);
    padding: 7px 13px;
    border-radius: 20px;
    white-space: nowrap;
    line-height: 1;
}

/* ── Reserve CTA — WhatsApp button ── */
.d57-btn-reserve {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    background: #25D366;
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
    font-family: inherit;
    transition: background .2s ease, transform .18s ease, box-shadow .2s ease;
    box-shadow: 0 4px 16px rgba(37,211,102,.32);
    flex-shrink: 0;
    line-height: 1;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}
.d57-btn-reserve:hover {
    background: #1aab55;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(37,211,102,.44);
    color: #fff;
}
.d57-btn-reserve:active {
    transform: translateY(0);
}
/* WhatsApp SVG icon */
.d57-wa-svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: block;
}
.d57-btn-label {
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
}

/* Unavailable state */
.d57-btn-unavail {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    background: #211F1A;
    color: #6B6255;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid #2E2B24;
    flex-shrink: 0;
    white-space: nowrap;
}

/* No vehicles */
.d57-no-vehicles {
    text-align: center;
    color: #6B6255;
    padding: 48px;
    font-size: 15px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet ≤1024px
═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .d57-vehicles-grid { grid-template-columns: repeat(2, 1fr); }
    .d57-cols-4        { grid-template-columns: repeat(2, 1fr); }
}


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet 768px (previously missing)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .d57-vehicles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .d57-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .d57-vc-img { height: 200px; }
    .d57-vc-name { font-size: 18px; }
    .d57-price-amt { font-size: 24px; }
}
/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile ≤640px
═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .d57-vehicles-grid,
    .d57-cols-2,
    .d57-cols-4 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .d57-vc { border-radius: 14px; }
    .d57-vc-img { height: 196px; }
    .d57-vc-body { padding: 14px 15px 16px; }
    .d57-vc-name { font-size: 18px; }

    /* Stack footer vertically on mobile */
    .d57-vc-ft {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    html[dir="rtl"] .d57-vc-ft { flex-direction: column; }

    .d57-btn-reserve {
        width: 100%;
        justify-content: center;
        padding: 14px 16px;
        border-radius: 10px;
    }
    .d57-wa-svg   { width: 20px; height: 20px; }
    .d57-btn-label { font-size: 14px; }
    .d57-price-amt { font-size: 20px; }
    .d57-price-discuter { font-size: 12.5px; }
    .d57-price-from { font-size: 10.5px; }

    /* Trust pills: allow wrap on narrow screens */
    .d57-vc-trust { flex-wrap: wrap; }
}

@media (max-width: 380px) {
    .d57-vc-specs { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   RTL
═══════════════════════════════════════════════════════════════ */
html[dir="rtl"] .d57-vehicles-grid { direction: rtl; }
html[dir="rtl"] .d57-vc-body       { text-align: right; }
html[dir="rtl"] .d57-vc-specs      { direction: rtl; }
html[dir="rtl"] .d57-vc-trust      { flex-direction: row-reverse; justify-content: flex-end; }
html[dir="rtl"] .d57-badge         { left: auto; right: 12px; }
html[dir="rtl"] .d57-price-block   { text-align: right; }

/* ═══════════════════════════════════════════════════════════════
   DRIVE57 — FILTER TABS
   Pure CSS/JS client-side filtering · No page reload
═══════════════════════════════════════════════════════════════ */

/* Wrapper */
.d57-filter-wrap {
    margin-bottom: 28px;
}

/* Tab strip */
.d57-filter-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 4px;
}
html[dir="rtl"] .d57-filter-tabs { flex-direction: row-reverse; }

/* Individual tab button */
.d57-filter-tab {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: 20px;
    border: 1.5px solid #2E2B24;
    background: transparent;
    color: #B0A898;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s, border-color .2s, color .2s, transform .15s;
    line-height: 1;
    letter-spacing: .02em;
}
.d57-filter-tab:hover {
    border-color: #C9A84C;
    color: #C9A84C;
    transform: translateY(-1px);
}
.d57-filter-tab.d57-tab-active {
    background: #C9A84C;
    border-color: #C9A84C;
    color: #0E0D0B;
}
.d57-filter-tab:focus-visible {
    outline: 2px solid #C9A84C;
    outline-offset: 3px;
}

/* No results message */
.d57-filter-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: #6B6255;
    font-size: 15px;
}

/* Card hide/show animation */
.d57-vc {
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease,
                opacity .25s ease;
}
.d57-vc.d57-hidden {
    display: none;
}

/* Mobile: scrollable horizontal tabs */
@media (max-width: 640px) {
    .d57-filter-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 8px;
        margin-bottom: -4px;
        /* Fade edges */
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 16px, black calc(100% - 16px), transparent 100%);
        mask-image: linear-gradient(to right, transparent 0%, black 16px, black calc(100% - 16px), transparent 100%);
    }
    .d57-filter-tabs::-webkit-scrollbar { display: none; }
    .d57-filter-tab {
        flex-shrink: 0;
        padding: 9px 16px;
        font-size: 12px;
    }
    .d57-filter-wrap { margin-bottom: 20px; }
}

@media (max-width: 375px) {
    .d57-filter-tab { padding: 8px 13px; font-size: 11.5px; }
}

/* ── RTL: WA reserve button — icon on correct side ── */
html[dir="rtl"] .d57-btn-reserve {
    flex-direction: row-reverse;
}
