/**
 * PMerca - Front styles
 * @author Nymtec S.A.S
 */

/* Oculta el CTA de orderonwhatsapp en el carrito (duplicado) */
body#cart .whatsapp-order-button,
body#cart button[data-target="#OrderOnWhatsAppModal"],
.cart-grid .whatsapp-order-button,
.cart-grid button[data-target="#OrderOnWhatsAppModal"] {
  display: none !important;
}

.pmerca-whatsapp-wrap {
  padding: 0 1.25rem 1rem;
}

.pmerca-whatsapp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  font-weight: 600;
  text-decoration: none !important;
}

.pmerca-whatsapp-btn:hover,
.pmerca-whatsapp-btn:focus {
  text-decoration: none !important;
}

.pmerca-whatsapp-btn img {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* El tema (ZOne) pone precio y botones en una fila en .third-block */
.product-list .grid .product-miniature .third-block,
.product-miniature .third-block {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
}

.product-list .grid .product-miniature .third-block .pmerca-qty-bar,
.product-miniature .third-block .pmerca-qty-bar,
.product-miniature .buttons-sections.pmerca-qty-row,
.js-product-miniature .buttons-sections.pmerca-qty-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 0.3rem;
  width: 100% !important;
}

.product-list .grid .product-miniature .third-block .product-price-and-shipping,
.product-list .grid .product-miniature .third-block .product-price,
.product-miniature .third-block .pmerca-mini-price {
  display: block !important;
  width: 100% !important;
  margin: 0 0 0.35rem !important;
  text-align: center;
}

.js-product-miniature.pmerca-mini .pmerca-mini-actions {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  width: 100% !important;
}

.js-product-miniature.pmerca-mini .pmerca-mini-price,
.js-product-miniature.pmerca-mini .product-price-and-shipping,
.js-product-miniature.pmerca-mini .product-price-info {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 auto !important;
  margin: 0 0 0.35rem !important;
  text-align: center;
}

.js-product-miniature.pmerca-mini .pmerca-qty-bar {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 0.3rem;
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 auto !important;
  box-sizing: border-box;
}

.pmerca-qty {
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto !important;
  width: auto !important;
  border: 1px solid #ced4da;
  border-radius: 4px;
  overflow: visible;
  height: 32px !important;
  background: #fff;
  margin: 0 rem !important;
  z-index: 2;
}

.pmerca-qty-btn,
.pmerca-qty .btn-touchspin,
.pmerca-qty .bootstrap-touchspin-up,
.pmerca-qty .bootstrap-touchspin-down {
  -webkit-appearance: none !important;
  appearance: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  height: 32px !important;
  border: 0 !important;
  background: #f1f3f5 !important;
  color: #333 !important;
  opacity: 1 !important;
  visibility: visible !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  cursor: pointer;
  padding: 0 !important;
  z-index: 3;
  pointer-events: auto !important;
}

.pmerca-qty-btn:hover,
.pmerca-qty-btn:focus,
.pmerca-qty .btn-touchspin:hover,
.pmerca-qty .btn-touchspin:focus {
  background: #e9ecef !important;
  color: #333 !important;
  outline: none;
}

.pmerca-qty .btn-touchspin .material-icons,
.pmerca-qty .btn-touchspin i {
  display: none !important;
}

.pmerca-qty .bootstrap-touchspin-down::after {
  content: "-" !important;
  font-family: Arial, sans-serif !important;
  font-size: 1.2rem !important;
  color: #333 !important;
  line-height: 1 !important;
}

.pmerca-qty .bootstrap-touchspin-up::after {
  content: "+" !important;
  font-family: Arial, sans-serif !important;
  font-size: 1.2rem !important;
  color: #333 !important;
  line-height: 1 !important;
}

.pmerca-qty-input {
  width: 26px !important;
  min-width: 26px !important;
  max-width: 26px !important;
  border: 0 !important;
  border-left: 1px solid #ced4da !important;
  border-right: 1px solid #ced4da !important;
  border-radius: 0 !important;
  text-align: center;
  height: 100% !important;
  padding: 0 !important;
  font-size: 0.75rem !important;
  box-shadow: none !important;
  -moz-appearance: textfield;
}

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

.js-product-miniature.pmerca-mini .pmerca-qty-bar .pmerca-add-btn,
.js-product-miniature.pmerca-mini .pmerca-qty-bar .js-ajax-add-to-cart,
.js-product-miniature.pmerca-mini .pmerca-qty-bar .btn.add-to-cart,
.js-product-miniature a.js-ajax-add-to-cart,
.js-product-miniature button.js-ajax-add-to-cart:not(.btn-touchspin):not(.pmerca-qty-btn),
.js-product-miniature a.add-to-cart,
.js-product-miniature button.add-to-cart:not(.btn-touchspin):not(.pmerca-qty-btn),
.js-product-miniature [data-button-action="add-to-cart"] {
  flex: 0 0 auto !important;
  min-width: 88px !important;
  max-width: 100% !important;
  padding: 0 0.9rem !important;
  line-height: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  white-space: nowrap !important;
  overflow: visible !important;
  font-size: 12px !important;
  box-sizing: border-box !important;
}

.js-product-miniature a.js-ajax-add-to-cart > i,
.js-product-miniature a.js-ajax-add-to-cart > .fa,
.js-product-miniature a.js-ajax-add-to-cart > svg,
.js-product-miniature button.js-ajax-add-to-cart:not(.btn-touchspin):not(.pmerca-qty-btn) > i,
.js-product-miniature button.js-ajax-add-to-cart:not(.btn-touchspin):not(.pmerca-qty-btn) > .fa,
.js-product-miniature button.add-to-cart:not(.btn-touchspin):not(.pmerca-qty-btn) > i,
.js-product-miniature button.add-to-cart:not(.btn-touchspin):not(.pmerca-qty-btn) > .fa,
.js-product-miniature button.add-to-cart:not(.btn-touchspin):not(.pmerca-qty-btn) > svg {
  display: none !important;
}

.js-product-miniature a.js-ajax-add-to-cart::after,
.js-product-miniature button.js-ajax-add-to-cart:not(.btn-touchspin):not(.pmerca-qty-btn)::after,
.js-product-miniature a.add-to-cart::after,
.js-product-miniature button.add-to-cart:not(.btn-touchspin):not(.pmerca-qty-btn)::after,
.js-product-miniature [data-button-action="add-to-cart"]::after {
  content: none !important;
  display: none !important;
}

.js-product-miniature .pmerca-add-btn.pmerca-added,
.js-product-miniature a.js-ajax-add-to-cart.pmerca-added,
.js-product-miniature button.add-to-cart.pmerca-added,
.js-product-miniature button.js-ajax-add-to-cart.pmerca-added,
body .product-list .grid .product-miniature .buttons-sections .btn.pmerca-added,
body .js-product-miniature .buttons-sections .pmerca-added {
  background: #2e7d32 !important;
  background-image: none !important;
  border: 1px solid #2e7d32 !important;
  color: #fff !important;
  min-width: 96px !important;
  width: auto !important;
  min-height: 32px !important;
  height: 32px !important;
  padding: 0 1rem !important;
  font-size: 12px !important;
  line-height: 32px !important;
  opacity: 1 !important;
  box-shadow: none !important;
  overflow: visible !important;
  flex: 0 0 auto !important;
}

.pmerca-qty .input-group .input-group-btn>.btn {
  padding: 0.15rem 0.4rem !important;
}

/* Móvil: Añadir debajo del +/- dentro de .buttons-sections */
@media (max-width: 991px) {
  body .product-list .grid .product-miniature .third-block,
  body .product-miniature .third-block,
  body .js-product-miniature .third-block,
  body .js-product-miniature.pmerca-is-mobile .third-block {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    min-height: 0 !important;
    gap: 0.2rem !important;
  }

  body .product-miniature .buttons-sections,
  body .product-miniature .buttons-sections.pmerca-qty-row,
  body .js-product-miniature .buttons-sections,
  body .js-product-miniature .buttons-sections.pmerca-qty-row,
  body .product-list .grid .product-miniature .third-block .pmerca-qty-bar,
  body .product-miniature .third-block .pmerca-qty-bar,
  body .js-product-miniature .pmerca-qty-bar,
  body .pmerca-qty-bar.pmerca-qty-bar--stack {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    gap: 0.2rem !important;
    min-height: 0 !important;
  }

  body .js-product-miniature.pmerca-is-mobile .pmerca-qty,
  body .product-miniature .third-block .pmerca-qty,
  body .product-miniature .buttons-sections .pmerca-qty {
    align-self: center !important;
    margin: 0 auto 0.15rem !important;
    order: 1 !important;
    flex: 0 0 auto !important;
  }

  body .product-miniature .buttons-sections .btn.add-to-cart,
  body .product-miniature .buttons-sections .js-ajax-add-to-cart,
  body .product-miniature .buttons-sections [data-button-action="add-to-cart"],
  body .product-miniature .third-block a.js-ajax-add-to-cart,
  body .product-miniature .third-block button.js-ajax-add-to-cart,
  body .product-miniature .third-block a.add-to-cart,
  body .product-miniature .third-block button.add-to-cart,
  body .product-miniature .third-block [data-button-action="add-to-cart"],
  body .pmerca-qty-bar .pmerca-add-btn,
  body .pmerca-qty-bar a.js-ajax-add-to-cart,
  body .pmerca-qty-bar button.js-ajax-add-to-cart,
  body .pmerca-qty-bar a.add-to-cart,
  body .pmerca-qty-bar button.add-to-cart {
    display: inline-flex !important;
    order: 2 !important;
    width: auto !important;
    min-width: 88px !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    align-self: center !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 auto !important;
    min-height: 32px !important;
    height: 32px !important;
    padding: 0.25rem 0.9rem !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }

  body .js-product-miniature .pmerca-added,
  body .product-miniature .buttons-sections .pmerca-added,
  body .product-miniature .third-block .pmerca-added {
    min-width: 96px !important;
    width: auto !important;
    font-size: 12px !important;
    background: #2e7d32 !important;
    border-color: #2e7d32 !important;
    color: #fff !important;
  }
}

