/* Shared vehicle gallery + fullscreen lightbox.
   Used by rental/car.php (public car page) and partner/listings (owner details card).
   Markup convention:
     .vehicle-gallery
       .vehicle-gallery__main        (desktop single hero image)
         .vehicle-gallery__zoom      (magnifier badge)
       .vehicle-gallery__thumbs      (desktop thumb strip)
         .vehicle-gallery__thumb[.is-active][data-full=…]
       .vehicle-gallery__slides-wrap (mobile carousel wrapper)
         .vehicle-gallery__slides    (swipe track)
           .vehicle-gallery__slide
         .vehicle-gallery__zoom--mobile
       .vehicle-gallery__dots
         .vehicle-gallery__dot[.is-active]
     .vehicle-lightbox[data-images='[…]']
       .vehicle-lightbox__close / __nav--prev / __img / __nav--next / __counter
*/

.vehicle-gallery__main {
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #f3f4f6;
    position: relative;
}
.vehicle-gallery__main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.vehicle-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.vehicle-gallery__thumb {
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s ease;
    background: #f3f4f6;
}
.vehicle-gallery__thumb.is-active {
    border-color: var(--Primary, #A61D3C);
}
.vehicle-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* Mobile swipe carousel (hidden on desktop) */
.vehicle-gallery__slides,
.vehicle-gallery__dots { display: none; }
/* Gallery images open the lightbox; the magnifier badge gives the visual
   affordance so the cursor can be a plain pointer. */
.vehicle-gallery__main img,
.vehicle-gallery__slide img { cursor: pointer; }
.vehicle-gallery__zoom {
    position: absolute;
    top: 12px; right: 12px;
    width: 40px; height: 40px;
    border: 0; border-radius: 50%;
    background: rgba(14, 16, 61, 0.6);
    color: #fff;
    font-size: 15px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.15s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2;
}
.vehicle-gallery__main:hover .vehicle-gallery__zoom,
.vehicle-gallery__zoom:focus-visible {
    opacity: 1;
    transform: translateY(0);
}
.vehicle-gallery__zoom:hover {
    background: var(--Primary, #A61D3C);
}
/* Touch devices: no hover state, so pin the badge visible. */
@media (hover: none) {
    .vehicle-gallery__zoom { opacity: 1; transform: none; }
}
/* Mobile slides carousel — wrapper is position: relative so the pinned-visible
   mobile zoom badge can anchor to its top-right. */
.vehicle-gallery__slides-wrap { position: relative; }
.vehicle-gallery__zoom--mobile {
    display: none;
    opacity: 1;
    transform: none;
}

/* Fullscreen photo lightbox */
.vehicle-lightbox {
    position: fixed; inset: 0;
    display: none;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1080;
    align-items: center; justify-content: center;
    padding: 24px;
}
.vehicle-lightbox.is-open { display: flex; }
.vehicle-lightbox__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.vehicle-lightbox__close,
.vehicle-lightbox__nav {
    position: absolute;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    display: inline-flex; align-items: center; justify-content: center;
}
.vehicle-lightbox__close:hover,
.vehicle-lightbox__nav:hover { background: rgba(255, 255, 255, 0.25); }
/* Red border + solid white background on the prev/next buttons so they stay
   visible against light car photos. */
.vehicle-lightbox__nav {
    background: #ffffff;
    color: var(--Primary, #A61D3C);
    border: 2px solid var(--Primary, #A61D3C);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.vehicle-lightbox__nav:hover {
    background: var(--Primary, #A61D3C);
    color: #ffffff;
}
.vehicle-lightbox__close {
    top: 16px; right: 16px;
    width: 44px; height: 44px;
    border-radius: 50%;
    font-size: 20px; line-height: 1;
}
.vehicle-lightbox__nav {
    top: 50%;
    transform: translateY(-50%);
    width: 52px; height: 52px;
    border-radius: 50%;
    font-size: 20px;
}
.vehicle-lightbox__nav--prev { left: 16px; }
.vehicle-lightbox__nav--next { right: 16px; }
.vehicle-lightbox__nav[disabled] { opacity: 0.3; cursor: default; }
.vehicle-lightbox__counter {
    position: absolute;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 14px;
    border-radius: 999px;
}
@media (max-width: 575.98px) {
    .vehicle-lightbox { padding: 12px; }
    .vehicle-lightbox__close { top: 10px; right: 10px; width: 38px; height: 38px; font-size: 24px; }
    .vehicle-lightbox__nav { width: 42px; height: 42px; }
    .vehicle-lightbox__nav--prev { left: 8px; }
    .vehicle-lightbox__nav--next { right: 8px; }
}
body.vehicle-lightbox-open { overflow: hidden; }

/* Mobile layout: hide the desktop main, show the swipe carousel + dots */
@media (max-width: 767.98px) {
    .vehicle-gallery__main img { max-width: 100%; }
    .vehicle-gallery { display: flex; flex-direction: column; }
    .vehicle-gallery__main { display: none; }
    .vehicle-gallery__slides { order: 1; }
    .vehicle-gallery__dots { order: 2; padding-bottom: 10px; }
    .vehicle-gallery__thumbs { order: 3; margin-top: 16px; }
    .vehicle-gallery__zoom--mobile { display: inline-flex; }
    .vehicle-gallery__slides {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        gap: 8px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
    }
    .vehicle-gallery__slides::-webkit-scrollbar { display: none; }
    .vehicle-gallery__slide {
        flex: 0 0 100%;
        max-width: 100%;
        scroll-snap-align: start;
        aspect-ratio: 4 / 3;
        background: #f3f4f6;
        border-radius: 12px;
        overflow: hidden;
    }
    .vehicle-gallery__slide img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
    .vehicle-gallery__dots {
        display: flex;
        justify-content: center;
        gap: 6px;
        margin-top: 10px;
    }
    .vehicle-gallery__dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: rgba(15, 23, 42, 0.2);
        transition: background 0.15s ease, transform 0.15s ease;
    }
    .vehicle-gallery__dot.is-active {
        background: var(--Primary, #A61D3C);
        transform: scale(1.3);
    }
}
