/* Estilos para galeria de projetos e produtos */

/* Container da galeria */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
    padding: 0 10px;
}

/* Item individual da galeria */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 8px var(--color-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #f8f8f8;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Imagens da galeria */
.gallery-item img {
    width: 100%;
    height: 250px;
    display: block;
    object-fit: cover;
    object-position: center;
    background-color: #f0f0f0;
}

/* Legendas da galeria */
.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 15px;
    font-size: 0.9em;
    text-align: center;
}

/* Container de produtos */
.product-list {
    margin-top: 60px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

/* Card individual de produto */
.product-card {
    background: var(--color-bg-card);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 8px var(--color-shadow);
    transition: transform 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
}

/* Imagens dos produtos */
.product-card img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 15px;
    border-radius: 4px;
}

/* Títulos dos produtos */
.product-card h4 {
    color: var(--color-primary);
    margin-bottom: 10px;
    font-size: 1.2em;
}

/* Descrições dos produtos */
.product-card p {
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Responsividade */
@media (max-width: 768px) {
    .gallery {
        grid-template-columns: 1fr;
    }
    
    .product-list {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .product-card img {
        height: 180px;
    }
    
    .gallery-item img {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .gallery {
        gap: 15px;
        grid-template-columns: 1fr;
    }
    
    .product-card {
        padding: 15px;
    }
    
    .product-card img {
        height: 150px;
    }
    
    .gallery-item img {
        height: 180px;
    }
}

/* Estilos do Modal de Imagem */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    max-width: 90%;
    height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    cursor: grab;
    transition: transform 0.3s ease;
    transform-origin: center center;
    user-select: none;
}

.modal-image:active {
    cursor: grabbing;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 1001;
}

.modal-close:hover,
.modal-close:focus {
    color: #bbb;
}

.modal-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 15px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Cursor de zoom ao passar sobre imagens da galeria */
.gallery-item img {
    cursor: zoom-in;
    transition: transform 0.3s ease, filter 0.3s ease;
}

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

/* Tratamento para imagens que não carregam corretamente */
.gallery-item img::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0),
                linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    z-index: -1;
}

/* Fallback para imagens com erro de carregamento */
.gallery-item img.error {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    text-align: center;
}

.gallery-item img.error::after {
    content: 'Imagem não disponível';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Efeito de brilho no hover */
.gallery-item {
    position: relative;
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.gallery-item:hover::before {
    opacity: 1;
}

/* Indicador visual de zoom */
.gallery-item::after {
    content: '🔍';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    border-radius: 50%;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* Loading state para imagens */
.gallery-item img {
    position: relative;
}

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

.gallery-item img.loaded {
    opacity: 1;
    filter: blur(0);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Animação de skeleton loading */
@keyframes skeletonLoading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.gallery-item img.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeletonLoading 1.5s infinite;
}

/* Animação de entrada do modal */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-modal.show {
    display: flex;
    animation: modalFadeIn 0.3s ease;
}

/* Responsividade do modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        height: 95%;
        padding: 10px;
    }
    
    .modal-close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
    
    .modal-controls {
        bottom: 20px;
        padding: 8px 15px;
    }
    
    .zoom-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}