/* ========================================
   Marsub Gallery - Estilos principales
   ======================================== */

.ggs-container {
    position: relative;
    max-width: 100%;
    margin: 40px auto;
    padding: 0 45px;
}

.ggs-wrapper {
    overflow: hidden;
    position: relative;
    width: 100%;
    height: auto;
}

.ggs-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--marsub-spacing, 10px);
    transition: transform var(--marsub-transition-speed, 300ms) ease-in-out;
    will-change: transform;
    width: max-content;
}

.ggs-item {
    position: relative;
    width: var(--item-width);
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--marsub-border-radius, 8px);
    background: #f0f0f0;
    cursor: pointer;
}

.ggs-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.ggs-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
}

.ggs-item:hover .ggs-image {
    transform: scale(1.05);
}

.ggs-item::after {
    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;
}

.ggs-item:hover::after {
    background: rgba(0, 0, 0, 0.1);
}

/* Botones de navegación */
.ggs-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    font-size: 48px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: 10px 15px;
    line-height: 1;
    font-weight: 300;
    user-select: none;
}

.ggs-nav:hover {
    color: rgba(255, 255, 255, 1);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.ggs-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.ggs-prev {
    left: 10px;
}

.ggs-next {
    right: 10px;
}

.ggs-nav svg {
    display: none;
}

.ggs-prev::before {
    content: '<';
}

.ggs-next::before {
    content: '>';
}

.ggs-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Indicadores de puntos */
.ggs-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.ggs-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.ggs-dot:hover {
    background: #bbb;
    transform: scale(1.1);
}

.ggs-dot.active {
    background: #333;
    width: 32px;
    border-radius: 6px;
}

/* Mensaje de error */
.ggs-error {
    color: #d63638;
    background: #fff0f0;
    padding: 12px 16px;
    border-left: 4px solid #d63638;
    border-radius: 4px;
    margin: 20px 0;
}

/* ========================================
   Responsive
   ======================================== */

/* Tablets */
@media screen and (max-width: 1024px) {
    .ggs-container {
        padding: 0 50px;
    }
    
    .ggs-nav {
        font-size: 40px;
        padding: 8px 12px;
    }
}

/* Móviles */
@media screen and (max-width: 768px) {
    .ggs-container {
        padding: 0 40px;
    }
    
    .ggs-grid {
        gap: calc(var(--marsub-spacing, 10px) * 0.8);
    }
    
    .ggs-nav {
        font-size: 36px;
        padding: 6px 10px;
    }
    
    .ggs-prev {
        left: 5px;
    }
    
    .ggs-next {
        right: 5px;
    }
}

@media screen and (max-width: 480px) {
    .ggs-container {
        padding: 0 35px;
    }
    
    .ggs-grid {
        gap: calc(var(--marsub-spacing, 10px) * 0.6);
    }
    
    .ggs-nav {
        font-size: 32px;
        padding: 5px 8px;
    }
    
    .ggs-prev {
        left: 2px;
    }
    
    .ggs-next {
        right: 2px;
    }
}

/* ========================================
   Personalización de GLightbox
   ======================================== */

/* Tema Clean */
.glightbox-clean .gslide-description {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 16px 20px;
    border-radius: 8px;
}

.glightbox-clean .gslide-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.glightbox-clean .gdesc-inner {
    font-size: 14px;
    line-height: 1.5;
}

/* Contador de imágenes */
.glightbox-container .gslide-description::before {
    content: attr(data-counter);
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Botones de navegación del lightbox */
.glightbox-container .gnext,
.glightbox-container .gprev {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.glightbox-container .gnext:hover,
.glightbox-container .gprev:hover {
    background: white;
    transform: scale(1.1);
}

/* Botón de cerrar */
.glightbox-container .gclose {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    opacity: 1;
    transition: all 0.3s ease;
}

.glightbox-container .gclose:hover {
    background: white;
    transform: scale(1.1);
}

/* ========================================
   Animaciones
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ggs-item {
    animation: fadeIn 0.4s ease backwards;
}

.ggs-item:nth-child(1) { animation-delay: 0.05s; }
.ggs-item:nth-child(2) { animation-delay: 0.1s; }
.ggs-item:nth-child(3) { animation-delay: 0.15s; }
.ggs-item:nth-child(4) { animation-delay: 0.2s; }

/* ========================================
   Accesibilidad
   ======================================== */

.ggs-nav:focus,
.ggs-dot:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .ggs-grid,
    .ggs-image,
    .ggs-nav,
    .ggs-dot {
        transition: none;
        animation: none;
    }
}

/* ========================================
   GLightbox - Etiqueta minimalista del nombre
   ======================================== */

/* Estilos minimalistas y elegantes para el nombre del archivo */
.glightbox-container .gslide-title {
    display: inline-block;
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95) 0%, rgba(20, 20, 20, 0.95) 100%);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    color: #ffffff;
    padding: 10px 22px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-align: center;
    margin: 0 auto;
    margin-top: 20px;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 80%;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Efecto hover sutil */
.glightbox-container .gslide-title:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 32px rgba(0, 0, 0, 0.5),
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Animación suave al aparecer */
.glightbox-container .gslide-title {
    animation: slideUpFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Contenedor de descripción centrado */
.glightbox-container .gslide-description {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 0 20px 30px;
    background: transparent;
    pointer-events: none;
}

.glightbox-container .gslide-description * {
    pointer-events: auto;
}

/* Ocultar la descripción secundaria si existe */
.glightbox-container .gslide-desc {
    display: none;
}

/* Ajustes responsive */
@media screen and (max-width: 768px) {
    .glightbox-container .gslide-title {
        font-size: 13px;
        padding: 8px 18px;
        margin-top: 16px;
        max-width: 85%;
        border-radius: 20px;
    }
    
    .glightbox-container .gslide-description {
        bottom: 0;
        padding: 0 15px 20px;
    }
}

@media screen and (max-width: 480px) {
    .glightbox-container .gslide-title {
        font-size: 12px;
        padding: 7px 16px;
        max-width: 90%;
        letter-spacing: 0.3px;
    }
}

/* Versión dark más intensa para mejor contraste */
@media (prefers-color-scheme: dark) {
    .glightbox-container .gslide-title {
        background: linear-gradient(135deg, rgba(10, 10, 10, 0.98) 0%, rgba(5, 5, 5, 0.98) 100%);
        border-color: rgba(255, 255, 255, 0.2);
    }
}

/* ========================================
   GLightbox - Mejoras móviles
   ======================================== */

/* Mejorar área táctil en móviles */
@media screen and (max-width: 768px) {
    /* Asegurar que las flechas del lightbox sean táctiles */
}

/* Ocultar la descripción secundaria si existe */
.glightbox-container .gslide-desc {
    display: none;
}

/* Mejorar área táctil en móviles */
@media screen and (max-width: 768px) {
    .glightbox-container .gslide-title {
        font-size: 14px;
        padding: 10px 20px;
        margin-top: 12px;
        max-width: 95%;
    }
    
    /* Asegurar que las flechas del lightbox sean táctiles */
    .glightbox-container .gslide-description {
        bottom: 60px;
    }
    
    /* Indicador visual de swipe en móvil */
    .glightbox-container .gslide-media::after {
        content: '← Desliza →';
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.6);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 14px;
        opacity: 0;
        animation: fadeInOut 3s ease-in-out;
        pointer-events: none;
        z-index: 9999;
    }
    
    @keyframes fadeInOut {
        0%, 100% { opacity: 0; }
        10%, 90% { opacity: 1; }
    }
    
    /* Mejorar área de touch para prevenir/next */
    .glightbox-container .gprev,
    .glightbox-container .gnext {
        width: 80px !important;
        height: 100% !important;
        opacity: 0.3 !important;
    }
    
    .glightbox-container .gprev:active,
    .glightbox-container .gnext:active {
        opacity: 0.8 !important;
    }
}

/* Optimizar rendimiento del drag en lightbox */
.glightbox-container .gslide-image img {
    touch-action: pan-x;
    user-select: none;
    -webkit-user-drag: none;
}

/* ========================================
   Print styles
   ======================================== */

@media print {
    .ggs-nav,
    .ggs-dots {
        display: none !important;
    }
    
    .ggs-grid {
        display: block;
    }
    
    .ggs-item {
        page-break-inside: avoid;
        margin-bottom: 10px;
    }
}
