/* =========================================================
   WooCommerce Blocks — CART PAGE (PharmaCommerce)
   ========================================================= */

/* =========================
   AJUSTES RÁPIDOS
   ========================= */
:root{
  --pc-cart-page-pad-top: 22px;
  --pc-cart-page-pad-btm: 32px;

  --pc-cart-layout-gap: 28px;
  --pc-cart-sidebar-w: 600px; /* ✅ más ancho (sube/baja aquí) */

  --pc-cart-card-gap: 0.75rem; /* ✅ gap entre cards */
  --pc-cart-card-radius: 16px;
  --pc-cart-card-pad: 14px;

  --pc-cart-img: 92px;
  --pc-cart-total-col: 140px;
}

/* =========================
   0) Padding general
   ========================= */
body.woocommerce-cart .pc-main{
  padding-top: var(--pc-cart-page-pad-top);
  padding-bottom: var(--pc-cart-page-pad-btm);
}

body.woocommerce-cart .wp-block-woocommerce-cart{
  width: 100%;
}

body.woocommerce-cart .wp-block-woocommerce-cart.alignwide{
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* =========================
   1) LAYOUT: 2 columnas
   ========================= */
body.woocommerce-cart
  .wp-block-woocommerce-cart
  .wc-block-components-sidebar-layout.wc-block-cart{
  display: grid !important;
  grid-template-columns: minmax(0,1fr) var(--pc-cart-sidebar-w);
  gap: var(--pc-cart-layout-gap);
  align-items: start;
}

body.woocommerce-cart .wc-block-cart__main,
body.woocommerce-cart .wc-block-cart__sidebar{
  min-width: 0;
}

@media (max-width: 980px){
  body.woocommerce-cart
    .wp-block-woocommerce-cart
    .wc-block-components-sidebar-layout.wc-block-cart{
    grid-template-columns: 1fr;
  }
}

/* =========================
   2) SIDEBAR: card + sticky
   ========================= */
body.woocommerce-cart .wc-block-cart__sidebar {
  background: #fff;
  border: 1px solid var(--pc-color-border);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 24px;

  position: sticky;
  top: calc(var(--pc-header-top-h) + var(--pc-header-bottom-h) + 16px);
}

@media (max-width: 980px) {
  body.woocommerce-cart .wc-block-cart__sidebar {
    position: static;
    top: auto;
  }
}

/* Sidebar title */
body.woocommerce-cart .wc-block-cart__totals-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pc-color-text-muted);
  margin: 0 0 18px !important;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--pc-color-border);
}

/* Totals wrapper */
body.woocommerce-cart .wc-block-components-totals-wrapper {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Each row (subtotal, shipping, total) */
body.woocommerce-cart .wc-block-components-totals-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--pc-color-border);
  padding: 14px 0;
}

body.woocommerce-cart .wc-block-components-totals-item:first-child {
  border-top: none;
  padding-top: 0;
}

body.woocommerce-cart .wc-block-components-totals-item__label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--pc-color-text-muted);
}

body.woocommerce-cart .wc-block-components-totals-item__value {
  font-size: 15px;
  font-weight: 800;
  color: var(--pc-color-text);
  text-align: right;
}

/* Total row: make the price bigger and primary-colored */
body.woocommerce-cart .wc-block-components-totals-item.wc-block-components-totals-total .wc-block-components-totals-item__label {
  font-size: 14px;
  font-weight: 800;
  color: var(--pc-color-text);
}

body.woocommerce-cart .wc-block-components-totals-item.wc-block-components-totals-total .wc-block-components-totals-item__value {
  font-size: 22px;
  font-weight: 900;
  color: var(--pc-color-primary);
}

/* Hide shipping notice — this flow doesn't use checkout */
body.woocommerce-cart .wc-block-components-totals-item__description {
  display: none;
}

/* Hide WooCommerce checkout button — WhatsApp is the purchase CTA */
body.woocommerce-cart a.wc-block-cart__submit-button,
body.woocommerce-cart .wp-block-woocommerce-proceed-to-checkout-block {
  display: none !important;
}


/* ── WhatsApp CTA button (injected via PHP/JS in wp_footer) ── */

#pc-cart-page-wa {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--pc-color-border);
}

.pc-cart-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 20px;
  background: #16a34a;
  color: #fff !important;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none !important;
  border-radius: 12px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
  box-shadow: 0 4px 18px rgba(22, 163, 74, 0.28);
}

.pc-cart-wa-btn:hover {
  background: #15803d;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(22, 163, 74, 0.36);
}

.pc-cart-wa-btn i {
  font-size: 20px;
  line-height: 1;
}

/* =========================
   2b) CLASSIC CART: .cart_totals
   Covers the shortcode-based cart page (non-Blocks).
   ========================= */

body.woocommerce-cart .cart_totals {
  background: #fff;
  border: 1px solid var(--pc-color-border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
  padding: 24px;
}

body.woocommerce-cart .cart_totals h2 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pc-color-text-muted);
  margin: 0 0 16px !important;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--pc-color-border);
}

body.woocommerce-cart .cart_totals table.shop_table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

body.woocommerce-cart .cart_totals table.shop_table th,
body.woocommerce-cart .cart_totals table.shop_table td {
  border: none !important;
  padding: 12px 0 !important;
  background: transparent !important;
  border-top: 1px solid var(--pc-color-border) !important;
}

body.woocommerce-cart .cart_totals table.shop_table tr:first-child th,
body.woocommerce-cart .cart_totals table.shop_table tr:first-child td {
  border-top: none !important;
  padding-top: 0 !important;
}

body.woocommerce-cart .cart_totals table.shop_table th {
  font-size: 13px;
  font-weight: 600;
  color: var(--pc-color-text-muted);
  text-align: left;
  white-space: nowrap;
  padding-right: 16px !important;
}

body.woocommerce-cart .cart_totals table.shop_table td {
  font-size: 15px;
  font-weight: 800;
  color: var(--pc-color-text);
  text-align: right;
}

/* Order total row */
body.woocommerce-cart .cart_totals table.shop_table .order-total th {
  font-size: 14px;
  font-weight: 800;
  color: var(--pc-color-text);
}

body.woocommerce-cart .cart_totals table.shop_table .order-total td {
  font-size: 22px;
  font-weight: 900;
  color: var(--pc-color-primary);
}

/* Shipping row — hide the calculator notice */
body.woocommerce-cart .cart_totals .shipping td p,
body.woocommerce-cart .cart_totals .shipping td .woocommerce-shipping-calculator {
  display: none;
}

/* Proceed to checkout button — hide it (WhatsApp is the CTA) */
body.woocommerce-cart .cart_totals .wc-proceed-to-checkout {
  display: none;
}


/* =========================
   3) ITEMS: cards + gap
   ========================= */
body.woocommerce-cart .wc-block-cart-items{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 var(--pc-cart-card-gap);
}

body.woocommerce-cart .wc-block-cart-items__header{
  display: none;
}

body.woocommerce-cart .wc-block-cart-items__row{
  display: grid;
  grid-template-columns: var(--pc-cart-img) minmax(0,1fr) var(--pc-cart-total-col);
  gap: 14px;

  background: #fff;
  border: 1px solid var(--pc-color-border);
  border-radius: var(--pc-cart-card-radius);
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
  padding: var(--pc-cart-card-pad);
  outline: none;
}

body.woocommerce-cart .wc-block-cart-items__row > td{
  border: 0 !important;
  padding: 0 !important;
  vertical-align: top;
}

body.woocommerce-cart .wc-block-cart-item__image img{
  width: var(--pc-cart-img);
  height: var(--pc-cart-img);
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--pc-color-border);
  border-radius: 14px;
  padding: 10px;
}

/* Precio */
body.woocommerce-cart .wc-block-cart-item__prices .price{
  font-weight: 900;
  color: var(--pc-color-primary);
}

/* Total derecha */
body.woocommerce-cart .wc-block-cart-item__total{
  display: flex;
  justify-content: flex-end;
}
body.woocommerce-cart .wc-block-cart-item__total .price{
  font-weight: 900;
  color: var(--pc-color-primary);
}

/* Qty */
body.woocommerce-cart .wc-block-components-quantity-selector{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

body.woocommerce-cart .wc-block-components-quantity-selector__input{
  width: 74px;
  height: 40px;
  border: 1px solid var(--pc-color-border);
  border-radius: 12px;
  padding: 0 10px;
  font-weight: 800;
  background: #fff;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--pc-color-border);
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button:disabled{
  opacity: .45;
  cursor: not-allowed;
}

/* Remove */
body.woocommerce-cart .wc-block-cart-item__remove-link{
  margin-top: 10px;
  display: inline-flex;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  color: #b91c1c;
  font-weight: 800;
  text-decoration: none !important;
  cursor: pointer;
}

body.woocommerce-cart .wc-block-cart-item__remove-link:hover{
  text-decoration: underline !important;
}

/* =========================
   4) MOBILE
   ========================= */
@media (max-width: 720px){
  body.woocommerce-cart .wc-block-cart-items__row{
    grid-template-columns: 86px 1fr;
  }

  body.woocommerce-cart .wc-block-cart-item__total{
    grid-column: 1 / -1;
    justify-content: flex-start;
    margin-top: 8px;
  }
}

/* =========================================================
   5) OVERRIDES (para ganar a Woo Blocks)
   ========================================================= */

/* ✅ Nombre producto (aquí sí o sí cambia) */
body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-cart-item__wrap a.wc-block-components-product-name{
  font-size: 17px !important;  /* ajusta aquí */
  line-height: 1.15 !important;
  font-weight: 900 !important;
  color: var(--pc-color-text) !important;
  text-decoration: none !important;
}

body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-cart-item__wrap a.wc-block-components-product-name:hover{
  color: var(--pc-color-primary) !important;
}



/* =========================================================
   OVERRIDES (cuando Woo Blocks se pone terco)
   ========================================================= */

/* Nombre producto (link) */
body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-cart-item__wrap a.wc-block-components-product-name {
  font-size: 17px !important; /* ajusta aquí */
  line-height: 1.15 !important;
  font-weight: 900 !important;
}

/* Si por alguna razón el link trae un span interno */
body.woocommerce-cart .wp-block-woocommerce-cart .wc-block-cart-item__wrap a.wc-block-components-product-name * {
  font-size: inherit !important;
}


/* =========================================================
   FIX — Neutralizar layout interno de Woo Blocks
   (65% / 35% + paddings en %)
   ========================================================= */

/* Main (columna izquierda) */
body.woocommerce-cart
.wp-block-woocommerce-cart
.wc-block-components-sidebar-layout
.wc-block-components-main {
  width: auto !important;        /* ⬅️ deja que el grid mande */
  padding-right: 0 !important;  /* ⬅️ quita padding en % */
  box-sizing: border-box;
}

/* Sidebar (columna derecha: total + botón) */
body.woocommerce-cart
.wp-block-woocommerce-cart
.wc-block-components-sidebar {
  width: auto !important;        /* ⬅️ usa el ancho del grid */
  padding-left: 0 !important;   /* ⬅️ quita padding en % */
  box-sizing: border-box;
}