/* ------------------------------------------------------------------
 * Masquage des éléments natifs (sélecteur "Valeur",
 * Quantité + Ajouter au panier) quand le tableau de déclinaisons est
 * rendu. Le sélecteur :has() cible uniquement les pages produit où
 * notre tableau a effectivement été injecté ; sur les autres produits
 * (sans déclinaisons / hors hook), les blocs natifs restent visibles.
 * ------------------------------------------------------------------ */
.product-actions:has(.advisto-qty-table) .product-variants,
.product-actions:has(.advisto-qty-table) .product-add-to-cart {
  display: none;
}

.advisto-qty-table {
  margin: 30px 0 34px;
}

.advisto-qty-table__table {
  width: 100%;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 13px;
  color: #121212;
  margin-bottom: 1.5rem;
}

.advisto-qty-table__table tbody tr {
  background: #f6f6f6;
}

.advisto-qty-table__table tbody tr:nth-of-type(2n) {
  background: #fff;
}

.advisto-qty-table__table td {
  padding: .625rem 0.25rem;
  text-align: center;
  border: .3125rem solid #f1f1f1;
  vertical-align: middle;
  font-size: 0.80rem;
}

.advisto-qty-table__combination {
  width: 30%;
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
}

.advisto-qty-table__price {
  width: 18%;
  white-space: nowrap;
}

.advisto-qty-table__quantity {
  width: 18%;
}

.advisto-qty-table__action {
  width: 35%;
}

.advisto-qty-table__input {
  width: 50px;
  min-width: 50px;
  border: 1px solid #bcbcbc;
  background: #fff;
  padding: 7px 5px;
}

.advisto-qty-table__button {
  width: 100%;
  font-size: 0.65rem;
  padding: 10px 8px;
  white-space: nowrap;
}

/* Desktop : flèches natives suffisantes, on masque les boutons +/- */
.advisto-qty-table__spinner-btn {
  display: none;
}

@media (max-width: 767px) {
  .advisto-qty-table {
    margin: 26px 0 34px;
  }

  .advisto-qty-table__table {
    font-size: 12px;
  }

  /* Mobile : 3 colonnes ; quantité et bouton empilés dans la 3e colonne */
  .advisto-qty-table__table,
  .advisto-qty-table__table tbody {
    display: block;
  }

  .advisto-qty-table__table tr {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) auto 1fr;
    grid-template-areas:
      "name price qty"
      "name price btn";
    border: .3125rem solid #f1f1f1;
    margin-bottom: 4px;
  }

  .advisto-qty-table__table td {
    display: block;
    width: auto;
    padding: 8px 6px;
    border: none;
    text-align: center;
  }

  .advisto-qty-table__table td.advisto-qty-table__combination {
    grid-area: name;
    font-size: 11px;
    border-right: .3125rem solid #f1f1f1;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .advisto-qty-table__table td.advisto-qty-table__price {
    grid-area: price;
    border-right: .3125rem solid #f1f1f1;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }

  .advisto-qty-table__table td.advisto-qty-table__quantity {
    grid-area: qty;
    border-bottom: .3125rem solid #f1f1f1;
  }

  .advisto-qty-table__table td.advisto-qty-table__action {
    grid-area: btn;
  }

  .advisto-qty-table__input {
    width: 46px;
    min-width: 46px;
    padding: 6px 3px;
  }

  /* Mobile : input à gauche, chevrons haut/bas empilés à droite */
  .advisto-qty-table__spinner {
    display: inline-grid;
    grid-template-columns: auto 18px;
    grid-template-rows: 1fr 1fr;
    border: 1px solid #bcbcbc;
    background: #fff;
    border-radius: 2px;
    overflow: hidden;
  }

  .advisto-qty-table__spinner .advisto-qty-table__input {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 36px;
    min-width: 36px;
    border: none;
    padding: 6px 2px;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
  }

  .advisto-qty-table__spinner .advisto-qty-table__input::-webkit-outer-spin-button,
  .advisto-qty-table__spinner .advisto-qty-table__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  .advisto-qty-table__spinner-btn {
    display: block;
    grid-column: 2;
    border: none;
    border-left: 1px solid #d8d8d8;
    background: #f1f1f1;
    color: #555;
    font-size: 8px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    user-select: none;
  }

  .advisto-qty-table__spinner-btn--up {
    grid-row: 1;
    border-bottom: 1px solid #d8d8d8;
  }

  .advisto-qty-table__spinner-btn--down {
    grid-row: 2;
  }

  .advisto-qty-table__spinner-btn:hover:not([disabled]) {
    background: #e4e4e4;
  }

  .advisto-qty-table__spinner-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.5;
  }

  .advisto-qty-table__button {
    white-space: normal;
    text-transform: none;
    line-height: 1.2;
    font-size: 10px;
    padding: 9px 4px;
  }

  .advisto-qty-table__spinner-btn {
  display: block;
}
}
