/* =========================================================
   Peptide Sciences — storefront
   Mobile-first. Off-white canvas, white rounded cards,
   navy ink, logo bead-chain colours as sparing accents.
   ========================================================= */

:root {
  --bg-app:    #F7F5F0;
  --card:      #FFFFFF;
  --ink:       #1C2B45;
  --ink-soft:  #7A8194;
  --line:      #ECE9E2;
  --sage:      #93A97C;
  --clay:      #C98A7E;
  --teal:      #6FA3A8;
  --gold:      #D9A441;
  --violet:    #8B7AA8;
  --danger:    #B4463B;

  --radius-lg: 26px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow:    0 1px 3px rgba(28, 43, 69, 0.06), 0 8px 24px rgba(28, 43, 69, 0.07);
  --font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg-app);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }

a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
img { max-width: 100%; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------------- App shell ---------------- */
.app-shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 48px;
}

/* ---------------- Top bar ---------------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 0;
}

.account-chip { font-size: 0.76rem; color: var(--ink-soft); line-height: 1.35; }
.account-chip strong { display: block; color: var(--ink); font-size: 0.86rem; font-weight: 600; }
.account-chip a { color: var(--ink-soft); text-decoration: underline; }

.auth-links { display: flex; gap: 14px; font-size: 0.82rem; }
.auth-links a { color: var(--ink); font-weight: 600; text-decoration: none; }

.basket-icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}
.basket-icon-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------- Hero ---------------- */
.hero { padding: 22px 22px 4px; }
.logo-wrap { display: flex; justify-content: center; margin-bottom: 12px; }
.logo-wrap img { height: 78px; width: auto; display: block; }
.tagline {
  text-align: center;
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 300px;
  margin: 0 auto;
}

/* ---------------- Search + filter ---------------- */
.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 22px 4px;
}
.search-box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.search-box svg { flex-shrink: 0; opacity: 0.45; }
.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 0.88rem;
}
.filter-btn {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--ink);
  border: none;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------- Section label ---------------- */
.section-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 24px 22px 12px;
}
.section-label h2 { font-size: 0.95rem; }
.section-label span { font-size: 0.76rem; color: var(--ink-soft); }

/* ---------------- Product grid ---------------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 0 22px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
}
.card .thumb {
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #F7F5F0 0%, #ECE7DA 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card .thumb svg { width: 42%; height: auto; opacity: 0.55; }
.card .info { padding: 10px 12px 12px; }
.card .info .title { font-size: 0.82rem; font-weight: 600; line-height: 1.3; }
.card .info .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.card .price { font-size: 0.88rem; font-weight: 700; }
.card.locked .price { color: var(--ink-soft); letter-spacing: 0.08em; }
.card .quick-add {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  border: none;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 10px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ---------------- Disclaimer ---------------- */
.disclaimer-strip {
  margin: 26px 22px 0;
  padding: 12px 14px;
  background: #FBF9F4;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------------- Bottom sheets ---------------- */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 25, 40, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
  z-index: 40;
}
.overlay-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  transform: translate(-50%, 110%);
  transition: transform 0.28s ease;
  background: var(--bg-app);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.16);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.sheet.open { transform: translate(-50%, 0); }

.sheet-handle {
  width: 40px;
  height: 4px;
  margin: 10px auto 4px;
  border-radius: 999px;
  background: var(--line);
  flex-shrink: 0;
}
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px 4px;
  flex-shrink: 0;
}
.sheet-header h3 { font-size: 1rem; }
.sheet-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px 20px;
}
.sheet-footer {
  flex-shrink: 0;
  padding: 14px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--bg-app);
}

/* ---------------- Sort options ---------------- */
.sort-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  cursor: pointer;
}
.sort-option.active { font-weight: 700; }
.sort-option .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0;
}
.sort-option.active .dot { opacity: 1; }
.sort-note {
  padding: 14px 4px 4px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------------- Product detail ---------------- */
.pdp-image {
  aspect-ratio: 1 / 1;
  max-height: 40vh;
  background: linear-gradient(135deg, #F7F5F0 0%, #ECE7DA 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.pdp-image svg { width: 34%; height: auto; opacity: 0.55; }
.pdp-title { font-size: 1.05rem; margin-bottom: 4px; }
.pdp-price { font-size: 1rem; font-weight: 700; margin-bottom: 14px; }
.pdp-desc {
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-bottom: 14px;
}
.pdp-disclaimer {
  font-size: 0.7rem;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.5;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  margin-bottom: 16px;
}

/* ---------------- Form controls ---------------- */
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
select, textarea {
  width: 100%;
  font-size: 0.86rem;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  margin-bottom: 14px;
}
textarea { resize: vertical; }

.stepper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.stepper button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
}
.stepper .qty-val {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
}

/* ---------------- Buttons ---------------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 15px 22px;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
}
.btn.locked {
  background: #D8D3C6;
  color: #6B6656;
  cursor: not-allowed;
  justify-content: center;
}
.btn-block-simple {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
}
.btn-block-simple:disabled { opacity: 0.55; cursor: not-allowed; }

.locked-panel {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  background: #FBF2E1;
  color: #7A5A1E;
  font-size: 0.8rem;
  line-height: 1.5;
}

/* ---------------- Basket lines ---------------- */
.basket-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.basket-line .thumb-sm {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #F7F5F0 0%, #ECE7DA 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.basket-line .thumb-sm svg { width: 55%; height: auto; opacity: 0.5; }
.basket-line .meta { flex: 1; min-width: 0; }
.basket-line .meta .t { font-size: 0.82rem; font-weight: 600; }
.basket-line .meta .v { font-size: 0.72rem; color: var(--ink-soft); }
.basket-line .stepper { margin-bottom: 0; gap: 8px; }
.basket-line .stepper button { width: 26px; height: 26px; font-size: 0.85rem; }

.remove-x {
  margin-top: 4px;
  padding: 0;
  border: none;
  background: none;
  color: var(--danger);
  font-size: 0.72rem;
  text-decoration: underline;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  color: var(--ink-soft);
}
.totals-row.total {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ink);
}

.empty-basket {
  text-align: center;
  padding: 40px 10px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ---------------- Confirmation modal ---------------- */
.center-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 30px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(20, 25, 40, 0.42);
}
.center-modal.open { display: flex; }
.center-modal .card-inner {
  width: 100%;
  max-width: 380px;
  padding: 32px 26px;
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}
.check-circle {
  width: 74px;
  height: 74px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
}
.check-circle svg { width: 34px; height: 34px; }

/* ---------------- Auth pages ---------------- */
.center-col {
  max-width: 440px;
  margin: 0 auto;
  padding: 40px 22px 60px;
}
.center-col .card-box {
  padding: 28px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.center-col h1 { font-size: 1.2rem; margin-bottom: 6px; }
.center-col .logo-wrap { margin-bottom: 20px; }
.center-col .logo-wrap img { height: 62px; }

.field-row { margin-bottom: 14px; }
.field-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.field-row input {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
}

.alert-box {
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.5;
}
.alert-error   { background: #F7EAE8; color: #7A3428; border: 1px solid #C9877E; }
.alert-success { background: #EEF3E8; color: #4C5C39; border: 1px solid var(--sage); }
.alert-pending { background: #FBF2E1; color: #7A5A1E; border: 1px solid var(--gold); }

.link-muted { color: var(--ink-soft); font-size: 0.84rem; line-height: 1.5; }
.link-muted a { color: var(--teal); font-weight: 600; }
