/**
 * ============================================
 * SISTEMA DE IMAGENS RESPONSIVAS - FOOD DELIVERY
 * ============================================
 * Sistema completo para garantir imagens 100% responsivas
 * em todos os dispositivos (mobile, tablet, desktop)
 */

/* ============================================
   1. CONTAINERS BASE PARA IMAGENS
   ============================================ */

.responsive-image-container {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Skeleton loading effect */
.responsive-image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.4),
            transparent);
    animation: skeleton-loading 1.5s infinite;
    z-index: 1;
}

@keyframes skeleton-loading {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* ============================================
   2. ASPECT RATIOS
   ============================================ */

/* Proporção 16:9 (Widescreen - ideal para banners) */
.aspect-16-9 {
    aspect-ratio: 16/9;
}

/* Proporção 1:1 (Quadrado - ideal para produtos) */
.aspect-1-1 {
    aspect-ratio: 1/1;
}

/* Proporção 4:3 (Padrão - fotos clássicas) */
.aspect-4-3 {
    aspect-ratio: 4/3;
}

/* Proporção 3:2 (Fotografia) */
.aspect-3-2 {
    aspect-ratio: 3/2;
}

/* Fallback para navegadores que não suportam aspect-ratio */
@supports not (aspect-ratio: 1/1) {
    .aspect-16-9 {
        padding-bottom: 56.25%;
        /* 9/16 * 100 */
        height: 0;
    }

    .aspect-1-1 {
        padding-bottom: 100%;
        height: 0;
    }

    .aspect-4-3 {
        padding-bottom: 75%;
        /* 3/4 * 100 */
        height: 0;
    }

    .aspect-3-2 {
        padding-bottom: 66.66%;
        /* 2/3 * 100 */
        height: 0;
    }

    .aspect-16-9 img,
    .aspect-1-1 img,
    .aspect-4-3 img,
    .aspect-3-2 img {
        position: absolute;
        top: 0;
        left: 0;
    }
}

/* ============================================
   3. IMAGENS RESPONSIVAS
   ============================================ */

.responsive-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
    display: block;
    z-index: 2;
    position: relative;
}

/* Variação: contain (imagem completa, pode ter espaços) */
.responsive-image-contain {
    object-fit: contain;
}

/* Variação: cover centralized */
.responsive-image-cover {
    object-fit: cover;
}

/* ============================================
   4. ESTADOS DE CARREGAMENTO
   ============================================ */

.responsive-image.loading {
    opacity: 0;
    filter: blur(10px);
}

.responsive-image.loaded {
    opacity: 1;
    filter: none;
}

/* Fade in suave ao carregar */
.responsive-image.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   5. HOVER EFFECTS
   ============================================ */

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

.responsive-image-zoom:hover {
    transform: scale(1.1);
    z-index: 10;
}

/* ============================================
   6. BANNERS DO SLIDER
   ============================================ */

.banner-slider-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.banner-slider-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Mobile: altura automática baseada em largura */
@media (max-width: 768px) {
    .banner-slider-container {
        aspect-ratio: 16/9;
        max-height: 250px;
        border-radius: 12px;
        margin: 10px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .banner-slider-container {
        aspect-ratio: 16/9;
        max-height: 350px;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .banner-slider-container {
        aspect-ratio: 16/9;
        max-height: 400px;
    }
}

/* ============================================
   7. PRODUTOS EM CARDS (GRID)
   ============================================ */

.product-card-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px 16px 0 0;
}

.product-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.product-card-image-container:hover .product-card-image {
    transform: scale(1.08);
}

/* Mobile ajustado */
@media (max-width: 480px) {
    .product-card-image-container {
        border-radius: 12px 12px 0 0;
    }
}

/* ============================================
   8. PRODUTOS HORIZONTAIS (LISTA)
   ============================================ */

.product-horizontal-image-container {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    aspect-ratio: 1/1;
}

.product-horizontal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.product-horizontal-image-container:hover .product-horizontal-image {
    transform: scale(1.1);
}

/* Mobile: 80x80px */
@media (max-width: 768px) {
    .product-horizontal-image-container {
        width: 80px;
        height: 80px;
    }
}

/* Desktop: 100x100px */
@media (min-width: 769px) {
    .product-horizontal-image-container {
        width: 100px;
        height: 100px;
    }
}

/* ============================================
   9. IMAGENS DO CARRINHO
   ============================================ */

.cart-item-image-container {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    aspect-ratio: 1/1;
}

.cart-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Mobile: 70x70px */
@media (max-width: 480px) {
    .cart-item-image-container {
        width: 70px;
        height: 70px;
        border-radius: 8px;
    }
}

/* Tablet e acima: 80x80px */
@media (min-width: 481px) {
    .cart-item-image-container {
        width: 80px;
        height: 80px;
    }
}

/* ============================================
   10. QR CODE PIX
   ============================================ */

.qrcode-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.qrcode-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

/* Mobile: 90vw máximo */
@media (max-width: 768px) {
    .qrcode-container {
        max-width: 90vw;
        padding: 15px;
        border-radius: 12px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .qrcode-container {
        max-width: 350px;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .qrcode-container {
        max-width: 400px;
    }
}

/* ============================================
   11. IMAGENS DE DETALHES/MODAIS
   ============================================ */

.detail-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    margin-bottom: 20px;
}

.detail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Mobile */
@media (max-width: 768px) {
    .detail-image-container {
        aspect-ratio: 16/9;
        border-radius: 12px;
        margin-bottom: 15px;
    }
}

/* ============================================
   12. OFERTAS E BADGES
   ============================================ */

.offer-badge-container {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
}

@media (max-width: 480px) {
    .offer-badge-container {
        top: 5px;
        right: 5px;
    }
}

/* ============================================
   13. LAZY LOADING
   ============================================ */

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

img[loading="lazy"].loaded,
img[loading="lazy"][data-loaded="true"] {
    opacity: 1;
}

/* ============================================
   14. PLACEHOLDER/SKELETON
   ============================================ */

.image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            #f0f0f0 0%,
            #e0e0e0 20%,
            #f0f0f0 40%,
            #f0f0f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   15. UTILITÁRIOS RESPONSIVOS
   ============================================ */

/* Esconder em mobile */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Esconder em desktop */
@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Width máxima responsiva */
.responsive-max-width {
    max-width: 100%;
    height: auto;
}

/* ============================================
   16. ACESSIBILIDADE
   ============================================ */

/* Garantir que imagens sem alt sejam identificadas */
img:not([alt]) {
    outline: 2px dashed red;
}

/* Modo de alto contraste */
@media (prefers-contrast: high) {
    .responsive-image-container {
        background: #fff;
        border: 2px solid #000;
    }
}

/* Reduzir movimento para usuários sensíveis */
@media (prefers-reduced-motion: reduce) {

    .responsive-image,
    .responsive-image-container,
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   17. PERFORMANCE
   ============================================ */

/* Will-change para otimização de performance */
.responsive-image-container:hover .responsive-image {
    will-change: transform;
}

/* GPU acceleration */
.responsive-image {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ============================================
   18. FALLBACKS PARA NAVEGADORES ANTIGOS
   ============================================ */

/* IE11 e Edge Legacy */
@supports not (aspect-ratio: 1/1) {
    .responsive-image-container {
        position: relative;
        padding-bottom: 100%;
        height: 0;
    }

    .responsive-image-container img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* ============================================
   19. PRINT STYLES
   ============================================ */

@media print {
    .responsive-image-container::before {
        display: none;
    }

    .responsive-image {
        opacity: 1 !important;
        filter: none !important;
        transform: none !important;
    }
}