/* Galería Colaborativa - Estilos Frontend v1.3.0 */
/* Optimizado para rendimiento y accesibilidad */

.gc-public-gallery {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    /* Optimización de rendimiento */
    will-change: auto;
    contain: layout style;
}

/* Responsive Design para móviles */
@media (max-width: 768px) {
    .gc-public-gallery {
        padding: 1rem;
    }
    
    .gc-gallery-header {
        padding: 0.75rem;
    }
    
    .gc-gallery-title {
        font-size: 1.5rem;
    }
    
    .gc-gallery-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .gc-public-gallery {
        padding: 0.5rem;
    }
    
    .gc-gallery-title {
        font-size: 1.25rem;
    }
}

.gc-gallery-header {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gc-gallery-title {
    margin: 0 0 1rem 0;
    font-size: 2rem;
    color: #333;
}

.gc-gallery-description {
    margin: 0 0 1.5rem 0;
    color: #666;
    line-height: 1.6;
}

.gc-gallery-stats {
    display: flex;
    gap: 1.5rem;
    color: #666;
}

.gc-stat strong {
    color: #333;
    font-weight: 600;
}

.gc-gallery-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem;
}

.gc-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

/* Grid responsive para móviles */
@media (max-width: 768px) {
    .gc-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 0.75rem;
        margin: 0.75rem 0;
    }
}

@media (max-width: 480px) {
    .gc-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
        margin: 0.5rem 0;
    }
}

@media (max-width: 320px) {
    .gc-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.gc-gallery-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gc-gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.gc-gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.gc-gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gc-gallery-item:hover .gc-gallery-item-overlay {
    opacity: 1;
}

.gc-gallery-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gc-gallery-item-filename {
    font-size: 0.9rem;
    font-weight: 500;
}

.gc-gallery-item-size {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Lightbox mejorado para móviles */
.gc-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    -webkit-overflow-scrolling: touch;
}

.gc-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    -webkit-tap-highlight-color: transparent;
}

.gc-lightbox-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 95vw;
    max-height: 95vh;
    background: transparent;
    border-radius: 0;
    overflow: visible;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-x;
}

.gc-lightbox-slider {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.gc-lightbox-slider.gc-slide-next {
    transform: translateX(-20px);
    opacity: 0.8;
}

.gc-lightbox-slider.gc-slide-prev {
    transform: translateX(20px);
    opacity: 0.8;
}

.gc-lightbox img,
.gc-lightbox video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease;
}

.gc-lightbox-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    background: rgba(0,0,0,0.7);
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 0.9rem;
    z-index: 10001;
    display: none;
}

.gc-error {
    color: #fff;
    background: rgba(255,0,0,0.7);
    padding: 15px 25px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
}

.gc-lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10000;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.gc-lightbox-close:hover {
    background: rgba(0,0,0,0.7);
}

/* Controles de navegación del lightbox */
.gc-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10000;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: all 0.3s ease;
}

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

.gc-lightbox-prev {
    left: 20px;
}

.gc-lightbox-next {
    right: 20px;
}

.gc-lightbox-counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0,0,0,0.5);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 10000;
}

/* Prevenir scroll del body cuando lightbox está abierto */
body.gc-lightbox-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Soporte para gestos táctiles en móviles */
.gc-lightbox-content img,
.gc-lightbox-content video {
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Mejoras para el área táctil en móviles */
.gc-gallery-item {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.gc-gallery-item:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Responsive para lightbox en móviles */
@media (max-width: 768px) {
    .gc-lightbox-content {
        max-width: 98vw;
        max-height: 98vh;
    }
    
    .gc-lightbox-close {
        top: 15px;
        right: 15px;
        font-size: 1.8rem;
        width: 45px;
        height: 45px;
        background: rgba(0,0,0,0.8);
        backdrop-filter: blur(10px);
    }
    
    .gc-lightbox-nav {
        font-size: 1.8rem;
        width: 50px;
        height: 50px;
        background: rgba(0,0,0,0.8);
        backdrop-filter: blur(10px);
    }
    
    .gc-lightbox-prev {
        left: 15px;
    }
    
    .gc-lightbox-next {
        right: 15px;
    }
    
    .gc-lightbox-counter {
        bottom: 20px;
        font-size: 0.9rem;
        padding: 8px 16px;
        background: rgba(0,0,0,0.8);
        backdrop-filter: blur(10px);
    }
    
    .gc-lightbox-loading {
        font-size: 1rem;
        padding: 20px 30px;
    }
    
    /* Indicador visual para swipe */
    .gc-lightbox-content::before {
        content: '';
        position: absolute;
        bottom: 60px;
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
        height: 4px;
        background: rgba(255,255,255,0.3);
        border-radius: 2px;
        z-index: 10000;
    }
}

@media (max-width: 480px) {
    .gc-lightbox-nav {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
    
    .gc-lightbox-close {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
        top: 10px;
        right: 10px;
    }
    
    .gc-lightbox-prev {
        left: 10px;
    }
    
    .gc-lightbox-next {
        right: 10px;
    }
    
    .gc-lightbox-counter {
        bottom: 15px;
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .gc-lightbox-content::before {
        bottom: 50px;
        width: 50px;
        height: 3px;
    }
}

/* Optimizaciones específicas para iOS */
@supports (-webkit-touch-callout: none) {
    .gc-lightbox {
        -webkit-overflow-scrolling: touch;
    }
    
    .gc-lightbox-content img {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Optimizaciones para Android */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .gc-lightbox-content {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* Estilos para la página vacía */
.gc-empty-gallery {
    text-align: center;
    padding: 3rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gc-empty-icon {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 1rem;
}

.gc-empty-gallery p {
    color: #666;
    font-size: 1.1rem;
}
