/* ============================================================
   ps_combinationstable — Tableau de déclinaisons
   Compatible : PS 1.7.7.x / 8 / 9 — thème agnostique
   ============================================================ */

.pscombotable-wrapper {
  margin: 2rem 0;
  font-size: 0.9rem;
}

/* ── Titre ────────────────────────────────────────────────── */
.pscombotable-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* ── Scroll horizontal sur mobile ────────────────────────── */
.pscombotable-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Table ────────────────────────────────────────────────── */
.pscombotable {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

/* ── En-têtes ─────────────────────────────────────────────── */
.pscombotable-th {
  background: #f5f5f5;
  border-bottom: 2px solid #ddd;
  padding: 0.6rem 0.6rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  color: #333;
}

/* ── Cellules ─────────────────────────────────────────────── */
.pscombotable-td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
  white-space: nowrap;
}

.pscombotable-row:hover .pscombotable-td {
  background: #fafafa;
}

/* ── Ligne cliquable (aperçu déclinaison : image + prix) ────── */
.pscombotable-row {
  cursor: pointer;
}
/* La cellule quantité garde un curseur normal (contrôles dédiés) */
.pscombotable-row .pscombotable-td--qty {
  cursor: default;
}

/* Ligne correspondant à la déclinaison actuellement sélectionnée */
.pscombotable-row--active .pscombotable-td {
  background: #f0f3ea; /* teinte douce dérivée de la charte Botanika #3F4727 */
}
.pscombotable-row--active:hover .pscombotable-td {
  background: #eaeee0;
}

/* ── Ligne épuisée ────────────────────────────────────────── */
.pscombotable-row--out .pscombotable-td {
  opacity: 0.45;
}

/* ── Référence ────────────────────────────────────────────── */
.pscombotable-ref {
  font-family: monospace;
  color: #666;
  font-size: 0.82rem;
}

/* ── Prix ─────────────────────────────────────────────────── */
.pscombotable-price,
.pscombotable-subtotal {
  font-weight: 500;
  white-space: nowrap;
}

/* ── Stock ────────────────────────────────────────────────── */
.pscombotable-stock--in {
  color: #2e7d32;
  font-weight: 600;
}

.pscombotable-stock--out {
  color: #c62828;
  font-size: 0.8rem;
}

/* ── Input quantité ───────────────────────────────────────── */
/* ── Stepper quantité (− valeur +) ────────────────────────── */
.pscombotable-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pscombotable-stepper:focus-within {
  border-color: #0078d7;
  box-shadow: 0 0 0 2px rgba(0, 120, 215, 0.15);
}

.pscombotable-stepper.is-invalid {
  border-color: #c62828;
}

.pscombotable-step {
  border: 0;
  background: #f4f4f4;
  color: #333;
  width: 30px;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background-color 0.15s;
}

.pscombotable-step:hover {
  background: #e6e6e6;
}

.pscombotable-step:active {
  background: #dcdcdc;
}

.pscombotable-step--minus { border-right: 1px solid #e0e0e0; }
.pscombotable-step--plus  { border-left:  1px solid #e0e0e0; }

.pscombotable-qty-input {
  width: 48px;
  padding: 0.3rem 0.2rem;
  border: 0;
  border-radius: 0;
  text-align: center;
  font-size: 0.9rem;
  background: transparent;
}

.pscombotable-qty-input:focus {
  outline: none;
}

.pscombotable-qty-input.is-invalid {
  color: #c62828;
}

/* Masque les flèches natives du navigateur (Chrome/Safari/Firefox) */
.pscombotable-qty-input::-webkit-outer-spin-button,
.pscombotable-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pscombotable-qty-input {
  -moz-appearance: textfield;
  appearance: textfield;
}

.pscombotable-qty-na {
  color: #bbb;
}

/* ── Pied de tableau ──────────────────────────────────────── */
.pscombotable-tfoot {
  padding: 0.6rem 0.8rem;
  text-align: right;
  background: #f9f9f9;
  border-top: 2px solid #ddd;
}

#pscombotable-total {
  color: #0078d7;
}

/* ── Zone actions ─────────────────────────────────────────── */
.pscombotable-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ── Bouton ajout panier ──────────────────────────────────── */
.pscombotable-btn-add {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  background: #0078d7;
  color: #fff;
}

.pscombotable-btn-add:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pscombotable-btn-add:not(:disabled):hover {
  background: #005fa3;
}

/* ── Feedback ─────────────────────────────────────────────── */
.pscombotable-feedback {
  font-size: 0.88rem;
  font-weight: 500;
}

.pscombotable-feedback.success {
  color: #2e7d32;
}

.pscombotable-feedback.error {
  color: #c62828;
}

.pscombotable-feedback.loading {
  color: #666;
}

/* ── Masquage des éléments natifs PS ──────────────────────────
   La classe de mode est posée par le JS sur un conteneur de portée :
   <body> sur la fiche produit, ou la modale en contexte Quick View
   (pour ne pas masquer les boutons des vignettes d'une page liste).
   On cible à la fois les classes Classic ET les classes BEM des
   thèmes personnalisés (product__variants), ainsi que Creative Elements. */
.pscombotable-replace .product-variants,
.pscombotable-replace #product-variants,
.pscombotable-replace .product-variants-item,
.pscombotable-replace .product__variants,
.pscombotable-replace .js-product-variants,
.pscombotable-replace .product-variant {
  display: none !important;
}

/* Réglage indépendant « Masquer le sélecteur de déclinaisons natif » :
   masque les déclinaisons du thème (Classic/BEM) ET de Creative Elements
   (icônes de contenance), quel que soit le mode d'affichage choisi. */
.pscombotable-hidevariants .product-variants,
.pscombotable-hidevariants #product-variants,
.pscombotable-hidevariants .product-variants-item,
.pscombotable-hidevariants .product__variants,
.pscombotable-hidevariants .js-product-variants,
.pscombotable-hidevariants .product-variant,
.pscombotable-hidevariants .ce-product-variants,
.pscombotable-hidevariants .elementor-widget-product-variants {
  display: none !important;
}

/* Quantité + bouton d'ajout natifs : masqués en mode `replace` ET en mode
   `keepvariants` (ce dernier conserve uniquement les déclinaisons natives).
   On cible les thèmes PrestaShop (Classic/BEM) ET Creative Elements.
   Les icônes de déclinaison CE (.ce-product-variants) sont volontairement
   conservées dans les deux modes. */
.pscombotable-replace .product-actions .product-quantity,
.pscombotable-replace .product-add-to-cart .product-quantity,
.pscombotable-replace .product-add-to-cart .add-to-cart,
.pscombotable-replace .elementor-widget-product-quantity,
.pscombotable-replace .elementor-widget-product-add-to-cart,
.pscombotable-replace .ce-product-quantity,
.pscombotable-replace a[href="#ce-action=addToCart"],
.pscombotable-hidecart .product-actions .product-quantity,
.pscombotable-hidecart .product-add-to-cart .product-quantity,
.pscombotable-hidecart .product-add-to-cart .add-to-cart,
.pscombotable-hidecart .elementor-widget-product-quantity,
.pscombotable-hidecart .elementor-widget-product-add-to-cart,
.pscombotable-hidecart .ce-product-quantity,
.pscombotable-hidecart a[href="#ce-action=addToCart"] {
  display: none !important;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 576px) {
  .pscombotable-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .pscombotable-btn-add {
    justify-content: center;
    width: 100%;
  }
}
