/* ===== SPACENUTS — CART & CHECKOUT STYLES ===== */

/* ── Cart Icon in Header ─────────────────────────────────────────────────── */
.cart-icon-btn {
  position: relative;
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid rgba(249, 115, 22, 0.4);
  border-radius: 10px;
  color: #f97316;
  font-size: 1rem;
  padding: 8px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s;
}
.cart-icon-btn:hover {
  background: rgba(249, 115, 22, 0.25);
  border-color: #f97316;
}
.cart-badge {
  background: #f97316;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Cart Overlay ─────────────────────────────────────────────────────────── */
#cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 900;
  backdrop-filter: blur(2px);
}
#cart-overlay.open { display: block; }

/* ── Cart Drawer ──────────────────────────────────────────────────────────── */
#cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  background: #fff;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 32px rgba(0,0,0,0.18);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
#cart-drawer.open { transform: translateX(0); }

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #111827;
  color: #fff;
}
.cart-drawer-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}
.cart-close-btn {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s;
  font-family: inherit;
}
.cart-close-btn:hover { color: #fff; }

#cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.cart-empty {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}
.cart-empty-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  opacity: 0.5;
}
.cart-empty p { font-size: 0.95rem; }

/* ── Cart Item ────────────────────────────────────────────────────────────── */
.cart-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}
.cart-item img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
  flex-shrink: 0;
}
.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
  margin-bottom: 2px;
}
.cart-item-pack {
  font-size: 0.73rem;
  color: #9ca3af;
  margin-bottom: 4px;
}
.cart-item-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: #f97316;
}
.cart-item-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.qty-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 2px;
}
.qty-btn {
  background: none;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  font-family: inherit;
}
.qty-btn:hover:not(:disabled) { background: #e5e7eb; }
.qty-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.qty-val {
  min-width: 22px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
}
.remove-btn {
  background: none;
  border: none;
  color: #d1d5db;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
  font-family: inherit;
}
.remove-btn:hover { color: #ef4444; }

/* ── Cart Footer ─────────────────────────────────────────────────────────── */
#cart-drawer-footer {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  background: #fafafa;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.95rem;
  color: #374151;
}
.cart-total-row strong {
  font-size: 1.15rem;
  color: #111827;
}
.btn-full { width: 100%; margin-bottom: 8px; }

/* ── "Add to Cart" button state ─────────────────────────────────────────── */
.add-to-cart-btn.added,
.product-add-to-cart-btn.added {
  background: #16a34a !important;
  border-color: #16a34a !important;
  color: #fff !important;
}

/* ── Product detail qty selector ────────────────────────────────────────── */
.qty-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.qty-selector label {
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
}
.qty-selector .qty-controls {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
}
.qty-selector .qty-btn {
  width: 36px;
  height: 36px;
}
#qty-input {
  width: 52px;
  text-align: center;
  border: none;
  background: none;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  color: #111827;
}
#qty-input::-webkit-inner-spin-button,
#qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── Checkout Page ───────────────────────────────────────────────────────── */
.checkout-section {
  padding: 48px 0 80px;
  min-height: calc(100vh - 68px);
  background: #f9fafb;
}
.checkout-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 32px;
}
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
  align-items: start;
}
@media (max-width: 900px) {
  .checkout-layout { grid-template-columns: 1fr; }
  .checkout-summary-col { order: -1; }
}

/* ── Checkout Steps ──────────────────────────────────────────────────────── */
.checkout-step {
  background: #fff;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}
.step-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.step-back {
  margin-bottom: 16px;
}

/* ── Checkout Form ───────────────────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.form-row-3 {
  grid-template-columns: 1fr 80px 100px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}
.form-group.mb {
  margin-bottom: 16px;
}
.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-group input,
.form-group select {
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #111827;
  background: #fff;
  transition: border-color 0.15s;
  outline: none;
}
.form-group input:focus { border-color: #f97316; }
.form-group input::placeholder { color: #9ca3af; }

/* ── Stripe element container ───────────────────────────────────────────── */
.stripe-loading {
  padding: 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 0.9rem;
}
#payment-element {
  margin-bottom: 8px;
}
.payment-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #dc2626;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.88rem;
  margin-bottom: 12px;
  display: none;
}

/* ── Order Summary Box ──────────────────────────────────────────────────── */
.order-summary-box {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  position: sticky;
  top: 88px;
}
.order-summary-box h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}
.summary-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.summary-item-left img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
  flex-shrink: 0;
}
.summary-item-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
}
.summary-item-pack {
  font-size: 0.72rem;
  color: #9ca3af;
  margin-top: 2px;
}
.summary-item-price {
  font-size: 0.88rem;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}
.summary-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 14px 0 10px;
}
.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  color: #374151;
}
.summary-total strong {
  font-size: 1.2rem;
  color: #111827;
}

/* ── Order Success Page ─────────────────────────────────────────────────── */
.success-section {
  padding: 60px 0 100px;
  min-height: calc(100vh - 68px);
  background: #f9fafb;
}
.success-card {
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06), 0 8px 32px rgba(0,0,0,.06);
  text-align: center;
}
.success-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}
.success-card h1 {
  font-size: 1.9rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 8px;
}
.success-card > p {
  color: #6b7280;
  margin-bottom: 24px;
}
.order-id-badge {
  display: inline-block;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #374151;
  letter-spacing: 0.05em;
  margin-bottom: 32px;
}
.order-details-box {
  text-align: left;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.order-details-section {
  padding: 18px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.order-details-section:last-child { border-bottom: none; }
.order-details-section h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  font-weight: 700;
  margin-bottom: 8px;
}
.order-details-section p {
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.5;
  margin: 0;
}
.order-line-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.88rem;
  color: #374151;
}
.order-line-item:last-child { border-bottom: none; }
.order-line-item-name { flex: 1; }
.order-line-item-price { font-weight: 600; white-space: nowrap; }
.order-total-row {
  display: flex;
  justify-content: space-between;
  padding: 14px 20px;
  background: #f9fafb;
  font-weight: 700;
  color: #111827;
  font-size: 1rem;
}
.success-note {
  color: #6b7280;
  font-size: 0.88rem;
  margin-bottom: 24px;
  line-height: 1.6;
}
