/* ===================================
   Estilos para GalerÃ­a - Sin CategorÃ­as
   =================================== */

/* Grid Masonry de GalerÃ­a */
.gallery-main-section {
    background: var(--bg-light);
    padding: 4rem 0;
}

.gallery-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    padding: 0 20px;
}

.gallery-masonry-item {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-masonry-item.visible {
    opacity: 1;
    transform: scale(1);
}

.gallery-masonry-item .gallery-item {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    background: var(--white);
    display: flex;
    flex-direction: column;
}

/* SOLUCIÃ“N DEFINITIVA PARA LA FRANJA BLANCA */
.gallery-masonry-item .gallery-item img {
    width: 100%;
    height: 100%;
    min-height: 300px;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: var(--transition);
}

.gallery-masonry-item .gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-masonry-item .gallery-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

/* Loading state */
.gallery-masonry-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-light);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 1s linear infinite;
}

/* Lightbox */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
}

.lightbox-close:hover {
    background: var(--accent-color);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-nav:hover {
    background: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: lightboxZoom 0.4s ease;
}

@keyframes lightboxZoom {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-content img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.lightbox-info {
    text-align: center;
    color: var(--white);
    margin-top: 1rem;
    max-width: 600px;
    padding: 0 20px;
}

.lightbox-info h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.lightbox-counter {
    font-size: 0.95rem;
    opacity: 0.7;
    margin-top: 0.3rem;
}

/* Responsive GalerÃ­a */
@media (max-width: 968px) {
    .gallery-masonry {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }

    .gallery-masonry-item .gallery-item img {
        min-height: 250px;
    }

    .lightbox-nav,
    .lightbox-close {
        width: 45px;
        height: 45px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }
}

/* Toggle de vista mÃ³vil */
.gallery-view-toggle {
    display: none;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 20px;
    margin-bottom: 1rem;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--white);
    border: 2px solid var(--bg-light);
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
}

.toggle-btn svg {
    color: var(--text-light);
    transition: var(--transition);
}

.toggle-btn:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.toggle-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--white);
}

.toggle-btn.active svg {
    color: var(--white);
}

/* BotÃ³n Ver MÃ¡s */
.gallery-load-more {
    display: none;
    justify-content: center;
    padding: 2rem 20px;
}

.gallery-load-more button {
    min-width: 200px;
}

@media (max-width: 640px) {
    /* Mostrar toggle en mÃ³vil */
    .gallery-view-toggle {
        display: flex;
    }

    /* Mostrar botÃ³n Ver MÃ¡s en mÃ³vil */
    .gallery-load-more {
        display: flex;
    }

    /* Ocultar imÃ¡genes 11-20 inicialmente en mÃ³vil */
    .hidden-mobile {
        display: none;
    }

    /* Vista de 1 columna por defecto */
    .gallery-masonry {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Vista de 2 columnas cuando estÃ¡ activa */
    .gallery-masonry.two-columns {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .gallery-masonry.two-columns .gallery-item img {
        min-height: 180px;
    }

    .gallery-masonry-item .gallery-item img {
        min-height: 200px;
    }

    .lightbox-content {
        padding: 0 10px;
    }

    .lightbox-content img {
        max-height: 60vh;
    }

    .lightbox-close {
        width: 40px;
        height: 40px;
        top: 5px;
        right: 5px;
    }

    .lightbox-close svg {
        width: 24px;
        height: 24px;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
    }

    .lightbox-nav svg {
        width: 24px;
        height: 24px;
    }

    .lightbox-info {
        margin-top: 0.5rem;
        padding: 0 10px;
    }

    .lightbox-info h3 {
        font-size: 1.2rem;
    }

    .lightbox-counter {
        font-size: 0.85rem;
    }
}