/**
 * Snow Gallery Styles com Auto-Thumbnail e Play Icon
 */

/* Container principal da galeria */
.snow-gallery-wrapper {
    --video-offset-x: 0%;
    --video-offset-y: 0%;
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
}

.snow-gallery-grid {
    display: block;
    width: 100%;
    height: 100%;
    gap: 0;
}

.snow-gallery-grid.single-preview {
    width: 100%;
    height: 100%;
}

.snow-gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.snow-gallery-item img {
    width: 100%;
    height: 100%;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ========================================
   THUMBNAIL DE VÍDEO COM PLAY ICON
   ======================================== */

.snow-video-thumbnail-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.snow-video-thumbnail-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.snow-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    color: #ffffff;
    pointer-events: none;
    z-index: 2;
    transition: all 0.3s ease;
}

.snow-video-play-icon svg {
    width: 100%;
    height: 100%;
    padding: 15px;
    padding-left: 18px; /* Ajuste visual para centralizar o triângulo */
}

.snow-video-thumbnail-wrap:hover .snow-video-play-icon {
    transform: translate(-50%, -50%) scale(1.1);
    background-color: rgba(0, 0, 0, 0.8);
}

/* Loading placeholder para thumbnails que serão carregadas via JS */
.snow-video-thumb-loading {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 12px;
}

/* ========================================
   VÍDEO COVER NO PREVIEW (Como Video Cover Widget)
   ======================================== */

.snow-gallery-video-wrap {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 177.78%;
    height: 177.78%;
    transform: translate(
        calc(-50% + var(--video-offset-x)),
        calc(-50% + var(--video-offset-y))
    );
    overflow: hidden;
}

.snow-gallery-video-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
}

.snow-gallery-video-element {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(
        calc(-50% + var(--video-offset-x)),
        calc(-50% + var(--video-offset-y))
    );
    object-fit: cover;
    pointer-events: none;
}

/* Efeitos Hover */
.snow-gallery-grid.hover-zoom .snow-gallery-item:hover img,
.snow-gallery-grid.hover-zoom .snow-gallery-item:hover .snow-gallery-video-wrap,
.snow-gallery-grid.hover-zoom .snow-gallery-item:hover .snow-gallery-video-element,
.snow-gallery-grid.hover-zoom .snow-gallery-item:hover .snow-video-thumbnail-wrap img {
    transform: scale(1.1);
}

.snow-gallery-grid.hover-zoom .snow-gallery-item:hover .snow-gallery-video-wrap {
    transform: translate(
        calc(-50% + var(--video-offset-x)),
        calc(-50% + var(--video-offset-y))
    ) scale(1.1);
}

.snow-gallery-grid.hover-zoom .snow-gallery-item:hover .snow-gallery-video-element {
    transform: translate(
        calc(-50% + var(--video-offset-x)),
        calc(-50% + var(--video-offset-y))
    ) scale(1.1);
}

.snow-gallery-grid.hover-opacity .snow-gallery-item:hover img,
.snow-gallery-grid.hover-opacity .snow-gallery-item:hover .snow-gallery-video-wrap,
.snow-gallery-grid.hover-opacity .snow-gallery-item:hover .snow-gallery-video-element,
.snow-gallery-grid.hover-opacity .snow-gallery-item:hover .snow-video-thumbnail-wrap {
    opacity: 0.7;
}

/* ========================================
   MODAL FULLSCREEN
   ======================================== */

.snow-gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.snow-gallery-modal.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
}

/* Botão Fechar */
.snow-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    background: none !important;
    border: none !important;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    padding: 0;
    transition: color 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: none !important;
}

.snow-modal-close:hover {
    opacity: 0.7;
    transform: none !important;
}

.snow-modal-close svg {
    display: block;
}

/* Conteúdo do Modal */
.snow-modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 20px;
}

/* Container de Mídia Principal */
.snow-modal-main-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 20px;
    min-height: 0;
}

/* Container de Mídia (imagem ou vídeo) */
.snow-modal-media-container {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.snow-modal-media-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    animation: fadeIn 0.3s ease;
}

/* Player de Vídeo no Modal */
.snow-video-player {
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 16/9;
    animation: fadeIn 0.3s ease;
}

.snow-video-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.snow-video-player video {
    width: 100%;
    height: 100%;
    max-height: 80vh;
    object-fit: contain;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Botões de Navegação */
.snow-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.3s ease, opacity 0.3s ease;
    padding: 15px;
    z-index: 5;
    width: auto !important;
    height: auto !important;
}

.snow-modal-nav::before,
.snow-modal-nav::after {
    display: none !important;
}

.snow-modal-nav:hover {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    opacity: 0.7;
    transform: translateY(-50%) !important;
}

.snow-modal-nav svg {
    display: block;
}

.snow-modal-prev {
    left: 20px;
}

.snow-modal-next {
    right: 20px;
}

/* Thumbnails */
.snow-modal-thumbs {
    display: flex;
    gap: 10px;
    justify-content: center;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.snow-modal-thumbs::-webkit-scrollbar {
    height: 6px;
}

.snow-modal-thumbs::-webkit-scrollbar-track {
    background: transparent;
}

.snow-modal-thumbs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.snow-modal-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.snow-modal-thumb:hover {
    opacity: 1;
}

.snow-modal-thumb.active {
    opacity: 1;
    border-color: #fff;
    transform: scale(1.1);
}

.snow-modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Play icon nas thumbnails do modal */
.snow-modal-thumb .snow-video-play-icon {
    width: 30px;
    height: 30px;
}

.snow-modal-thumb .snow-video-play-icon svg {
    padding: 8px;
    padding-left: 10px;
}

/* Placeholder de Vídeo na Thumbnail */
.snow-video-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 24px;
}

.snow-video-thumb-placeholder i {
    opacity: 0.9;
}

/* Responsivo */
@media (max-width: 768px) {
    .snow-gallery-video-wrap {
        width: 200%;
        height: 200%;
    }

    .snow-modal-close {
        top: 10px;
        right: 15px;
    }

    .snow-modal-nav {
        display: none !important;
    }

    .snow-modal-thumb {
        width: 60px;
        height: 60px;
    }

    .snow-modal-content {
        padding: 10px;
    }
    
    .snow-modal-main-image {
        touch-action: pan-y pinch-zoom;
        user-select: none;
        -webkit-user-select: none;
    }

    .snow-video-player {
        max-width: 100%;
    }

    .snow-video-play-icon {
        width: 50px;
        height: 50px;
    }

    .snow-modal-thumb .snow-video-play-icon {
        width: 25px;
        height: 25px;
    }
}