/* ==========================================================================
   Optimal Balance Pharmacy (OBPRX) — OTC Storefront Stylesheet
   Brand tokens match live obprx.com computed values (provided 2026-07-29):
     Primary purple/violet : #7C59F6  (headings, category labels, gradient)
     Deep navy-indigo      : #1A1D6C  (buttons, nav text — secondary/CTA)
     Blue link color       : #046BD2
     Body/slate text       : #334155
     Background            : #FFFFFF
   Typography: system font stack, no custom webfont — matches obprx.com.
   ========================================================================== */

:root {
  --purple:        #7C59F6;
  --purple-dark:   #6B46E5;
  --purple-light:  #EDE8FE;
  --navy:          #1A1D6C;
  --navy-hover:    #12154f;
  --blue-link:     #046BD2;
  --text:          #334155;
  --text-dim:      #64748B;
  --bg:            #FFFFFF;
  --bg-soft:       #F8F7FF;
  --border:        #E5E1FB;
  --border-soft:   #EEF0F4;
  --success:       #16A34A;
  --danger:        #DC2626;
  --danger-bg:     #FEF2F2;

  --gradient-brand: linear-gradient(90deg, #7C59F6 0%, #046BD2 100%);
  --gradient-band:  linear-gradient(135deg, #7C59F6 0%, #5A3FE0 45%, #1A1D6C 100%);

  --ff-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --max-w: 1220px;
  --shadow-sm: 0 1px 2px rgba(26,29,108,.06), 0 1px 1px rgba(26,29,108,.04);
  --shadow-md: 0 6px 20px rgba(26,29,108,.10);
  --shadow-lg: 0 16px 40px rgba(26,29,108,.16);
  --transition: 160ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--ff-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }

h1, h2, h3, h4 { color: var(--navy); font-weight: 700; line-height: 1.2; }
.text-purple { color: var(--purple); }
a.link { color: var(--blue-link); text-decoration: underline; text-underline-offset: 2px; }
a.link:hover { color: var(--navy); }

/* ─── Gradient accent bar (brand signature element) ─────────────────────── */
.gradient-bar { height: 5px; width: 100%; background: var(--gradient-brand); }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.5rem; border-radius: var(--radius-pill);
  font-weight: 600; font-size: .95rem; transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--navy-hover); box-shadow: var(--shadow-md); }
.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: var(--purple-dark); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: .5rem 1rem; font-size: .85rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #fff; }

/* ─── Nav ────────────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 500;
  background: #fff; border-bottom: 1px solid var(--border-soft);
}
.nav-inner {
  max-width: var(--max-w); margin: 0 auto; padding: .85rem 1.25rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.nav-logo { display: flex; align-items: center; height: 36px; flex-shrink: 0; }
.nav-logo img { height: 100%; width: auto; }
.nav-links { display: flex; gap: 1.75rem; margin-left: .5rem; flex: 1; }
.nav-links a { font-weight: 600; font-size: .95rem; color: var(--navy); transition: color var(--transition); }
.nav-links a:hover { color: var(--purple); }
.nav-actions { display: flex; align-items: center; gap: .9rem; }
.nav-icon-link {
  position: relative; display: flex; align-items: center; gap: .4rem;
  font-weight: 600; color: var(--navy); font-size: .95rem;
}
/* Header pill linking to the obprx.com corporate/marketing site (added
   2026-07-31 alongside the new obprx.com build — see components.js). */
.nav-shop-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--purple-light); color: var(--purple-dark) !important;
  font-size: .82rem; font-weight: 700;
  padding: .5rem 1rem; border-radius: var(--radius-pill);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-shop-pill:hover { background: var(--purple); color: #fff !important; }
.cart-count {
  position: absolute; top: -8px; right: -12px;
  background: var(--purple); color: #fff; font-size: .7rem; font-weight: 700;
  border-radius: 50%; width: 19px; height: 19px; display: flex; align-items: center; justify-content: center;
}
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 38px; height: 38px; border-radius: var(--radius-sm);
}
.nav-toggle span {
  display: block; width: 20px; height: 2px; background: var(--navy); border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-mobile-panel {
  display: none; flex-direction: column; padding: 0 1.25rem 1rem;
  border-top: 1px solid var(--border-soft);
}
.nav-mobile-panel a { padding: .8rem 0; font-weight: 600; color: var(--navy); border-bottom: 1px solid var(--border-soft); }
.nav-mobile-panel.open { display: flex; }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
}
@media (min-width: 861px) {
  .nav-mobile-panel { display: none !important; }
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  padding: 3.5rem 0 3rem;
  background: var(--bg-soft);
}
.hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2.5rem; align-items: center; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--purple-light); color: var(--purple-dark);
  font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .35rem .85rem; border-radius: var(--radius-pill); margin-bottom: 1rem;
}
.hero h1 { font-size: 2.6rem; margin-bottom: 1rem; }
.hero p.lead { font-size: 1.1rem; color: var(--text-dim); margin-bottom: 1.75rem; max-width: 40ch; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-art {
  background: var(--gradient-band); border-radius: var(--radius-lg);
  min-height: 320px; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
}
.hero-art img { max-width: 60%; filter: brightness(0) invert(1); opacity: .9; }

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .hero-art { min-height: 200px; order: -1; }
}

/* ─── Trust / feature band (purple gradient, pill badges) ───────────────── */
.trust-band {
  background: var(--gradient-band);
  padding: 2.75rem 0;
}
.trust-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem;
}
.trust-item {
  position: relative; overflow: hidden; color: #fff;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  padding: 1.25rem 1.1rem;
  backdrop-filter: blur(6px);
}
.trust-emoji {
  position: absolute; top: .6rem; right: .7rem;
  font-size: 2.4rem; line-height: 1; opacity: .28;
  pointer-events: none; z-index: 0;
}
.trust-item > div { position: relative; z-index: 1; }
.trust-item strong { display: block; font-size: .95rem; }
.trust-item span { font-size: .8rem; opacity: .85; }

@media (max-width: 860px) {
  .trust-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Section headings ───────────────────────────────────────────────────── */
.section { padding: 3.5rem 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap; }
.section-head h2 { font-size: 1.9rem; }
.section-head p { color: var(--text-dim); margin-top: .35rem; }
.eyebrow { color: var(--purple); font-weight: 700; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; margin-bottom: .4rem; }

/* ─── Category chips ─────────────────────────────────────────────────────── */
.chip-row { display: flex; gap: .6rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: 2rem; }
.chip {
  flex-shrink: 0; padding: .55rem 1.1rem; border-radius: var(--radius-pill);
  border: 1.5px solid var(--border); font-weight: 600; font-size: .87rem; color: var(--navy);
  background: #fff; transition: all var(--transition);
}
.chip:hover { border-color: var(--purple); color: var(--purple); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ─── Product grid & cards ───────────────────────────────────────────────── */
.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.5rem;
  align-items: stretch;
}
.product-card {
  background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius);
  overflow: hidden; transition: box-shadow var(--transition), transform var(--transition);
  display: flex; flex-direction: column; height: 100%;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.product-card-media {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  background: linear-gradient(160deg, #f4f1fd 0%, #eef2fb 100%);
  display: flex; align-items: center; justify-content: center;
}
.product-card-media img { width: 100%; height: 100%; object-fit: contain; padding: 1.4rem; box-sizing: border-box; }
.product-badge {
  position: absolute; top: .7rem; left: .7rem;
  background: var(--purple); color: #fff; font-size: .7rem; font-weight: 700;
  padding: .25rem .6rem; border-radius: var(--radius-pill); letter-spacing: .02em;
}
.product-card-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.product-cat { font-size: .72rem; font-weight: 700; color: var(--purple); text-transform: uppercase; letter-spacing: .04em; }
.product-name {
  font-size: 1rem; font-weight: 700; color: var(--navy); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: calc(1.3em * 2);
}
.product-unit { font-size: .8rem; color: var(--text-dim); }
.product-desc { font-size: .85rem; color: var(--text-dim); flex: 1; }
.product-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: .5rem; gap: .5rem; }
.product-price { font-size: 1.15rem; font-weight: 700; color: var(--navy); }
.add-btn {
  background: var(--purple); color: #fff; font-weight: 700; font-size: .85rem;
  padding: .55rem .95rem; border-radius: var(--radius-pill); transition: background var(--transition);
  white-space: nowrap;
}
.add-btn:hover { background: var(--purple-dark); }
.add-btn.added { background: var(--success); }
.add-btn.added:hover { background: #12813c; }

/* Qty stepper — replaces the Add to Cart button on a tile once that
   product is in the cart, so qty can be adjusted right from the grid
   (Bradley, 2026-07-31). Minus at qty 1 removes the item and reverts
   the tile back to the purple Add to Cart button. */
.qty-stepper {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--success); color: #fff; border-radius: var(--radius-pill);
  padding: .25rem .3rem; min-width: 96px;
}
.qty-stepper button {
  width: 26px; height: 26px; flex-shrink: 0; background: rgba(255,255,255,.16);
  color: #fff; border: none; border-radius: 50%; font-weight: 700; font-size: 1rem;
  line-height: 1; cursor: pointer; transition: background var(--transition);
}
.qty-stepper button:hover { background: rgba(255,255,255,.32); }
.qty-stepper .qty-stepper-val {
  flex: 1; text-align: center; font-weight: 700; font-size: .85rem; padding: 0 .3rem;
}

/* ─── Product detail page ───────────────────────────────────────────────── */
.pdp { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: flex-start; }
.pdp-media {
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
  background: linear-gradient(160deg, #f4f1fd 0%, #eef2fb 100%);
  display: flex; align-items: center; justify-content: center;
}
.pdp-media img { width: 100%; aspect-ratio: 1/1; object-fit: contain; padding: 2.2rem; box-sizing: border-box; }
.pdp-info h1 { font-size: 2rem; margin: .5rem 0 .3rem; }
.pdp-price { font-size: 1.75rem; font-weight: 800; color: var(--navy); margin: 1rem 0; }
.pdp-desc { color: var(--text-dim); margin-bottom: 1.5rem; font-size: 1.02rem; }
.qty-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.qty-control { display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.qty-control button { width: 38px; height: 38px; font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.qty-control button:hover { background: var(--bg-soft); }
.qty-control input { width: 46px; text-align: center; border: none; font-weight: 700; }
.pdp-badges { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.5rem; }
.pdp-badge {
  font-size: .78rem; font-weight: 600; color: var(--navy); background: var(--purple-light);
  padding: .4rem .8rem; border-radius: var(--radius-pill);
}

@media (max-width: 860px) {
  .pdp { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ─── Cart ───────────────────────────────────────────────────────────────── */
.cart-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 2.5rem; align-items: flex-start; }
.cart-item {
  display: grid; grid-template-columns: 72px 1fr auto; gap: 1rem; align-items: center;
  padding: 1.1rem 0; border-bottom: 1px solid var(--border-soft);
}
.cart-item-media {
  width: 72px; height: 72px; border-radius: var(--radius-sm); overflow: hidden;
  background: linear-gradient(160deg, #f4f1fd 0%, #eef2fb 100%);
  display: flex; align-items: center; justify-content: center;
}
.cart-item-media img { width: 100%; height: 100%; object-fit: contain; padding: .35rem; box-sizing: border-box; }
.cart-item-name { font-weight: 700; color: var(--navy); font-size: .95rem; }
.cart-item-cat { font-size: .78rem; color: var(--text-dim); }
.cart-item-actions { display: flex; align-items: center; gap: .75rem; }
.cart-item-remove { color: var(--danger); font-size: .8rem; font-weight: 600; }
.cart-item-price { font-weight: 700; color: var(--navy); text-align: right; min-width: 70px; }
.cart-summary {
  background: var(--bg-soft); border-radius: var(--radius-lg); padding: 1.75rem;
  position: sticky; top: 90px;
}
.summary-row { display: flex; justify-content: space-between; margin-bottom: .75rem; font-size: .95rem; }
.summary-row.total { font-weight: 800; font-size: 1.2rem; color: var(--navy); border-top: 1px solid var(--border); padding-top: 1rem; margin-top: .5rem; }
.summary-row.tier-nudge { display: block; background: #f4f0ff; color: #5b3fd6; font-size: .82rem; font-weight: 600; padding: .6rem .75rem; border-radius: 8px; margin: .25rem 0 1rem; }
.summary-row.tier-nudge.tier-nudge-max { background: #eefaf1; color: #1e8a4c; }
.display-case-banner { background: #fff8e6; border: 1px solid #f0d98c; border-radius: 10px; padding: .85rem .9rem; margin-bottom: 1rem; }
.display-case-banner p { font-size: .85rem; font-weight: 600; color: #7a5c00; margin-bottom: .6rem; line-height: 1.4; }
.free-tag { display: inline-block; background: #1e8a4c; color: #fff; font-size: .65rem; font-weight: 800; letter-spacing: .03em; padding: .15rem .4rem; border-radius: 5px; vertical-align: middle; margin-left: .4rem; }
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-dim); }
.empty-state h3 { margin-bottom: .5rem; }

@media (max-width: 860px) {
  .cart-layout { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
}

/* ─── Forms (auth, checkout, account) ───────────────────────────────────── */
.auth-shell {
  max-width: 440px; margin: 3rem auto; background: #fff; border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 2.25rem; box-shadow: var(--shadow-sm);
}
.auth-shell h1 { font-size: 1.6rem; margin-bottom: .35rem; }
.auth-shell p.sub { color: var(--text-dim); margin-bottom: 1.5rem; font-size: .92rem; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .85rem; font-weight: 700; color: var(--navy); margin-bottom: .35rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: .7rem .9rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .95rem; transition: border-color var(--transition);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--purple); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-error { color: var(--danger); font-size: .8rem; margin-top: .3rem; display: none; }
.field.has-error input { border-color: var(--danger); }
.field.has-error .field-error { display: block; }
.form-alert {
  padding: .85rem 1rem; border-radius: var(--radius-sm); font-size: .88rem; margin-bottom: 1.25rem; display: none;
}
.form-alert.show { display: block; }
.form-alert.error { background: var(--danger-bg); color: var(--danger); }
.form-alert.success { background: #F0FDF4; color: var(--success); }
.auth-foot { text-align: center; margin-top: 1.25rem; font-size: .9rem; color: var(--text-dim); }

/* ─── Checkout ───────────────────────────────────────────────────────────── */
.checkout-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: flex-start; }
.checkout-section { background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); padding: 1.75rem; margin-bottom: 1.5rem; }
.checkout-section h3 { font-size: 1.1rem; margin-bottom: 1rem; }
#authnet-iframe-container iframe { width: 100%; min-height: 220px; border: none; }
.sandbox-note {
  background: var(--purple-light); color: var(--navy); border-radius: var(--radius-sm);
  padding: .85rem 1rem; font-size: .82rem; margin-bottom: 1.25rem; line-height: 1.5;
}

@media (max-width: 860px) {
  .checkout-layout { grid-template-columns: 1fr; }
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.site-footer { background: var(--navy); color: rgba(255,255,255,.85); padding: 3rem 0 2rem; margin-top: 3rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
.footer-grid h4 { color: #fff; font-size: .9rem; margin-bottom: 1rem; }
.footer-grid a, .footer-grid p { color: rgba(255,255,255,.72); font-size: .88rem; line-height: 2; }
.footer-grid a:hover { color: #fff; }
.footer-logo { height: 30px; margin-bottom: 1rem; filter: brightness(0) invert(1); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); padding-top: 1.5rem; font-size: .8rem; color: rgba(255,255,255,.6); display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.footer-disclaimer { font-size: .78rem; color: rgba(255,255,255,.55); max-width: 700px; margin-top: .75rem; line-height: 1.6; }

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas: "brand brand brand" "shop company support";
  }
  .footer-grid > div:first-child { grid-area: brand; text-align: center; }
  .footer-grid > div:first-child .footer-logo { margin-left: auto; margin-right: auto; }
  .footer-grid > div:nth-child(2) { grid-area: shop; }
  .footer-grid > div:nth-child(3) { grid-area: company; }
  .footer-grid > div:nth-child(4) { grid-area: support; }
  .footer-grid h4 { font-size: .78rem; margin-bottom: .65rem; }
  .footer-grid a { font-size: .74rem; line-height: 1.7; }
  .footer-grid > div:first-child p { font-size: .85rem; line-height: 1.5; white-space: normal; max-width: 320px; margin-left: auto; margin-right: auto; }
}

/* ─── Utility ────────────────────────────────────────────────────────────── */
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.small { font-size: .85rem; color: var(--text-dim); }
