/*
 * Ajustes complementarios del flujo de guías de Donde Viajo.
 * Requiere la clase de alcance `dv-guide-flow` añadida por el plugin.
 */

/* Checkout: evita repetir el subtotal cuando el producto ya muestra su precio. */
body.woocommerce-checkout.dv-guide-flow #order_review tr.cart-subtotal {
  display: none;
}

/* Carrito de bloques: conserva únicamente el total alineado a la derecha. */
body.woocommerce-cart.dv-guide-flow .wc-block-cart-item__prices,
body.woocommerce-cart.dv-guide-flow .wc-block-components-product-metadata,
body.woocommerce-cart.dv-guide-flow .wc-block-cart-item__product .wc-block-components-product-price {
  display: none !important;
}

body.woocommerce-cart.dv-guide-flow .wc-block-cart-item__product .wc-block-components-product-name {
  font-size: 18px;
  font-weight: 700 !important;
  line-height: 1.35;
}

body.woocommerce-cart.dv-guide-flow .wc-block-cart-item__total {
  display: flex !important;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  margin-left: auto;
  text-align: right;
}

/* El script conserva el botón nativo y lo mueve a la celda derecha. */
body.woocommerce-cart.dv-guide-flow .wc-block-cart-item__remove-link {
  display: inline-grid !important;
  box-sizing: border-box;
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  place-items: center;
  float: none;
  margin: 16px 0 0 auto !important;
  padding: 9px !important;
  color: var(--dv-commerce-error, #a33b32) !important;
  line-height: 1 !important;
}

body.woocommerce-cart.dv-guide-flow .wc-block-cart-item__remove-link svg {
  display: block !important;
  width: 22px !important;
  min-width: 22px !important;
  height: 22px !important;
  color: inherit;
  fill: currentColor;
}

body.woocommerce-cart.dv-guide-flow .wc-block-cart-item__remove-link svg path {
  fill: currentColor;
}

/* Errores de validación más legibles. */
body.woocommerce-checkout.dv-guide-flow .woocommerce-NoticeGroup-checkout .woocommerce-error {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 14px 18px !important;
}

body.woocommerce-checkout.dv-guide-flow .woocommerce-NoticeGroup-checkout .woocommerce-error li {
  display: block;
  flex: 1 1 auto;
  margin: 0;
  font-weight: 600;
}

body.woocommerce-checkout.dv-guide-flow .woocommerce-NoticeGroup-checkout .woocommerce-error li::before {
  display: none !important;
  content: none !important;
}

body.woocommerce-checkout.dv-guide-flow .woocommerce-NoticeGroup-checkout .woocommerce-error::before {
  display: grid;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  place-items: center;
  margin: 0;
  border-radius: 50%;
  background: var(--dv-commerce-error, #a33b32);
  color: #fff;
  content: "!";
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

body.woocommerce-checkout.dv-guide-flow .woocommerce-invalid .woocommerce-error,
body.woocommerce-checkout.dv-guide-flow .woocommerce-invalid-required-field .woocommerce-error,
body.woocommerce-checkout.dv-guide-flow .woocommerce-invalid .checkout-inline-error-message,
body.woocommerce-checkout.dv-guide-flow .woocommerce-invalid-required-field .checkout-inline-error-message {
  display: block;
  margin: 7px 0 0;
  color: var(--dv-commerce-error, #a33b32);
  font-size: 13px;
  line-height: 1.4;
}

/* Confirmación: prioriza el resultado y diferencia el resumen del fondo. */
body.woocommerce-order-received .woocommerce-thankyou-order-received {
  display: grid;
  gap: 7px;
  margin: 0 0 22px;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--dv-commerce-border, #dce2e1);
  border-left: 5px solid var(--dv-commerce-success, #2f6a52);
  border-radius: 14px;
  background: var(--dv-commerce-paper, #fff);
  color: var(--dv-commerce-ink, #293337);
  box-shadow: 0 12px 32px rgba(36, 50, 55, 0.07);
  line-height: 1.55;
}

body.woocommerce-order-received .woocommerce-thankyou-order-received .dv-confirmation-title {
  font-size: clamp(20px, 2.5vw, 26px);
  line-height: 1.25;
  text-wrap: balance;
}

body.woocommerce-order-received .woocommerce-thankyou-order-received .dv-confirmation-status {
  font-size: 18px;
  line-height: 1.35;
}

body.woocommerce-order-received .woocommerce-thankyou-order-received .dv-download-confirmation {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--dv-commerce-border, #dce2e1);
}

body.woocommerce-order-received .woocommerce-order-overview {
  box-sizing: border-box;
  margin-bottom: 28px;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--dv-commerce-border, #dce2e1);
  border-radius: 14px;
  background: var(--dv-commerce-paper, #fff);
  box-shadow: 0 12px 32px rgba(36, 50, 55, 0.07);
}

body.woocommerce-order-received .woocommerce-order-details th.product-total,
body.woocommerce-order-received .woocommerce-order-details td.product-total,
body.woocommerce-order-received .woocommerce-order-details tfoot td {
  font-variant-numeric: tabular-nums;
  text-align: right !important;
}

@media (max-width: 768px) {
  body.woocommerce-order-received .woocommerce-order-overview {
    display: grid;
    gap: 14px;
  }

  /* OceanWP asigna paddings distintos al primero y al último dato. */
  body.woocommerce-order-received .woocommerce-order-overview li {
    float: none !important;
    box-sizing: border-box;
    width: 100% !important;
    margin: 0 !important;
    padding: 14px 0 !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--dv-commerce-border, #dce2e1);
    font-variant-numeric: tabular-nums;
  }

  body.woocommerce-order-received .woocommerce-order-overview li:first-child {
    padding-top: 0 !important;
  }

  body.woocommerce-order-received .woocommerce-order-overview li:last-child {
    padding-bottom: 0 !important;
    border-bottom: 0 !important;
  }

  /* Evita que las cuatro columnas de descargas desborden la pantalla. */
  body.woocommerce-order-received .woocommerce-order-downloads,
  body.woocommerce-order-received .woocommerce-order-downloads table,
  body.woocommerce-order-received .woocommerce-order-downloads tbody,
  body.woocommerce-order-received .woocommerce-order-downloads tr {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
  }

  body.woocommerce-order-received .woocommerce-order-downloads thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  body.woocommerce-order-received .woocommerce-order-downloads td {
    display: grid !important;
    grid-template-columns: minmax(112px, 0.9fr) minmax(0, 1.2fr);
    gap: 14px;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    padding: 12px 14px !important;
    text-align: left !important;
  }

  body.woocommerce-order-received .woocommerce-order-downloads td::before {
    float: none !important;
    margin: 0;
    content: attr(data-title);
    font-weight: 700;
    text-align: left;
  }

  body.woocommerce-order-received .woocommerce-order-downloads td.download-file {
    display: block !important;
  }

  body.woocommerce-order-received .woocommerce-order-downloads td.download-file::before {
    display: block;
    margin-bottom: 10px;
  }

  body.woocommerce-order-received .woocommerce-order-downloads .button {
    box-sizing: border-box;
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    white-space: normal;
  }
}
