/* Gallery Section Styles */
.gallery {
    background: var(--light-gray);
}

/* Estilos para os itens da galeria */
.gallery-item-b {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    height: 300px;
}

.gallery-item-b img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s ease;
}

/* Apenas o efeito de zoom no hover */
.gallery-item-b:hover img {
    transform: scale(1.1);
}

/* Lightbox Modal - CORREÇÃO CRÍTICA */
.gallery-lightbox {
    display: none; /* Começa escondido */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-lightbox.active {
    display: flex; /* Quando ativo, mostra como flex */
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: auto;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Lightbox Controls */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: var(--primary-white);
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 10000;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    color: var(--primary-red);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: var(--primary-white);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav:hover {
    background: var(--primary-red);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

/* Responsive Design */
@media (max-width: 992px) {
    .gallery-item-b {
        height: 250px;
    }
}

@media (max-width: 768px) {
    .gallery-item-b {
        height: 200px;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .lightbox-prev {
        left: 15px;
    }
    
    .lightbox-next {
        right: 15px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .gallery-item-b {
        height: 150px;
    }
    
    .lightbox-content {
        max-width: 95%;
    }
}

/* Grid layout adjustments */
.gallery .row.g-0 {
    margin: 0;
}

.gallery .col-lg-3,
.gallery .col-md-4 {
    padding: 0;
}