/**
 * Gutenberg Modal Lightbox CSS
 * v2.0.0 - Seguro y optimizado
 */

/* Modal overlay */
.gml-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.gml-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

.gml-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

/* Contenedor de imagen */
.gml-modal-image-container {
    position: relative;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gml-modal-image {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
}

/* Botón cerrar */
.gml-modal-close {
    position: fixed;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1000000;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    opacity: 0.8;
    line-height: 1;
}

.gml-modal-close:hover {
    opacity: 1;
    transform: rotate(90deg);
    background: rgba(255, 255, 255, 0.1);
}

/* Botones de navegación */
.gml-modal-prev,
.gml-modal-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    font-size: 30px;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    cursor: pointer;
    z-index: 1000000;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    opacity: 0.7;
    line-height: 1;
}

.gml-modal-prev {
    left: 20px;
}

.gml-modal-next {
    right: 20px;
}

.gml-modal-prev:hover,
.gml-modal-next:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

/* Título y contador */
.gml-modal-caption {
    position: fixed;
    bottom: 20px;
    left: 0;
    width: 100%;
    text-align: center;
    color: #fff;
    font-size: 16px;
    padding: 15px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    box-sizing: border-box;
    z-index: 1000000;
}

.gml-modal-counter {
    position: fixed;
    top: 20px;
    left: 30px;
    color: #fff;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 12px;
    border-radius: 20px;
    z-index: 1000000;
    letter-spacing: 0.5px;
}

/* Estilos para triggers en frontend */
.gml-trigger {
    cursor: pointer;
    display: inline-block;
    transition: opacity 0.3s ease;
}

.gml-trigger:hover {
    opacity: 0.9;
}

/* Responsive Móvil */
@media (max-width: 768px) {
    .gml-modal-prev,
    .gml-modal-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
        opacity: 0.9;
        background: rgba(0, 0, 0, 0.7);
    }
    
    .gml-modal-prev {
        left: 5px;
    }
    
    .gml-modal-next {
        right: 5px;
    }
    
    .gml-modal-close {
        top: 10px;
        right: 15px;
        font-size: 35px;
    }
    
    .gml-modal-image-container {
        max-width: 100vw;
        max-height: 80vh;
    }
    
    .gml-modal-caption {
        font-size: 14px;
        padding: 10px;
        bottom: 0;
    }
    
    .gml-modal-counter {
        top: 10px;
        left: 15px;
        font-size: 12px;
    }
}

/* Soporte para pantallas táctiles */
@media (hover: none) and (pointer: coarse) {
    .gml-modal-prev,
    .gml-modal-next {
        display: flex; /* Siempre visibles en móvil */
    }
}

/* Animaciones */
@keyframes gml-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gml-modal[style*="display: block"] {
    animation: gml-fade-in 0.3s ease;
}

/* Prevención de scroll en body cuando modal activo */
body.gml-modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}
