/*
 * ds_shoppingcart — Dynamite Side Cart. Style samowystarczalne (prefiks .dssc-).
 * @author Dynamite Studio
 */

/* --- Zmienne --- */
:root {
  --dssc-accent: #2b7a4b;
  --dssc-accent-dark: #226b40;
  --dssc-fill: #4cbb6c;
  --dssc-bg: #ffffff;
  --dssc-text: #222222;
  --dssc-muted: #777777;
  --dssc-border: #ececec;
  --dssc-width: 420px;
  --dssc-z: 99990;
}

/* --- Trigger --- */
.dssc-trigger-wrap { display: inline-flex; align-items: center; }
.dssc-trigger {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  color: inherit; text-decoration: none; padding: 6px;
}
.dssc-trigger:hover { color: var(--dssc-accent); }
.dssc-trigger-icon { display: inline-flex; }
.dssc-trigger-count {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--dssc-accent); color: #fff; font-size: 11px; line-height: 18px;
  text-align: center; font-weight: 700;
}
.dssc-trigger-count[data-count="0"] { display: none; }

/* --- Overlay + panel --- */
.dssc-overlay {
  position: fixed; inset: 0; z-index: var(--dssc-z); display: none;
}
.dssc-overlay.dssc-open { display: block; }
.dssc-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.45); opacity: 0;
  transition: opacity .28s ease;
}
.dssc-overlay.dssc-open .dssc-backdrop { opacity: 1; }
.dssc-panel {
  position: absolute; top: 0; bottom: 0; width: var(--dssc-width); max-width: 92vw;
  background: var(--dssc-bg); color: var(--dssc-text); box-shadow: 0 0 40px rgba(0,0,0,.2);
  display: flex; flex-direction: column; transition: transform .3s ease;
}
.dssc-overlay[data-side="right"] .dssc-panel { right: 0; transform: translateX(100%); }
.dssc-overlay[data-side="left"]  .dssc-panel { left: 0;  transform: translateX(-100%); }
.dssc-overlay.dssc-open .dssc-panel { transform: translateX(0); }

.dssc-panel-inner { display: flex; flex-direction: column; height: 100%; }

/* --- Head --- */
.dssc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--dssc-border); flex: 0 0 auto;
}
.dssc-title { margin: 0; font-size: 18px; font-weight: 700; }
.dssc-title-count { color: var(--dssc-muted); font-weight: 400; }
.dssc-close {
  border: 0; background: none; font-size: 28px; line-height: 1; cursor: pointer; color: var(--dssc-muted);
}
.dssc-close:hover { color: var(--dssc-text); }

/* --- Progress bar --- */
.dssc-progress-slot { padding: 14px 20px 0; flex: 0 0 auto; }
.dssc-progress { font-size: 13px; }
.dssc-progress-msg { margin-bottom: 8px; color: var(--dssc-text); }
.dssc-progress-icon { color: var(--dssc-accent); font-weight: 700; margin-right: 4px; }
.dssc-progress-track {
  position: relative; height: 8px; border-radius: 5px; background: #eee; overflow: visible;
}
.dssc-progress-fill {
  height: 100%; border-radius: 5px; background: var(--dssc-fill); transition: width .35s ease;
}
.dssc-progress-marker {
  position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%;
  transform: translate(-50%, -50%); background: #fff; border: 2px solid #ccc;
}
.dssc-progress-marker.dssc-marker-reached { border-color: var(--dssc-fill); background: var(--dssc-fill); }

/* --- Body / lines --- */
.dssc-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 20px; }
.dssc-lines { list-style: none; margin: 0; padding: 0; }
.dssc-line {
  position: relative; display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--dssc-border);
}
.dssc-thumb { flex: 0 0 64px; width: 64px; }
.dssc-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--dssc-border); }
.dssc-line-info { flex: 1 1 auto; min-width: 0; }
.dssc-line-name { display: block; color: var(--dssc-text); text-decoration: none; font-weight: 600; font-size: 14px; }
.dssc-line-name:hover { color: var(--dssc-accent); }
.dssc-line-attrs { color: var(--dssc-muted); font-size: 12px; margin: 2px 0 8px; }
.dssc-line-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dssc-line-price { font-weight: 700; white-space: nowrap; }

.dssc-qty { display: inline-flex; align-items: center; border: 1px solid var(--dssc-border); border-radius: 6px; overflow: hidden; }
.dssc-qty-btn {
  width: 28px; height: 28px; border: 0; background: #f7f7f7; cursor: pointer; font-size: 16px; line-height: 1; color: var(--dssc-text);
}
.dssc-qty-btn:hover { background: #efefef; }
.dssc-qty-btn[disabled] { opacity: .5; cursor: default; }
.dssc-qty-val { min-width: 32px; text-align: center; font-size: 14px; }

.dssc-remove {
  position: absolute; top: 12px; right: 0; border: 0; background: none; cursor: pointer; color: var(--dssc-muted); padding: 4px;
}
.dssc-remove:hover { color: #c0392b; }

.dssc-line.dssc-busy { opacity: .5; pointer-events: none; }

/* --- Cross-sell --- */
.dssc-crosssell { margin: 16px 0; }
.dssc-crosssell-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.dssc-crosssell-track { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.dssc-cs-item { flex: 0 0 110px; width: 110px; }
.dssc-cs-thumb img { width: 110px; height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--dssc-border); }
.dssc-cs-name { display: block; font-size: 12px; color: var(--dssc-text); text-decoration: none; margin: 4px 0 2px; }
.dssc-cs-price { font-size: 13px; font-weight: 700; }

/* --- Coupon --- */
.dssc-coupon { margin: 16px 0; }
.dssc-voucher-list { list-style: none; margin: 0 0 8px; padding: 0; }
.dssc-voucher { display: flex; align-items: center; justify-content: space-between; background: #f4f9f5; border-radius: 6px; padding: 6px 10px; margin-bottom: 4px; font-size: 13px; }
.dssc-voucher-remove { border: 0; background: none; cursor: pointer; font-size: 18px; line-height: 1; color: var(--dssc-muted); }
.dssc-coupon-form { display: flex; gap: 8px; }
.dssc-coupon-input { flex: 1 1 auto; border: 1px solid var(--dssc-border); border-radius: 6px; padding: 8px 10px; font-size: 14px; }
.dssc-coupon-btn { border: 0; background: #333; color: #fff; border-radius: 6px; padding: 8px 14px; cursor: pointer; font-size: 14px; }
.dssc-coupon-btn:hover { background: #000; }
.dssc-coupon-msg { font-size: 12px; margin-top: 6px; min-height: 16px; }
.dssc-coupon-msg.dssc-ok { color: var(--dssc-accent); }
.dssc-coupon-msg.dssc-err { color: #c0392b; }

/* --- Note --- */
.dssc-note { font-size: 12px; color: var(--dssc-muted); margin: 12px 0; }

/* --- Summary --- */
.dssc-summary { margin-top: 12px; border-top: 1px solid var(--dssc-border); padding-top: 12px; }
.dssc-sum-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.dssc-sum-discount { color: var(--dssc-accent); }
.dssc-sum-total { font-weight: 700; font-size: 16px; border-top: 1px solid var(--dssc-border); margin-top: 6px; padding-top: 10px; }

/* --- Footer --- */
.dssc-foot { flex: 0 0 auto; padding: 16px 20px; border-top: 1px solid var(--dssc-border); display: flex; flex-direction: column; gap: 8px; }
.dssc-cta {
  display: block; text-align: center; text-decoration: none; border-radius: 8px; padding: 13px 16px; font-weight: 700; font-size: 15px; cursor: pointer; border: 0;
}
.dssc-cta-checkout { background: var(--dssc-accent); color: #fff; }
.dssc-cta-checkout:hover { background: var(--dssc-accent-dark); color: #fff; }
.dssc-cta-cart { background: #f2f2f2; color: var(--dssc-text); }
.dssc-cta-cart:hover { background: #e8e8e8; }

/* --- Empty --- */
.dssc-empty { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px 20px; text-align: center; }
.dssc-empty-text { color: var(--dssc-muted); font-size: 15px; margin: 0; }
.dssc-continue { background: var(--dssc-accent); color: #fff; }

/* --- Sticky floating button --- */
.dssc-sticky-btn {
  position: fixed; bottom: 24px; right: 24px; z-index: calc(var(--dssc-z) - 1); width: 56px; height: 56px; border-radius: 50%;
  border: 0; background: var(--dssc-accent); color: #fff; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
}
.dssc-sticky-count {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: #c0392b; color: #fff; font-size: 11px; line-height: 18px; font-weight: 700;
}
.dssc-sticky-count[data-count="0"] { display: none; }

/* --- Standalone bar --- */
.dssc-progress-standalone {
  --dssc-bar-bg: #f6f6f6; --dssc-bar-fill: #4cbb6c; --dssc-bar-text: #333;
  background: var(--dssc-bar-bg); color: var(--dssc-bar-text); padding: 10px 16px; text-align: center;
}
.dssc-progress-standalone .dssc-progress-fill { background: var(--dssc-bar-fill); }
.dssc-progress-standalone .dssc-progress-track { max-width: 480px; margin: 0 auto; }
.dssc-progress-standalone.dssc-progress-sticky { position: sticky; top: 0; z-index: 999; }

/* --- Fly-to-cart clone --- */
.dssc-fly {
  position: fixed; z-index: calc(var(--dssc-z) + 1); border-radius: 8px; object-fit: cover; pointer-events: none;
  transition: transform .8s cubic-bezier(.2,.6,.3,1), opacity .8s ease; will-change: transform, opacity;
}

/* Blokada scrolla body gdy drawer otwarty */
body.dssc-locked { overflow: hidden; }

@media (max-width: 480px) {
  :root { --dssc-width: 100vw; }
}
