/* ===============================
   GALERIA CSS - COMPLETAMENTE CORRIGIDO
   =============================== */

/* CORES PRINCIPAIS DOS ÍCONES */
:root {
    --icon-color-normal: #D4B896;     /* Castanho claro/bege */
    --icon-color-hover: #8B5A2B;      /* Castanho escuro */
    --icon-color-active: #A0622F;     /* Castanho médio */
}
/* Normalização de ícones para SVG e Font Awesome */
.category-item i,
.icon-display i,
.icon-option i,
.icon-preview i,
.svg-icon svg,
.svg-container svg,
.icon-preview svg {
    width: 26px !important;
    height: 26px !important;
    color: var(--primary-color) !important;
    fill: currentColor !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    font-weight: 400 !important;   /* outlined/regular */
    transition: color 0.2s;
}

/* ===============================
   BANNER INFORMATIVO B2B - PROFISSIONAL
   =============================== */

.gallery-info-banner {
    background: rgba(89, 54, 33, 0.08);
    margin: -10px auto 20px;
    max-width: 100%;
    width: 70%;
    padding: 5px 40px;
    border-radius: 0;
    text-align: center;
    box-sizing: border-box;
}

.gallery-info-text {
    color: #593621;
    font-size: 0.75rem;
    line-height: 1.7;
    margin: 0 auto;
    font-weight: 400;
    letter-spacing: 0.2px;
    max-width: 1000px;
}

.gallery-info-text br {
    display: block;
    margin-bottom: 12px;
}

.gallery-info-text strong {
    color: #8B5A2B;
    font-weight: 600;
}

/* Responsividade do banner */
@media (max-width: 1024px) {
    .gallery-info-banner {
        padding: 25px 35px;
    }

    
}

@media (max-width: 768px) {
    .gallery-info-banner {
        padding: 20px 25px;
        max-width: none;
    }

    .gallery-info-text {
        font-size: 0.9rem;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    

    .gallery-info-text {
        font-size: 0.85rem;
        line-height: 1.5;
    }
}

/* Galeria */
.gallery {
    background: var(--secondary-color);
    padding: 50px 20px 20px;
    min-height: 400px;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0;
    position: relative;
    color: var(--primary-color, #593621);
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 3px;
    background-color: var(--accent-color, #8B4513);
    margin: 1rem auto 0;
}

/* ===============================
   FILTROS DE CATEGORIA - COM BARRA INFERIOR IGUAL AO HEADER
   =============================== */
.category-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 25px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
    gap: 1.5rem;
}

.category-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.5rem 0.8rem;
    color: var(--primary-color, #593621);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 17px;
    text-decoration: none;
    opacity: 0.9;
}

/* BARRA INFERIOR - IGUAL AO HEADER */
.category-item::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10px;
    width: 0;
    height: 2px;
    background-color: var(--primary-color, #593621);
    transition: width 0.3s ease-in-out;
}

.category-item i, .category-item .svg-icon {
    margin-right: 10px;
    transition: all 0.3s ease;
    scale: 1.5;
}

.category-item .svg-icon svg {
    width: 28px !important;
    height: 28px !important;
    vertical-align: middle;
    transition: all 0.3s ease;
}

/* ESTADO ATIVO - IGUAL AO HEADER */
.category-item.active {
    color: #593621 !important;
    opacity: 1;
    font-weight: 400;
}

.category-item.active::after {
    width: 80%;
}

.category-item.active i, 
.category-item.active .svg-icon,
.category-item.active .svg-icon svg {
    color: var(--icon-color-hover) !important;
    fill: var(--icon-color-hover) !important;
}

/* ESTADO HOVER - IGUAL AO HEADER */
.category-item:hover {
    color: var(--primary-color, #593621);
    opacity: 1;
}

.category-item:hover::after {
    width: 80%;
}

.category-item:hover i, 
.category-item:hover .svg-icon,
.category-item:hover .svg-icon svg {
    color: var(--icon-color-hover) !important;
    fill: var(--icon-color-hover) !important;
    transform: scale(1.1);
}



/* ===============================
   GRID DE IMAGENS - CORRIGIDO COMPLETAMENTE
   =============================== */

.gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 200px;
    width: 100%;
}

.gallery-item {
    width: 100% !important;
    min-height: 280px !important;
    position: relative;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: zoom-in;
    border-radius: 6px;
    visibility: visible !important;
    opacity: 1 !important;
}

.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.gallery-item img {
    width: 100% !important;
    height: 200px !important;
    object-fit: cover !important;
    transition: transform 0.3s ease;
    display: block !important;
    flex-shrink: 0;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    background: linear-gradient(to top, rgba(89, 54, 33, 0.9), transparent 70%);
    color: var(--secondary-color);
    opacity: 0;
    transform: translateY(20px);
    height: 70%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.gallery-item:hover .gallery-item-info {
    opacity: 1;
    transform: translateY(0);
}

/* Botão Ver Mais */
.gallery-pagination-row {
    text-align: center;
    margin-top: 3rem;
    grid-column: 1 / -1;
}

.button-gallery {
    padding: 12px 30px;
    background-color: var(--primary-color, #593621);
    color: var(--secondary-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(89, 54, 33, 0.3);
}

.button-gallery:hover {
    background-color: var(--accent-color, #8B4513);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(89, 54, 33, 0.4);
}

/* ===============================
   LIGHTBOX STYLES - MELHORADO
   =============================== */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
    touch-action: manipulation;
    user-select: none;
    overflow: hidden;
}

.lightbox.open {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    touch-action: manipulation;
    outline: none;
}

.lightbox img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
    transition: transform 0.3s ease;
    border-radius: 3px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.lightbox-description {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 1rem;
    text-align: center;
    max-width: 70%;
    line-height: 1.4;
    z-index: 1250;
    font-weight: normal;
    pointer-events: none;
}

.lightbox .close {
    position: fixed;
    top: 25px;
    right: 35px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1300;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.5);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox .close:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    padding: 0 20px;
}

.prev-btn, .next-btn {
    position: fixed;
    top: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    user-select: none;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    z-index: 1250;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    padding: 0;
    margin: 0;
}

.prev-btn:hover, .next-btn:hover {
    background-color: rgba(255, 255, 255, 1);
    color: #000;
    transform: translateY(-50%) scale(1.05);
}

.prev-btn {
    left: 60px;
}

.next-btn {
    right: 60px;
}

/* ===============================
   BOTÕES RESPONSIVOS PARA LIGHTBOX
   =============================== */

/* Tablet (768px até 1023px) - Botões menores, posição FORA da imagem */
@media (max-width: 1023px) and (min-width: 768px) {
    .prev-btn, .next-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .prev-btn {
        left: 45px;
    }

    .next-btn {
        right: 45px;
    }

    /* Ajustar também o ícone de fechar e descrição */
    .lightbox .close {
        width: 40px;
        height: 40px;
        font-size: 28px;
        top: 20px;
        right: 20px;
    }

    .lightbox-description {
        bottom: 50px;
        max-width: 80%;
        font-size: 0.95rem;
        padding: 10px 16px;
    }
}

/* Mobile (até 767px) - Botões ainda menores, posição FORA da imagem */
@media (max-width: 767px) {
    .prev-btn, .next-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }

    .prev-btn {
        left: 35px;
    }

    .next-btn {
        right: 35px;
    }

    /* Ajustar também o ícone de fechar e descrição */
    .lightbox .close {
        width: 35px;
        height: 35px;
        font-size: 24px;
        top: 15px;
        right: 15px;
    }

    .lightbox-description {
        bottom: 40px;
        max-width: 90%;
        font-size: 0.85rem;
        padding: 8px 12px;
    }
}

/* ===============================
   LOADING MESSAGE
   =============================== */
.loading-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: var(--primary-color, #593621);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* ===============================
   RESPONSIVIDADE - CORRIGIDA COMPLETAMENTE
   =============================== */

/* PC (Desktop) - 1024px+ : 4 colunas (12 imagens = 3 filas) */
@media (min-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px;
        padding: 0 20px;
    }

    .gallery-item {
        min-height: 280px !important;
        display: flex !important;
        flex-direction: column !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .gallery-item img {
        height: 180px !important;
        display: block !important;
        width: 100% !important;
        object-fit: cover !important;
    }
}

/* Tablet - 768px até 1023px: 3 colunas (8 imagens = ~3 filas) */
@media (min-width: 768px) and (max-width: 1023px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        max-width: 900px;
        gap: 18px !important;
        padding: 0 20px;
        display: grid !important;
    }
    
    .gallery-item {
        min-height: 260px !important;
        display: flex !important;
        flex-direction: column !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        border-radius: 6px !important;
        overflow: hidden !important;
    }
    
    .gallery-item img {
        height: 100% !important;
        min-height: 260px !important;
        display: block !important;
        width: 100% !important;
        object-fit: cover !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex: 1 !important;
    }

    .gallery-item-info {
        height: 30% !important;
        background: linear-gradient(to top, rgba(89, 54, 33, 0.95), rgba(89, 54, 33, 0.7) 50%, transparent) !important;
    }

    .category-filters {
        max-width: 900px;
        padding: 0 20px;
        gap: 1rem;
    }
    
    .gallery {
        padding: 60px 0;
    }
    
    .section-title {
        font-size: 2.2rem;
    }
}

/* Mobile - Menos de 768px */
@media (max-width: 767px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 0 10px;
    }

    .gallery-item {
        min-height: 220px !important;
        display: flex !important;
        flex-direction: column !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .gallery-item img {
        height: 140px !important;
        display: block !important;
        width: 100% !important;
        object-fit: cover !important;
    }

    .category-filters {
        gap: 0.8rem;
        padding: 0 10px;
    }

    .category-item {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
}

/* Mobile Horizontal - LANDSCAPE (Maior largura em modo landscape) */
@media (max-height: 500px) and (max-width: 767px) and (orientation: landscape) {
    .gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        padding: 0 8px;
    }

    .gallery-item {
        min-height: 180px !important;
    }

    .gallery-item img {
        height: 100px !important;
    }
}
/* ===============================
   MELHORIAS PARA EXPERIÊNCIA DE TOQUE - GALERIA SWIPE
   =============================== */

/* Melhorar experiência de toque na galeria */
.gallery-container {
    touch-action: pan-x pan-y;
    user-select: none;
    position: relative;
    /* Área específica para swipe */
    padding: 30px;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
}

.gallery-grid {
    touch-action: pan-x pan-y;
    position: relative;
    order: 1;
}

.ver-mais-container {
    order: 2;
    text-align: center;
    margin-top: 20px;
    width: 100%;
}

/* Indicador visual para swipe APENAS na área da galeria - DESATIVADO */
@media (max-width: 768px) {
    .gallery-container::before {
        display: none;
    }
}

/* OTIMIZAÇÕES ESPECÍFICAS PARA MOBILE PEQUENO (480px) */
@media (max-width: 480px) {
    .gallery-container {
        padding: 5px;
        margin: 5px 0;
    }
    
    .gallery-container::before {
        font-size: 10px;
        padding: 6px 12px;
        margin-bottom: 8px;
    }
    
    /* Otimizar espaçamento do grid */
    .gallery-grid {
        gap: 12px !important;
        padding: 0 5px;
    }
    
    /* Melhorar botão "Ver Mais" */
    .btn-ver-mais {
        padding: 12px 20px;
        font-size: 0.9rem;
        width: 100%;
        max-width: 250px;
        border-radius: 25px;
        border: none;
        color: #f4ebdc;
        font-weight: 600;
        transition: all 0.3s ease;
    }
    
    .btn-ver-mais:active {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(89, 54, 33, 0.4);
    }
    
    /* Melhorar indicador de loading */
    .loading-message {
        padding: 30px 15px;
        font-size: 0.9rem;
        text-align: center;
    }
    
    /* Otimizar empty state */
    .empty-state {
        padding: 40px 20px;
        text-align: center;
    }
    
    .empty-state h3 {
        font-size: 1.1rem;
        margin: 10px 0;
    }
    
    .empty-state p {
        font-size: 0.9rem;
        color: #666;
        margin: 5px 0;
    }
}

/* FORÇAR VISIBILIDADE EM TODOS OS TAMANHOS - REGRAS IMPORTANTES */
.gallery-item {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    border-radius: 6px !important;
}

.gallery-item img {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    object-fit: cover !important;
    position: relative !important;
}

.gallery-grid {
    display: grid !important;
    margin: 0 auto !important;
}

/* ESPECIFICAMENTE PARA O BREAKPOINT PROBLEMÁTICO 768px-954px */
@media (min-width: 768px) and (max-width: 954px) {
    .gallery-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 18px !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .gallery-item {
        display: flex !important;
        flex-direction: column !important;
        visibility: visible !important;
        opacity: 1 !important;
        min-height: 260px !important;
        background: #f3eee7 !important;
        border-radius: 6px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
        position: relative !important;
    }
    
    .gallery-item img {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        height: 160px !important;
        object-fit: cover !important;
        position: relative !important;
    }
    
    @media (min-width: 768px) and (max-width: 954px) {
        .gallery-item-info {
            display: block !important;
            visibility: visible !important;
            opacity: 1 !important;
            padding: 15px !important;
            position: absolute !important;
            bottom: 0 !important;
            left: 0 !important;
            right: 0 !important;
        }
    }
}