/*
 * AMUI v2.0.4
 * Koszyk: dopięcie układu pozycji, naprawa duplikatu „RazemRazem” i wspólne miękkie tło dla kluczowych stron.
 */

:root {
  --amui-page-soft: #eef0f2;
  --amui-cart-orange: var(--amui-accent, #ff5a00);
  --amui-cart-teal: #00796b;
  --amui-cart-text: var(--amui-text, #1f2937);
  --amui-cart-muted: var(--amui-muted, #64748b);
  --amui-cart-line: var(--amui-line, #e2e8f0);
}

/* To tło z koszyka sprawdza się najlepiej pod białe karty, więc spójnie przenosimy je na kluczowe widoki. */
body.home,
body.front-page,
body.amui-soft-bg,
body.woocommerce-shop,
body.post-type-archive-product,
body.tax-product_cat,
body.tax-product_tag,
body.woocommerce-cart,
body.woocommerce-checkout,
body.woocommerce-account {
  background: var(--amui-page-soft) !important;
  background-color: var(--amui-page-soft) !important;
}

body.home::before,
body.front-page::before,
body.amui-soft-bg::before,
body.woocommerce-shop::before,
body.post-type-archive-product::before,
body.tax-product_cat::before,
body.tax-product_tag::before,
body.woocommerce-cart::before,
body.woocommerce-checkout::before,
body.woocommerce-account::before {
  background: var(--amui-page-soft) !important;
  background-color: var(--amui-page-soft) !important;
}

body.woocommerce-cart .site-content,
body.woocommerce-checkout .site-content,
body.woocommerce-account .site-content,
body.woocommerce-shop .site-content,
body.post-type-archive-product .site-content,
body.home .site-content,
body.front-page .site-content,
body.amui-soft-bg .site-content {
  background: transparent !important;
}

/* Prawy panel: usuń pseudo-label WooCommerce, który na niektórych szerokościach robił „RazemRazem”. */
body.woocommerce-cart .cart_totals table.shop_table tr.order-total td::before,
body.woocommerce-cart .cart_totals table.shop_table tr.order-total th::before,
body.woocommerce-cart .cart_totals table.shop_table tr.order-total td::after,
body.woocommerce-cart .cart_totals table.shop_table tr.order-total th::after,
body.woocommerce-cart .cart_totals table.shop_table td[data-title]::before {
  content: none !important;
  display: none !important;
}

body.woocommerce-cart .cart_totals table.shop_table tr.order-total {
  display: grid !important;
  grid-template-columns: minmax(70px, auto) minmax(0, 1fr) !important;
  column-gap: 18px !important;
  align-items: center !important;
  padding: 0 0 18px !important;
  border: 0 !important;
}

body.woocommerce-cart .cart_totals table.shop_table tr.order-total th {
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  padding: 0 !important;
  color: var(--amui-cart-text) !important;
  font-size: 15px !important;
  line-height: 1.2 !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  border: 0 !important;
  background: transparent !important;
}

body.woocommerce-cart .cart_totals table.shop_table tr.order-total td {
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  padding: 0 !important;
  text-align: right !important;
  border: 0 !important;
  background: transparent !important;
}

body.woocommerce-cart .cart_totals table.shop_table tr.order-total td,
body.woocommerce-cart .cart_totals table.shop_table tr.order-total strong,
body.woocommerce-cart .cart_totals table.shop_table tr.order-total .amount,
body.woocommerce-cart .cart_totals table.shop_table tr.order-total bdi {
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}

/* Produkt w koszyku: jedna stabilna linia akcji po prawej bez nachodzenia na siebie. */
@media (min-width: 1181px) {
  body.woocommerce-cart table.shop_table.cart tbody tr.cart_item {
    grid-template-columns: 210px minmax(230px, 1fr) 154px minmax(155px, max-content) 48px !important;
    column-gap: 18px !important;
    row-gap: 8px !important;
    padding: 20px 24px !important;
    min-height: 148px !important;
    overflow: visible !important;
  }

  body.woocommerce-cart table.shop_table.cart .product-thumbnail {
    grid-column: 1 !important;
    grid-row: 1 / span 2 !important;
  }

  body.woocommerce-cart table.shop_table.cart .product-name {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: end !important;
  }

  body.woocommerce-cart table.shop_table.cart .product-price {
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: start !important;
  }

  body.woocommerce-cart table.shop_table.cart .product-quantity {
    grid-column: 3 !important;
    grid-row: 1 / span 2 !important;
    justify-self: center !important;
    align-self: center !important;
    min-width: 154px !important;
    width: 154px !important;
    max-width: 154px !important;
  }

  body.woocommerce-cart table.shop_table.cart .product-subtotal {
    grid-column: 4 !important;
    grid-row: 1 / span 2 !important;
    justify-self: end !important;
    align-self: center !important;
    min-width: 155px !important;
    width: max-content !important;
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    text-align: right !important;
    font-size: clamp(22px, 1.75vw, 27px) !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
  }

  body.woocommerce-cart table.shop_table.cart .product-remove {
    grid-column: 5 !important;
    grid-row: 1 / span 2 !important;
    justify-self: end !important;
    align-self: center !important;
    width: 46px !important;
    min-width: 46px !important;
  }
}

@media (min-width: 1181px) and (max-width: 1380px) {
  body.woocommerce-cart .entry-content > .woocommerce,
  body.woocommerce-cart .ast-woocommerce-container > .woocommerce,
  body.woocommerce-cart #primary > .woocommerce,
  body.woocommerce-cart .woocommerce.amui-cart-root {
    grid-template-columns: minmax(0, 1fr) minmax(330px, 370px) !important;
    gap: 18px !important;
  }

  body.woocommerce-cart table.shop_table.cart tbody tr.cart_item {
    grid-template-columns: 185px minmax(205px, 1fr) 142px minmax(140px, max-content) 44px !important;
    column-gap: 14px !important;
    padding: 18px 20px !important;
  }

  body.woocommerce-cart .amui-cart-thumb-wrap {
    grid-template-columns: 24px 120px !important;
    gap: 12px !important;
  }

  body.woocommerce-cart .amui-cart-thumb-media,
  body.woocommerce-cart table.cart img,
  body.woocommerce-cart table.shop_table.cart .product-thumbnail img,
  body.woocommerce-cart .amui-cart-thumb-media img {
    width: 120px !important;
    height: 98px !important;
    max-width: 120px !important;
  }

  body.woocommerce-cart table.shop_table.cart .product-quantity {
    min-width: 142px !important;
    width: 142px !important;
    max-width: 142px !important;
  }

  body.woocommerce-cart table.shop_table.cart .quantity {
    width: 142px !important;
    max-width: 142px !important;
  }

  body.woocommerce-cart table.shop_table.cart .quantity .qty {
    width: 54px !important;
    max-width: 54px !important;
    flex: 0 0 54px !important;
  }

  body.woocommerce-cart table.shop_table.cart .amui-qty-btn {
    width: 44px !important;
    flex: 0 0 44px !important;
  }

  body.woocommerce-cart table.shop_table.cart .product-subtotal {
    min-width: 140px !important;
    font-size: 23px !important;
  }
}

/* Kontroler ilości: zawsze trzy widoczne pola: minus, liczba, plus. */
body.woocommerce-cart table.shop_table.cart .quantity {
  display: inline-flex !important;
  align-items: stretch !important;
  justify-content: center !important;
  width: 154px !important;
  max-width: 154px !important;
  height: 46px !important;
  min-height: 46px !important;
  border: 1px solid #94a3b8 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  background: #fff !important;
}

body.woocommerce-cart table.shop_table.cart .quantity .qty {
  display: block !important;
  width: 62px !important;
  max-width: 62px !important;
  height: 46px !important;
  min-height: 46px !important;
  flex: 0 0 62px !important;
  padding: 0 !important;
  border: 0 !important;
  border-left: 1px solid #94a3b8 !important;
  border-right: 1px solid #94a3b8 !important;
  border-radius: 0 !important;
  background: #fff !important;
  color: var(--amui-cart-text) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  text-align: center !important;
  box-shadow: none !important;
}

body.woocommerce-cart table.shop_table.cart .amui-qty-btn {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 46px !important;
  height: 46px !important;
  min-height: 46px !important;
  flex: 0 0 46px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #fff !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

body.woocommerce-cart table.shop_table.cart .amui-qty-btn::before {
  display: block !important;
  color: var(--amui-cart-teal) !important;
  font-family: Arial, sans-serif !important;
  font-size: 28px !important;
  font-weight: 300 !important;
  line-height: 1 !important;
}

body.woocommerce-cart table.shop_table.cart .amui-qty-btn--minus::before {
  content: "−" !important;
}

body.woocommerce-cart table.shop_table.cart .amui-qty-btn--plus::before {
  content: "+" !important;
}

body.woocommerce-cart table.shop_table.cart .amui-qty-btn:hover {
  background: rgba(0, 121, 107, .06) !important;
}

body.woocommerce-cart table.shop_table.cart .amui-qty-btn[disabled],
body.woocommerce-cart table.shop_table.cart .amui-qty-btn:disabled {
  opacity: .45 !important;
  cursor: not-allowed !important;
}

/* Usuwanie produktu bardziej jak akcja, nie zepsuty znak. */
body.woocommerce-cart table.shop_table.cart .product-remove a.remove {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  height: 44px !important;
  border: 1px solid #d8dee6 !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: #7b8794 !important;
  font-size: 0 !important;
  line-height: 1 !important;
  text-indent: 0 !important;
  overflow: hidden !important;
}

body.woocommerce-cart table.shop_table.cart .product-remove a.remove::before {
  content: "×" !important;
  color: currentColor !important;
  font-family: Arial, sans-serif !important;
  font-size: 27px !important;
  font-weight: 300 !important;
  line-height: 1 !important;
}

body.woocommerce-cart table.shop_table.cart .product-remove a.remove:hover {
  border-color: var(--amui-cart-orange) !important;
  color: var(--amui-cart-orange) !important;
  background: #fff !important;
}

/* Na mobile zostaje układ pod sobą, ale bez duplikatów w podsumowaniu. */
@media (max-width: 760px) {
  body.woocommerce-cart .cart_totals table.shop_table tr.order-total {
    grid-template-columns: 1fr !important;
    row-gap: 8px !important;
  }

  body.woocommerce-cart .cart_totals table.shop_table tr.order-total td {
    text-align: left !important;
  }
}
