/* FORÇA 3 COLUNAS EM MOBILE - PRIORIDADE MÁXIMA */
/* Este arquivo deve ser carregado por último para sobrescrever tudo */
/* Cards otimizados para diferentes resoluções mobile */

/* Breakpoints para diferentes dispositivos */
/*
  320px-374px: iPhone SE, Galaxy Fold
  375px-413px: iPhone 6/7/8, iPhone X/11 Pro
  414px-479px: iPhone 6/7/8 Plus, iPhone 11/12/13
  480px-767px: Tablets pequenos, landscape phones
  768px-991px: Tablets portrait
*/

@media screen and (max-width: 991px) {
  /* Força todas as variações possíveis de grid de produtos */
  .products__grid,
  .grid,
  .products-grid,
  .product-grid,
  .productsGrid,
  [class*="grid"][class*="product"],
  [class*="product"][class*="grid"],
  .container .products__grid,
  .main .products__grid,
  .content .products__grid,
  section .products__grid,
  div[class*="product"] .grid,
  div[class*="grid"] {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: clamp(10px, 3vw, 15px) !important;
    width: 100% !important;
    max-width: none !important;
    min-width: auto !important;
    grid-auto-flow: row !important;
    grid-template-rows: auto !important;
  }

  /* Cards para tablets e mobile geral */
  .products__grid > *,
  .grid > *,
  .products-grid > *,
  .product-grid > * {
    width: 100% !important;
    min-width: auto !important;
    max-width: none !important;
    flex: none !important;
    height: auto !important;
    aspect-ratio: 0.9 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .product-card {
    aspect-ratio: 0.95 !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .product-card__image {
    aspect-ratio: 1.2 !important;
    flex-shrink: 0 !important;
    height: auto !important;
    min-height: 140px !important;
    max-height: 180px !important;
  }

  .product-card__content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding: clamp(8px, 2.2vw, 12px) !important;
  }

  .product-card__title {
    font-size: clamp(12px, 3.2vw, 16px) !important;
    line-height: 1.2 !important;
    margin: 4px 0 3px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
  }

  .product-card__subtitle {
    font-size: clamp(9px, 2.2vw, 11px) !important;
    margin: 0 0 3px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .product-card__price {
    margin: 3px 0 5px !important;
    gap: 4px !important;
  }

  .price-current {
    font-size: clamp(14px, 3.5vw, 18px) !important;
  }

  .product-card__badge {
    font-size: clamp(8px, 2vw, 10px) !important;
    padding: 3px 5px !important;
    top: 5px !important;
    left: 5px !important;
  }

  .product-card__rating {
    font-size: clamp(9px, 2.2vw, 11px) !important;
    margin-bottom: 3px !important;
  }

  /* Melhorar container de imagem nos produtos */
  .product-image-container {
    background: #ffffff !important;
    border-radius: 12px 12px 0 0 !important;
    padding: 5px !important;
    min-height: 180px !important;
    height: 180px !important;
  }

  .product-image-container img,
  .product-image-container div {
    padding: 5px !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    min-height: 170px !important;
    height: 170px !important;
  }

  /* Forçar altura nos cards de produto mobile */
  @media screen and (max-width: 768px) {
    article[data-product-id] {
      min-height: 300px !important;
    }

    .product-image-container {
      height: 180px !important;
      min-height: 180px !important;
      max-height: 180px !important;
    }
  }
}

/* Tablets portrait e smartphones landscape (480px-767px) */
@media screen and (max-width: 767px) and (min-width: 480px) {
  .products__grid,
  .grid,
  .products-grid,
  .product-grid,
  .productsGrid,
  [class*="grid"][class*="product"],
  [class*="product"][class*="grid"],
  .container .products__grid,
  .main .products__grid,
  .content .products__grid,
  section .products__grid,
  div[class*="product"] .grid,
  div[class*="grid"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: clamp(10px, 3vw, 15px) !important;
  }

  .product-card {
    aspect-ratio: 0.9 !important;
  }

  .product-card__image {
    aspect-ratio: 1.2 !important;
    min-height: 150px !important;
  }

  .product-card__title {
    font-size: clamp(10px, 2.5vw, 13px) !important;
    -webkit-line-clamp: 2 !important;
  }

  .product-card__content {
    padding: clamp(6px, 1.8vw, 10px) !important;
  }
}

/* Smartphones portrait padrão (414px-479px) */
@media screen and (max-width: 479px) and (min-width: 414px) {
  .products__grid,
  .grid,
  .products-grid,
  .product-grid,
  .productsGrid,
  [class*="grid"][class*="product"],
  [class*="product"][class*="grid"],
  .container .products__grid,
  .main .products__grid,
  .content .products__grid,
  section .products__grid,
  div[class*="product"] .grid,
  div[class*="grid"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: clamp(8px, 2.5vw, 12px) !important;
  }

  .product-card {
    aspect-ratio: 0.85 !important;
  }

  .product-card__image {
    aspect-ratio: 1.15 !important;
    min-height: 140px !important;
  }

  .product-card__title {
    font-size: clamp(9px, 2.3vw, 12px) !important;
    -webkit-line-clamp: 2 !important;
  }

  .product-card__subtitle {
    font-size: clamp(7px, 1.8vw, 9px) !important;
  }

  .product-card__content {
    padding: clamp(5px, 1.5vw, 8px) !important;
  }

  .price-current {
    font-size: clamp(10px, 2.5vw, 13px) !important;
  }
}

/* iPhones padrão (375px-413px) */
@media screen and (max-width: 413px) and (min-width: 375px) {
  .products__grid,
  .grid,
  .products-grid,
  .product-grid,
  .productsGrid,
  [class*="grid"][class*="product"],
  [class*="product"][class*="grid"],
  .container .products__grid,
  .main .products__grid,
  .content .products__grid,
  section .products__grid,
  div[class*="product"] .grid,
  div[class*="grid"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: clamp(8px, 2vw, 12px) !important;
  }

  .product-card {
    aspect-ratio: 0.9 !important;
  }

  .product-card__image {
    aspect-ratio: 1.1 !important;
    min-height: 130px !important;
  }

  .product-card__title {
    font-size: clamp(8px, 2.1vw, 11px) !important;
    -webkit-line-clamp: 2 !important;
  }

  .product-card__subtitle {
    font-size: clamp(6px, 1.6vw, 8px) !important;
  }

  .product-card__content {
    padding: clamp(4px, 1.3vw, 7px) !important;
  }

  .price-current {
    font-size: clamp(9px, 2.3vw, 12px) !important;
  }

  .product-card__badge {
    font-size: clamp(6px, 1.5vw, 8px) !important;
    padding: 2px 3px !important;
  }
}

/* Telas muito pequenas (320px-374px) - iPhone SE, Galaxy Fold */
@media screen and (max-width: 374px) {
  .products__grid,
  .grid,
  .products-grid,
  .product-grid,
  .productsGrid,
  [class*="grid"][class*="product"],
  [class*="product"][class*="grid"],
  .container .products__grid,
  .main .products__grid,
  .content .products__grid,
  section .products__grid,
  div[class*="product"] .grid,
  div[class*="grid"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: clamp(6px, 1.5vw, 10px) !important;
  }

  .product-card {
    aspect-ratio: 0.9 !important;
  }

  .product-card__image {
    aspect-ratio: 1.0 !important;
    min-height: 120px !important;
  }

  .product-card__title {
    font-size: clamp(7px, 1.8vw, 10px) !important;
    -webkit-line-clamp: 1 !important;
  }

  .product-card__subtitle {
    display: none !important;
  }

  .product-card__content {
    padding: clamp(3px, 1vw, 5px) !important;
  }

  .price-current {
    font-size: clamp(8px, 2vw, 11px) !important;
  }

  .product-card__badge {
    font-size: clamp(5px, 1.3vw, 7px) !important;
    padding: 1px 2px !important;
    top: 2px !important;
    left: 2px !important;
  }

  .product-card__rating {
    font-size: clamp(6px, 1.5vw, 8px) !important;
  }
}

