/**
 * Deko Hogar — carrito + mini carrito: cantidad dkh + X sobre foto.
 */

/* ---- Mini carrito: producto relativo; X eliminar sobre la foto ---- */
.elementor-cart__product {
  position: relative;
}

.elementor-cart__product-image {
  position: relative;
  isolation: isolate;
}

.elementor-cart__product-remove,
a.elementor-cart__product-remove {
  position: absolute !important;
  top: 4px !important;
  left: 4px !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 5 !important;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(44, 69, 66, 0.18) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18) !important;
  color: #2C4542 !important;
  font-size: 12px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: auto !important;
  justify-self: auto !important;
  grid-column: 1 !important;
  grid-row: 1 !important;
  text-decoration: none !important;
  transition: background 0.15s ease, color 0.15s ease;
}

.elementor-cart__product-remove:hover,
.elementor-cart__product-remove:focus,
a.elementor-cart__product-remove:hover,
a.elementor-cart__product-remove:focus {
  background: #fff !important;
  color: #8B3A2F !important;
}

.elementor-cart__product-remove::before {
  font-size: 12px !important;
  line-height: 1 !important;
}

/* Product card may overflow for X-on-photo; the LIST scrolls separately (see layout below). */
.elementor-widget-shopping-cart .elementor-cart__product {
  overflow: visible !important;
}

.elementor-widget-shopping-cart .elementor-cart__product {
  grid-template-columns: 25% minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  align-items: start !important;
  column-gap: 12px !important;
  row-gap: 4px !important;
  padding-top: 12px !important;
  padding-bottom: 20px !important;
  margin-bottom: 0 !important;
}

.elementor-cart__product-image {
  grid-row: 1 / span 2 !important;
  grid-column: 1 !important;
}

.elementor-cart__product-name {
  grid-column: 2 !important;
  grid-row: 1 !important;
  padding-inline-start: 0 !important;
  margin: 0 0 2px !important;
}

.elementor-cart__product-price {
  grid-column: 2 !important;
  grid-row: 2 !important;
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: flex-start !important;
  align-self: start !important;
  gap: 8px !important;
  padding-inline-start: 0 !important;
  padding-bottom: 4px !important;
  overflow: visible !important;
  color: #6b6b6b;
  min-height: 0 !important;
}

.elementor-cart__product-price .dkh-cart-unit-price {
  display: block !important;
  order: 1 !important;
  width: 100% !important;
  max-width: 100% !important;
  white-space: nowrap !important;
  line-height: 1.45 !important;
  overflow: visible !important;
  color: inherit;
  font-size: 14px !important;
}

.elementor-cart__product .dkh-qty-stepper.dkh-cart-qty {
  order: 2 !important;
  width: auto !important;
  max-width: 118px !important;
  min-width: 96px !important;
  height: 32px !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
}

.elementor-cart__product .dkh-qty-stepper.dkh-cart-qty .dkh-qty-btn {
  width: 28px !important;
  height: 30px !important;
  min-width: 28px !important;
  font-size: 0.95rem !important;
}

.elementor-cart__product .dkh-qty-stepper.dkh-cart-qty .dkh-qty-input {
  width: 36px !important;
  min-width: 36px !important;
  height: 30px !important;
  font-size: 0.85rem !important;
  padding: 0 2px !important;
}

.elementor-cart__product .dkh-cart-line-alert {
  order: 3 !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-line;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

.elementor-cart__product.dkh-cart-enhanced .elementor-cart__product-quantity,
.elementor-cart__product.dkh-cart-enhanced .dkh-cart-times {
  display: none !important;
}

/* Totals: soft dim while qty request in flight — never hide steppers */
html.dkh-minicart-updating .elementor-cart__summary,
html.dkh-minicart-updating .elementor-cart__toggle .elementor-button-text {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

html.dkh-minicart-updating .elementor-cart__product .dkh-qty-stepper.dkh-cart-qty {
  opacity: 1 !important;
}

/* ---- Página del carrito: reemplazar touchspin roto ---- */
body#cart .cart-item .qty .bootstrap-touchspin,
body#cart .product-line-actions .qty .bootstrap-touchspin {
  display: none !important;
}

body#cart .cart-item .qty .dkh-qty-stepper.dkh-cart-qty,
body#cart .product-line-actions .qty .dkh-qty-stepper.dkh-cart-qty {
  width: 120px !important;
  max-width: 100% !important;
  height: 36px !important;
  margin: 0 !important;
}

body#cart .cart-item .qty .dkh-qty-btn,
body#cart .product-line-actions .qty .dkh-qty-btn {
  width: 32px !important;
  height: 34px !important;
  min-width: 32px !important;
}

body#cart .cart-item .qty .dkh-qty-input,
body#cart .product-line-actions .qty .dkh-qty-input {
  height: 34px !important;
  font-size: 0.9rem !important;
  padding: 0 4px !important;
}

body#cart .dkh-cart-line-alert {
  display: block;
  width: 100%;
  margin: 6px 0 0;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-line;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

body#cart .dkh-qty-btn:disabled,
.elementor-cart__product .dkh-qty-btn:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}

body#cart .qty > .bootstrap-touchspin {
  display: none !important;
}
body#cart .dkh-qty-stepper.dkh-cart-qty {
  display: flex !important;
  visibility: visible !important;
}
body#cart .dkh-qty-stepper.dkh-cart-qty .dkh-qty-input,
body#cart .dkh-qty-stepper.dkh-cart-qty input[type="number"] {
  display: block !important;
  width: 40px !important;
  min-width: 36px !important;
  opacity: 1 !important;
  visibility: visible !important;
  color: #3D3D3D !important;
  -moz-appearance: textfield !important;
}
body#cart .dkh-qty-stepper.dkh-cart-qty .bootstrap-touchspin {
  display: contents !important;
}

@media (max-width: 575px) {
  .elementor-cart__product-remove,
  a.elementor-cart__product-remove {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    top: 2px !important;
    left: 2px !important;
  }

  .elementor-widget-shopping-cart .elementor-cart__product {
    padding-bottom: 18px !important;
  }

  .elementor-cart__product .dkh-cart-line-alert,
  body#cart .dkh-cart-line-alert,
  body#cart [id^="js-product-line-alert--"] .dkh-cart-line-alert,
  body#cart [id^="js-product-line-alert--"] {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    box-sizing: border-box !important;
  }

  /* − / N / + always visible on mobile cart */
  body#cart .dkh-qty-stepper.dkh-cart-qty {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 132px !important;
    min-width: 132px !important;
    max-width: 100% !important;
    overflow: visible !important;
  }
  body#cart .dkh-qty-stepper.dkh-cart-qty .dkh-qty-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    flex: 0 0 36px !important;
  }
  body#cart .dkh-qty-stepper.dkh-cart-qty .dkh-qty-input,
  body#cart .dkh-qty-stepper.dkh-cart-qty input[type="number"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 52px !important;
    min-width: 48px !important;
    flex: 1 1 auto !important;
  }

}

/*
 * SOLO celular — página carrito:
 * Foto sola a la izquierda; en la columna de descripción:
 * total centrado → fila centrada (−/N/+ + basura).
 * Sin cambios de tipografía/color/tamaño de controles.
 */
@media (max-width: 767px) {
  /* Foto izq (span 2 filas); der = descripción arriba + total/qty/basura abajo */
  body#cart .product-line-grid {
    display: grid !important;
    grid-template-columns: 33.33333333% 66.66666667% !important;
    grid-template-areas:
      "img body"
      "img right";
    align-items: start !important;
    column-gap: 0 !important;
    row-gap: 6px !important;
  }

  body#cart .product-line-grid-left,
  body#cart .product-line-grid-body,
  body#cart .product-line-grid-right {
    float: none !important;
    clear: none !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
  }

  body#cart .product-line-grid-left {
    grid-area: img !important;
    width: auto !important;
    max-width: none !important;
    padding-right: 8px !important;
  }

  body#cart .product-line-grid-body {
    grid-area: body !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
  }

  body#cart .product-line-grid-right {
    grid-area: right !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body#cart .product-line-grid > .clearfix {
    display: none !important;
  }

  body#cart .product-line-grid-right > .row > .col-xs-4.hidden-md-up {
    display: none !important;
  }

  body#cart .product-line-grid-right > .row {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body#cart .product-line-grid-right > .row > .col-md-10,
  body#cart .product-line-grid-right > .row > [class*="col-xs-6"] {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Columna basura original: el enlace vive junto al qty */
  body#cart .product-line-grid-right > .row > .col-md-2,
  body#cart .product-line-grid-right > .row > .text-xs-right {
    display: none !important;
  }

  body#cart .product-line-grid-right .col-md-10 .row,
  body#cart .product-line-grid-right [class*="col-xs-6"] > .row {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 0 !important;
    width: 100% !important;
  }

  body#cart .product-line-grid-right .price,
  body#cart .product-line-grid-right .dkh-cart-line-total {
    order: 1 !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    float: none !important;
    text-align: center !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  body#cart .product-line-grid-right .price .product-price,
  body#cart .product-line-grid-right .price strong,
  body#cart .product-line-grid-right .dkh-cart-line-total strong {
    display: inline-block !important;
    max-width: 100% !important;
    white-space: nowrap !important;
  }

  body#cart .product-line-grid-right .qty {
    order: 2 !important;
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    width: auto !important;
    max-width: 100% !important;
    float: none !important;
    padding: 0 !important;
  }

  body#cart .product-line-grid-right .qty .remove-from-cart,
  body#cart .product-line-grid-right .qty .cart-line-product-actions {
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
  }

  /*
   * SOLO corre el bloque Continuar→FINALIZAR al medio (eje logo).
   * No cambia la alineación interna del texto (label izq / valor der).
   */
  body#cart .cart-grid-body > a.label,
  body#cart .cart-grid-body > .label {
    display: block !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 340px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    float: none !important;
    /* igual que en la captura: texto a la izquierda dentro del bloque */
    text-align: left !important;
  }

  body#cart .cart-grid-right {
    display: block !important;
    float: none !important;
    width: 100% !important;
    max-width: 340px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
  }

  body#cart .cart-summary,
  body#cart .cart-detailed-totals,
  body#cart .cart-detailed-subtotals,
  body#cart .cart-summary-totals,
  body#cart .block-promo,
  body#cart .checkout.cart-detailed-actions {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
    /* no forzar text-align: center — deja el tema */
  }

  body#cart .cart-summary .cart-summary-line,
  body#cart .cart-detailed-totals .cart-summary-line,
  body#cart #dkh-cart-list-total,
  body#cart #dkh-cart-group-discount,
  body#cart .dkh-cart-summary-discount .cart-summary-line {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: baseline !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body#cart .cart-summary .cart-summary-line .label,
  body#cart .cart-summary .cart-summary-line .label.sub,
  body#cart .cart-detailed-totals .cart-summary-line .label,
  body#cart #dkh-cart-list-total .label,
  body#cart #dkh-cart-group-discount .label {
    float: none !important;
    text-align: left !important;
    width: auto !important;
    max-width: none !important;
    flex: 1 1 auto !important;
  }

  body#cart .cart-summary .cart-summary-line .value,
  body#cart .cart-summary .cart-summary-line .value.sub,
  body#cart .cart-detailed-totals .cart-summary-line .value,
  body#cart #dkh-cart-list-total .value,
  body#cart #dkh-cart-group-discount .value {
    float: none !important;
    text-align: right !important;
    width: auto !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }

  body#cart #dkh-cart-tier-notice,
  body#cart .dkh-cart-tier-notice {
    /* leyenda debajo del descuento: como en captura, alineada al bloque */
    text-align: left !important;
    width: 100% !important;
  }

  /* FAB visible como en la captura; fuera del bloque centrado */
  body#cart .deko-whatsapp-button,
  body#cart a.deko-whatsapp-button {
    display: flex !important;
    top: auto !important;
    bottom: 120px !important;
    right: 12px !important;
    left: auto !important;
    z-index: 5 !important;
  }
}

/* v1.4 — página carrito: sin parpadeo en +/- */
html.dkh-cartpage-updating .cart-overview img,
html.dkh-cartpage-updating .cart-summary img {
  /* evitar flash de lazy-reload si algo toca el DOM */
  content-visibility: auto;
}

body#cart .cart-item.dkh-cart-line-removing {
  pointer-events: none;
}

body#cart .dkh-cart-line-alert {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  margin-top: 0.35rem;
}


/* v1.5 — aviso stock/mínimo persistente, sin desbordar */
body#cart .qty {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  max-width: 100%;
}
body#cart .qty .dkh-cart-line-alert {
  flex: 1 1 100%;
  order: 5;
}


/* ============================================================
   Mini cart panel layout: fixed header + scrollable list + fixed footer
   ============================================================ */
.elementor-widget-shopping-cart .elementor-cart__container.elementor-cart--shown,
.elementor-widget-shopping-cart .elementor-cart__container[open] {
  /* dialog / overlay fills viewport; keep overflow hidden so only the list scrolls */
  overflow: hidden !important;
}

.elementor-widget-shopping-cart .elementor-cart__main {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  box-sizing: border-box !important;
  height: 100% !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
}

.elementor-widget-shopping-cart .elementor-cart__close-button,
.elementor-widget-shopping-cart .elementor-cart__title {
  flex: 0 0 auto !important;
}

.elementor-widget-shopping-cart .elementor-cart__products {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  /* room so last product is not flush under sticky footer */
  padding-bottom: 8px !important;
  scrollbar-gutter: stable;
}

.elementor-widget-shopping-cart .elementor-cart__summary,
.elementor-widget-shopping-cart .elementor-alert-warning,
.elementor-widget-shopping-cart .elementor-cart__footer-buttons {
  flex: 0 0 auto !important;
  background: #fff !important;
  z-index: 2;
}

.elementor-widget-shopping-cart .elementor-cart__summary {
  /* keep border from CE; clear floats so height is correct */
  overflow: hidden; /* clearfix for floated label/value */
  margin-top: 0 !important;
}

.elementor-widget-shopping-cart .elementor-cart__footer-buttons {
  padding-top: 12px !important;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)) !important;
}

/* While panel open: page behind stays put (dialog showModal usually handles this;
   reinforce without fighting close restore). */
html.dkh-minicart-open,
html.dkh-minicart-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

@media (max-width: 575px) {
  .elementor-widget-shopping-cart .elementor-cart__main {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}
