/*
 * Silent Heroes — Cart (Koszyk)
 * Used by template-parts/cart-demo.php and woocommerce/cart/cart.php
 */

/* Reset page.php wrappers na koszyku — usuwamy hero i outer card. */
body.woocommerce-cart .sh-hero,
body.woocommerce-cart .site-main > .sh-hero,
body.woocommerce-checkout .sh-hero,
body.woocommerce-checkout .site-main > .sh-hero {
  display: none !important;
}
body.woocommerce-cart .site-main > article.sh-container,
body.woocommerce-cart .site-main > article.sh-section,
body.woocommerce-checkout .site-main > article.sh-container,
body.woocommerce-checkout .site-main > article.sh-section {
  max-width: none;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
body.woocommerce-cart .site-main > article > .sh-entry-content,
body.woocommerce-checkout .site-main > article > .sh-entry-content {
  margin: 0;
  padding: 0;
}
/* Shortcode [woocommerce_cart] opakowuje content w <div class="woocommerce"> z grid layout — resetujemy.
   Wyklucz order-pay i order-received bo te mają własny styling (components-account.css). */
body.woocommerce-cart .sh-entry-content > .woocommerce,
body.woocommerce-checkout:not(.woocommerce-order-pay):not(.woocommerce-order-received):not(.woocommerce-view-order) .sh-entry-content > .woocommerce {
  display: block !important;
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
body.woocommerce-cart .sh-cart-page {
  width: 100%;
}

.sh-cart-page {
  background: var(--sh-offwhite);
  min-height: 70vh;
  padding: 32px 0 80px;
}
.sh-cart-inner {
  max-width: 1200px;
  margin-inline: auto;
  padding: 0 var(--sh-gutter);
}

/* Back link */
.sh-cart-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--sh-muted);
  text-decoration: none;
  margin-bottom: 16px;
  transition: color .15s;
}
.sh-cart-back:hover { color: var(--sh-black); }
.sh-cart-back svg {
  width: 14px; height: 14px;
  stroke: currentColor; stroke-width: 2; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Title */
.sh-cart-title {
  font-family: 'Poppins', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--sh-black);
  margin: 0 0 28px;
}

/* Layout */
.sh-cart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
  min-width: 0;
}
.sh-cart-grid > * { min-width: 0; }

/* ===== ITEM CARD ===== */
.sh-cart-item {
  background: var(--sh-white);
  border: 1px solid var(--sh-border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 20px;
  align-items: start;
}
.sh-cart-thumb {
  width: 90px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--sh-offwhite);
}
.sh-cart-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.sh-cart-info { min-width: 0; }
.sh-cart-cat {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sh-red);
  margin: 0 0 6px;
}
.sh-cart-name {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--sh-black);
  margin: 0 0 8px;
  line-height: 1.3;
}
.sh-cart-stock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--sh-success, #27ae60);
  font-weight: 500;
}
.sh-cart-stock svg {
  width: 14px; height: 14px;
  stroke: currentColor; stroke-width: 2.5; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Right column (qty + price + remove) — desktop tylko (na mobile aside spans pełną szerokość). */
.sh-cart-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
@media (min-width: 601px) {
  .sh-cart-aside { min-width: 140px; }
}

/* Qty */
.sh-cart-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--sh-border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--sh-white);
}
.sh-cart-qty button {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--sh-ink);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.sh-cart-qty button:hover { background: var(--sh-offwhite); }
.sh-cart-qty input {
  width: 36px;
  height: 32px;
  border: 0;
  text-align: center;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--sh-black);
  background: transparent;
  -moz-appearance: textfield;
}
.sh-cart-qty input::-webkit-outer-spin-button,
.sh-cart-qty input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}

/* Price */
.sh-cart-price {
  font-family: 'Poppins', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--sh-black);
  margin: 0;
  line-height: 1;
}

/* Remove */
.sh-cart-remove {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 0;
  color: var(--sh-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: color .15s;
}
.sh-cart-remove:hover { color: var(--sh-red); }
.sh-cart-remove svg {
  width: 12px; height: 12px;
  stroke: currentColor; stroke-width: 2; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ===== COUPON ===== */
.sh-cart-coupon {
  background: var(--sh-white);
  border: 1px solid var(--sh-border);
  border-radius: 10px;
  padding: 18px 22px;
  margin-top: 14px;
}
.sh-cart-coupon-label {
  display: block;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--sh-black);
  margin: 0 0 10px;
}
.sh-cart-coupon-row {
  display: flex;
  gap: 10px;
}
.sh-cart-coupon-row input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--sh-border);
  border-radius: 6px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  background: var(--sh-white);
  color: var(--sh-black);
}
.sh-cart-coupon-row input:focus {
  outline: 0;
  border-color: var(--sh-red);
}
.sh-cart-coupon-row button {
  padding: 11px 22px;
  background: var(--sh-white);
  color: var(--sh-black);
  border: 1px solid var(--sh-border);
  border-radius: 6px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.sh-cart-coupon-row button:hover {
  background: var(--sh-black);
  color: var(--sh-white);
  border-color: var(--sh-black);
}

/* ===== SUMMARY ===== */
.sh-cart-summary {
  background: var(--sh-white);
  border: 1px solid var(--sh-border);
  border-radius: 10px;
  padding: 24px;
  position: sticky;
  top: 130px;
}
.sh-cart-summary-title {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--sh-black);
  margin: 0 0 18px;
}
.sh-cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 14px;
  color: var(--sh-ink);
}
.sh-cart-summary-row .label { color: var(--sh-ink); }
.sh-cart-summary-row .value {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  color: var(--sh-black);
}
.sh-cart-summary-row.is-free .value {
  color: var(--sh-success, #27ae60);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.sh-cart-summary-divider {
  height: 1px;
  background: var(--sh-border);
  margin: 8px 0;
}
.sh-cart-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 0 18px;
}
.sh-cart-summary-total .label {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--sh-black);
}
.sh-cart-summary-total .value {
  font-family: 'Poppins', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--sh-black);
}

.sh-cart-checkout-btn,
.sh-cart-checkout-btn:link,
.sh-cart-checkout-btn:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: var(--sh-red);
  color: var(--sh-white);
  border: 0;
  border-radius: 6px;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: filter .15s;
}
.sh-cart-checkout-btn:hover,
.sh-cart-checkout-btn:focus,
.sh-cart-checkout-btn:active {
  background: #b01717;
  color: var(--sh-white);
  filter: none;
  text-decoration: none;
}
.sh-cart-checkout-btn svg {
  width: 16px; height: 16px;
  stroke: currentColor; stroke-width: 2.5; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Payment badges */
.sh-cart-payments {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  margin-bottom: 18px;
}
.sh-cart-payment-badge {
  padding: 4px 10px;
  border: 1px solid var(--sh-border);
  border-radius: 4px;
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--sh-muted);
  background: var(--sh-white);
}

/* Trust list */
.sh-cart-trust {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sh-cart-trust li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--sh-ink);
}
.sh-cart-trust svg {
  width: 16px; height: 16px;
  stroke: var(--sh-muted); stroke-width: 1.8; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sh-cart-grid { grid-template-columns: minmax(0, 1fr); }
  .sh-cart-summary { position: static; }
}
@media (max-width: 600px) {
  /* Mobile bez padding na .sh-cart-page — wewnętrzny .sh-cart-inner i
     karty same dbają o swój gutter. */
  .sh-cart-page {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .sh-cart-inner { max-width: 100%; }
  .sh-cart-title { font-size: 24px; word-break: break-word; }

  /* ===== ITEM CARD ===== */
  .sh-cart-item {
    grid-template-columns: 70px minmax(0, 1fr);
    padding: 14px;
    gap: 14px;
    max-width: 100%;
    box-sizing: border-box;
  }
  .sh-cart-thumb { width: 70px; height: 70px; }
  .sh-cart-info { min-width: 0; max-width: 100%; }
  .sh-cart-name { word-wrap: break-word; overflow-wrap: anywhere; hyphens: auto; }

  .sh-cart-aside {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }
  .sh-cart-aside > * { flex-shrink: 0; }
  .sh-cart-price { font-size: 17px; flex-shrink: 1; min-width: 0; }
  .sh-cart-remove { white-space: nowrap; flex-shrink: 0; }

  /* ===== SUMMARY ===== */
  .sh-cart-summary {
    padding: 20px;
    max-width: 100%;
    box-sizing: border-box;
  }
  .sh-cart-summary-row,
  .sh-cart-summary-total {
    gap: 12px;
    min-width: 0;
    flex-wrap: nowrap;
  }
  .sh-cart-summary-row .label,
  .sh-cart-summary-total .label {
    min-width: 0;
    flex-shrink: 1;
    word-break: break-word;
  }
  .sh-cart-summary-row .value,
  .sh-cart-summary-total .value {
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
  }
  .sh-cart-summary-total .value { font-size: 20px; }

  /* Coupon (kod rabatowy) — mniejszy padding, button nie shrinkuje. */
  .sh-cart-coupon { padding: 16px 18px; }
  .sh-cart-coupon-row { gap: 8px; }
  .sh-cart-coupon-row input { min-width: 0; }
  .sh-cart-coupon-row button { flex-shrink: 0; padding: 11px 16px; }
}

/* Bardzo wąskie ekrany (np. iPhone SE 320 / iPhone 17 z safe-area) */
@media (max-width: 380px) {
  .sh-cart-item { padding: 12px; gap: 12px; grid-template-columns: 60px minmax(0, 1fr); }
  .sh-cart-thumb { width: 60px; height: 60px; }
  .sh-cart-name { font-size: 15px; }
  .sh-cart-price { font-size: 16px; }
  .sh-cart-summary { padding: 16px; }
  .sh-cart-summary-total .value { font-size: 18px; }
}

/* Skład zestawu (bundle) w koszyku / checkout / thank-you / mail.
   Każdy <li> = 1 produkt: nazwa bold + opis + atrybuty (gramatura, smak) — każdy
   element na nowej linii dla czytelności. */
.sh-bundle-cart-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.sh-bundle-cart-list li {
  position: relative;
  padding: 6px 0 6px 16px;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--sh-gray-500, #555);
  border-bottom: 1px solid rgba(0, 0, 0, .05);
}
.sh-bundle-cart-list li:last-child { border-bottom: 0; }
.sh-bundle-cart-list li::before {
  content: "›";
  position: absolute;
  left: 2px;
  top: 6px;
  color: var(--sh-red);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.45;
}
.sh-bundle-cart-list .sh-bundle-name {
  display: block;
  color: var(--sh-black, #111);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.35;
}
.sh-bundle-cart-list .sh-bundle-name strong { font-weight: 600 !important; }
.sh-bundle-cart-list .sh-bundle-desc {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--sh-gray-500, #666);
}
.sh-bundle-cart-list .sh-bundle-attrs {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--sh-gray-500, #666);
  font-style: italic;
}

/* ===== Pusty koszyk — pełnoekranowy widok ===== */
body.woocommerce-cart .sh-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  min-height: 60vh;
  max-width: 560px;
  margin: 0 auto;
  padding: 64px 24px;
  box-sizing: border-box;
}
.sh-cart-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 9999px;
  background: var(--sh-offwhite-2, #EEEBE3);
  color: var(--sh-red, #CC1B1B);
  margin-bottom: 6px;
}
.sh-cart-empty-icon svg { width: 38px; height: 38px; }
.sh-cart-empty-title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--sh-black, #111);
}
.sh-cart-empty-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--sh-muted, #666);
}
.sh-cart-empty-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}
.sh-cart-empty .sh-btn-ghost,
.sh-cart-empty .sh-btn-ghost:visited {
  background: transparent;
  color: var(--sh-black, #111);
  border: 1px solid var(--sh-border, #E0DDD8);
}
.sh-cart-empty .sh-btn-ghost:hover {
  border-color: var(--sh-red, #CC1B1B);
  color: var(--sh-red, #CC1B1B);
}
