/*
 * Single cart page (body.woocommerce-cart). Restyles WooCommerce's own classic cart template
 * (table.woocommerce-cart-form__contents + .cart_totals), which had zero theme CSS targeting it
 * until now — found live 2026-08-15: the empty-cart notice, "Return to shop" button, item table,
 * coupon form and "Proceed to checkout" button were all rendering as raw, unstyled Storefront/
 * WooCommerce defaults (default blue notice banner, plain gray buttons) even though the cart
 * DRAWER (overlay.css) has been fully styled since early in the project — the full /cart/ page is
 * a secondary surface (reached via back button, direct link, non-JS fallback) but still fully
 * public, so it needs the same brand treatment. Pattern mirrors checkout.css throughout.
 */

.woocommerce-cart .page-title {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
  font-size: var(--font-size-h1);
  line-height: var(--line-height-heading);
  color: var(--color-text-primary);
  padding: var(--space-8) 0 var(--space-6);
  margin: 0;
  text-align: center;
}
.woocommerce-cart .page-header { border-bottom: var(--border-width) solid var(--color-border-default); margin-bottom: var(--space-8); }
.woocommerce-cart .content-area .woocommerce { max-width: 1260px; margin: 0 auto; padding: 0 var(--space-6) var(--space-9); }

/* ================= Notices (empty cart, coupon errors) ================= */
.woocommerce-cart .woocommerce-info,
.woocommerce-cart .woocommerce-error,
.woocommerce-cart .woocommerce-message {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
  background: var(--color-background-surface);
  border: var(--border-width) solid var(--color-border-default);
  border-left: 3px solid var(--color-text-muted);
  border-radius: var(--radius-medium);
  padding: var(--space-5);
  margin: 0 0 var(--space-6);
  list-style: none;
}
.woocommerce-cart .woocommerce-error { border-left-color: var(--color-error); }
.woocommerce-cart .woocommerce-message { border-left-color: var(--color-success); }
.woocommerce-cart .woocommerce-info::before,
.woocommerce-cart .woocommerce-error::before,
.woocommerce-cart .woocommerce-message::before { display: none; }
.woocommerce-cart .woocommerce-info a,
.woocommerce-cart .woocommerce-message a { color: var(--color-action-primary); text-decoration: underline; }

/* Empty-cart "Return to shop" — same visual weight as every other primary CTA sitewide */
.woocommerce-cart .wc-empty-cart-message + .return-to-shop,
.woocommerce-cart .return-to-shop { margin-top: var(--space-2); }
.woocommerce-cart .return-to-shop .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-btn-padding);
  background: var(--color-action-primary);
  color: var(--color-text-on-accent);
  border: none;
  border-radius: var(--radius-small);
  font-family: var(--font-body);
  font-weight: var(--font-weight-body);
  font-size: var(--font-size-button);
  letter-spacing: var(--letter-spacing-button);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--animation-duration) var(--animation-easing);
}
.woocommerce-cart .return-to-shop .button:hover { background: var(--color-background-accent-hover); }

/* ================= Layout: items + totals sidebar ================= */
.woocommerce-cart form.woocommerce-cart-form { margin-bottom: var(--space-8); }
@media (min-width: 1024px) {
  .woocommerce-cart .woocommerce { display: grid; grid-template-columns: 1.6fr 1fr; gap: 60px; align-items: start; }
  .woocommerce-cart form.woocommerce-cart-form { grid-column: 1; margin-bottom: 0; }
  .woocommerce-cart .cart-collaterals { grid-column: 2; }
}

/* ================= Item table ================= */
.woocommerce-cart table.shop_table.cart {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--space-6);
}
.woocommerce-cart table.shop_table.cart thead th {
  text-align: left;
  font-size: var(--font-size-label);
  letter-spacing: var(--letter-spacing-label);
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-body);
  padding: 0 var(--space-3) var(--space-3);
  border-bottom: var(--border-width) solid var(--color-border-default);
}
.woocommerce-cart table.shop_table.cart thead th:first-child { padding-left: 0; }
.woocommerce-cart table.shop_table.cart thead th:last-child { padding-right: 0; }
.woocommerce-cart table.shop_table.cart thead th.product-subtotal,
.woocommerce-cart table.shop_table.cart thead th.product-price { text-align: right; }
.woocommerce-cart table.shop_table.cart tbody tr.cart_item { border-bottom: var(--border-width) solid var(--color-border-default); }
.woocommerce-cart table.shop_table.cart td {
  padding: var(--space-5) var(--space-3);
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
  vertical-align: middle;
}
.woocommerce-cart table.shop_table.cart td.product-remove { padding-right: 0; width: 32px; }
.woocommerce-cart table.shop_table.cart td.product-remove a.remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--color-text-muted);
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  transition: background var(--animation-duration) var(--animation-easing), color var(--animation-duration) var(--animation-easing);
}
.woocommerce-cart table.shop_table.cart td.product-remove a.remove:hover { background: var(--color-background-primary); color: var(--color-error); }
.woocommerce-cart table.shop_table.cart td.product-thumbnail { width: 88px; padding-left: 0; }
.woocommerce-cart table.shop_table.cart td.product-thumbnail img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-small);
  background: var(--color-border-default);
}
.woocommerce-cart table.shop_table.cart td.product-name a {
  color: var(--color-text-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.woocommerce-cart table.shop_table.cart td.product-name a:hover { border-bottom-color: currentColor; }
.woocommerce-cart table.shop_table.cart td.product-price,
.woocommerce-cart table.shop_table.cart td.product-subtotal { text-align: right; white-space: nowrap; }
.woocommerce-cart table.shop_table.cart td.product-subtotal .woocommerce-Price-amount { font-weight: var(--font-weight-emphasis); }

/* Quantity input — same visual language as .qty__input on the product page, without the JS
   stepper buttons (WC's own cart-table markup is a bare <input>, no +/- wrapper to hook into). */
.woocommerce-cart table.shop_table.cart .quantity { display: inline-flex; }
.woocommerce-cart table.shop_table.cart input.qty {
  width: 64px;
  height: var(--qty-control-size, 40px);
  padding: 0 var(--space-2);
  border: var(--border-width) solid var(--color-border-default);
  border-radius: var(--radius-small);
  background: var(--color-background-surface);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
  text-align: center;
}
.woocommerce-cart table.shop_table.cart input.qty:focus-visible { outline: none; box-shadow: inset 0 0 0 1.5px var(--color-action-primary); }
.woocommerce-cart table.shop_table.cart input.qty::-webkit-inner-spin-button,
.woocommerce-cart table.shop_table.cart input.qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* data-title labels WooCommerce prints for the mobile stacked layout (Storefront's own responsive
   breakpoint for .shop_table_responsive — kept as-is, only the label typography is themed here) */
.woocommerce-cart table.shop_table_responsive tr td::before {
  font-family: var(--font-body);
  font-size: var(--font-size-label);
  letter-spacing: var(--letter-spacing-label);
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-body);
}

/**
 * Real bug, found live 2026-08-15: below Storefront's own 768px breakpoint, .product-remove and
 * .product-thumbnail carry no [data-title] (icon-only columns), so Storefront's default
 * `display:block` stack renders them as two small left-aligned boxes floating above the labeled
 * rows, with the row's own white background exposed as dead space to their right — reads as a
 * layout bug even though nothing is technically overlapping. Recomposing the row as a small grid
 * (thumbnail as a left rail, remove as an absolute-positioned corner icon, everything else
 * stacked in the right column) matches the same "image + stacked details" composition already
 * established and approved in the cart drawer (.cart-drawer__item, overlay.css) instead of
 * leaving Storefront's bare label-list default.
 */
@media (max-width: 767px) {
  .woocommerce-cart table.shop_table.cart tbody tr.cart_item {
    display: grid;
    grid-template-columns: 72px 1fr;
    column-gap: var(--space-4);
    position: relative;
    padding: var(--space-5) var(--space-3);
  }
  .woocommerce-cart table.shop_table.cart td.product-remove {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    padding: 0;
  }
  .woocommerce-cart table.shop_table.cart td.product-thumbnail {
    grid-column: 1;
    grid-row: 1 / span 4;
    padding: 0;
    align-self: start;
  }
  .woocommerce-cart table.shop_table.cart td.product-name,
  .woocommerce-cart table.shop_table.cart td.product-price,
  .woocommerce-cart table.shop_table.cart td.product-quantity,
  .woocommerce-cart table.shop_table.cart td.product-subtotal {
    grid-column: 2;
    text-align: left;
    padding: 0 0 var(--space-2);
  }
  .woocommerce-cart table.shop_table.cart td.product-subtotal { padding-bottom: 0; }
  .woocommerce-cart table.shop_table.cart td::before { display: none; }
}

/* ================= Coupon + update-cart actions row ================= */
.woocommerce-cart table.shop_table.cart tfoot .actions { padding: var(--space-5) var(--space-3) 0; border-top: none; }
.woocommerce-cart .coupon {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
}
.woocommerce-cart .coupon .input-text {
  flex: 1 1 180px;
  min-height: 44px;
  padding: 0 var(--space-4);
  border: var(--border-width) solid var(--color-border-default);
  border-radius: var(--radius-small);
  background: var(--color-background-surface);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
}
.woocommerce-cart .coupon .input-text:focus-visible { outline: none; border-color: var(--color-action-primary); }
.woocommerce-cart .coupon .button,
.woocommerce-cart button[name="update_cart"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--space-btn-padding);
  background: transparent;
  color: var(--color-text-primary);
  border: 1px solid var(--color-text-primary);
  border-radius: var(--radius-small);
  font-family: var(--font-body);
  font-weight: var(--font-weight-body);
  font-size: var(--font-size-button);
  letter-spacing: var(--letter-spacing-button);
  cursor: pointer;
  transition: background var(--animation-duration) var(--animation-easing);
}
.woocommerce-cart .coupon .button:hover,
.woocommerce-cart button[name="update_cart"]:hover { background: color-mix(in srgb, var(--color-text-primary) 6%, transparent); }
.woocommerce-cart button[name="update_cart"]:disabled {
  border-color: var(--color-action-primary-disabled);
  color: var(--color-text-muted);
  cursor: not-allowed;
  background: transparent;
}

/* ================= Totals sidebar ================= */
.woocommerce-cart .cart_totals {
  background: var(--color-background-surface);
  border: var(--border-width) solid var(--color-border-default);
  border-radius: var(--radius-medium);
  padding: var(--space-6);
}
.woocommerce-cart .cart_totals h2 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
  font-size: var(--font-size-h3);
  color: var(--color-text-primary);
  margin: 0 0 var(--space-5);
}
.woocommerce-cart .cart_totals table.shop_table { width: 100%; border-collapse: collapse; }
.woocommerce-cart .cart_totals table.shop_table tr th,
.woocommerce-cart .cart_totals table.shop_table tr td {
  padding: var(--space-3) 0;
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
  border-bottom: var(--border-width) solid var(--color-border-default);
  text-align: left;
  vertical-align: top;
}
.woocommerce-cart .cart_totals table.shop_table tr th { font-weight: var(--font-weight-body); width: 40%; }
.woocommerce-cart .cart_totals table.shop_table tr td { text-align: right; }
/**
 * Real bug, found live 2026-08-15: the order-total row inherited the same 40%/60% th/td width
 * split as every other totals row, but at this row's larger --font-size-h3 the price didn't fit
 * in ~60% of the sidebar's ~230px width (the sidebar is a narrow fixed grid column on desktop,
 * not full page width) — "1 490,00 ₴" wrapped mid-number into "1" on one line and "490,00 ₴" on
 * the next. A flex row with space-between sizes each side to its own content instead of a fixed
 * percentage, so the label and price sit on one line regardless of container width.
 */
.woocommerce-cart .cart_totals table.shop_table tr.order-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}
.woocommerce-cart .cart_totals table.shop_table tr.order-total th,
.woocommerce-cart .cart_totals table.shop_table tr.order-total td {
  width: auto;
  white-space: nowrap;
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-emphasis);
  border-bottom: none;
  padding-top: var(--space-4);
}
.woocommerce-cart .cart_totals table.shop_table tr.order-total td .woocommerce-Price-amount { font-weight: var(--font-weight-emphasis); }
.woocommerce-cart .woocommerce-shipping-destination { margin: var(--space-2) 0 0; font-size: var(--font-size-label); color: var(--color-text-muted); }
.woocommerce-cart .shipping-calculator-button {
  display: inline-block;
  margin-top: var(--space-2);
  color: var(--color-action-primary);
  font-size: var(--font-size-label);
  text-decoration: underline;
}
.woocommerce-cart .shipping-calculator-form { margin-top: var(--space-4); }
.woocommerce-cart .shipping-calculator-form .form-row { margin: 0 0 var(--space-3); }
.woocommerce-cart .shipping-calculator-form label { display: block; font-size: var(--font-size-label); color: var(--color-text-muted); margin-bottom: var(--space-1); }
.woocommerce-cart .shipping-calculator-form input.input-text,
.woocommerce-cart .shipping-calculator-form select {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-4);
  border: var(--border-width) solid var(--color-border-default);
  border-radius: var(--radius-small);
  background: var(--color-background-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  color: var(--color-text-primary);
}
.woocommerce-cart .shipping-calculator-form button[name="calc_shipping"] {
  margin-top: var(--space-3);
  min-height: 40px;
  padding: 0 var(--space-5);
  background: transparent;
  border: 1px solid var(--color-text-primary);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: var(--font-size-button);
  color: var(--color-text-primary);
  cursor: pointer;
}

.woocommerce-cart .wc-proceed-to-checkout { margin-top: var(--space-6); }
.woocommerce-cart .wc-proceed-to-checkout .checkout-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  background: var(--color-background-accent);
  color: var(--color-text-on-accent);
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: var(--font-size-button, 13px);
  font-weight: var(--font-weight-emphasis);
  letter-spacing: var(--letter-spacing-button, 0.03em);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--animation-duration) var(--animation-easing);
}
.woocommerce-cart .wc-proceed-to-checkout .checkout-button:hover { background: var(--color-background-accent-hover); }
