/* ==========================================================================
   Cacao Boys cart (WooCommerce)
   Restyles WooCommerce's default cart output into the Ploy mockup's calm,
   hairline-table look: no boxed grid, cream surfaces, pill buttons, generous
   vertical rhythm. Primary target is the CLASSIC shortcode cart
   ([woocommerce_cart] -> .woocommerce-cart-form + table.shop_table.cart);
   block-cart (.wc-block-cart) selectors are added at the end as a bonus.
   Everything is scoped under .cb-woo (the outer wrapper from woocommerce.php)
   so it never leaks onto archive/product/checkout templates.
   Loaded only on is_cart() via functions.php.
   ========================================================================== */

/* --- Page rhythm ---------------------------------------------------------- */
.cb-woo .woocommerce-cart-form { margin: 0 0 clamp(2rem, 4vw, 3rem); }

/* Desktop: cart form beside the totals panel; single column on mobile.
   The cart form and .cart-collaterals are adjacent siblings inside page.php's
   .cb-wc-page__content wrapper, so we lay THAT out as a grid. A grid contains
   its children (no floats to escape), which prevents the earlier bug where the
   floated columns overflowed and the footer bled up behind the cart. */
@media (min-width: 1000px) {
  .cb-woo .cb-wc-page__content {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
    gap: clamp(2rem, 4vw, 3.5rem);
    align-items: start;
  }
  .cb-woo .cb-wc-page__content .woocommerce-cart-form { width: auto; float: none; margin-bottom: 0; }
  .cb-woo .cb-wc-page__content .cart-collaterals { width: auto; float: none; }
}
/* Belt-and-suspenders: contain any float even before the grid kicks in so the
   footer can never overlap the cart. */
.cb-woo .cb-wc-page__content { display: flow-root; }
@media (min-width: 1000px) { .cb-woo .cb-wc-page__content { display: grid; } }

/* --- Cart table: clean hairline rows, not a boxed grid -------------------- */
/* WooCommerce's default stylesheet gives table.shop_table a full border, rounded
   box, and border-collapse tweaks. Neutralize the box so the table reads as
   open rows with hairline separators. !important beats Woo's own shop_table
   border rules which are equally specific. */
.cb-woo table.shop_table.cart,
.cb-woo table.cart {
  width: 100%;
  margin: 0;
  border: 0 !important;
  border-radius: 0 !important;
  border-collapse: collapse !important;
  background: transparent;
}
.cb-woo table.shop_table.cart thead th {
  padding: 0 0 1rem;
  border: 0;
  border-bottom: var(--cb-border-width) solid var(--cb-border);
  text-align: left;
  font-size: var(--cb-text-xs);
  font-weight: var(--cb-weight-heading);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cb-text-muted);
}
.cb-woo table.shop_table.cart tbody td {
  padding: 1.35rem 1rem 1.35rem 0;
  border: 0;
  border-bottom: var(--cb-border-width) solid var(--cb-border);
  vertical-align: middle;
  background: transparent;
  color: var(--cb-text);
}
.cb-woo table.shop_table.cart tbody tr.cart_item:last-child td { border-bottom: 0; }

/* Column alignment: price / quantity / subtotal read as a tidy right column. */
.cb-woo table.shop_table.cart th.product-price,
.cb-woo table.shop_table.cart th.product-subtotal,
.cb-woo table.shop_table.cart td.product-price,
.cb-woo table.shop_table.cart td.product-subtotal { text-align: right; }
.cb-woo table.shop_table.cart td.product-subtotal { font-weight: var(--cb-weight-heading); }

/* --- Remove item: small circular hairline button -------------------------- */
.cb-woo table.shop_table.cart td.product-remove { width: 2.75rem; padding-right: 0.5rem; }
/* Woo styles a.remove red with a large font-size; override to a quiet round chip
   that darkens to cocoa on hover. !important beats Woo's a.remove color rule. */
.cb-woo table.shop_table.cart td.product-remove a.remove,
.cb-woo td.product-remove a.remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: var(--cb-radius-pill);
  border: var(--cb-border-width) solid var(--cb-border);
  background: var(--cb-cream-light);
  color: var(--cb-text-muted) !important;
  font-size: var(--cb-text-base);
  line-height: 1;
  text-decoration: none;
  transition: background var(--cb-transition), color var(--cb-transition), border-color var(--cb-transition);
}
.cb-woo table.shop_table.cart td.product-remove a.remove:hover,
.cb-woo td.product-remove a.remove:hover {
  background: var(--cb-inverse);
  border-color: var(--cb-inverse);
  color: var(--cb-text-inverse) !important;
}

/* --- Thumbnail: rounded square -------------------------------------------- */
.cb-woo table.shop_table.cart td.product-thumbnail { width: 6rem; }
/* Woo core caps cart images at 32px; we want a proper thumbnail, so override. */
.cb-woo table.shop_table.cart td.product-thumbnail img {
  width: 5rem !important;
  height: 5rem;
  object-fit: cover;
  border-radius: var(--cb-radius-md);
  border: var(--cb-border-width) solid var(--cb-border);
}

/* --- Product name + price ------------------------------------------------- */
.cb-woo table.shop_table.cart td.product-name {
  font-size: var(--cb-text-base);
  line-height: 1.4;
}
.cb-woo table.shop_table.cart td.product-name a {
  color: var(--cb-text);
  font-weight: var(--cb-weight-medium);
  transition: color var(--cb-transition);
}
.cb-woo table.shop_table.cart td.product-name a:hover { color: var(--cb-accent); }
/* Variation / meta lines under the product name. */
.cb-woo table.shop_table.cart td.product-name dl.variation {
  margin: 0.4rem 0 0;
  font-size: var(--cb-text-sm);
  color: var(--cb-text-muted);
}
.cb-woo table.shop_table.cart td.product-name dl.variation dt,
.cb-woo table.shop_table.cart td.product-name dl.variation dd { display: inline; margin: 0; }
.cb-woo table.shop_table.cart td.product-price { color: var(--cb-text-muted); }

/* --- Quantity: match the PDP pill / number style -------------------------- */
.cb-woo table.shop_table.cart td.product-quantity .quantity { display: inline-flex; }
.cb-woo table.shop_table.cart td.product-quantity .quantity .qty {
  min-height: 3rem;
  width: 4.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--cb-radius-pill);
  border: var(--cb-border-width) solid var(--cb-border-strong);
  background: var(--cb-cream-light);
  color: var(--cb-text);
  font-size: var(--cb-text-base);
  font-weight: var(--cb-weight-medium);
  text-align: center;
}
.cb-woo table.shop_table.cart td.product-quantity .quantity .qty:focus {
  outline: none;
  border-color: var(--cb-accent);
}

/* --- Actions row: coupon + update cart ------------------------------------ */
.cb-woo table.shop_table.cart td.actions {
  padding: 1.75rem 0 0;
  border-bottom: 0;
}
.cb-woo table.shop_table.cart td.actions .coupon {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  float: none;
}
.cb-woo table.shop_table.cart td.actions .coupon label { display: none; }
/* Woo core sets the coupon field width via a percentage; give it a fixed,
   sensible field width instead so it does not stretch the toolbar. */
.cb-woo table.shop_table.cart td.actions .coupon .input-text,
.cb-woo table.shop_table.cart td.actions #coupon_code {
  width: 12rem !important;
  min-height: 3rem;
  padding: 0.7rem 1.1rem;
  border-radius: var(--cb-radius-pill);
  border: var(--cb-border-width) solid var(--cb-border-strong);
  background: var(--cb-cream-light);
  color: var(--cb-text);
  font-size: var(--cb-text-sm);
}
.cb-woo table.shop_table.cart td.actions .coupon .input-text:focus {
  outline: none;
  border-color: var(--cb-accent);
}

/* Apply coupon = ghost pill; Update cart = ghost pill floated right. Woo floats
   button[name="update_cart"] right by default; we keep that intent but skin it. */
.cb-woo table.shop_table.cart td.actions button.button,
.cb-woo table.shop_table.cart td.actions input.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--cb-radius-pill);
  border: var(--cb-border-width) solid var(--cb-btn-ghost-border);
  background: transparent;
  color: var(--cb-btn-ghost-text);
  font-weight: var(--cb-weight-heading);
  font-size: var(--cb-text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1;
  cursor: pointer;
  transition: background var(--cb-transition), color var(--cb-transition), border-color var(--cb-transition);
}
.cb-woo table.shop_table.cart td.actions button.button:hover,
.cb-woo table.shop_table.cart td.actions input.button:hover {
  background: var(--cb-btn-hover-bg);
  border-color: var(--cb-btn-hover-bg);
  color: var(--cb-btn-hover-text);
}
.cb-woo table.shop_table.cart td.actions button[name="update_cart"],
.cb-woo table.shop_table.cart td.actions input[name="update_cart"] {
  float: right;
}
.cb-woo table.shop_table.cart td.actions button[name="update_cart"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Cart totals panel: calm cream card ----------------------------------- */
.cb-woo .cart_totals {
  padding: clamp(1.5rem, 3vw, 2rem);
  background: var(--cb-surface);
  border: var(--cb-border-width) solid var(--cb-border);
  border-radius: var(--cb-radius-lg);
}
.cb-woo .cart_totals h2 {
  margin: 0 0 1.25rem;
  font-size: var(--cb-text-sm);
  font-weight: var(--cb-weight-heading);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cb-text-muted);
}
/* Totals table: hairline rows, no box. Woo borders these cells by default. */
.cb-woo .cart_totals table.shop_table {
  width: 100%;
  margin: 0;
  border: 0 !important;
  border-radius: 0 !important;
  border-collapse: collapse !important;
  background: transparent;
}
.cb-woo .cart_totals table.shop_table th,
.cb-woo .cart_totals table.shop_table td {
  padding: 0.85rem 0;
  border: 0;
  border-bottom: var(--cb-border-width) solid var(--cb-border);
  text-align: left;
  vertical-align: top;
  background: transparent;
  font-size: var(--cb-text-sm);
}
.cb-woo .cart_totals table.shop_table th {
  font-weight: var(--cb-weight-heading);
  color: var(--cb-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--cb-text-xs);
  width: 40%;
}
.cb-woo .cart_totals table.shop_table td { text-align: right; color: var(--cb-text); }
.cb-woo .cart_totals table.shop_table tr.order-total th,
.cb-woo .cart_totals table.shop_table tr.order-total td {
  border-bottom: 0;
  padding-top: 1.1rem;
  font-size: var(--cb-text-lg);
  color: var(--cb-text);
}
.cb-woo .cart_totals table.shop_table tr.order-total td { font-weight: var(--cb-weight-heading); }
.cb-woo .cart_totals .woocommerce-shipping-methods { list-style: none; margin: 0; padding: 0; }
.cb-woo .cart_totals .shipping-calculator-button {
  color: var(--cb-accent-2);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Proceed to checkout = primary pill, full width in the card. Woo core sets its
   own background/color, so override to the cocoa-filled button. */
.cb-woo .wc-proceed-to-checkout { margin-top: 1.5rem; padding: 0; }
.cb-woo .wc-proceed-to-checkout a.checkout-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--cb-radius-pill);
  border: var(--cb-border-width) solid var(--cb-btn-border);
  background: var(--cb-btn-bg) !important;
  color: var(--cb-btn-text) !important;
  font-weight: var(--cb-weight-heading);
  font-size: var(--cb-text-sm);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1;
  transition: background var(--cb-transition), color var(--cb-transition), border-color var(--cb-transition);
}
.cb-woo .wc-proceed-to-checkout a.checkout-button:hover {
  background: var(--cb-btn-hover-bg) !important;
  border-color: var(--cb-btn-hover-bg);
  color: var(--cb-btn-hover-text) !important;
}

/* --- Cross-sells: reuse the shop product-card grid ------------------------ */
.cb-woo .cross-sells {
  clear: both;
  width: 100%;
  float: none;
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.cb-woo .cross-sells > h2 {
  font-size: var(--cb-text-3xl);
  margin-bottom: 1.5rem;
}
/* Cross-sell products render our content-product.php cards, so they reuse the
   .cb-product-card grid + card styling from woo-shop.css (also enqueued on the
   cart via functions.php). Just re-assert the grid in case only this file loads. */
.cb-woo .cross-sells ul.products {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 700px)  { .cb-woo .cross-sells ul.products { grid-template-columns: repeat(3, 1fr); } }

/* --- Empty cart state ----------------------------------------------------- */
.cb-woo .cart-empty,
.cb-woo .wc-empty-cart-message {
  margin: clamp(2rem, 5vw, 3.5rem) auto 1.5rem;
  max-width: 34rem;
  text-align: center;
  font-size: var(--cb-text-lg);
  color: var(--cb-text-muted);
}
.cb-woo .return-to-shop {
  text-align: center;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.cb-woo .return-to-shop .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.85rem 1.8rem;
  border-radius: var(--cb-radius-pill);
  border: var(--cb-border-width) solid var(--cb-btn-border);
  background: var(--cb-btn-bg) !important;
  color: var(--cb-btn-text) !important;
  font-weight: var(--cb-weight-heading);
  font-size: var(--cb-text-sm);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1;
  transition: background var(--cb-transition), color var(--cb-transition), border-color var(--cb-transition);
}
.cb-woo .return-to-shop .button:hover {
  background: var(--cb-btn-hover-bg) !important;
  border-color: var(--cb-btn-hover-bg);
  color: var(--cb-btn-hover-text) !important;
}

/* --- Responsive: stacked cart table on narrow screens --------------------
   WooCommerce adds .shop_table_responsive and, at its own mobile breakpoint,
   stacks each cell with a generated td::before label. We skin that stacked
   layout so it reads as a clean per-item card, and ensure a wide table never
   forces horizontal page scroll (it scrolls inside its own wrapper instead). */
.cb-woo .woocommerce-cart-form { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 767.98px) {
  .cb-woo table.shop_table.cart,
  .cb-woo table.shop_table.cart tbody { display: block; width: 100%; }
  .cb-woo table.shop_table.cart thead { display: none; }
  .cb-woo table.shop_table.cart tbody tr.cart_item {
    display: block;
    padding: 1.15rem 0;
    border-bottom: var(--cb-border-width) solid var(--cb-border);
  }
  .cb-woo table.shop_table.cart tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border: 0;
    text-align: right;
  }
  /* Woo prints the column label into td::before on stacked rows; style it as a
     small muted caps label on the left of each row. */
  .cb-woo table.shop_table.cart tbody td::before {
    content: attr(data-title);
    font-size: var(--cb-text-xs);
    font-weight: var(--cb-weight-heading);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--cb-text-muted);
    text-align: left;
  }
  .cb-woo table.shop_table.cart tbody td.product-remove,
  .cb-woo table.shop_table.cart tbody td.product-thumbnail { justify-content: flex-start; }
  .cb-woo table.shop_table.cart tbody td.product-remove::before,
  .cb-woo table.shop_table.cart tbody td.product-thumbnail::before { content: none; }
  .cb-woo table.shop_table.cart td.actions {
    display: block;
    padding-top: 1.25rem;
  }
  .cb-woo table.shop_table.cart td.actions .coupon { width: 100%; }
  .cb-woo table.shop_table.cart td.actions .coupon .input-text,
  .cb-woo table.shop_table.cart td.actions #coupon_code { flex: 1 1 auto; width: auto !important; }
  .cb-woo table.shop_table.cart td.actions button[name="update_cart"],
  .cb-woo table.shop_table.cart td.actions input[name="update_cart"] {
    float: none;
    width: 100%;
    margin-top: 0.75rem;
  }
}

/* Single-column stacking for the form + totals below the desktop breakpoint. */
@media (max-width: 999.98px) {
  .cb-woo .woocommerce-cart-form,
  .cb-woo .cart-collaterals { width: 100%; float: none; }
  .cb-woo .cart-collaterals { margin-top: 1.5rem; }
}

/* ==========================================================================
   Block cart bonus (.wc-block-cart, [woocommerce/cart] block)
   Light skin so a block-based cart still reads on-brand. The classic shortcode
   cart above is the primary target.
   ========================================================================== */
.cb-woo .wc-block-cart__totals-title {
  font-size: var(--cb-text-sm);
  font-weight: var(--cb-weight-heading);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cb-text-muted);
}
.cb-woo .wc-block-cart .wc-block-components-sidebar {
  padding: clamp(1.5rem, 3vw, 2rem);
  background: var(--cb-surface);
  border: var(--cb-border-width) solid var(--cb-border);
  border-radius: var(--cb-radius-lg);
}
.cb-woo .wc-block-cart-items__row {
  border-bottom: var(--cb-border-width) solid var(--cb-border);
}
.cb-woo .wc-block-cart-item__image img {
  border-radius: var(--cb-radius-md);
  border: var(--cb-border-width) solid var(--cb-border);
}
.cb-woo .wc-block-components-product-name {
  color: var(--cb-text);
  font-weight: var(--cb-weight-medium);
}
.cb-woo .wc-block-components-product-name:hover { color: var(--cb-accent); }
.cb-woo .wc-block-cart__submit-button,
.cb-woo .wc-block-components-button.contained {
  border-radius: var(--cb-radius-pill) !important;
  background: var(--cb-btn-bg) !important;
  color: var(--cb-btn-text) !important;
  font-weight: var(--cb-weight-heading);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.cb-woo .wc-block-components-button.contained:hover {
  background: var(--cb-btn-hover-bg) !important;
  color: var(--cb-btn-hover-text) !important;
}
