/* ── Cart Sidebar — Self-contained styles ── */

:root {
  --sidebar-bg: #161B22;
  --sidebar-bg-page: rgba(18, 22, 26, 1);
  --sidebar-border: #30363D;
  --sidebar-text: #FAF9F5;
  --sidebar-text-muted: #9A9A95;
  --sidebar-cta: #C8232D;
  --sidebar-cta-hover: #a81d26;
  --sidebar-success: #4ade80;
  --sidebar-accent: #D4AF69;
  --sidebar-radius: 10px;
  --sidebar-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Scroll lock — applied via JS classList, avoids position:fixed scroll jump */
html.onesite-scroll-locked,
html.onesite-scroll-locked body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

/* Overlay */
.onesite-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  z-index: 9998;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* Panel */
.onesite-sidebar-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 480px;
  height: 100vh;
  height: 100dvh;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  font-family: var(--sidebar-font);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  border-left:1px solid var(--sidebar-border);
}

.onesite-sidebar-panel.is-open {
  transform: translateX(0);
}

@media (max-width: 480px) {
  .onesite-sidebar-panel {
    width: 100%;
  }
}

/* Header */
.onesite-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.onesite-sidebar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.onesite-sidebar-count {
  font-size: 13px;
  font-weight: 400;
  color: var(--sidebar-text-muted);
  margin-left: 8px;
}

.onesite-sidebar-close {
  background: none;
  border: none;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}

.onesite-sidebar-close:hover {
  color: var(--sidebar-text);
}

/* Free shipping banner */
.onesite-sidebar-freeship {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: rgba(74, 222, 128, 0.08);
  border-bottom: 1px solid var(--sidebar-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--sidebar-success);
  flex-shrink: 0;
}

/* Scrollable items area */
.onesite-sidebar-items {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

/* Individual item */
.onesite-sidebar-item {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}

.onesite-sidebar-item-img {
  width: 78px;
  border-radius: 6px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}

.onesite-sidebar-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.onesite-sidebar-item-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.onesite-sidebar-item-name a {
  color: var(--sidebar-text);
  text-decoration: none;
}

.onesite-sidebar-item-name a:hover {
  color: var(--sidebar-accent);
}

.onesite-sidebar-item-variant {
  font-size: 12px;
  color: var(--sidebar-text-muted);
}

.onesite-sidebar-item-price {
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

.onesite-sidebar-item-price-sale {
  color: var(--sidebar-success);
}

.onesite-sidebar-item-price del {
  color: var(--sidebar-text-muted);
  font-weight: 400;
  font-size: 12px;
  margin-left: 6px;
}

/* Qty controls */
.onesite-sidebar-qty {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-top: 6px;
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  overflow: hidden;
  width: fit-content;
  max-width: 100px;
}

.onesite-sidebar-qty button {
  width: 28px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s;
}

.onesite-sidebar-qty button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.onesite-sidebar-qty span {
  width: 28px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  border-left: 1px solid var(--sidebar-border);
  border-right: 1px solid var(--sidebar-border);
  line-height: 26px;
  flex-shrink: 0;
}

/* Remove button */
.onesite-sidebar-item-remove {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}

.onesite-sidebar-item-remove:hover {
  color: var(--sidebar-cta);
}

/* Empty state */
.onesite-sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--sidebar-text-muted);
  gap: 12px;
}

.onesite-sidebar-empty svg {
  opacity: 0.4;
}

.onesite-sidebar-empty p {
  font-size: 15px;
  margin: 0;
}

/* Footer (sticky bottom) */
.onesite-sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--sidebar-border);
  padding: 15px 20px 25px 20px;
  background: var(--sidebar-bg);
}

/* Subtotal */
.onesite-sidebar-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.onesite-sidebar-subtotal-label {
  font-size: 15px;
  font-weight: 700;
}

.onesite-sidebar-subtotal-amount {
  font-size: 18px;
  font-weight: 700;
}

.onesite-sidebar-subtotal-note {
  display: block;
  font-size: 11px;
  color: var(--sidebar-text-muted);
  margin-bottom: 14px;
}

/* CTA buttons */
.onesite-sidebar-btn-checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  background: var(--sidebar-cta);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: none;
  border-radius: var(--sidebar-radius);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.onesite-sidebar-btn-checkout:hover {
  background: var(--sidebar-cta-hover);
  color: #fff;
  text-decoration: none;
}

.onesite-sidebar-btn-viewcart {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--sidebar-radius);
  text-decoration: none;
  cursor: pointer;
  margin-top: 8px;
  transition: border-color 0.15s;
}

.onesite-sidebar-btn-viewcart:hover {
  border-color: var(--sidebar-text-muted);
  color: var(--sidebar-text);
  text-decoration: none;
}

/* Trust badges */
.onesite-sidebar-trust {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap:8px;
  margin-top: 10px;
  padding-top: 10px;
}

.onesite-sidebar-trust-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--sidebar-text-muted);
  font-weight: 500;
}

.onesite-sidebar-trust-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.onesite-sidebar-trust-icons img {
  height: 22px;
  opacity: 0.7;
}

/* HTMX loading indicator */
.onesite-sidebar-items.htmx-request {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.15s;
}
