/* ═══════════════════════════════════════════
   CART ICON + CART DRAWER
═══════════════════════════════════════════ */

/* ── Cart icon in header ─────────────── */
.cart-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-dark);
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
}

.cart-icon-btn:hover {
  background: rgba(82,113,255,0.08);
  color: var(--brand);
}

.cart-count {
  position: absolute;
  top: 2px;
  right: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Drawer overlay ──────────────────── */
.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
  visibility: hidden;
}

.cart-drawer.active {
  pointer-events: auto;
  visibility: visible;
}

.cart-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cart-drawer.active .cart-drawer-overlay {
  opacity: 1;
}

/* ── Drawer panel ────────────────────── */
.cart-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 92vw;
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.1);
}

.cart-drawer.active .cart-drawer-panel {
  transform: translateX(0);
}

/* ── Header ──────────────────────────── */
.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.cart-drawer-header h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
}

.cart-drawer-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-mid);
  transition: background 0.2s, color 0.2s;
}

.cart-drawer-close:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text-dark);
}

/* ── Body (scrollable) ───────────────── */
.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

/* ── Empty state ─────────────────────── */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 1rem;
  text-align: center;
}

.cart-empty p {
  color: var(--text-light);
  font-size: 1rem;
}

.cart-empty-link {
  color: var(--brand);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cart-empty-link:hover {
  color: var(--brand-dark);
}

/* ── Cart items ──────────────────────── */
.cart-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  position: relative;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--cream);
  flex-shrink: 0;
}

.cart-item-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cart-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
  color: var(--text-dark);
  padding-right: 1.5rem;
}

.cart-item-variant {
  font-size: 0.78rem;
  color: var(--text-light);
  text-transform: capitalize;
}

.cart-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.4rem;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  overflow: hidden;
}

.cart-qty-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-mid);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.cart-qty-btn:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text-dark);
}

.cart-qty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cart-qty-value {
  width: 28px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
}

.cart-item-price {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-dark);
}

.cart-item-free {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--green);
  background: rgba(26,154,92,0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.cart-item-remove {
  position: absolute;
  top: 1rem;
  right: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
}

.cart-item-remove:hover {
  color: var(--red-therapy);
  background: rgba(221,29,29,0.06);
}

/* ── Discount prices ─────────────────── */
.cart-item-prices {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cart-item-price-current {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--brand);
}

.cart-item-price-compare {
  font-size: 0.78rem;
  color: var(--text-light);
  text-decoration: line-through;
}

/* ── Shipping upsell toggle ──────────── */
.cart-shipping-upsell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--cream);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.cart-shipping-upsell-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--brand);
}

.cart-shipping-upsell-info > div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cart-shipping-upsell-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.3;
}

.cart-shipping-upsell-price {
  font-size: 0.75rem;
  color: var(--text-mid);
}

/* Toggle switch */
.cart-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.cart-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cart-toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 24px;
  transition: background 0.25s ease;
}

.cart-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.cart-toggle input:checked + .cart-toggle-slider {
  background: var(--brand);
}

.cart-toggle input:checked + .cart-toggle-slider::before {
  transform: translateX(20px);
}

.cart-toggle input:disabled + .cart-toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Savings banner ──────────────────── */
.cart-savings {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green);
  background: rgba(26,154,92,0.06);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.8rem;
}

/* ── Footer ──────────────────────────── */
.cart-drawer-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
  background: #fff;
}

.cart-subtotal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.cart-shipping-note {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.cart-checkout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.9rem 1.5rem;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.cart-checkout-btn:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.cart-trust-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 0.8rem;
  font-size: 0.72rem;
  color: var(--text-light);
}

.cart-trust-badges span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ── Button loading spinner ──────────── */
.btn-loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ──────────────────────── */
@media (max-width: 600px) {
  .cart-drawer-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .cart-item-img {
    width: 60px;
    height: 60px;
  }
}
