/* ═══════════════════════════════════════════
 * DEFINITIVE MOBILE FIX — Override Shoptimizer
 * ═══════════════════════════════════════════ */

/* MOBILE: Force 2 columns */
@media (max-width: 992px) {
  body .col-full-nav ul.products,
  body .site-main ul.products,
  body ul.products.columns-4,
  body ul.products.columns-3,
  body ul.products.columns-2,
  body ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 10px !important;
    float: none !important;
  }

  body .col-full-nav ul.products li.product,
  body .site-main ul.products li.product,
  body ul.products li.product {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
  }

  body ul.products li.product a img,
  body ul.products li.product .woocommerce-image__wrapper img {
    width: 100% !important;
    height: auto !important;
    border-radius: 8px !important;
  }

  body ul.products li.product .woocommerce-loop-product__title,
  body ul.products li.product h2,
  body ul.products li.product .woocommerce-card__header .woocommerce-loop-product__title a {
    font-size: 12px !important;
    line-height: 1.3 !important;
    margin-bottom: 2px !important;
  }

  body ul.products li.product .price {
    font-size: 13px !important;
    margin-bottom: 6px !important;
  }

  body ul.products li.product .button {
    font-size: 10px !important;
    padding: 8px 12px !important;
    display: block !important;
    width: 100% !important;
    text-align: center !important;
  }

  /* Homepage grids */
  body .entry-content div[style*="grid-template-columns"] {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
}

/* DESKTOP: 4 columns */
@media (min-width: 993px) {
  body .col-full-nav ul.products,
  body ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
  }
  body .col-full-nav ul.products li.product,
  body ul.products li.product {
    float: none !important;
    width: 100% !important;
  }
}

/* Fix encoding display */
body {
  unicode-bidi: normal;
}

/* Fix Collections grid on homepage — force 2x2 */
@media (max-width: 992px) {
  body .entry-content div[style*="grid-template-columns:repeat(2"] {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  
  /* Fix first product being bigger */
  body ul.products li.product:first-child {
    grid-column: auto !important;
    grid-row: auto !important;
  }
  body ul.products li.product:first-child a img {
    width: 100% !important;
    max-height: none !important;
  }
  
  /* All product images same size */
  body ul.products li.product .woocommerce-image__wrapper {
    aspect-ratio: 3/4 !important;
    overflow: hidden !important;
  }
  body ul.products li.product .woocommerce-image__wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: top center !important;
  }
  
  /* Related products also 2 columns */
  body .related.products ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  
  /* Reduce spacing between sections */
  body .entry-content > div,
  body .entry-content > section {
    margin-bottom: 0 !important;
  }
}

/* Hide premium product message */
.woocommerce-info a[href*="retours"],
.woocommerce div.product .woocommerce-info {
  display: none !important;
}

/* Force ALL products same size — no featured first product */
@media (max-width: 992px) {
  body ul.products li.product:first-child {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }
  body .site-main ul.products li.product:first-child {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }
  /* Shoptimizer featured product override */
  body .shoptimizer-full-width-content ul.products li.product:first-child,
  body .content-area ul.products li.product:first-child {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }
  body ul.products li.product:first-child .woocommerce-image__wrapper,
  body ul.products li.product .woocommerce-image__wrapper {
    aspect-ratio: 3/4 !important;
    overflow: hidden !important;
    border-radius: 8px !important;
  }
  body ul.products li.product:first-child .woocommerce-image__wrapper img,
  body ul.products li.product .woocommerce-image__wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: top center !important;
  }
  /* Shoptimizer card header — compact */
  body ul.products li.product .woocommerce-card__header {
    padding: 4px 0 !important;
  }
}

/* Hide "Choix des options" button on mobile product grid — like Zara/Sézane */
@media (max-width: 992px) {
  body ul.products li.product .button,
  body ul.products li.product .add_to_cart_button,
  body ul.products li.product a.added_to_cart,
  body ul.products li.product .product_type_variable {
    display: none !important;
  }
}
