/* Galerie fiche produit marketplace — classes dédiées (évite les conflits .gallery-slide globaux) */

.product-gallery-main {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    background: #111827;
    margin-bottom: 1.5rem;
    border: 2px solid var(--gray-200, #e5e7eb);
}

.product-gallery-main .product-gallery-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.2s ease;
}

.product-gallery-main .product-gallery-slide.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 2;
}

.product-gallery-main .product-gallery-slide img.product-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-gallery-main .product-gallery-slide video.product-gallery-video {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}

.product-gallery-main .product-gallery-youtube-host {
    width: 100%;
    height: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    padding: 0;
}

.product-gallery-main .product-gallery-youtube-frame {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 100%;
    height: auto;
    border: 0;
    display: block;
    background: #000;
}

/* Désactive le zoom au survol hérité de .main-product-image-wrapper sur la galerie */
.product-gallery-main:hover .product-gallery-image.main-product-image {
    transform: none;
}

.product-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.product-gallery-thumb {
    position: relative;
    padding: 0;
    border: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    aspect-ratio: 1;
}

.product-gallery-thumb.is-active {
    border-color: var(--primary-500, #1f3a5f);
    box-shadow: 0 0 0 2px rgba(31, 58, 95, 0.2);
}

.product-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-md, 8px);
}

.product-gallery-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    pointer-events: none;
    border-radius: var(--radius-md, 8px);
}

/* Mobile */
.mobile-product-gallery {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: var(--app-gray-100, #f3f4f6);
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

.mobile-product-gallery-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.mobile-product-gallery-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.mobile-product-gallery-slide img.mobile-product-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
}

.mobile-product-gallery-slide video.mobile-product-gallery-video {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #000;
}

.mobile-product-gallery-slide .mobile-product-gallery-youtube-host {
    width: 100%;
    max-height: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.mobile-product-gallery-slide iframe.mobile-product-gallery-youtube {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.mobile-product-gallery-counter {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 5;
}

.mobile-product-gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.75rem 0;
    -webkit-overflow-scrolling: touch;
}

.mobile-product-gallery-thumb-wrap {
    position: relative;
    flex-shrink: 0;
}

.mobile-product-gallery-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
}

.mobile-product-gallery-thumb.is-active {
    border-color: var(--app-primary, #1f3a5f);
}

.mobile-product-gallery-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    border-radius: 8px;
    pointer-events: none;
}
