/* ==================================================

   CATALYST CART — Cart overlay, checkout, restock modal

   ================================================== */

.cart-count,
.catalyst-cart__count {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--catalyst-orange);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
}

.cart-count.visible,
.catalyst-cart__count.visible {
  display: flex;
}

/* Orange treatment on cart button when items are in cart */
.catalyst-nav__cart-btn.has-items {
  border-color: var(--catalyst-orange);
}
.catalyst-nav__cart-btn.has-items svg {
  stroke: var(--catalyst-orange);
}

.add-to-cart-btn {
  width: 100%;
  padding: 17px 32px;
  background: var(--carbon);
  color: var(--white);
  border: 1.5px solid var(--carbon);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.add-to-cart-btn:hover {
  background: transparent;
  border-color: var(--catalyst-orange);
  color: var(--catalyst-orange);
  transform: translateY(-1px);
  box-shadow: none;
}

.add-to-cart-btn:active {
  transform: translateY(0);
}

.add-to-cart-btn.added {
  background: transparent;
  border: 1.5px solid var(--catalyst-orange);
  color: var(--catalyst-orange);
  pointer-events: none;
}

.add-to-cart-btn.added .btn-check {
  display: block;
}

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgb(26, 26, 26, 0.3);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(2px);
}

.cart-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 90vw;
  z-index: 501;
  background: var(--white);
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 0.35s;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 48px rgb(0, 0, 0, 0.08);
  visibility: hidden;
  /* iOS Safari: prevent off-screen fixed element from causing horizontal overflow */
  clip-path: inset(0 0 0 0);
}

.cart-panel.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 0s;
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 18px;
  flex-shrink: 0;
}

.cart-header-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cart-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: none;
  cursor: pointer;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.cart-close:hover {
  background: var(--surface-warm);
  color: var(--carbon);
}

.cart-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

.cart-sep {
  height: 1px;
  background: var(--border-light);
  margin: 0 28px;
  flex-shrink: 0;
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px;
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
  gap: 10px;
}

.cart-empty svg {
  width: 32px;
  height: 32px;
  stroke: var(--border-solid);
  fill: none;
  stroke-width: 1.2;
}

.cart-items {
  display: none;
}

.cart-items.visible {
  display: block;
}

.cart-line {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}

.cart-line-thumb {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #e8e4df, #d5d0cb);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.cart-line-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-line-info {
  flex: 1;
  min-width: 0;
}

.cart-line-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2px;
}

.cart-line-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--carbon);
}

.cart-line-name .dose-tag {
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 6px;
}

.cart-line-price {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  margin-left: 12px;
}

.cart-line-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

/* Remove button hidden — replaced by qty-to-zero confirmation */
.cart-line-remove { display: none; }

/* Inline remove confirmation */
.remove-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  animation: fadeIn 0.2s ease;
}
.remove-confirm__text {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font);
}
.remove-confirm__yes,
.remove-confirm__no {
  font-size: 11px;
  font-family: var(--font);
  font-weight: 500;
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  background: none;
  transition: all 0.15s;
}
.remove-confirm__yes {
  color: #c0392b;
  border-color: #c0392b;
}
.remove-confirm__yes:hover {
  background: #c0392b;
  color: #fff;
}
.remove-confirm__no {
  color: var(--carbon);
}
.remove-confirm__no:hover {
  background: var(--carbon);
  color: #fff;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.cart-addons {
  padding-top: 16px;
}

.cart-addons-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.addon-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.addon-card:hover {
  border-color: var(--border-solid);
}

.addon-card.selected {
  border-color: var(--catalyst-teal);
  background: rgb(91, 170, 157, 0.04);
}

.addon-check {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-solid);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.addon-card.selected .addon-check {
  background: var(--catalyst-teal);
  border-color: var(--catalyst-teal);
}

.addon-check svg {
  width: 11px;
  height: 11px;
  stroke: var(--white);
  fill: none;
  stroke-width: 2.5;
  opacity: 0;
  transition: opacity 0.2s;
}

.addon-card.selected .addon-check svg {
  opacity: 1;
}

.addon-detail {
  flex: 1;
}

.addon-name {
  font-size: 13px;
  font-weight: 500;
}

.addon-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.addon-price {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.cart-footer {
  padding: 0 28px 28px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}

.cart-totals {
  padding-top: 16px;
}

.checkout-btn {
  width: 100%;
  padding: 15px;
  margin-top: 18px;
  background: var(--carbon);
  color: var(--white);
  border: 1.5px solid var(--carbon);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.checkout-btn:hover {
  background: transparent;
  border-color: var(--catalyst-orange);
  color: var(--catalyst-orange);
}

.checkout-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

@media (width <= 860px) {
  .cart-panel {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  }

  /* Mobile touch targets */
  .cart-close {
    width: 44px;
    height: 44px;
  }

  .qty-btn {
    width: 44px;
    height: 44px;
  }

  .qty-val {
    width: 40px;
    padding: 8px 0;
    font-size: 14px;
  }

  .access-input {
    padding: 12px 14px;
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  .access-apply {
    padding: 12px 18px;
    font-size: 13px;
  }

  .access-row-toggle {
    min-height: 44px;
    font-size: 14px;
  }

  .checkout-btn {
    min-height: 48px;
  }
}


.restock-overlay {
  position: fixed;
  inset: 0;
  background: rgb(26, 26, 26, 0.35);
  backdrop-filter: blur(4px);
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.restock-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.restock-modal {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 40px 36px 36px;
  max-width: 380px;
  width: 100%;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 24px 80px rgb(0, 0, 0, 0.12);
}

.restock-overlay.open .restock-modal {
  transform: translateY(0) scale(1);
}

.restock-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.restock-close:hover {
  background: var(--surface-warm);
  color: var(--carbon);
}

.restock-close svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.restock-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--catalyst-orange);
  margin-bottom: 8px;
}

.restock-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 8px;
  color: var(--carbon);
}

.restock-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.restock-form {
  display: flex;
  gap: 8px;
}

.restock-input {
  flex: 1;
  padding: 13px 16px;
  border: 1.5px solid var(--border-solid);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}

.restock-input:focus {
  border-color: var(--catalyst-orange);
}

.restock-input::placeholder {
  color: var(--text-muted);
}

.restock-submit {
  padding: 13px 22px;
  background: var(--carbon);
  color: var(--white);
  border: 1.5px solid var(--carbon);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}

.restock-submit:hover {
  background: transparent;
  border-color: var(--catalyst-orange);
  color: var(--catalyst-orange);
}

.restock-success {
  display: none;
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  color: var(--catalyst-teal);
  font-weight: 500;
}

.add-to-cart-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ==================================================
   CART PANEL — Qty stepper, access code, totals
   (Shared across all pages for global cart panel)
   ================================================== */

.qty-stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.qty-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  font-family: var(--font);
}

.qty-btn:hover {
  background: var(--bg);
  color: var(--carbon);
}

.qty-val {
  width: 32px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  border-left: 1px solid var(--border-solid);
  border-right: 1px solid var(--border-solid);
  padding: 6px 0;
  font-family: var(--font);
}

.access-row {
  padding: 10px 0;
}

.access-row-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--catalyst-orange);
  padding: 0;
}

.access-row-toggle .arrow {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.access-row-toggle.open .arrow {
  transform: rotate(90deg);
}

.access-field {
  display: none;
  margin-top: 8px;
  gap: 8px;
  align-items: center;
}

.access-field.visible {
  display: flex;
}

.access-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border-solid);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
}

.access-input:focus {
  border-color: var(--catalyst-orange);
}

.access-input::placeholder {
  color: var(--text-muted);
}

.access-apply {
  padding: 10px 16px;
  background: var(--carbon);
  color: var(--white);
  border: 1.5px solid var(--carbon);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
}

.access-apply:hover {
  background: transparent;
  border-color: var(--catalyst-orange);
  color: var(--catalyst-orange);
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 5px 0;
}

.totals-row .tr-val {
  font-weight: 500;
  color: var(--carbon);
}

.totals-row.total {
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--border-light);
  font-size: 15px;
  font-weight: 600;
  color: var(--carbon);
}

.totals-row.total .tr-val {
  font-size: 20px;
  font-weight: 700;
}


/* ── Coupon acceptance transitions ── */
.access-row {
  overflow: hidden;
  max-height: 120px;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.4s ease, padding 0.4s ease;
}
.access-row.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  pointer-events: none;
}

/* Coupon applied tag — small monospace pill above totals */
.coupon-tag {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 0 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--catalyst-teal);
}
.coupon-tag.visible {
  display: flex;
}
.coupon-tag svg {
  width: 12px;
  height: 12px;
  stroke: var(--catalyst-teal);
  fill: none;
  stroke-width: 2.5;
  flex-shrink: 0;
}

/* FREE label in totals */
.tr-val--free {
  color: var(--catalyst-teal) !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  letter-spacing: 0.04em;
}

/* Addon card FREE price */
.addon-price--free {
  color: var(--catalyst-teal);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Shipping row entrance animation */
.totals-row.shipping-row {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0;
  transition: max-height 0.35s ease 0.15s, opacity 0.3s ease 0.2s, padding 0.35s ease 0.15s;
}
.totals-row.shipping-row.visible {
  max-height: 40px;
  opacity: 1;
  padding: 5px 0;
}

/* iOS Safari: prevent auto-zoom on input focus (requires >= 16px) */
@media screen and (max-width: 768px) {
  .access-input,
  .restock-input {
    font-size: 16px;
  }
}
