/* SoundGlow Cart UI — drawer + mini-cart (English mirror, identical to DK) */

:root {
  --sg-cart-bg: #07060f;
  --sg-cart-card: #0d0b1e;
  --sg-cart-purple: #a855f7;
  --sg-cart-pink: #ec4899;
  --sg-cart-cyan: #22d3ee;
  --sg-cart-white: #f0eeff;
  --sg-cart-light: #c4bfe8;
  --sg-cart-muted: #9b96b8;
  --sg-cart-dim: #6b6980;
  --sg-cart-border: rgba(255, 255, 255, 0.06);
  --sg-cart-border-purple: rgba(168, 85, 247, 0.2);
}

body.sg-cart-locked { overflow: hidden; }

.sg-cart-backdrop {
  position: fixed; inset: 0;
  background: rgba(7, 6, 15, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 9998;
}
.sg-cart-backdrop--visible { opacity: 1; pointer-events: auto; }

.sg-cart-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--sg-cart-card);
  border-left: 1px solid var(--sg-cart-border-purple);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--sg-cart-white);
}
.sg-cart-drawer--open { transform: translateX(0); }

.sg-cart-drawer__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--sg-cart-border);
  flex-shrink: 0;
}
.sg-cart-drawer__title {
  font-family: 'Bebas Neue', 'Space Grotesk', sans-serif;
  font-size: 22px; letter-spacing: 0.05em;
  margin: 0; color: var(--sg-cart-white); font-weight: 400;
}
.sg-cart-drawer__close {
  background: transparent; border: none; color: var(--sg-cart-light);
  font-size: 28px; line-height: 1; cursor: pointer;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s; padding: 0;
}
.sg-cart-drawer__close:hover { background: rgba(255, 255, 255, 0.06); color: var(--sg-cart-white); }

.sg-cart-drawer__items { flex: 1; overflow-y: auto; padding: 8px 20px; }
.sg-cart-drawer__item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--sg-cart-border);
  align-items: flex-start;
}
.sg-cart-drawer__item:last-child { border-bottom: none; }
.sg-cart-drawer__item-img {
  width: 64px; height: 64px;
  background: var(--sg-cart-bg);
  border: 1px solid var(--sg-cart-border);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; overflow: hidden; flex-shrink: 0;
}
.sg-cart-drawer__item-img img { width: 100%; height: 100%; object-fit: cover; }
.sg-cart-drawer__item-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sg-cart-drawer__item-name {
  font-size: 14px; font-weight: 600;
  color: var(--sg-cart-white); line-height: 1.3;
  overflow-wrap: anywhere; word-break: break-word;
}
.sg-cart-drawer__item-variant {
  font-size: 12px; color: var(--sg-cart-muted);
  overflow-wrap: anywhere; word-break: break-word;
}
.sg-cart-drawer__item-controls { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.sg-cart-drawer__qty {
  display: inline-flex; align-items: center;
  border: 1px solid var(--sg-cart-border-purple);
  border-radius: 6px; overflow: hidden;
}
.sg-cart-drawer__qty-btn {
  background: transparent; border: none; color: var(--sg-cart-light);
  width: 28px; height: 28px; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s; padding: 0;
}
.sg-cart-drawer__qty-btn:hover { background: rgba(168, 85, 247, 0.12); color: var(--sg-cart-purple); }
.sg-cart-drawer__qty-num {
  font-size: 13px; font-weight: 600;
  padding: 0 8px; min-width: 24px; text-align: center;
}
.sg-cart-drawer__remove {
  background: transparent; border: none; color: var(--sg-cart-dim);
  font-size: 11px; cursor: pointer; padding: 0;
  text-decoration: underline; text-underline-offset: 2px;
  transition: color 0.15s; font-family: inherit;
}
.sg-cart-drawer__remove:hover { color: #fca5a5; }
.sg-cart-drawer__item-price {
  font-size: 14px; font-weight: 700; color: var(--sg-cart-purple); white-space: nowrap;
}

.sg-cart-drawer__empty {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px 20px;
}
.sg-cart-drawer__empty-title { font-size: 16px; color: var(--sg-cart-light); margin: 0 0 6px; }
.sg-cart-drawer__empty-hint { font-size: 13px; color: var(--sg-cart-muted); margin: 0; }

.sg-cart-drawer__footer {
  padding: 20px;
  border-top: 1px solid var(--sg-cart-border);
  flex-shrink: 0;
  background: var(--sg-cart-card);
}
.sg-cart-drawer__totals {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 14px; color: var(--sg-cart-light); margin-bottom: 4px;
}
.sg-cart-drawer__totals strong { font-size: 18px; font-weight: 700; color: var(--sg-cart-white); }
.sg-cart-drawer__shipping-note { font-size: 11px; color: var(--sg-cart-dim); margin: 0 0 14px; }
.sg-cart-drawer__checkout {
  display: block; width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--sg-cart-purple), var(--sg-cart-pink));
  color: white; text-align: center; text-decoration: none;
  font-weight: 700; font-size: 14px;
  letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.3);
  transition: opacity 0.15s, transform 0.15s; font-family: inherit;
}
.sg-cart-drawer__checkout:hover { opacity: 0.9; }
.sg-cart-drawer__checkout:active { transform: scale(0.98); }

.sg-mini-cart {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sg-cart-border);
  border-radius: 8px;
  color: var(--sg-cart-light); cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit; padding: 0;
}
.sg-mini-cart:hover {
  background: rgba(168, 85, 247, 0.08);
  border-color: var(--sg-cart-border-purple);
  color: var(--sg-cart-purple);
}
.sg-mini-cart__count {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  background: linear-gradient(135deg, var(--sg-cart-purple), var(--sg-cart-pink));
  color: white;
  border-radius: 10px;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.sg-mini-cart__count--hidden { display: none; }

@media (max-width: 768px) {
  .sg-cart-drawer { max-width: none; }
  .sg-cart-drawer__header { padding: 14px 16px; }
  .sg-cart-drawer__title { font-size: 20px; }
  .sg-cart-drawer__close { width: 44px; height: 44px; font-size: 30px; }
  .sg-cart-drawer__items { padding: 4px 16px; }
  .sg-cart-drawer__item { grid-template-columns: 56px 1fr auto; gap: 10px; padding: 14px 0; }
  .sg-cart-drawer__item-img { width: 56px; height: 56px; }
  .sg-cart-drawer__item-controls { gap: 14px; margin-top: 6px; }
  .sg-cart-drawer__qty-btn { width: 36px; height: 36px; font-size: 18px; }
  .sg-cart-drawer__qty-num { padding: 0 10px; font-size: 14px; }
  .sg-cart-drawer__remove { font-size: 12px; padding: 4px 0; }
  .sg-cart-drawer__footer { padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .sg-cart-drawer__totals { font-size: 15px; }
  .sg-cart-drawer__totals strong { font-size: 19px; }
  .sg-cart-drawer__checkout { padding: 16px 20px; font-size: 15px; }
}

@media (max-width: 380px) {
  .sg-cart-drawer__item { grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 6px; }
  .sg-cart-drawer__item-img { grid-column: 1; grid-row: 1 / span 2; }
  .sg-cart-drawer__item-info { grid-column: 2; grid-row: 1; }
  .sg-cart-drawer__item-price { grid-column: 2; grid-row: 2; text-align: left; font-size: 15px; align-self: end; }
}
