/* Poster Bazaar — Mini-cart (slide-out / dropdown). Loaded site-wide. */

:root {
  --pbm-border: #e6e3dc;
  --pbm-heading: #2a2a2a;
  --pbm-text: #4a4a4a;
  --pbm-muted: #8a8a8a;
  --pbm-surface: #f7f7f7;
  --pbm-surface-warm: #faf6ef;
  --pbm-primary: #8f9779;
  --pbm-primary-dark: #6b705c;
  --pbm-error: #c94a4a;
  --pbm-success: #2e7d32;
  --pbm-cocoa: #6d4d2c;
  --pbm-cocoa-bg: #ebe0d2;
  --pbm-radius: 4px;
}

/* ── Items ────────────────────────────────────────────────────────────── */
.woocommerce-mini-cart.pb-mini-cart {
  padding: 0;
  margin: 0;
  list-style: none;
}
/* Beat `.cart-widget-side .woocommerce-mini-cart .mini_cart_item { display: flex }`
   from WoodMart core (header-el-cart-side.min.css) — we need grid for the
   thumb | info | price layout to match cart/checkout. */
.cart-widget-side .woocommerce-mini-cart .pb-mini-cart-item,
.pb-mini-cart-item {
  display: grid !important;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  grid-template-rows: auto;
  gap: 6px 12px;
  align-items: start;
  padding: 14px 15px !important;
  border-bottom: 1px solid var(--pbm-border);
  position: relative;
}
.pb-mini-cart-item > .cart-item-image { grid-column: 1; grid-row: 1; }
.pb-mini-cart-item > .cart-info { grid-column: 2; grid-row: 1; min-width: 0; }
.pb-mini-cart-item:first-child { padding-top: 4px; }
.pb-mini-cart-item:last-child { border-bottom: none; }

.pb-mini-cart-item .cart-item-image {
  display: block;
  width: 64px;
  line-height: 0;
}
.pb-mini-cart-item img {
  width: 64px !important;
  height: 84px !important;
  object-fit: cover;
  border-radius: var(--pbm-radius);
  border: 1px solid var(--pbm-border);
  margin: 0 !important;
  float: none !important;
}

.pb-mini-cart-item .cart-info { min-width: 0; }
.pb-mini-cart .pb-mini-cart-item .wd-entities-title,
.pb-mini-cart-item .wd-entities-title {
  font-size: 14px !important;
  font-weight: 600;
  line-height: 1.4;
  color: var(--pbm-heading);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.pb-mini-cart-item .wd-entities-title a {
  color: inherit;
  text-decoration: none;
}
.pb-mini-cart-size {
  font-size: 13px;
  color: var(--pbm-muted);
}
.pb-mini-cart-meta {
  font-size: 13px;
  color: var(--pbm-muted);
  margin-bottom: 6px;
}
.pb-mini-cart-meta .pb-mini-cart-size + .pb-mini-cart-qty::before {
  content: ' · ';
  margin: 0 2px;
}
.pb-mini-cart-item .quantity {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: var(--pbm-heading);
  /* Pin to the 3rd grid column on its own (sibling of .cart-info). */
  grid-column: 3;
  grid-row: 1;
  white-space: nowrap;
  margin-right: 24px; /* keep clear of the remove × in top-right */
}
.pb-mini-cart-item .remove {
  position: absolute;
  top: 12px;
  right: 0;
  width: 22px;
  height: 22px;
  line-height: 20px;
  text-align: center;
  font-size: 18px;
  color: var(--pbm-muted);
  background: transparent;
  border-radius: 50%;
}
.pb-mini-cart-item .remove:hover {
  color: var(--pbm-error);
  background: var(--pbm-surface);
}

/* Kill WoodMart core's item hover (grey background on whole row) — the
   row is not clickable, so the hover-card affordance is misleading.
   Beats `.cart-widget-side .woocommerce-mini-cart .mini_cart_item:hover`. */
.cart-widget-side .woocommerce-mini-cart .mini_cart_item:hover,
.pb-mini-cart .pb-mini-cart-item:hover {
  background-color: transparent !important;
}

/* ── Frame add-on group ─────────────────────────────────────────────────
   The group <li> is the same grid as singletons — no wrapper styling.
   Frame block is a third grid row spanning all columns, indented + cocoa
   left accent for visual nesting under the parent. */
.pb-mini-cart-group {
  /* still a grid row from .pb-mini-cart-item; nothing else needed */
}
.pb-mini-cart-frame-block {
  grid-column: 1 / 4;
  grid-row: 2;
  width: auto;
  background: var(--pbm-surface-warm, #faf6ef);
  border: 1px solid var(--pbm-border);
  border-left: 3px solid var(--pbm-cocoa, #6d4d2c);
  border-radius: 0 4px 4px 0;
  padding: 8px 10px;
  margin: 4px 24px 0 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  box-sizing: border-box;
}
.pb-mini-cart-frame-block .pb-frame-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--pbm-heading);
}
.pb-mini-cart-frame-block .pb-frame-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--pbm-heading);
  margin-left: auto;
}
.pb-mini-cart-frame-block .pb-frame-included {
  flex-basis: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--pbm-success, #2e7d32);
  font-weight: 500;
  margin-top: 1px;
}
.pb-mini-cart-frame-block .pb-frame-included svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* "Z RAMĄ" badge in mini-cart — always on its own line, below size·qty. */
.pb-mini-cart .pb-frame-badge-wrap {
  margin: 3px 0 0;
}
.pb-mini-cart .pb-frame-badge {
  font-size: 10px;
  padding: 2px 7px 2px 5px;
  background: var(--pbm-cocoa-bg, #ebe0d2);
  color: var(--pbm-cocoa, #6d4d2c);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.2;
}
.pb-mini-cart .pb-frame-badge svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

/* ── Footer: shipping bar above total, then buttons ──────────────────── */
.shopping-cart-widget-footer {
  display: flex;
  flex-direction: column;
}
.shopping-cart-widget-footer .wd-free-progress-bar { order: 1; }
.shopping-cart-widget-footer .woocommerce-mini-cart__total { order: 2; }
.shopping-cart-widget-footer .woocommerce-mini-cart__buttons { order: 3; }

/* ── Free-shipping progress bar — unified across mini-cart, product, cart,
   checkout. Three contexts use different wrappers; we neutralize WoodMart's
   dashed-bordered variant and apply a single visual treatment. ───────── */
.wd-shipping-progress-bar,
.wd-shipping-progress-bar.wd-style-bordered {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}
/* On the product page Elementor wraps the bar in a fixed-width widget; force
   the widget to fill its column so the bar matches surrounding boxes. */
.single-product .elementor-widget:has(> .elementor-widget-container > .wd-shipping-progress-bar) {
  width: 100% !important;
  max-width: 100% !important;
}
.shopping-cart-widget-footer .wd-free-progress-bar,
.wd-shipping-progress-bar .wd-free-progress-bar {
  border: 1px solid var(--pbm-border) !important;
  border-radius: var(--pbm-radius) !important;
  padding: 14px 18px !important;
  background: #fff !important;
}
.shopping-cart-widget-footer .wd-free-progress-bar {
  margin: 12px 15px 18px !important;
}
/* On the product page, surrounding Elementor boxes (coupon, "Tworzone z pasją",
   etc.) use 8px — match those rather than the tight 4px used in the mini-cart. */
.wd-shipping-progress-bar .wd-free-progress-bar {
  border-radius: 8px !important;
}

.wd-free-progress-bar .progress-msg {
  font-size: 14px !important;
  font-weight: 500;
  line-height: 1.4;
  color: var(--pbm-text) !important;
  margin: 0 0 10px !important;
  text-align: left;
}
.wd-free-progress-bar .progress-msg .pb-progress-icon {
  vertical-align: middle;
  margin-right: 10px;
  position: relative;
  top: -1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  background-color: rgba(143, 151, 121, 0.15);
  border-radius: 50%;
  color: var(--pbm-primary-dark);
  font-size: 15px;
  line-height: 1;
}
.wd-free-progress-bar .progress-msg .pb-progress-icon::before {
  display: block;
  line-height: 1;
}
.wd-free-progress-bar .progress-msg strong,
.wd-free-progress-bar .progress-msg .amount {
  color: var(--pbm-primary-dark) !important;
  font-weight: 600;
}
.wd-free-progress-bar .progress-area {
  background: #ececec !important;
  background-image: none !important;
  border: 0 !important;
  border-radius: 100px !important;
  height: 8px !important;
  overflow: hidden;
}
.wd-free-progress-bar .progress-area .progress-bar {
  background: var(--pbm-primary) !important;
  background-image: linear-gradient(
    90deg,
    var(--pbm-primary) 0%,
    var(--pbm-primary-dark) 50%,
    var(--pbm-primary) 100%
  ) !important;
  background-size: 200% 100% !important;
  border-radius: 100px !important;
  height: 8px !important;
  margin-top: 0 !important;
  box-shadow: 0 1px 4px rgba(143, 151, 121, 0.35);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1) !important;
  animation: pbProgressShimmer 2.4s linear infinite;
}
@keyframes pbProgressShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .wd-free-progress-bar .progress-area .progress-bar { animation: none; }
}

/* Threshold reached — collapse bar, banner becomes a celebratory state. */
.wd-free-progress-bar:has(.progress-bar[style*="width: 100%"]) {
  background: rgba(143, 151, 121, 0.10) !important;
  border-color: var(--pbm-primary) !important;
}
.wd-free-progress-bar:has(.progress-bar[style*="width: 100%"]) .progress-msg {
  margin: 0 !important;
  color: var(--pbm-primary-dark) !important;
  font-weight: 600;
}
.wd-free-progress-bar:has(.progress-bar[style*="width: 100%"]) .progress-msg .pb-progress-icon {
  background-color: var(--pbm-primary) !important;
  color: #fff !important;
  font-size: 16px;
}
.wd-free-progress-bar:has(.progress-bar[style*="width: 100%"]) .progress-area {
  display: none !important;
}

/* Buttons: stacked, full-width, primary + outlined-secondary. */
.shopping-cart-widget-footer .woocommerce-mini-cart__buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}
.shopping-cart-widget-footer .woocommerce-mini-cart__buttons .button {
  display: block;
  width: 100%;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  padding: 13px 18px !important;
  text-align: center;
  text-transform: none;
  border-radius: var(--pbm-radius);
  box-sizing: border-box;
}
.shopping-cart-widget-footer .woocommerce-mini-cart__buttons .button.btn-cart {
  background: #fff !important;
  color: var(--pbm-heading) !important;
  border: 1px solid var(--pbm-border) !important;
}
.shopping-cart-widget-footer .woocommerce-mini-cart__buttons .button.btn-cart:hover {
  background: var(--pbm-surface) !important;
  border-color: #d6d2c8 !important;
}
.shopping-cart-widget-footer .woocommerce-mini-cart__buttons .button.checkout {
  background: var(--pbm-primary-dark) !important;
  color: #fff !important;
  border: 1px solid var(--pbm-primary-dark) !important;
}
.shopping-cart-widget-footer .woocommerce-mini-cart__buttons .button.checkout:hover {
  background: #595d4d !important;
  border-color: #595d4d !important;
}
