/**
 * TioWeb Media Gallery - Frontend Styles
 * Version: 1.0.0
 * Author: TioWeb.cl
 */

.tioweb-custom-gallery {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 0 30px 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

/* Soporte para altura variable en shortcode/widget */
.tioweb-shortcode-gallery .gallery-main {
    height: var(--gallery-height, 500px);
}

/* Estilos específicos del widget de Elementor */
.tioweb-elementor-gallery .tioweb-custom-gallery {
    margin: 0;
}

.gallery-main {
    position: relative;
    width: 100%;
    height: 500px;
    background: transparent;
    overflow: hidden;
}

.gallery-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    /* Transiciones removidas para cambio instantáneo */
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-slide.active {
    opacity: 1;
    z-index: 2;
}

.gallery-slide img,
.gallery-slide video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gallery-slide video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #129FFF;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    z-index: 3;
}

/* Media info ocultado para vista más limpia */
.media-info {
    display: none;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 4;
}

.gallery-nav:hover {
    background: rgba(0,0,0,0.8);
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav.prev {
    left: 20px;
}

.gallery-nav.next {
    right: 20px;
}

.gallery-thumbs {
    display: flex;
    gap: 10px;
    padding: 20px;
    overflow-x: auto;
    background: transparent;
}

.gallery-thumb {
    flex: 0 0 100px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.gallery-thumb:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.gallery-thumb.active {
    border-color: #129FFF;
    transform: translateY(-3px);
}

.gallery-thumb img,
.gallery-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
}

.video-controls {
    position: absolute;
    bottom: 80px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 4;
}

.video-control-btn {
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.video-control-btn:hover {
    background: rgba(0,0,0,0.9);
    transform: scale(1.1);
}

.tioweb-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 99999;
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: -40px;
    color: white;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    width: 40px;
    height: 40px;
}

@media (max-width: 768px) {
    .gallery-main {
        height: 300px;
    }
    
    .tioweb-shortcode-gallery .gallery-main {
        height: min(var(--gallery-height, 300px), 300px);
    }
    
    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .gallery-thumbs {
        padding: 15px;
    }
    
    .gallery-thumb {
        flex: 0 0 80px;
        height: 60px;
    }
    
    .video-controls {
        bottom: 50px;
        right: 15px;
    }
    
    .video-control-btn {
        padding: 8px;
        font-size: 14px;
    }
    
    .featured-badge {
        top: 10px;
        right: 10px;
        padding: 6px 10px;
        font-size: 11px;
    }
    
    /* Mejores adaptaciones para video en móvil */
    .gallery-slide video {
        object-fit: contain; /* Cambiado de cover a contain para móvil */
    }
}

@media (max-width: 480px) {
    .gallery-main {
        height: 250px;
    }
    
    .tioweb-shortcode-gallery .gallery-main {
        height: min(var(--gallery-height, 250px), 250px);
    }
    
    .gallery-nav {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .gallery-nav.prev {
        left: 10px;
    }
    
    .gallery-nav.next {
        right: 10px;
    }
    
    .gallery-thumbs {
        padding: 10px;
        gap: 8px;
    }
    
    .gallery-thumb {
        flex: 0 0 70px;
        height: 50px;
    }
    
    /* Video optimizado para pantallas muy pequeñas */
    .gallery-slide video {
        object-fit: contain;
        max-height: 100%;
    }
}

/* Accesibilidad */
.gallery-nav:focus {
    outline: 2px solid #129FFF;
    outline-offset: 2px;
}

.gallery-thumb:focus {
    outline: 2px solid #129FFF;
    outline-offset: 2px;
}

.video-control-btn:focus {
    outline: 2px solid #129FFF;
    outline-offset: 2px;
}

/* Animaciones removidas para cambio instantáneo */