/**
 * SWI-TEC Product Gallery Styles
 * Version: 1.2.0
 */

/* Contenedor principal */
.switec-product-gallery {
    position: relative;
    width: 100%;
    max-width: 100%;
    transition: opacity 0.3s ease-in-out; /* Transición suave para evitar parpadeos */
    opacity: 0; /* Inicialmente oculto, se muestra cuando JS esté listo */
}

/* Mostrar cuando no hay JavaScript o está cargado */
.switec-product-gallery.loaded {
    opacity: 1;
}

/* Slider principal */
.switec-gallery-main {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
    background: transparent;
}

/* Ocultar slides clonados por Slick antes de la inicialización */
.switec-gallery-main:not(.slick-initialized) .switec-gallery-slide:not(:first-child) {
    display: none !important;
}

.switec-gallery-slide {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4; /* Proporción 3:4 SIEMPRE - sin cortar nada */
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    outline: none !important;
    overflow: hidden; /* Evitar desbordamiento */
}

/* Video slide */
.switec-video-slide {
    cursor: pointer;
}

.switec-video-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.switec-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; /* Cubrir todo el contenedor manteniendo proporciones */
}

/* Image slide */
.switec-image-slide {
    cursor: pointer;
    background: #fff;
}

.switec-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.switec-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; /* Cubrir todo el contenedor manteniendo proporciones */
    background: transparent;
}

/* Miniaturas */
.switec-gallery-thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.switec-gallery-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.switec-gallery-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.switec-gallery-thumbnails::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.switec-gallery-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.switec-thumbnail {
    flex: 0 0 auto;
    width: 100px;
    height: 100px;
    cursor: pointer;
    border: 3px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff;
    opacity: 0.85;
}

.switec-thumbnail:hover {
    border-color: #999;
    opacity: 1;
}

.switec-thumbnail.slick-current {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
    opacity: 1;
    transform: scale(1.05);
}

.switec-thumb-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.switec-thumb-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video thumbnail */
.switec-video-thumbnail .switec-thumb-container {
    background: #000;
}

.switec-video-thumb-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.switec-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    background: rgba(0,0,0,0.6);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: all 0.3s ease;
}

.switec-video-play-icon svg {
    width: 24px;
    height: 24px;
    margin-left: 2px; /* Centrar visualmente el triángulo */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
    flex-shrink: 0; /* Evitar que se deforme */
}

/* Asegurar que el icono siempre esté centrado, incluso en clones de Slick */
.slick-cloned .switec-video-play-icon,
.slick-slide .switec-video-play-icon {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

.switec-thumbnail:hover .switec-video-play-icon {
    background: rgba(0,0,0,0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Botón de zoom - OCULTO */
.switec-zoom-button {
    display: none !important;
}

/* Ocultar botón de filtro responsivo */
.category-filtering,
.product-filter-row,
.filter-button {
    display: none !important;
}

/* Slick arrows - SIN fondo blanco circular */
.switec-gallery-main .slick-prev,
.switec-gallery-main .slick-next {
    width: 50px;
    height: 50px;
    background: transparent !important;
    z-index: 10;
    transition: opacity 0.15s ease;
}

.switec-gallery-main .slick-prev:hover,
.switec-gallery-main .slick-next:hover {
    background: transparent !important;
    opacity: 0.9;
}

.switec-gallery-main .slick-prev {
    left: 15px;
}

.switec-gallery-main .slick-next {
    right: 15px;
}

.switec-gallery-main .slick-prev:before,
.switec-gallery-main .slick-next:before {
    color: #fff;
    font-size: 40px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    opacity: 1;
}

.switec-gallery-main .slick-prev:hover:before,
.switec-gallery-main .slick-next:hover:before {
    color: #fff;
    opacity: 1;
}

/* Slick dots - OCULTAR */
.switec-gallery-main .slick-dots {
    display: none !important;
}

/* Placeholder */
.switec-gallery-placeholder {
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

/* Proporción 3:4 SIEMPRE en todos los dispositivos */

/* Responsive */
@media (max-width: 768px) {
    
    .switec-thumbnail {
        width: 80px;
        height: 80px;
    }
    
    .switec-zoom-button {
        display: none !important;
    }
    
    .switec-gallery-main .slick-prev,
    .switec-gallery-main .slick-next {
        width: 40px;
        height: 40px;
    }
    
    .switec-gallery-main .slick-prev {
        left: 10px;
    }
    
    .switec-gallery-main .slick-next {
        right: 10px;
    }
    
    .switec-gallery-main .slick-prev:before,
    .switec-gallery-main .slick-next:before {
        font-size: 32px;
    }
}

@media (max-width: 480px) {
    
    .switec-thumbnail {
        width: 70px;
        height: 70px;
    }
    
    .switec-video-play-icon {
        width: 35px;
        height: 35px;
    }
    
    .switec-video-play-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* Loading animation */
.switec-gallery-slide.slick-loading {
    background: #f5f5f5;
}

.switec-gallery-slide.slick-loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: switec-spin 1s linear infinite;
}

@keyframes switec-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
