/*
 * Sticky Add To Cart
 * Style inspiré du design MyToolSwiss.
 */

.mts-sticky-cart {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #f5f5f5;
  border-top: 1px solid rgba(222, 108, 39, 0.15);
  z-index: 2;
  font-family: inherit;

  /* Caché par défaut : ne s'affiche que quand le CTA principal n'est plus visible */
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.25s ease-out,
    opacity 0.25s ease-out;
}

.mts-sticky-cart.mts-sticky-cart--visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.mts-sticky-cart__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 7px 30px;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ---------- Bloc info (image + texte) ---------- */
.mts-sticky-cart__info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
}

.mts-sticky-cart__img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  flex-shrink: 0;
  background: #f6f6f6;
  border-radius: 8px;
  padding: 4px;
}

.mts-sticky-cart__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}

.mts-sticky-cart__name {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mts-sticky-cart__pricing {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  line-height: 1.2;
}

.mts-sticky-cart__price {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

.mts-sticky-cart__regular {
  font-size: 13px;
  color: #9a9a9a;
  text-decoration: line-through;
  font-weight: 400;
  margin-left: 24px;
}

.mts-sticky-cart__price_information {
  font-size: 10px;
  color: #9a9a9a;
  margin-left: 10px;
}

.mts-sticky-cart__badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  background: #2c2c2c;
  padding: 4px 8px;
  line-height: 1.2;
  white-space: nowrap;
  margin-left: 8px;
}

/* ---------- Bloc actions (quantité + bouton) ---------- */
.mts-sticky-cart__actions {
  display: flex;
  align-items: center;
  gap: 40px;
  flex-shrink: 0;
}

.mts-sticky-cart__qty {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}

.mts-sticky-cart__qty-input {
  color: #414141;
  background-color: white;
  height: 2.75rem;
  padding: 0.175rem 0.5rem;
  width: 3rem;
  text-align: center;
  border: 1px solid #d9d9d9;
  border-right: none;
  font-size: 1rem;
  font-weight: 400;
  font-family: inherit;
  -moz-appearance: textfield;
  box-sizing: border-box;
}

.mts-sticky-cart__qty-input:focus {
  outline: none;
  border-color: #f47318;
  box-shadow: 0 0 0 2px rgba(244, 115, 24, 0.15);
}

.mts-sticky-cart__qty-input::-webkit-outer-spin-button,
.mts-sticky-cart__qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mts-sticky-cart__qty-buttons {
  display: flex;
  flex-direction: column;
  width: 22px;
  flex-shrink: 0;
}

.mts-sticky-cart__qty-buttons button {
  flex: 1;
  background-color: white;
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  color: #555;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    color 0.15s;
}

.mts-sticky-cart__qty-buttons button:hover {
  background: #f5f5f5;
  color: #000;
}

.mts-sticky-cart__qty-buttons button:active {
  background: #e3e3e3;
}

.mts-sticky-cart__qty-buttons .material-icons {
  font-size: 16px;
  line-height: 1;
}

/* ---------- Bouton "Ajouter au panier" ---------- */

.mts-sticky-cart__add-label {
  display: inline-block;
}

/* ---------- Espace réservé en bas de page ---------- */
body.mts-sticky-cart-active {
  padding-bottom: 86px;
}

/* ---------- Mobile (≤ 768px) ---------- */
@media (max-width: 768px) {
  .mts-sticky-cart__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 7px 16px;
  }

  .mts-sticky-cart__info {
    width: 100%;
    gap: 10px;
  }

  .mts-sticky-cart__text {
    flex: 1 1 auto;
    min-width: 0; /* nécessaire pour que le nom puisse tronquer + flex-shrink */
  }

  .mts-sticky-cart__actions {
    width: 100%;
    gap: 10px; /* override le gap: 40px desktop */
  }

  .mts-sticky-cart__add {
    flex: 1 1 auto;
    padding: 0 16px;
    min-width: 0; /* override le min-width: 217px desktop */
  }

  .mts-sticky-cart__img {
    width: 56px;
    height: 56px;
  }

  /* Tailles font mobile alignées sur la maquette */
  .mts-sticky-cart__name {
    font-size: 13px;
    line-height: 18px;
  }

  .mts-sticky-cart__price {
    font-size: 14px;
  }

  .mts-sticky-cart__regular {
    font-size: 12px;
    margin-left: 10px; /* resserré pour gérer les milliers */
  }

  .mts-sticky-cart__badge {
    font-size: 11px;
    padding: 3px 6px;
    margin-left: 0px;
  }

  body.mts-sticky-cart-active {
    padding-bottom: 150px;
  }
}

/* ---------- Très petits écrans : marges resserrées pour gérer les milliers ---------- */
@media (max-width: 380px) {
  .mts-sticky-cart__img {
    width: 48px;
    height: 48px;
  }
  .mts-sticky-cart__regular {
    margin-left: 8px;
  }
  .mts-sticky-cart__badge {
    margin-left: 4px;
    padding: 3px 5px;
  }
}
