/* ── Cart panel & cart icon ──────────────────────────────────────────────── */

/* ── Header cart button ─────────────────────────────────────────────────── */
.header-cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--r-sm);
  color: rgba(255, 255, 255, 0.75);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.header-cart-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.header-cart-btn svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}
.header-cart-count {
  position: absolute;
  top: 0px;
  right: 0px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--gold);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  letter-spacing: 0;
  line-height: 1;
  pointer-events: none;
  border: 1.5px solid var(--slate-dark);
}

/* ── Backdrop ───────────────────────────────────────────────────────────── */
.cart-backdrop {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(28, 23, 20, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.cart-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Cart panel ─────────────────────────────────────────────────────────── */
.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  width: 400px;
  max-width: 100vw;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(28, 23, 20, 0.22);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-body);
}
.cart-panel.is-open {
  transform: translateX(0);
}
@media (max-width: 440px) {
  .cart-panel { width: 100vw; }
}

/* ── Panel header ───────────────────────────────────────────────────────── */
.cart-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--slate-dark);
  flex-shrink: 0;
}
.cart-panel-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}
.cart-panel-count {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
  margin-left: 4px;
}
.cart-panel-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.cart-panel-close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* ── Panel body (scrollable) ────────────────────────────────────────────── */
.cart-panel-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px 24px;
  text-align: center;
}
.cart-empty svg {
  width: 56px;
  height: 56px;
  color: var(--border);
}
.cart-empty p {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink3);
}
.cart-empty-btn {
  margin-top: 4px;
  font-size: 14px;
  padding: 12px 24px;
}

/* ── Cart items list ────────────────────────────────────────────────────── */
.cart-items-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.cart-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
  background: #fff;
  transition: background 0.12s;
}
.cart-item:last-child { border-bottom: none; }
.cart-item:hover { background: var(--cream2); }

/* Thumbnail */
.cart-item-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--cream2);
  border: 1px solid var(--border);
}
.cart-item-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cart-item-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream2);
}
.cart-item-thumb-placeholder svg {
  width: 28px;
  height: 28px;
  color: var(--border);
}

/* Info */
.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 4px;
  word-break: break-word;
}
.cart-item-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 5px;
}

/* Qty controls */
.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
  background: #fff;
}
.cart-qty-btn {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--ink2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
  font-family: var(--font-body);
  line-height: 1;
}
.cart-qty-btn:hover {
  background: var(--cream2);
  color: var(--gold);
}
.cart-qty-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.cart-qty-num {
  width: 32px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Remove button */
.cart-item-remove {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--ink3);
  font-size: 16px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.12s, color 0.12s;
  line-height: 1;
}
.cart-item-remove:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ── Panel footer ───────────────────────────────────────────────────────── */
.cart-panel-footer {
  padding: 10px 20px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cart-panel-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 2px;
}
.cart-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink2);
}
.cart-summary-row.is-total {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid var(--border);
}
.cart-summary-row.is-total span:last-child {
  color: var(--gold);
}
.cart-summary-row.cart-summary-save {
  color: var(--gold);
  font-weight: 700;
}
.cart-summary-was {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink3);
  text-decoration: line-through;
  margin-right: 5px;
}
.cart-shipping-note {
  font-size: 11px;
  color: var(--ink3);
  text-align: center;
}
.cart-panel-checkout-btn {
  width: 100%;
  padding: 15px 20px;
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 52px;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.cart-panel-checkout-btn:hover { background: #8F5225; }
.cart-panel-checkout-btn:active { transform: scale(0.98); }
.cart-panel-checkout-btn:disabled {
  background: var(--ink3);
  cursor: not-allowed;
  transform: none;
}
.cart-panel-checkout-btn svg {
  width: 18px;
  height: 18px;
}
.cart-panel-continue {
  display: none !important;
  width: 100%;
  padding: 12px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink2);
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.15s, color 0.15s;
}
.cart-panel-continue:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* ── Cart error / loading states ────────────────────────────────────────── */
.cart-panel-error {
  font-size: 12px;
  color: #c0392b;
  text-align: center;
  padding: 0 4px;
}
.cart-item.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ── "Added to cart" toast ──────────────────────────────────────────────── */
.cart-toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 9999;
  background: var(--slate-dark);
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 24px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.28);
}
.cart-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Bounce animation on cart count badge ───────────────────────────────── */
@keyframes cartBadgePop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.55); }
  70%  { transform: scale(0.88); }
  100% { transform: scale(1); }
}
.header-cart-count.pop {
  animation: cartBadgePop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Larger thumbnail (improvement #5) ─────────────────────────────────── */
.cart-item-thumb {
  width: 88px !important;
  height: 88px !important;
}

/* ── Cart item customisation meta ───────────────────────────────────────── */
.cart-item-meta {
  font-size: 11px;
  color: var(--ink3);
  margin-bottom: 0px;
  line-height: 1.4;
}

/* ── Emotional tagline under item name (improvement #1) ─────────────────── */
.cart-item-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 12px;
  color: var(--ink3);
  margin: -2px 0 0px;
  line-height: 1.4;
}

/* ── Free gift badge (improvement #6) ──────────────────────────────────── */
.cart-gift-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: #4A7C44;
  background: #EEF6E8;
  border-radius: 20px;
  padding: 3px 9px 3px 7px;
  margin-top: 2px;
  margin-bottom: 3px;
  line-height: 1.3;
}
.cart-gift-tag svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* ── Trust strip (improvement #2) ──────────────────────────────────────── */
.cart-trust-strip {
  display: flex;
  align-items: stretch;
  border: none;
  border-radius: 0px;
  overflow: hidden;
  background: #fff;
}
.cart-trust-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0px 2px;
  gap: 5px;
  border-right: 1px solid var(--border);
  font-family: var(--font-body);
}
.cart-trust-item:last-child { border-right: none; }
.cart-trust-item svg {
  width: 15px;
  height: 15px;
  color: var(--gold);
  flex-shrink: 0;
}
.cart-trust-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}
.cart-trust-sub {
  font-size: 9.5px;
  color: var(--ink3);
  line-height: 1.2;
}

/* ── Customer quote (improvement #3) ────────────────────────────────────── */
.cart-quote-block {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 10px;
  background: #FAF6F1;
  border-radius: 10px;
  border: 1px solid #EDE0D0;
}
.cart-quote-mark {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1;
  color: var(--gold);
  opacity: 0.35;
  margin-top: -4px;
  flex-shrink: 0;
  font-style: normal;
  user-select: none;
}
.cart-quote-body {}
.cart-quote-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.1;
  margin: 0 0 4px;
}
.cart-quote-author {
  font-size: 11px;
  color: var(--ink3);
  font-family: var(--font-body);
  font-weight: 500;
}

/* ── Dispatch timing note (improvement #4) ──────────────────────────────── */
.cart-dispatch-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink3);
  font-family: var(--font-body);
  text-align: center;
  line-height: 1.4;
}
.cart-dispatch-note svg {
  width: 12px;
  height: 12px;
  color: var(--gold);
  flex-shrink: 0;
}

/* ── Cart item action links ─────────────────────────────────────────────── */
.cart-item-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.cart-item-action-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink3);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.12s;
}
.cart-item-action-btn:hover { color: var(--gold); }
.cart-item-edit-btn { color: var(--ink2); }
.cart-item-edit-btn:hover { color: var(--gold); }

/* ── Preview overlay ────────────────────────────────────────────────────── */
.cart-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(20, 16, 14, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  padding: 20px;
}
.cart-preview-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.cart-preview-overlay-inner {
  position: relative;
  max-width: min(480px, 90vw);
  width: 100%;
  text-align: center;
}
.cart-preview-close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.cart-preview-close:hover { background: rgba(255,255,255,0.22); }
.cart-preview-img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  display: block;
}
.cart-preview-label {
  margin-top: 14px;
  font-family: var(--font-body);
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  font-weight: 500;
}
