/**
 * UltraDev_ProductGallery — productgallery.css
 * Desktop : thumbnails verticais à esquerda, imagem principal à direita
 * Mobile  : thumbnails horizontais com scroll nativo + setas < >
 */

/* ─── MOBILE-FIRST BASE ──────────────────────────────────────────── */

/* Wrapper das setas + slider horizontal */
.vertical-slider-container {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    margin: 8px 0 0;
}

/* Setas mobile (< >) */
.vertical-slider-arrow {
    border: none;
    outline: none;
    padding: 0;
    background-color: #f5f5f5;
    color: #333333 !important;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    transition: background-color 200ms ease, color 200ms ease;
    font-size: 14px;
    z-index: 10;
    /* posição absoluta não usada no mobile — fica no flow flex */
    position: relative;
    left: auto;
    transform: none;
}

/* No mobile, up = seta esquerda, down = seta direita */
.vertical-slider-arrow.up  { order: 1; }
#itemslider-zoom            { order: 2; }
.vertical-slider-arrow.down { order: 3; }

.vertical-slider-arrow:hover:not(:disabled) {
    background-color: #2c85c8;
    color: #ffffff !important;
}

.vertical-slider-arrow:disabled {
    background-color: #f0f0f0;
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.vertical-slider-arrow.ic:before {
    margin: 0;
    line-height: 32px;
}

/* Slider horizontal — scroll nativo com snap */
#itemslider-zoom {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 6px;
    padding: 2px 4px;
    margin: 0;
    list-style: none;
    flex: 1;
    /* esconde scrollbar mas mantém scroll funcional */
    scrollbar-width: none;
}
#itemslider-zoom::-webkit-scrollbar { display: none; }

/* Item mobile — largura fixa para mostrar exatamente 3 */
#itemslider-zoom .item {
    flex: 0 0 calc((100% - 12px) / 3) !important; /* 3 visíveis, gap 6px×2 */
    scroll-snap-align: start;
    margin: 0 !important;
}

/* Imagens dos thumbnails */
#itemslider-zoom .item img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid #ddd;
    box-sizing: border-box;
    border-radius: 3px;
}

/* ─── VIDEO ──────────────────────────────────────────────────────── */

.ultrd-video-item a {
    position: relative;
    display: block;
}

.ultrd-video-item a .video-icon-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.3s ease;
}

.ultrd-video-item a:hover .video-icon-wrapper {
    background: rgba(0, 0, 0, 0.8);
}

.ultrd-video-item svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* Player de vídeo 1:1 */
.ultrd-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    height: 0;
    background: #000;
    margin-bottom: 10px;
}

.ultrd-video-wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

/* Fix: autorelated não aparece após produto com .ultrd-video-wrapper */
.column-main {
    overflow: visible !important;
}

.product-view {
    overflow: visible !important;
}

/* ─── DESKTOP (≥ 768px) ──────────────────────────────────────────── */

@media (min-width: 768px) {

    /* Layout geral: imagem direita, thumbs esquerda */
    .product-view .product-img-box {
        display: flex !important;
        flex-direction: row-reverse !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
    }

    .product-view .product-image {
        flex: 0 0 calc(100% - 110px) !important;
        width: calc(100% - 110px) !important;
        max-width: calc(100% - 110px) !important;
        float: none !important;
        margin: 0 !important;
    }

    .product-view .more-views {
        flex: 0 0 100px !important;
        width: 100px !important;
        margin: 15px !important;
        padding: 0 !important;
        float: none !important;
    }

    /* Container volta ao eixo vertical */
    .vertical-slider-container {
        flex-direction: column;
        align-items: center;
        width: 74px;
        margin: 5px;
    }

    /* Setas: posição absoluta acima/abaixo do slider */
    .vertical-slider-arrow {
        width: 40px;
        height: 40px;
        font-size: 16px;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .vertical-slider-arrow.up   { top: -25px;    order: unset; }
    .vertical-slider-arrow.down { bottom: -30px;  order: unset; }

    /* Slider vertical */
    #itemslider-zoom {
        flex-direction: column !important;
        overflow-x: hidden;
        overflow-y: hidden;
        scroll-snap-type: none;
        max-height: 410px; /* 5 itens × ~76px */
        width: 100% !important;
        gap: 0;
        padding: 0;
        order: unset;
        flex: none;
    }

    /* Item desktop — largura total, margem inferior */
    #itemslider-zoom .item {
        flex: none !important;
        width: 100% !important;
        margin: 0 0 10px 0 !important;
        scroll-snap-align: none;
    }

    /* Ícone de vídeo maior no desktop */
    .ultrd-video-item a .video-icon-wrapper {
        width: 40px;
        height: 40px;
    }

    .ultrd-video-item svg {
        width: 24px;
        height: 24px;
    }
}

/* ─── VIDEO SVG ANIMATION ────────────────────────────────────────── */

.ultrd-video-item svg path {
    stroke: #ffffff;
    stroke-width: 20;
    fill: transparent;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: ultrd-draw 1.5s ease-in-out forwards,
               ultrd-fill 0.3s 1.4s ease forwards;
}

@keyframes ultrd-draw { to { stroke-dashoffset: 0; } }
@keyframes ultrd-fill  { to { fill: #ffffff; } }