/* ==========================================================================
   Cart page only (items list, stepper, empty cart, recommendations).
   Shared cart + checkout rules are in wc-blocks.css, which loads first.
   ========================================================================== */

/* ---- Items --------------------------------------------------------------- */

body.woocommerce-cart table.wc-block-cart-items,
body.woocommerce-cart table.wc-block-cart-items tbody {
  display: block;
  width: 100%;
  border: 0;
}

body.woocommerce-cart table.wc-block-cart-items {
  border-top: 1px solid var(--sffr-line);
}

body.woocommerce-cart table.wc-block-cart-items thead {
  display: none;
}

body.woocommerce-cart .wc-block-cart table.wc-block-cart-items .wc-block-cart-items__row {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  grid-template-areas:
    'img name  total'
    'img price qty'
    'img meta  remove';
  column-gap: 1.25rem;
  row-gap: 0.25rem;
  align-items: start;
  padding: 1rem 0;
  border-bottom: 1px solid var(--sffr-line);
}

/* Compact row: the product cell and its wrappers dissolve so that name, price,
   weight, stepper, total and "Usuń" are all direct grid items of the row. */
body.woocommerce-cart .wc-block-cart table.wc-block-cart-items .wc-block-cart-items__row > td.wc-block-cart-item__product,
body.woocommerce-cart .wc-block-cart-item__wrap,
body.woocommerce-cart .wc-block-cart-item__quantity {
  display: contents;
}

/* WooCommerce gives each of these a bottom margin (12-40px); the grid uses row-gap instead. */
body.woocommerce-cart .wc-block-cart table.wc-block-cart-items .wc-block-cart-items__row > td,
body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-cart-item__wrap > *,
body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-cart-item__quantity > * {
  margin-top: 0;
  margin-bottom: 0;
}

body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-cart-item__image { grid-area: img; }
body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-cart-item__wrap > .wc-block-components-product-name { grid-area: name; }
body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-cart-item__prices { grid-area: price; }
body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-components-product-metadata { grid-area: meta; }
body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-components-quantity-selector { grid-area: qty; justify-self: end; align-self: center; }
body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-cart-item__remove-link { grid-area: remove; justify-self: end; align-self: end; }
body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-cart-item__total { grid-area: total; justify-self: end; align-self: start; }

body.woocommerce-cart .wc-block-cart table.wc-block-cart-items .wc-block-cart-items__row > td {
  display: block;
  padding: 0;
  border: 0;
  background: none;
}

body.woocommerce-cart .wc-block-cart-item__image {
  width: auto;
}

body.woocommerce-cart .wc-block-cart-item__image a {
  display: block;
}

body.woocommerce-cart .wc-block-cart-item__image img {
  display: block;
  width: 6.5rem;
  max-width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 15px;
  background: var(--sffr-surface-low);
}

body.woocommerce-cart .wc-block-components-product-name {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--sffr-ink);
}

body.woocommerce-cart .wc-block-components-product-name:hover,
body.woocommerce-cart .wc-block-components-product-name:focus-visible {
  color: var(--sffr-deep);
}

body.woocommerce-cart .wc-block-cart-item__prices,
body.woocommerce-cart .wc-block-cart-item__prices .wc-block-components-product-price {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--sffr-muted);
}

/* Weight / volume line from the short description, shown as a small pill. */
body.woocommerce-cart .wc-block-components-product-metadata {
  margin: 0;
  align-self: start;
  justify-self: start;
}

body.woocommerce-cart .wc-block-components-product-metadata__description p {
  display: inline-block;
  margin: 0;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: rgba(253, 183, 66, 0.35);
  color: var(--sffr-on-accent);
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Quantity stepper: blush pill with round buttons, like the product card. */
body.woocommerce-cart .wc-block-components-quantity-selector {
  display: inline-flex;
  align-items: center;
  width: auto;
  margin: 0;
  padding: 4px;
  gap: 0.25rem;
  border-radius: 999px;
  background: var(--sffr-surface-low);
  box-shadow: none;
}

body.woocommerce-cart .wc-block-components-quantity-selector::after {
  display: none;
}

body.woocommerce-cart .wc-block-components-quantity-selector__input {
  order: 2;
  width: 2.5rem;
  min-width: 0;
  height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--sffr-ink);
  -moz-appearance: textfield;
  appearance: textfield;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button {
  position: static;
  width: 2rem;
  height: 2rem;
  min-width: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--sffr-surface);
  color: var(--sffr-brand);
  font-size: 1rem;
  line-height: 1;
  opacity: 1;
  transition: background-color 0.15s ease, color 0.15s ease;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button--minus {
  order: 1;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button--plus {
  order: 3;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button:hover:not(:disabled),
body.woocommerce-cart .wc-block-components-quantity-selector__button:focus-visible:not(:disabled) {
  background: var(--sffr-brand);
  color: var(--sffr-on-brand);
}

body.woocommerce-cart .wc-block-components-quantity-selector__button:disabled {
  opacity: 0.4;
}

body.woocommerce-cart .wc-block-cart-item__remove-link {
  padding: 0.25rem 0;
  border: 0;
  background: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: var(--sffr-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.woocommerce-cart .wc-block-cart-item__remove-link:hover,
body.woocommerce-cart .wc-block-cart-item__remove-link:focus-visible {
  background: none;
  color: var(--sffr-error);
}

body.woocommerce-cart .wc-block-cart-item__total {
  text-align: right;
  white-space: nowrap;
}

body.woocommerce-cart .wc-block-cart-item__total .wc-block-components-product-price {
  font-family: 'Inter', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--sffr-deep);
  font-variant-numeric: tabular-nums;
}

/* ---- Empty cart ---------------------------------------------------------- */

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block {
  padding: 3.5rem 1rem;
  border-radius: 20px;
  background: var(--sffr-surface-low);
  text-align: center;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block h2 {
  font-family: 'Quicksand', sans-serif;
  color: var(--sffr-ink);
}

/* ---- Phone: item rows ---------------------------------------------------- */

@media (max-width: 560px) {
  body.woocommerce-cart .wc-block-cart table.wc-block-cart-items .wc-block-cart-items__row {
    grid-template-columns: 5rem minmax(0, 1fr) auto auto;
    grid-template-areas:
      'img name  name  name'
      'img price price price'
      'img meta  meta  meta'
      'qty qty   total remove';
    column-gap: 1rem;
    row-gap: 0.25rem;
    align-items: center;
  }

  body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-components-quantity-selector { margin-top: 0.5rem; }
  body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-cart-item__total,
  body.woocommerce-cart .wc-block-cart .wc-block-cart-items__row .wc-block-cart-item__remove-link { margin-top: 0.5rem; margin-right: 0; align-self: center; }

  body.woocommerce-cart .wc-block-cart-item__image img {
    width: 5rem;
  }
}

/* ---- "Polecane do koszyka" (Elementor template under the cart) ----------- */

body.woocommerce-cart .sffrhs-cart-recs {
  margin-top: 4rem;
}

/* WooCommerce's mobile layout pins the total cell to grid row 1; put it back in its area. */
body.woocommerce-cart .wc-block-cart.wc-block-cart table.wc-block-cart-items .wc-block-cart-items__row > td.wc-block-cart-item__total {
  grid-area: total;
}

/* ---- Empty cart: banner (icon, text, CTA) + "Popularne produkty" below ---- */

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block {
  padding: 0;
  background: none;
  text-align: left;
}

body.woocommerce-cart .sffrhs-empty {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 1.75rem 2rem;
  border-radius: 20px;
  background: var(--sffr-surface-low);
}

body.woocommerce-cart .sffrhs-empty__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 5rem;
  height: 5.5rem;
  background: var(--sffr-accent);
  color: var(--sffr-on-accent);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

body.woocommerce-cart .sffrhs-empty__icon svg {
  width: 32px;
  height: 32px;
}

body.woocommerce-cart .sffrhs-empty__text {
  flex: 1;
  min-width: 14rem;
}

body.woocommerce-cart .sffrhs-empty__title {
  margin: 0 0 0.35rem;
  font-family: 'Quicksand', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--sffr-ink);
}

body.woocommerce-cart .sffrhs-empty__text p {
  margin: 0;
  max-width: 34rem;
  font-family: 'Inter', sans-serif;
  color: var(--sffr-muted);
}

body.woocommerce-cart .page-content a.sffrhs-empty__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3.25rem;
  padding: 0 1.75rem;
  border-radius: 999px;
  background: var(--sffr-accent);
  color: var(--sffr-on-accent);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body.woocommerce-cart .page-content a.sffrhs-empty__cta:hover,
body.woocommerce-cart .page-content a.sffrhs-empty__cta:focus-visible {
  background: #ffcb6b; /* same hover as the homepage hero button */
  color: var(--sffr-on-accent);
}

body.woocommerce-cart .sffrhs-empty__cta svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 560px) {
  body.woocommerce-cart .sffrhs-empty {
    padding: 1.25rem;
  }
}

/* Cart summary: no shipping option list, the checkout is where the method is chosen. The row shows the cheapest one. */
.woocommerce-cart .wp-block-woocommerce-cart-order-summary-shipping-block .wc-block-components-totals-shipping__collaterals {
  display: none;
}
