/* CSS específico para imagens responsivas */

/* Regras gerais para todas as imagens */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Container de imagem padrão */
.image-container {
    position: relative;
    overflow: hidden;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Imagens de produtos */
.product-image {
    object-fit: contain;
    object-position: center;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    transition: transform 0.3s ease;
}

.product-image:hover {
    transform: scale(1.05);
}

/* Imagens em cards */
.card img {
    object-fit: contain;
    object-position: center;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

/* Container de imagem com altura fixa */
.image-container.fixed-height {
    height: 200px;
}

/* Responsividade para mobile */
@media (max-width: 768px) {
    .image-container {
        height: 180px;
    }
    
    .image-container.fixed-height {
        height: 160px;
    }
    
    .product-image {
        max-width: 90%;
        max-height: 90%;
    }
    
    .card img {
        max-width: 90%;
        max-height: 90%;
    }
}

/* Responsividade para telas muito pequenas */
@media (max-width: 480px) {
    .image-container {
        height: 160px;
    }
    
    .image-container.fixed-height {
        height: 140px;
    }
    
    .product-image {
        max-width: 85%;
        max-height: 85%;
    }
    
    .card img {
        max-width: 85%;
        max-height: 85%;
    }
}

/* Responsividade para tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .image-container {
        height: 200px;
    }
    
    .image-container.fixed-height {
        height: 180px;
    }
    
    .product-image {
        max-width: 95%;
        max-height: 95%;
    }
    
    .card img {
        max-width: 95%;
        max-height: 95%;
    }
}

/* Responsividade para desktop */
@media (min-width: 1025px) {
    .image-container {
        height: 220px;
    }
    
    .image-container.fixed-height {
        height: 200px;
    }
    
    .product-image {
        max-width: 100%;
        max-height: 100%;
    }
    
    .card img {
        max-width: 100%;
        max-height: 100%;
    }
}

/* Fallback para imagens que não carregam */
.image-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23ccc'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.5;
    z-index: -1;
}

/* Melhorar performance de carregamento */
img {
    will-change: transform;
}

/* Suporte para lazy loading */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Melhorar acessibilidade */
img {
    alt: attr(alt);
}

/* Prevenir quebra de layout durante carregamento */
.image-container {
    min-height: 100px;
}

/* Estilos para imagens com aspect ratio específico */
.image-container.aspect-ratio-1-1 {
    aspect-ratio: 1 / 1;
}

.image-container.aspect-ratio-4-3 {
    aspect-ratio: 4 / 3;
}

.image-container.aspect-ratio-16-9 {
    aspect-ratio: 16 / 9;
} 