/* ========================================
   GALERÍA INTERACTIVA PRO v2.0
   Con soporte de video YouTube
   ======================================== */

.gallery-container {
    width: 100%;
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    margin: 0 0 30px 0;
}

/* Contenedor principal que alterna entre imagen y video */
.main-display-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 66.67%; /* 3:2 ratio */
    background: #f8f8f8;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Contenedor de imagen */
.main-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.main-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 70%, rgba(0,0,0,0.3));
    pointer-events: none;
}

/* Contenedor de video */
.main-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.main-video-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Thumbnails */
.thumbnails-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: #ddd #f8f8f8;
}

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

.thumbnails-container::-webkit-scrollbar-track {
    background: #f8f8f8;
    border-radius: 10px;
}

.thumbnails-container::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

.thumbnails-container::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

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

.thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0);
    transition: background 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.thumbnail:hover {
    transform: translateY(-4px);
    border-color: #2C5F8D;
    box-shadow: 0 6px 16px rgba(44, 95, 141, 0.3);
}

.thumbnail:hover::before {
    background: rgba(44, 95, 141, 0.1);
}

.thumbnail.active {
    border-color: #2C5F8D;
    box-shadow: 0 4px 12px rgba(44, 95, 141, 0.4);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Efecto shimmer en thumbnails */
.thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    animation: shimmer 3s infinite;
    animation-delay: calc(var(--index) * 0.3s);
    z-index: 2;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Thumbnail de video - estilo especial */
.video-thumb {
    position: relative;
    background: #000;
}

.video-thumb img {
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.video-thumb:hover img {
    opacity: 1;
}

/* Icono de play para video */
.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 3;
    transition: transform 0.3s ease;
}

.play-icon svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.video-thumb:hover .play-icon {
    transform: translate(-50%, -50%) scale(1.15);
}

.video-thumb.active .play-icon {
    animation: pulse-play 1.5s ease-in-out infinite;
}

@keyframes pulse-play {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* Hint text */
.gallery-hint {
    text-align: center;
    color: #6C757D;
    font-size: 14px;
    margin-top: 16px;
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Responsive Design */
@media (max-width: 1250px) {
    .main-display-wrapper {
        padding-bottom: 66.67%;
    }
}

@media (max-width: 768px) {
    .gallery-container {
        padding: 16px;
        max-width: 100%;
    }

    .main-display-wrapper {
        padding-bottom: 66.67%;
    }

    .thumbnail {
        width: 80px;
        height: 80px;
    }

    .play-icon {
        width: 35px;
        height: 35px;
    }

    .play-icon svg {
        width: 35px;
        height: 35px;
    }

    .gallery-hint {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .gallery-container {
        padding: 12px;
        border-radius: 12px;
    }

    .thumbnail {
        width: 70px;
        height: 70px;
    }

    .thumbnails-container {
        gap: 8px;
    }

    .play-icon {
        width: 30px;
        height: 30px;
    }

    .play-icon svg {
        width: 30px;
        height: 30px;
    }
}

/* Loading state para video */
.main-video-container.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.main-video-container.loading::after {
    content: 'Cargando video...';
    color: #fff;
    font-size: 16px;
}