/* ============================================================
   product-gallery.css — Galeria de imagens do produto
   ============================================================ */

.product-gallery {
    display: flex;
    flex-direction: column;
    gap: var(--ecom-space-4);
}

.product-gallery__main {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--ecom-radius-lg);
    overflow: hidden;
}

.product-gallery__main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
    transition: opacity var(--ecom-duration-normal) var(--ecom-ease-default);
}

    .product-gallery__main-image:hover {
        opacity: 0.9;
    }

.product-gallery__thumbs-nav {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem;
    align-items: center;
    gap: var(--ecom-space-2);
    width: 100%;
    min-width: 0;
}

.product-gallery__thumb-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 100%;
    min-height: 5rem;
    padding: 0;
    border: 1px solid var(--ecom-border-default);
    border-radius: var(--ecom-radius-md);
    background: var(--ecom-bg-surface, #fff);
    color: var(--ecom-text-primary, #0f172a);
    cursor: pointer;
    transition: background-color var(--ecom-duration-fast) var(--ecom-ease-default), border-color var(--ecom-duration-fast) var(--ecom-ease-default), color var(--ecom-duration-fast) var(--ecom-ease-default);
}

    .product-gallery__thumb-arrow:hover:not(:disabled) {
        background: var(--ecom-color-neutral-100, #f1f5f9);
        border-color: var(--ecom-color-neutral-400, #94a3b8);
    }

    .product-gallery__thumb-arrow:focus-visible {
        outline: 2px solid var(--ecom-border-focus);
        outline-offset: 2px;
    }

    .product-gallery__thumb-arrow:disabled {
        opacity: 0.35;
        cursor: default;
    }

    .product-gallery__thumb-arrow[hidden] {
        display: none !important;
    }

.product-gallery__thumbs {
    display: flex;
    gap: var(--ecom-space-3);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
}

    .product-gallery__thumbs::-webkit-scrollbar {
        display: none;
    }

.product-gallery__thumb {
    flex-shrink: 0;
    width: 5rem;
    height: 5rem;
    border-radius: var(--ecom-radius-md);
    border: 2px solid var(--ecom-border-default);
    overflow: hidden;
    cursor: pointer;
    background-color: var(--ecom-bg-surface-alt);
    transition: border-color var(--ecom-duration-fast) var(--ecom-ease-default);
    padding: 0;
    scroll-snap-align: start;
}

    .product-gallery__thumb:hover {
        border-color: var(--ecom-color-neutral-400);
    }

.product-gallery__thumb--active {
    border-color: var(--ecom-color-primary-500);
}

.product-gallery__thumb-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Botão de vídeo — exibido abaixo das miniaturas */
.product-gallery__video-wrap {
    width: 100%;
}

.product-gallery__video-btn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--ecom-space-2);
    width: 100%;
    min-height: 48px;
    padding: var(--ecom-space-3) var(--ecom-space-5);
    background-color: var(--ecom-color-neutral-800);
    color: var(--ecom-color-neutral-0);
    border: 1px solid var(--ecom-color-neutral-700);
    border-radius: var(--ecom-radius-lg);
    font-size: var(--ecom-text-sm);
    font-weight: var(--ecom-font-semibold, 600);
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color var(--ecom-duration-fast) var(--ecom-ease-default), border-color var(--ecom-duration-fast) var(--ecom-ease-default), transform var(--ecom-duration-fast) var(--ecom-ease-default);
}

    .product-gallery__video-btn:hover {
        background-color: var(--ecom-color-neutral-700);
        border-color: var(--ecom-color-neutral-500);
        transform: translateY(-1px);
    }

    .product-gallery__video-btn:focus-visible {
        outline: 2px solid var(--ecom-border-focus);
        outline-offset: 2px;
    }

/* YouTube embed area */
.product-gallery__video-embed {
    width: 100%;
    height: 100%;
    border: none;
}

@media (min-width: 768px) {
    .product-gallery__main {
        aspect-ratio: 4 / 3;
    }

    .product-gallery__thumb {
        width: 5.5rem;
        height: 5.5rem;
    }

    .product-gallery__thumb-arrow {
        min-height: 5.5rem;
    }
}

/* ============================================================
   Lightbox
   ============================================================ */

.gallery-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: var(--ecom-z-modal);
    align-items: center;
    justify-content: center;
}

.gallery-lightbox--open {
    display: flex;
}

.gallery-lightbox__overlay {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 0.85);
}

.gallery-lightbox__panel {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: var(--ecom-space-12) var(--ecom-space-8);
}

.gallery-lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--ecom-radius-lg);
    display: block;
}

/* Iframe de vídeo dentro do lightbox — proporção 16:9 responsiva */
.gallery-lightbox__video-embed {
    width: min(90vw, 64rem);
    aspect-ratio: 16 / 9;
    height: auto;
    border: none;
    border-radius: var(--ecom-radius-lg);
    display: block;
}

.gallery-lightbox__close {
    position: fixed;
    top: var(--ecom-space-4);
    right: var(--ecom-space-4);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--ecom-radius-full);
    border: none;
    background: rgb(255 255 255 / 0.15);
    color: var(--ecom-color-neutral-0);
    font-size: var(--ecom-text-xl);
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--ecom-duration-fast) var(--ecom-ease-default);
    z-index: 2;
}

    .gallery-lightbox__close:hover {
        background: rgb(255 255 255 / 0.3);
    }

    .gallery-lightbox__close:focus-visible {
        outline: 2px solid var(--ecom-border-focus);
        outline-offset: 2px;
    }

.gallery-lightbox__arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--ecom-radius-full);
    border: none;
    background: rgb(255 255 255 / 0.15);
    color: var(--ecom-color-neutral-0);
    font-size: var(--ecom-text-xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--ecom-duration-fast) var(--ecom-ease-default);
    z-index: 2;
}

    .gallery-lightbox__arrow:hover {
        background: rgb(255 255 255 / 0.3);
    }

    .gallery-lightbox__arrow:focus-visible {
        outline: 2px solid var(--ecom-border-focus);
        outline-offset: 2px;
    }

.gallery-lightbox__arrow--prev {
    left: var(--ecom-space-4);
}

.gallery-lightbox__arrow--next {
    right: var(--ecom-space-4);
}

/* Body scroll lock */
body.lightbox-open {
    overflow: hidden;
}


@media (max-width: 767px) {
    .product-gallery__video-btn {
        min-height: 46px;
        padding-inline: var(--ecom-space-4);
    }
}


@media (max-width: 480px) {
    .product-gallery__thumbs-nav {
        grid-template-columns: 2.25rem minmax(0, 1fr) 2.25rem;
        gap: var(--ecom-space-1);
    }

    .product-gallery__thumb-arrow {
        width: 2.25rem;
        min-height: 5rem;
    }
}
