/**
 * SUPERNET - Modern Product Cards CSS
 * Mobile-first responsive design with optimized Nutri-Score integration
 * Accessibility AA compliant with 44x44px touch targets
 */

/* ==== CSS CUSTOM PROPERTIES — hérite de 01-supernet-core.css ==== */
/* Variables locales de fallback uniquement */
:root {
  --supernet-radius: 8px;
  --supernet-spacing-xs: 4px;
  --supernet-spacing-sm: 8px;
  --supernet-spacing-md: 16px;
  --supernet-spacing-lg: 24px;
  --supernet-spacing-xl: 32px;
  --supernet-transition: all 0.2s ease;
}

/* ==== PRODUCT GRID CONTAINER - OPTIMIZED FOR DENSITY ==== */
.supernet-products-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--supernet-spacing-md); /* Réduit de 24px à 16px */
  padding: var(--supernet-spacing-sm); /* Réduit de 16px à 8px */
  margin: 0;
  list-style: none;
}

/* Tablet - 3 columns pour format portrait */
@media (min-width: 768px) {
  .supernet-products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--supernet-spacing-sm);
    padding: var(--supernet-spacing-sm);
  }
}

/* Desktop - 5 columns pour 2 rangées exactes (10 produits) */
@media (min-width: 1024px) {
  .supernet-products-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: var(--supernet-spacing-sm);
  }
}

/* Large Desktop - maintenir 5 colonnes pour consistance */
@media (min-width: 1280px) {
  .supernet-products-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: var(--supernet-spacing-sm);
    max-width: 1200px;
    margin: 0 auto;
  }
}

/* Extra Large Desktop - maintenir 5 colonnes */
@media (min-width: 1400px) {
  .supernet-products-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: var(--supernet-spacing-md);
    max-width: 1400px;
    margin: 0 auto;
  }
}

/* ==== PRODUCT CARD - FORMAT PORTRAIT ==== */
/* Style Carrefour : pas de bordure de carte, séparateur vertical entre colonnes */
.supernet-product-card {
  background: #FFFFFF;
  border-radius: 0;
  border: none;
  border-right: 1px solid #E9ECEF;
  box-shadow: none;
  overflow: hidden;
  transition: background 0.15s ease;
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.supernet-product-card:last-child {
  border-right: none;
}

.supernet-product-card:hover {
  background: #FAFAFA;
  box-shadow: none;
  transform: none;
}

.supernet-product-card:focus-within {
  outline: 2px solid #4CAF50;
  outline-offset: 2px;
}

/* ==== PRODUCT MINIATURE ==== */
.supernet-product-miniature {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  gap: 0;
}

/* ==== THUMBNAIL CONTAINER - FORMAT CARRÉ (style Carrefour) ==== */
.supernet-thumbnail-container {
  position: relative;
  overflow: hidden;
  background: #FFFFFF;
  aspect-ratio: 1/1;
  width: 100%;
  border-radius: 0;
}

.supernet-image-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.supernet-product-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.supernet-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.supernet-product-image {
  width: 85%;
  height: 85%;
  object-fit: contain;
  object-position: center center;
  transition: opacity 0.2s ease;
  margin: auto;
}

/* Hover effect removed as requested */

/* ==== NUTRI-SCORE BADGE ==== */
.supernet-nutriscore-badge {
  position: absolute !important;
  bottom: 10px !important;
  right: 10px !important;
  top: auto !important;
  left: auto !important;
  z-index: 10 !important;
  background: white !important;
  padding: 2px !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.supernet-nutriscore-image {
  width: 90px !important;
  height: auto !important;
  max-width: none !important;
}

@media (min-width: 768px) {
  .supernet-nutriscore-image {
    width: 100px !important;
  }
}

@media (min-width: 1024px) {
  .supernet-nutriscore-image {
    width: 110px !important;
  }
}

/* ==== ACTIONS OVERLAY - SUPPRIMÉ ==== */
/* Quick-view overlay et boutons supprimés - clic sur image ouvre la page produit */

/* ==== PRODUCT FLAGS ==== */
.supernet-product-flags {
  position: absolute;
  top: var(--supernet-spacing-sm);
  left: var(--supernet-spacing-sm);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: var(--supernet-spacing-xs);
}

.product-flag {
  background: #4CAF50;
  color: white;
  padding: var(--supernet-spacing-xs) var(--supernet-spacing-sm);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.product-flag.discount {
  background: #e53e3e;
}

.product-flag.new {
  background: #3182ce;
}

/* ==== PRODUCT INFO SECTION (style Carrefour amélioré) ==== */
.supernet-product-info {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-content: start;
  text-align: left;
  min-height: auto;
  flex: 1;
}

/* Badge marque (style sticker, sous l'image / au-dessus du prix) */
.supernet-brand-badge {
  display: inline-block;
  background: #4CAF50;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-self: flex-start;
}

/* Grammage produit (ex: 500g, 1kg) affiché avec le prix */
.supernet-product-grammage {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

/* Variante fiche produit : taille plus grande */
.supernet-brand-badge-page {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* Ligne prix + bouton Acheter (style Carrefour — prix à gauche, bouton à droite) */
.supernet-price-row {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin-bottom: 4px;
  width: 100% !important;
}

/* Pousse le bouton à droite */
.supernet-price-row .supernet-add-to-cart-form,
.supernet-price-row > form {
  margin-left: auto !important;
  flex-shrink: 0 !important;
}

/* Le bloc prix prend l'espace à gauche */
.supernet-price-row .supernet-price-block {
  flex: 0 0 auto;
}

.supernet-price-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Le "+" dans le bouton Acheter */
.supernet-btn-plus {
  font-weight: 400;
  font-size: 20px;
  line-height: 1;
}

/* ==== PRODUCT TITLE — sous le prix, style Carrefour ==== */
.supernet-product-title {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: #333333;
  max-height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  align-self: stretch;
}

.supernet-product-title a {
  text-decoration: none;
  color: inherit;
  transition: var(--supernet-transition);
}

.supernet-product-title a:hover {
  color: #4CAF50;
}

.supernet-product-title a:focus {
  outline: 2px solid #4CAF50;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ==== PRICE SECTION ==== */
.supernet-price-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.supernet-discount-info {
  display: flex;
  align-items: center;
  gap: var(--supernet-spacing-xs); /* Réduit de 8px à 4px */
  margin-bottom: 2px; /* Réduit de 4px à 2px */
}

.supernet-regular-price {
  font-size: 14px;
  color: var(--supernet-text-secondary, #666666);
  text-decoration: line-through;
}

.supernet-discount-badge {
  background: #e53e3e;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.supernet-current-price {
  display: flex;
  align-items: baseline;
  gap: var(--supernet-spacing-xs); /* Réduit de 8px à 4px */
}

.supernet-price {
  font-size: 22px;
  font-weight: 700;
  color: #1A1A1A;
  letter-spacing: -0.5px;
}

/* ==== REVIEWS SECTION - DÉSACTIVÉ ==== */
/* .supernet-reviews-section supprimée - feature non utilisée */

/* ==== ADD TO CART SECTION ==== */
.supernet-cart-section {
  width: 100%;
  padding: 0;
  /* Grid item qui s'aligne automatiquement en bas grâce à grid-template-rows */
  align-self: end;
  justify-self: stretch;
}

.supernet-cart-section .supernet-add-to-cart-form {
  margin: 0;
  width: 100%;
}

/* Bouton Acheter — style Carrefour (bleu, "+ Acheter") */
.supernet-cart-section .supernet-add-to-cart-form .supernet-add-to-cart-btn,
.supernet-add-to-cart-btn {
  width: auto !important;
  background: #4CAF50 !important;
  color: #FFFFFF !important;
  border: 2px solid #4CAF50 !important;
  border-radius: 6px !important;
  padding: 8px 18px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 38px;
  margin: 0 !important;
  box-sizing: border-box;
  white-space: nowrap;
}

.supernet-add-to-cart-btn:hover {
  background: #388E3C !important;
}

.supernet-add-to-cart-btn:focus {
  outline: 2px solid #4CAF50;
  outline-offset: 2px;
}

.supernet-add-to-cart-btn:active {
  transform: translateY(0);
}

.supernet-btn-text {
  font-size: 14px;
  font-weight: 600;
}

/* Hover sur la carte — léger fond gris */
.supernet-product-card:hover .supernet-product-info {
  background: #FAFBFC;
}

@media (min-width: 768px) {
  .supernet-add-to-cart-btn {
    padding: 10px 16px;
    font-size: var(--supernet-font-size-sm, 14px);
    min-height: 44px;
  }
}

/* ==== MINIATURE QUANTITY CONTROLS ==== */
.supernet-miniature-qty-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.supernet-miniature-qty-controls {
  display: flex;
  align-items: center;
  background: #f5f5f5;
  border-radius: 4px;
  overflow: hidden;
  flex: 1;
}

.supernet-miniature-qty-btn {
  background: #4CAF50;
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
  padding: 0;
  line-height: 1;
}

.supernet-miniature-qty-btn:hover {
  background: var(--supernet-primary-dark);
}

.supernet-miniature-qty-btn:active {
  transform: scale(0.95);
}

.supernet-miniature-qty-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.supernet-miniature-qty-input {
  width: 32px;
  height: 28px;
  border: none;
  background: #f5f5f5;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  -moz-appearance: textfield;
}

.supernet-miniature-qty-input::-webkit-outer-spin-button,
.supernet-miniature-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.supernet-miniature-qty-row .supernet-add-to-cart-btn {
  width: 36px !important;
  min-width: 36px !important;
  height: 28px !important;
  min-height: 28px !important;
  border-radius: 4px !important;
  padding: 0 !important;
  flex-shrink: 0;
}

.supernet-miniature-qty-row .supernet-add-to-cart-btn .material-icons {
  font-size: 18px;
}

@media (min-width: 768px) {
  .supernet-miniature-qty-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  .supernet-miniature-qty-input {
    width: 28px;
    height: 24px;
    font-size: 12px;
  }

  .supernet-miniature-qty-row .supernet-add-to-cart-btn {
    width: 32px !important;
    min-width: 32px !important;
    height: 24px !important;
    min-height: 24px !important;
  }

  .supernet-miniature-qty-row .supernet-add-to-cart-btn .material-icons {
    font-size: 16px;
  }
}

/* ==== VARIANTS ==== */
.supernet-variants {
  margin-top: var(--supernet-spacing-sm);
}

/* ==== ACCESSIBILITY IMPROVEMENTS ==== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==== HIGH CONTRAST MODE ==== */
@media (prefers-contrast: high) {
  .supernet-product-card {
    border: 2px solid var(--supernet-text-main, #1A1A1A);
  }
  
  .supernet-nutriscore-badge {
    border: 2px solid var(--supernet-text-main, #1A1A1A);
  }
}

/* ==== FOCUS IMPROVEMENTS ==== */
.supernet-product-card:focus-within .supernet-product-image {
  transform: scale(1.02);
}

/* ==== LOADING STATE ==== */
.supernet-product-card[data-loading="true"] {
  opacity: 0.7;
  pointer-events: none;
}

.supernet-product-card[data-loading="true"]::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==== EMPTY STATE ==== */
.supernet-no-products {
  text-align: center;
  padding: var(--supernet-spacing-xl);
  color: var(--supernet-text-secondary, #666666);
  grid-column: 1 / -1;
}

.supernet-no-products h3 {
  font-size: 24px;
  margin-bottom: var(--supernet-spacing-md);
  color: #1a202c;
}

/* =============================================================================
   OVERRIDES — Renforcement spécificité vs parent theme (191KB)
   ========================================================================== */

/* Force left alignment on all product info (parent forces center) */
#js-product-list .supernet-product-info,
#products .supernet-product-info,
.products .supernet-product-info,
section#main .supernet-product-info {
  text-align: left !important;
  align-items: flex-start !important;
}

/* Force price section left alignment */
#js-product-list .supernet-price-section,
#products .supernet-price-section,
.products .supernet-price-section {
  align-items: flex-start !important;
  text-align: left !important;
}

/* Force price to be dark and large (Carrefour 24px) */
#js-product-list .supernet-price,
#products .supernet-price,
.products .supernet-price {
  color: #1A1A1A !important;
  font-size: 24px !important;
  font-weight: 700 !important;
}

/* Price unit (per kg) styling */
#js-product-list .supernet-price-unit,
#products .supernet-price-unit,
.products .supernet-price-unit {
  color: var(--supernet-text-secondary, #666666) !important;
  font-size: var(--supernet-font-size-xs, 12px) !important;
  text-align: left !important;
}

/* Force product title left alignment */
#js-product-list .supernet-product-title,
#products .supernet-product-title,
.products .supernet-product-title {
  text-align: left !important;
}

#js-product-list .supernet-product-title a,
#products .supernet-product-title a {
  color: var(--supernet-text-main, #1A1A1A) !important;
  text-decoration: none !important;
}

#js-product-list .supernet-product-title a:hover {
  color: #4CAF50 !important;
}

/* Add to cart button - Carrefour style (bleu, compact, pas pleine largeur) */
#js-product-list .supernet-add-to-cart-btn,
#products .supernet-add-to-cart-btn,
.products .supernet-add-to-cart-btn {
  width: auto !important;
  background: #4CAF50 !important;
  color: #FFFFFF !important;
  border: none !important;
  border-radius: 4px !important;
  padding: 8px 20px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  min-height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  cursor: pointer !important;
  transition: background 0.15s ease !important;
}

#js-product-list .supernet-add-to-cart-btn:hover {
  background: #388E3C !important;
}

/* Card info section padding */
#js-product-list .supernet-product-info,
#products .supernet-product-info {
  padding: 12px !important;
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

/* Card border between image and content */
#js-product-list .supernet-thumbnail-container,
#products .supernet-thumbnail-container {
  border-bottom: 1px solid var(--supernet-border, #E5E7EB) !important;
}

/* Override parent theme product-miniature styles */
.product-miniature,
article.product-miniature,
.js-product-miniature {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure card — Carrefour style (no card border, vertical + horizontal separators) */
#js-product-list .supernet-product-card,
#products .supernet-product-card {
  background: #FFFFFF !important;
  border: none !important;
  border-right: 1px solid #E9ECEF !important;
  border-bottom: 1px solid #E9ECEF !important;
  padding-bottom: 16px !important;
  margin-bottom: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: hidden !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

#js-product-list .supernet-product-card:last-child,
#products .supernet-product-card:last-child {
  border-right: none !important;
}

/* ==== PRINT STYLES ==== */
@media print {
  .supernet-add-to-cart-btn {
    display: none !important;
  }
  
  .supernet-product-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
/* =================================================
   Prix au kg/L
   ================================================= */
/* Prix au kg — style Carrefour (ex: "15.96 € / KG") */
.supernet-price-unit,
.prix-kg {
  font-size: 12px;
  color: #888;
  font-weight: 400;
  display: block;
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

/* Sur la fiche produit */
.product-prices .prix-kg {
  font-size: 0.8em;
  color: var(--supernet-text-secondary, #666666);
  vertical-align: middle;
}

