/* Estilos para el Widget de Galería de Medios */
.media-gallery {
    display: grid;
    gap: 15px;
}

/* Configuraciones de columnas */

.gallery-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gallery-columns-3 .gallery-item img{
    height: 350px !important;
    object-fit: cover;
}

.gallery-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gallery-columns-4 .gallery-item img{
    height: 300px !important;
    object-fit: cover;
}

.gallery-columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Estilos para elementos de la galería */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.media-wrapper {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.media-wrapper img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.media-wrapper:hover img {
    transform: scale(1.05);
}

/* Overlay de medios */
.media-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.media-wrapper:hover .media-overlay {
    opacity: 1;
}

.media-overlay i {
    color: #fff;
    font-size: 2rem;
    transition: transform 0.3s ease;
}

.media-overlay:hover i {
    transform: scale(1.2);
}

/* Icono específico para videos */
.video-item .media-overlay i {
    font-size: 3rem;
}

/* Contenido del elemento */
.gallery-item-content {
    padding: 15px;
}

.gallery-item-title {
    margin: 0 0 8px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.gallery-item-description {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-columns-3,
    .gallery-columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .gallery-columns-4 .gallery-item img,    
    .gallery-columns-3 .gallery-item img{
        height: 300px !important;
    }
    .media-wrapper img {
        height: 200px;
    }
    
    .gallery-item-content {
        padding: 12px;
    }
    
    .gallery-item-title {
        font-size: 1.1rem;
    }
    
    .gallery-item-description {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .gallery-columns-3,
    .gallery-columns-4 {
        grid-template-columns: 1fr;
    }
    .gallery-columns-4 .gallery-item img,    
    .gallery-columns-3 .gallery-item img{
        height: 250px !important;
    }
    
    .media-wrapper img {
        height: 180px;
    }
    
    .media-gallery {
        gap: 10px;
    }
}

/* Estados de carga */
.gallery-item.loading {
    opacity: 0.7;
}

.gallery-item.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-radius: 50%;
    border-top: 2px solid #3498db;
    animation: spin 1s linear infinite;
}

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

/* Efectos adicionales para hover */
.gallery-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-item:hover::before {
    opacity: 1;
}

/* Icono de reproducción mejorado */
.video-item .media-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.video-item .media-overlay i {
    font-size: 3.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Efecto de hover específico para videos */
.video-item:hover .media-overlay {
    background: rgba(0, 0, 0, 0.8);
}

.video-item:hover .media-overlay i {
    transform: scale(1.1);
    color: #fff;
}

/* Indicadores de carga para videos */
.video-item.loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid #fff;
    animation: spin 1s linear infinite;
    z-index: 3;
}

/* Mejoras para miniaturas de YouTube */
.media-wrapper[data-video-source="youtube"] img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Estilos para el lightbox personalizado */
.simple-lightbox-modal {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.simple-lightbox-modal .lightbox-content {
    animation: lightboxFadeIn 0.3s ease-out;
}

@keyframes lightboxFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Prevenir scroll del body cuando lightbox está activo */
body.lightbox-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Ocultar swiper-zoom-container cuando lightbox está activo */
body.lightbox-active .swiper-zoom-container {
    display: none !important;
}

/* Estilos para el botón de cerrar */
.simple-lightbox-modal .close-lightbox {
    transition: all 0.2s ease;
}

.simple-lightbox-modal .close-lightbox:hover {
    transform: scale(1.2);
    color: #ff4444 !important;
}

/* Contenedores de medios en el lightbox */
.simple-lightbox-modal .video-container,
.simple-lightbox-modal .image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.simple-lightbox-modal video,
.simple-lightbox-modal iframe {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.simple-lightbox-modal img {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Estilos responsivos para el lightbox */
@media (max-width: 768px) {
    .simple-lightbox-modal .video-container iframe {
        width: 95vw !important;
        height: calc(95vw * 9 / 16) !important;
        max-height: 60vh !important;
    }
    
    .simple-lightbox-modal .video-container video {
        width: 95vw !important;
        height: auto !important;
        max-height: 60vh !important;
    }
    
    .simple-lightbox-modal .image-container img {
        width: 95vw !important;
        height: auto !important;
        max-height: 80vh !important;
    }
    
    .simple-lightbox-modal .lightbox-content {
        max-width: 95%;
        max-height: 95%;
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .simple-lightbox-modal .close-lightbox {
        top: -30px !important;
        font-size: 25px !important;
        width: 35px !important;
        height: 35px !important;
    }
}