/*
 * AMUI v2.0.1
 * Czystszy koszyk: usunięcie nadmiarowych komunikatów, auto-update i poprawka nazwy produktu.
 */

:root {
  --amui-v201-orange: var(--amui-accent, #ff5a00);
  --amui-v201-orange-dark: var(--amui-accent-dark, #e65000);
  --amui-v201-teal: #00796b;
  --amui-v201-text: var(--amui-text, #1f2937);
  --amui-v201-muted: var(--amui-muted, #64748b);
  --amui-v201-line: var(--amui-line, #e5e7eb);
}

/* Usuń dodatkowe boksy, które dublowały informacje o dostawie/finalizacji. */
body.woocommerce-cart .amui-cart-allegro-hint,
body.woocommerce-cart .amui-cart-confidence,
body.woocommerce-cart .amui-cart-delivery-note {
  display: none !important;
}

/* Usuń teksty typu „Dostawa i płatność…” spod nazwy produktu. */
body.woocommerce-cart table.shop_table.cart .product-name::after {
  content: none !important;
  display: none !important;
}

/* WooCommerce actions: kupon/update generują pusty, brzydki pasek. Zostawiamy je technicznie w DOM,
   ale ukrywamy wizualnie — JS v2.0.1 aktualizuje koszyk automatycznie po zmianie ilości. */
body.woocommerce-cart table.shop_table.cart td.actions {
  position: absolute !important;
  left: -99999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  max-height: 1px !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Usuń z koszyka wybór/kalkulator dostawy i teksty typu Free shipping.
   Dostawa ma być finalizowana na checkout, nie jako chaotyczny blok pod koszykiem. */
body.woocommerce-cart .cart_totals tr.shipping,
body.woocommerce-cart .cart_totals tr.woocommerce-shipping-totals,
body.woocommerce-cart .cart_totals .woocommerce-shipping-destination,
body.woocommerce-cart .cart_totals .woocommerce-shipping-calculator,
body.woocommerce-cart .cart_totals .shipping-calculator-button,
body.woocommerce-cart .cart_totals ul#shipping_method,
body.woocommerce-cart .cart_totals .woocommerce-shipping-methods {
  display: none !important;
}

/* Stabilna siatka pozycji koszyka. Poprawia błąd, w którym nazwa produktu potrafiła łamać się pionowo. */
body.woocommerce-cart table.shop_table.cart tbody tr.cart_item {
  grid-template-columns: minmax(190px, 230px) minmax(300px, 1fr) minmax(142px, 160px) minmax(150px, 175px) 44px !important;
  gap: 18px !important;
  align-items: center !important;
}

body.woocommerce-cart table.shop_table.cart .product-name {
  min-width: 280px !important;
  width: 100% !important;
  max-width: none !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
}

body.woocommerce-cart table.shop_table.cart .product-name a,
body.woocommerce-cart table.shop_table.cart .product-name a:visited {
  display: block !important;
  width: 100% !important;
  max-width: 680px !important;
  min-width: 0 !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  color: var(--amui-v201-text) !important;
}

body.woocommerce-cart table.shop_table.cart .product-name br {
  display: none !important;
}

/* Lepszy oddech między paskiem „cały koszyk”, przesyłką i produktem. */
body.woocommerce-cart .amui-cart-selection-bar {
  margin-bottom: 12px !important;
}

body.woocommerce-cart .amui-cart-delivery-group {
  border-bottom: 1px solid rgba(226, 232, 240, .9) !important;
  margin-bottom: 12px !important;
}

body.woocommerce-cart table.shop_table.cart tbody tr.cart_item {
  border-top: 1px solid rgba(226, 232, 240, .9) !important;
  border-radius: 0 !important;
}

/* Podsumowanie po prawej — zostaje proste: wartość produktów + razem. */
body.woocommerce-cart .cart_totals table.shop_table tr.cart-subtotal th {
  font-size: 0 !important;
}

body.woocommerce-cart .cart_totals table.shop_table tr.cart-subtotal th::before {
  content: "Wartość produktów";
  font-size: 16px !important;
  font-weight: 400 !important;
}

body.woocommerce-cart .cart_totals table.shop_table tr.order-total th {
  font-size: 0 !important;
}

body.woocommerce-cart .cart_totals table.shop_table tr.order-total th::before {
  content: "Razem";
  font-size: 16px !important;
  font-weight: 400 !important;
}

body.woocommerce-cart .wc-proceed-to-checkout {
  padding-bottom: 28px !important;
}

body.woocommerce-cart .wc-proceed-to-checkout::after {
  margin-top: 8px !important;
}

/* Status auto-aktualizacji ilości. */
body.woocommerce-cart .amui-cart-autoupdate-status {
  display: none;
  margin: 10px 0 0;
  color: var(--amui-v201-muted);
  font-size: 12px;
  font-weight: 700;
}

body.woocommerce-cart.amui-cart-updating .amui-cart-autoupdate-status {
  display: block;
}

body.woocommerce-cart.amui-cart-updating table.shop_table.cart tbody tr.cart_item {
  opacity: .72;
}

/* Mobile/tablet: nazwa nadal ma normalną szerokość i nie może zwinąć się do jednej litery. */
@media (max-width: 1180px) {
  body.woocommerce-cart table.shop_table.cart tbody tr.cart_item {
    grid-template-columns: minmax(170px, 210px) minmax(260px, 1fr) minmax(136px, 150px) 44px !important;
  }

  body.woocommerce-cart table.shop_table.cart .product-name {
    min-width: 240px !important;
  }
}

@media (max-width: 981px) {
  body.woocommerce-cart table.shop_table.cart tbody tr.cart_item {
    grid-template-columns: minmax(150px, 190px) minmax(0, 1fr) 44px !important;
  }

  body.woocommerce-cart table.shop_table.cart .product-name {
    min-width: 0 !important;
  }
}

@media (max-width: 760px) {
  body.woocommerce-cart table.shop_table.cart tbody tr.cart_item {
    grid-template-columns: 98px minmax(0, 1fr) 40px !important;
  }

  body.woocommerce-cart table.shop_table.cart .product-name,
  body.woocommerce-cart table.shop_table.cart .product-name a {
    min-width: 0 !important;
    max-width: 100% !important;
  }
}
