/* Recovery Cart Fix - high priority overrides for photo visibility + alignment */

body.woocommerce-cart .woocommerce {
  display: block !important;
  max-width: 1120px !important;
  margin: 0 auto !important;
}

body.woocommerce-cart .woocommerce-cart-form {
  width: auto !important;
  min-width: 0 !important;
  float: none !important;
  background: #fff !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 18px !important;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08) !important;
  padding: 14px 18px 18px !important;
}

body.woocommerce-cart .cart-collaterals {
  width: 100% !important;
  max-width: 420px !important;
  float: none !important;
  margin: 20px 0 0 auto !important;
  min-width: 0 !important;
}

body.woocommerce-cart .cart_totals {
  background: linear-gradient(180deg, #ffffff 0%, #fff7f2 100%) !important;
  border: 1px solid rgba(249, 99, 33, 0.14) !important;
  border-radius: 18px !important;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08) !important;
  padding: 22px 22px 18px !important;
  margin: 0 !important;
  max-width: none !important;
}

body.woocommerce-cart .cart_totals h2 {
  margin: 0 0 16px !important;
  padding: 0 0 12px !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  font-size: 1.05rem !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
}

body.woocommerce-cart .cart_totals table.shop_table {
  border: 0 !important;
  margin: 0 !important;
}

body.woocommerce-cart .cart_totals table.shop_table th,
body.woocommerce-cart .cart_totals table.shop_table td {
  padding: 12px 0 !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
  font-size: 0.94rem !important;
}

body.woocommerce-cart .cart_totals table.shop_table th {
  color: var(--color-text-muted) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  font-size: 0.76rem !important;
}

body.woocommerce-cart .cart_totals tr.order-total th,
body.woocommerce-cart .cart_totals tr.order-total td {
  font-size: 1rem !important;
  font-weight: 800 !important;
  color: var(--color-text) !important;
}

body.woocommerce-cart .wc-proceed-to-checkout {
  padding-bottom: 0 !important;
}

body.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
  min-height: 52px !important;
  border-radius: 14px !important;
  box-shadow: 0 14px 28px rgba(249, 99, 33, 0.24) !important;
}

body.woocommerce-cart .woocommerce,
body.woocommerce-cart .woocommerce-cart-form {
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch !important;
}

body.woocommerce-cart table.shop_table {
  width: 100% !important;
  table-layout: auto !important;
}

body.woocommerce-cart table.shop_table td.product-remove,
body.woocommerce-cart table.shop_table th.product-remove {
  width: 44px !important;
  text-align: center !important;
}

body.woocommerce-cart table.shop_table td.product-thumbnail,
body.woocommerce-cart table.shop_table th.product-thumbnail {
  display: table-cell !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body.woocommerce-cart table.shop_table td.product-thumbnail a {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 112px !important;
}

body.woocommerce-cart table.shop_table td.product-thumbnail img,
body.woocommerce-cart table.shop_table td.product-thumbnail img.rc-cart-thumb {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 112px !important;
  height: 112px !important;
  min-width: 112px !important;
  min-height: 112px !important;
  max-width: 112px !important;
  object-fit: contain !important;
  background: #fff !important;
  border: 1px solid var(--color-border-light) !important;
  border-radius: 10px !important;
}

@media (min-width: 769px) {
  body.woocommerce-cart table.shop_table {
    min-width: 760px !important;
    table-layout: auto !important;
  }

  body.woocommerce-cart table.shop_table thead th.product-thumbnail,
  body.woocommerce-cart table.shop_table tbody td.product-thumbnail {
    width: 132px !important;
  }

  body.woocommerce-cart table.shop_table thead th.product-name,
  body.woocommerce-cart table.shop_table tbody td.product-name {
    width: auto !important;
    min-width: 280px !important;
  }

  body.woocommerce-cart table.shop_table thead th.product-price,
  body.woocommerce-cart table.shop_table tbody td.product-price,
  body.woocommerce-cart table.shop_table thead th.product-quantity,
  body.woocommerce-cart table.shop_table tbody td.product-quantity,
  body.woocommerce-cart table.shop_table thead th.product-subtotal,
  body.woocommerce-cart table.shop_table tbody td.product-subtotal {
    width: 132px !important;
    display: table-cell !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  body.woocommerce-cart table.shop_table tbody td.product-quantity .quantity {
    display: flex !important;
    justify-content: flex-end !important;
  }
}

@media (max-width: 768px) {
  body.woocommerce-cart .woocommerce {
    display: block !important;
  }

  body.woocommerce-cart .woocommerce-cart-form,
  body.woocommerce-cart .cart_totals {
    border-radius: 14px !important;
    padding: 14px !important;
  }

  body.woocommerce-cart .cart-collaterals {
    max-width: 100% !important;
    margin: 16px 0 0 !important;
  }

  body.woocommerce-cart table.shop_table thead {
    display: none !important;
  }

  body.woocommerce-cart table.shop_table tbody tr.cart_item,
  body.woocommerce-cart table.shop_table tbody tr.woocommerce-cart-form__cart-item {
    display: grid !important;
    grid-template-columns: 24px 88px minmax(0, 1fr) !important;
    grid-template-areas:
      "remove thumb name"
      "remove thumb price"
      "remove thumb qty"
      "remove thumb subtotal" !important;
    gap: 6px 10px !important;
    padding: 12px !important;
    margin-bottom: 12px !important;
    border: 1px solid var(--color-border-light) !important;
    border-radius: 12px !important;
    background: #fff !important;
  }

  body.woocommerce-cart table.shop_table tbody tr.cart_item > td,
  body.woocommerce-cart table.shop_table tbody tr.woocommerce-cart-form__cart-item > td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: left !important;
  }

  body.woocommerce-cart table.shop_table td.product-remove { grid-area: remove !important; }
  body.woocommerce-cart table.shop_table td.product-thumbnail {
    grid-area: thumb !important;
    display: block !important;
    width: auto !important;
  }
  body.woocommerce-cart table.shop_table td.product-name { grid-area: name !important; }
  body.woocommerce-cart table.shop_table td.product-price { grid-area: price !important; }
  body.woocommerce-cart table.shop_table td.product-quantity { grid-area: qty !important; }
  body.woocommerce-cart table.shop_table td.product-subtotal { grid-area: subtotal !important; }

  body.woocommerce-cart table.shop_table td.product-thumbnail img,
  body.woocommerce-cart table.shop_table td.product-thumbnail img.rc-cart-thumb {
    width: 88px !important;
    height: 88px !important;
    min-width: 88px !important;
    min-height: 88px !important;
    max-width: 88px !important;
  }

  body.woocommerce-cart table.shop_table td.product-price::before,
  body.woocommerce-cart table.shop_table td.product-quantity::before,
  body.woocommerce-cart table.shop_table td.product-subtotal::before {
    display: block !important;
    margin-bottom: 2px !important;
    color: var(--color-text-muted) !important;
    font-size: 0.72rem !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    font-weight: var(--font-weight-semibold) !important;
  }

  body.woocommerce-cart table.shop_table td.product-price::before { content: "Precio" !important; }
  body.woocommerce-cart table.shop_table td.product-quantity::before { content: "Cantidad" !important; }
  body.woocommerce-cart table.shop_table td.product-subtotal::before { content: "Subtotal" !important; }
}

/* Coupon + update cart controls alignment */
body.woocommerce-cart table.shop_table tr td.actions {
  border-top: 1px solid var(--color-border-light) !important;
  padding-top: 14px !important;
}

body.woocommerce-cart table.shop_table tr td.actions .coupon .input-text {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 12px !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 10px !important;
}

body.woocommerce-cart table.shop_table tr td.actions .coupon .button,
body.woocommerce-cart table.shop_table tr td.actions .button[name="update_cart"] {
  height: 44px !important;
  min-height: 44px !important;
  border-radius: 10px !important;
  font-size: 0.9rem !important;
  font-weight: var(--font-weight-black) !important;
  letter-spacing: 0.02em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  line-height: 1 !important;
  padding: 0 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  float: none !important;
  clear: none !important;
}

body.woocommerce-cart table.shop_table tr td.actions .button[name="update_cart"] {
  min-width: 170px !important;
}

body.woocommerce-cart table.shop_table tr td.actions input.button[name="update_cart"],
body.woocommerce-cart table.shop_table tr td.actions button.button[name="update_cart"] {
  background: var(--color-accent, #f96321) !important;
  color: #fff !important;
  border: 1px solid var(--color-accent-hover, #e5531d) !important;
  box-shadow: 0 8px 18px rgba(249, 99, 33, 0.28) !important;
  font-size: 0.95rem !important;
  letter-spacing: 0.03em !important;
  text-align: center !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  box-sizing: border-box !important;
  overflow: visible !important;
  text-indent: 0 !important;
}

body.woocommerce-cart table.shop_table tr td.actions input.button[name="update_cart"]:hover,
body.woocommerce-cart table.shop_table tr td.actions button.button[name="update_cart"]:hover {
  background: var(--color-accent-hover, #e5531d) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

body.woocommerce-cart table.shop_table tr td.actions input.button[name="update_cart"][disabled],
body.woocommerce-cart table.shop_table tr td.actions button.button[name="update_cart"][disabled],
body.woocommerce-cart table.shop_table tr td.actions input.button[name="update_cart"]:disabled,
body.woocommerce-cart table.shop_table tr td.actions button.button[name="update_cart"]:disabled {
  opacity: 1 !important;
  background: var(--color-accent, #f96321) !important;
  border-color: var(--color-accent-hover, #e5531d) !important;
  color: #fff !important;
  cursor: not-allowed !important;
  filter: saturate(0.92) brightness(0.98) !important;
}

@media (min-width: 769px) {
  body.woocommerce-cart table.shop_table tr td.actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 10px !important;
  }

  body.woocommerce-cart table.shop_table tr td.actions .coupon {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 760px !important;
  }

  body.woocommerce-cart table.shop_table tr td.actions .button[name="update_cart"] {
    margin-left: auto !important;
    min-width: 220px !important;
  }
}

@media (max-width: 768px) {
  body.woocommerce-cart table.shop_table tr td.actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding-top: 10px !important;
  }

  body.woocommerce-cart table.shop_table tr td.actions .coupon {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
    width: 100% !important;
    margin-bottom: 8px !important;
  }

  body.woocommerce-cart table.shop_table tr td.actions .coupon .input-text,
  body.woocommerce-cart table.shop_table tr td.actions .coupon .button,
  body.woocommerce-cart table.shop_table tr td.actions .button[name="update_cart"] {
    width: 100% !important;
  }

  body.woocommerce-cart table.shop_table tr td.actions .coupon .button {
    max-width: 160px !important;
    justify-self: end !important;
  }

  body.woocommerce-cart table.shop_table tr td.actions .button[name="update_cart"] {
    width: 100% !important;
    max-width: 100% !important;
    margin: 6px 0 0 !important;
    float: none !important;
    clear: both !important;
    font-size: 0.84rem !important;
    letter-spacing: 0.01em !important;
    padding: 0 10px !important;
    line-height: 1.1 !important;
  }
}

@media (max-width: 480px) {
  body.woocommerce-cart table.shop_table tr td.actions .coupon {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  body.woocommerce-cart table.shop_table tr td.actions .coupon .button,
  body.woocommerce-cart table.shop_table tr td.actions .button[name="update_cart"] {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.woocommerce-cart table.shop_table tr td.actions input.button[name="update_cart"],
  body.woocommerce-cart table.shop_table tr td.actions button.button[name="update_cart"] {
    font-size: 0.78rem !important;
    letter-spacing: 0 !important;
    font-weight: 800 !important;
    min-height: 42px !important;
    height: 42px !important;
    border-radius: 9px !important;
    white-space: normal !important;
  }
}
