/* Estilos específicos para la galería */

/* Hero de galería */
.gallery-hero {
    min-height: 60vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2c5aa0 100%);
}

/* Sección de galería */
.gallery-section {
    padding: 5rem 0;
    background: var(--white);
}

/* Filtros de galería */
.gallery-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 3rem;
}

.filter-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: var(--bg-light);
    border: 2px solid transparent;
    border-radius: 25px;
    color: var(--text-dark);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
}

.filter-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--secondary-color);
    color: var(--white);
    border-color: var(--secondary-color);
}

.filter-btn i {
    font-size: 1rem;
}

/* Grid de galería */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.gallery-item {
    opacity: 1;
    transform: scale(1);
    transition: all 0.5s ease;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.gallery-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    height: 0;
    margin: 0;
    padding: 0;
}

.gallery-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/3;
    cursor: pointer;
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.gallery-image:hover img {
    transform: scale(1.1);
}

/* Overlay de galería */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 40%,
        rgba(0, 0, 0, 0.7) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transition: var(--transition);
}

.gallery-image:hover .gallery-overlay {
    opacity: 1;
}

.gallery-info {
    color: var(--white);
    margin-bottom: 1rem;
}

.gallery-info h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.gallery-info p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.gallery-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    color: var(--primary-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-btn:hover {
    background: var(--secondary-color);
    color: var(--white);
    transform: scale(1.1);
}

/* Botón cargar más */
.gallery-load-more {
    text-align: center;
    margin-top: 2rem;
}

#loadMoreBtn {
    min-width: 200px;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: lightboxZoom 0.3s ease-out;
}

@keyframes lightboxZoom {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-content img {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

.lightbox-prev {
    left: -70px;
}

.lightbox-next {
    right: -70px;
}

.lightbox-info {
    background: rgba(0, 0, 0, 0.8);
    color: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    text-align: center;
    max-width: 500px;
}

.lightbox-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.lightbox-info p {
    opacity: 0.9;
    line-height: 1.6;
}

/* Contador de imágenes */
.image-counter {
    position: absolute;
    top: -50px;
    left: 0;
    color: var(--white);
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Animaciones de entrada */
.gallery-item {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Delays escalonados para animación */
.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }
.gallery-item:nth-child(n+7) { animation-delay: 0.7s; }

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

.gallery-item.loading img {
    filter: blur(2px);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .lightbox-nav {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .lightbox-prev {
        left: -60px;
    }
    
    .lightbox-next {
        right: -60px;
    }
}

@media (max-width: 768px) {
    .gallery-filters {
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .filter-btn span {
        display: none;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .gallery-overlay {
        padding: 1rem;
    }
    
    .gallery-info h3 {
        font-size: 1rem;
    }
    
    .gallery-info p {
        font-size: 0.8rem;
    }
    
    .lightbox-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .lightbox-close {
        top: -40px;
        width: 35px;
        height: 35px;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    .lightbox-prev {
        left: -50px;
    }
    
    .lightbox-next {
        right: -50px;
    }
    
    .lightbox-info {
        padding: 1rem;
        margin-top: 0.5rem;
    }
    
    .lightbox-info h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .lightbox-nav {
        display: none;
    }
    
    .lightbox-content img {
        max-height: calc(100vh - 200px);
    }
}

/* Efectos de hover adicionales */
.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Loading spinner para lazy loading */
.gallery-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Tooltip para botones */
.gallery-btn:hover::after,
.lightbox-close:hover::after,
.lightbox-nav:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: var(--white);
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
}

/* Efectos de transición suave */
.gallery-item img {
    transition: transform 0.5s ease, filter 0.3s ease;
}

.gallery-item:hover img {
    filter: brightness(1.1) contrast(1.1);
}

/* Estilos para modo oscuro (opcional) */
@media (prefers-color-scheme: dark) {
    .filter-btn {
        background: rgba(255, 255, 255, 0.1);
        color: var(--white);
    }
    
    .gallery-item {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
}