/* ============================================
   Drewnianysklep v3 — DSBC Cart Slide-Out override
   Plugin: ds-box-creator/assets/cart-slideout/slideout.css
   Cel: dopasować paletę, typografię i layout do v3 brand.

   Strategia: bez nadpisywania mini-cart.php.
   - puste meta (typu `Grawer z tylu: ""`) ukryte przez filtr PHP
     `woocommerce_get_item_data` w inc/woocommerce.php
   - layout pozycji koszyka osiagniety przez CSS:
     `<li>` -> grid 88px / 1fr / auto
     `<li> > a:first-of-type` (link wokol <img> + nazwy) -> `display: contents`
       — img i text-name staja sie direct dziecmi grida `<li>`
   ============================================ */

#dsbc-mc-root {
  font-family: var(--ds-font-body) !important;
}

/* ─── Overlay (backdrop) ─────────────────────────────────────── */
#dsbc-mc-root .dsbc-mc-overlay {
  background: rgba(42, 39, 34, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ─── Panel ──────────────────────────────────────────────────── */
#dsbc-mc-root .dsbc-mc-panel {
  background: var(--ds-paper);
  width: 440px;
  max-width: 92vw;
  border-left: 1px solid var(--ds-line);
  box-shadow: -12px 0 32px -12px rgba(0, 0, 0, 0.18);
}

/* ─── Header ─────────────────────────────────────────────────── */
.dsbc-mc-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--ds-line);
  background: var(--ds-cream);
  flex: 0 0 auto;
}
.dsbc-mc-header h3 {
  font-family: var(--ds-font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--ds-ink);
  letter-spacing: -0.01em;
  gap: 10px;
}
.dsbc-mc-check {
  width: 24px;
  height: 24px;
  background: var(--ds-success) !important;
  color: var(--ds-paper) !important;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(111, 127, 83, 0.3);
}
.dsbc-mc-close {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border-radius: 50%;
  color: var(--ds-ink-soft);
  font-size: 24px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.dsbc-mc-close:hover {
  background: var(--ds-ink) !important;
  color: var(--ds-paper) !important;
}

/* ─── Body wrapper ───────────────────────────────────────────── */
.dsbc-mc-body {
  padding: 0;
  background: var(--ds-paper);
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ds-sand) transparent;
}
.dsbc-mc-body::-webkit-scrollbar { width: 6px; }
.dsbc-mc-body::-webkit-scrollbar-thumb { background: var(--ds-sand); border-radius: 3px; }

#dsbc-mc-root .widget_shopping_cart_content {
  padding: 0;
}

/* ─── Lista pozycji ──────────────────────────────────────────── */
#dsbc-mc-root ul.woocommerce-mini-cart,
#dsbc-mc-root .dsbc-mc-body ul.cart_list,
#dsbc-mc-root .dsbc-mc-body ul.product_list_widget {
  list-style: none;
  margin: 0;
  padding: 0;
  display: block;
}

/* Pozycja: grid 2-kolumnowy (88px thumb + 1fr body).
   Override WC default `cart_list li { padding: 4px 0 }` (0,2,2) i DSBC plugin `.dsbc-mc-body li { display: flex; padding: 10px 0 }` (0,2,2) — uzywamy !important + wyzsza specificity. */
.dsbc-mc-body ul.woocommerce-mini-cart .woocommerce-mini-cart-item,
.dsbc-mc-body ul.woocommerce-mini-cart li.mini_cart_item {
  display: grid !important;
  grid-template-columns: 88px 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 14px;
  row-gap: 6px;
  padding: 18px 22px 18px 22px !important;
  margin: 0 !important;
  border-bottom: 1px dashed var(--ds-line);
  position: relative;
  align-items: start;
}
.dsbc-mc-body .woocommerce-mini-cart-item:last-child,
.dsbc-mc-body li.mini_cart_item:last-child {
  border-bottom: 0;
}

/* Thumbnail wrapper (link lub span) — col 1, full height */
.dsbc-mc-body .dsmc-thumb {
  grid-column: 1;
  grid-row: 1 / span 3;
  display: block;
  width: 88px;
  height: 88px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--ds-stone);
  border: 1px solid var(--ds-line-soft);
  align-self: start;
  text-decoration: none;
}
/* WC default `.woocommerce ul.cart_list li img { width: 32px }` (specificity 0,2,2) wygrywa, plus DSBC plugin slideout.css ma `.dsbc-mc-body img { width: 56px }`. Override przez !important + wieksza specificity. */
.dsbc-mc-body .woocommerce-mini-cart-item .dsmc-thumb img,
.dsbc-mc-body .dsmc-thumb img.attachment-woocommerce_thumbnail {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: 0 !important;
  float: none !important;
  max-width: none !important;
}

/* Body (col 2) — nazwa + meta + qty stack */
.dsbc-mc-body .dsmc-body {
  grid-column: 2;
  grid-row: 1 / span 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* Nazwa produktu (link) — margin-right zostawia miejsce na .remove (×) ktory jest absolute top-right */
.dsbc-mc-body .dsmc-name {
  display: block;
  font-family: var(--ds-font-display);
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.3;
  color: var(--ds-ink);
  text-decoration: none;
  padding-right: 36px;
}
.dsbc-mc-body .dsmc-name:hover {
  color: var(--ds-olive-deep);
}

/* Quantity + amount (qty x cena) — wewnatrz .dsmc-body flex column */
.dsbc-mc-body .quantity {
  display: block;
  margin: 4px 0 0 0;
  padding: 0;
  color: var(--ds-ink-soft);
  font-size: 13px;
  font-weight: 600;
}
.dsbc-mc-body .quantity .amount,
.dsbc-mc-body .quantity bdi {
  color: var(--ds-ink);
  font-weight: 800;
  font-size: 14px;
}

/* dl.variation — kazda para "Label: Value" na wlasnej linii (display: block z inline dt+dd).
   NIE uzywamy grid bo WC default `dl.variation dt, dd { float: left }` + chaos auto-placement
   sprawia ze DT laduje po prawej a DD po lewej (grid widzi je w odwrotnej kolejnosci). */
.dsbc-mc-body dl.variation {
  margin: 4px 0 0 !important;
  padding: 0 !important;
  display: block !important;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ds-ink-soft);
  width: 100%;
}
.dsbc-mc-body dl.variation dt,
.dsbc-mc-body dl.variation dd {
  float: none !important;
  clear: none !important;
  width: auto !important;
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
.dsbc-mc-body dl.variation dt {
  font-weight: 600;
  color: var(--ds-ink-muted);
  text-transform: none;
}
.dsbc-mc-body dl.variation dt::after {
  content: " ";
}
.dsbc-mc-body dl.variation dd {
  color: var(--ds-ink);
  font-weight: 700;
}
.dsbc-mc-body dl.variation dd p {
  margin: 0 !important;
  padding: 0 !important;
  display: inline !important;
}
/* Kazda para "label: value" w jednej linii (kompaktowy podglad — bez separatorow). Para dt+dd = jeden wiersz. */
.dsbc-mc-body dl.variation dt {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
}
.dsbc-mc-body dl.variation dd {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  width: auto !important;
}
.dsbc-mc-body dl.variation dd::after {
  content: "\A";
  white-space: pre;
}

/* ─── Remove (×) — top-right pozycji ─────────────────────────── */
.dsbc-mc-body ul.woocommerce-mini-cart li .remove,
.dsbc-mc-body ul.woocommerce-mini-cart li .remove_from_cart_button {
  position: absolute !important;
  top: 14px !important;
  right: 18px !important;
  left: auto !important;
  width: 26px !important;
  height: 26px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--ds-ink-muted);
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.dsbc-mc-body .remove:hover,
.dsbc-mc-body .remove_from_cart_button:hover {
  background: var(--ds-error);
  color: var(--ds-paper);
  transform: rotate(90deg);
  text-decoration: none;
}

/* ─── Total (Kwota) ──────────────────────────────────────────── */
.dsbc-mc-body .woocommerce-mini-cart__total,
.dsbc-mc-body p.total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0;
  padding: 16px 22px;
  border-top: 1px solid var(--ds-line);
  border-bottom: 0;
  background: var(--ds-cream);
  font-family: var(--ds-font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--ds-ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dsbc-mc-body .woocommerce-mini-cart__total strong,
.dsbc-mc-body p.total strong {
  font-weight: 600;
  color: var(--ds-ink-soft);
}
.dsbc-mc-body .woocommerce-mini-cart__total .amount,
.dsbc-mc-body .woocommerce-mini-cart__total bdi,
.dsbc-mc-body p.total .amount,
.dsbc-mc-body p.total bdi {
  font-weight: 800;
  color: var(--ds-olive-deep);
  font-size: 19px;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--ds-font-display);
}

/* Ukryj duplikujace WC default buttons (DSBC ma wlasny footer) */
#dsbc-mc-root .woocommerce-mini-cart__buttons,
.dsbc-mc-body .woocommerce-mini-cart__buttons,
.dsbc-mc-body p.buttons {
  display: none !important;
}

/* ─── Empty + loading state ──────────────────────────────────── */
.dsbc-mc-empty,
#dsbc-mc-root .woocommerce-mini-cart__empty-message {
  padding: 60px 22px;
  text-align: center;
  color: var(--ds-ink-muted);
  font-size: 14px;
  margin: 0;
}
.dsbc-mc-loading {
  padding: 40px 22px;
  text-align: center;
  color: var(--ds-ink-muted);
  font-size: 14px;
}
.dsbc-mc-loading::after {
  border: 2px solid var(--ds-line);
  border-top-color: var(--ds-olive);
}

/* ─── Footer / akcje ─────────────────────────────────────────── */
.dsbc-mc-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--ds-line);
  background: var(--ds-paper);
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.dsbc-mc-btn-secondary,
.dsbc-mc-btn-primary {
  flex: 1;
  height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  font-family: var(--ds-font-body);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-width: 1px;
  border-style: solid;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.dsbc-mc-btn-secondary:hover,
.dsbc-mc-btn-primary:hover {
  transform: translateY(-1px);
}

.dsbc-mc-btn-secondary {
  background: transparent !important;
  color: var(--ds-ink) !important;
  border-color: var(--ds-ink) !important;
}
.dsbc-mc-btn-secondary:hover {
  background: var(--ds-ink) !important;
  color: var(--ds-paper) !important;
  border-color: var(--ds-ink) !important;
}

.dsbc-mc-btn-primary {
  background: var(--ds-olive) !important;
  color: var(--ds-paper) !important;
  border-color: var(--ds-olive) !important;
  box-shadow: 0 4px 14px -4px rgba(138, 138, 90, 0.5);
}
.dsbc-mc-btn-primary:hover {
  background: var(--ds-olive-deep) !important;
  color: var(--ds-paper) !important;
  border-color: var(--ds-olive-deep) !important;
  box-shadow: 0 6px 18px -4px rgba(111, 111, 67, 0.55);
}

/* ─── Responsive (mobile) ────────────────────────────────────── */
@media (max-width: 600px) {
  #dsbc-mc-root .dsbc-mc-panel {
    width: 100vw;
    max-width: 100vw;
    border-left: 0;
  }
  .dsbc-mc-header {
    padding: 14px 18px;
  }
  .dsbc-mc-header h3 {
    font-size: 15px;
  }
  .dsbc-mc-body .woocommerce-mini-cart-item,
  .dsbc-mc-body li.mini_cart_item {
    grid-template-columns: 72px 1fr;
    column-gap: 12px;
    padding: 16px 18px;
  }
  .dsbc-mc-body img,
  .dsbc-mc-body img.attachment-woocommerce_thumbnail {
    width: 72px;
    height: 72px;
  }
  .dsbc-mc-body .remove,
  .dsbc-mc-body .remove_from_cart_button {
    top: 12px;
    right: 12px;
  }
  .dsbc-mc-body .woocommerce-mini-cart__total,
  .dsbc-mc-body p.total {
    padding: 14px 18px;
  }
  .dsbc-mc-footer {
    padding: 14px 18px;
    flex-direction: column-reverse;
    gap: 8px;
  }
  .dsbc-mc-btn-secondary,
  .dsbc-mc-btn-primary {
    width: 100%;
    height: 46px;
  }
}
