/* Coin Rectify — dark/gold theme. System fonts only (zero web-font fetch =
   nothing blocks first paint). Colors carried from the tuned Streamlit theme. */

:root {
  --bg: #111114;
  --surface: #1b1b20;
  --surface-2: #232329;
  --border: #2c2c34;
  --gold: #e0ae3c;
  --gold-bright: #f0c24a;
  --text: #ececee;
  --muted: #9a9aa2;
  --radius: 12px;
  --maxw: 980px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }

/* ── Header ─────────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
}
.brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand span { color: var(--gold); }
.nav { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
/* Segmented page tabs (iOS-style): one rounded bar, active segment lifted */
.nav-tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem; gap: 0.1rem; }
.nav-tabs a { padding: 0.4rem 0.85rem; border-radius: 999px; color: var(--muted); font-size: 0.9rem; white-space: nowrap; transition: background 0.15s ease, color 0.15s ease; }
.nav-tabs a:hover { color: var(--text); }
.nav-tabs a.active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #1a1407;
}
.btn-primary:hover { color: #1a1407; filter: brightness(1.05); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.container { max-width: var(--maxw); margin: 0 auto; padding: 1rem 1.25rem 4rem; }

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 2.25rem 0 2.5rem;
  text-align: center;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -10% 0 auto 0;
  height: 360px;
  background: radial-gradient(60% 100% at 50% 0%, rgba(224, 174, 60, 0.16), transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold);
  margin: 0 0 1rem;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  font-weight: 750;
}
.hero h1 .accent { color: var(--gold); }
.hero-media { margin: 1.4rem auto 1.6rem; max-width: 460px; }
.hero-media img { width: 100%; height: auto; display: block; border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4); }
.lede {
  max-width: 640px;
  margin: 0 auto 1.5rem;
  font-size: 1.12rem;
  color: var(--muted);
}
.cta-row { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.micro { margin-top: 1.4rem; font-size: 0.85rem; color: var(--muted); }

/* ── Steps ──────────────────────────────────────────────────────────── */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2.5rem;
}
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}
.step-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 0.5rem;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(224, 174, 60, 0.14);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.95rem;
  flex: none;
}
.step h3 { margin: 0; font-size: 1.05rem; }
.step p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ── Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

/* ── Auth ───────────────────────────────────────────────────────────── */
.auth { max-width: 420px; margin: 3.5rem auto; text-align: center; }
.auth h1 { font-size: 1.8rem; margin: 0 0 0.6rem; letter-spacing: -0.01em; }
.auth .lede { font-size: 1rem; margin-bottom: 1.6rem; }
.auth-form { display: flex; flex-direction: column; gap: 0.9rem; text-align: left; }
.auth-form input[type="email"] {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  width: 100%;
}
.auth-form input[type="email"]:focus { outline: none; border-color: var(--gold); }
.auth-form .btn { width: 100%; }
.check { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.9rem; }
.alert {
  background: rgba(224, 80, 60, 0.12);
  border: 1px solid rgba(224, 80, 60, 0.4);
  color: #f0b4ab;
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ── Photo app (upload + results) ───────────────────────────────────── */
.app { max-width: 640px; margin: 2.5rem auto; }
.app h1 { font-size: 2rem; margin: 0 0 0.5rem; letter-spacing: -0.02em; text-align: center; }
.app .lede { margin: 0 auto 2rem; text-align: center; max-width: 520px; }
.quota { color: var(--gold); white-space: nowrap; }
#upload-form,
#ai-form { display: flex; flex-direction: column; gap: 1.25rem; }

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 200px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  border: 2px dashed var(--border);
  border-radius: 16px;
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--gold); background: var(--surface-2); }
.dropzone.has-files { border-style: solid; border-color: var(--gold); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dz-icon { font-size: 2rem; line-height: 1; }
.dz-text { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.dz-link { color: var(--gold); }
.dz-sub { font-size: 0.85rem; color: var(--muted); }

.settings {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
}
.setting { display: flex; flex-direction: column; gap: 0.55rem; }
.setting-label { font-weight: 600; font-size: 0.95rem; }
.setting-label .hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-left: 0.4rem; }

.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.chip input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { border-color: var(--gold); background: rgba(224, 174, 60, 0.12); color: var(--gold-bright); }
.chip-color input[type="color"] { width: 26px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 5px; background: none; cursor: pointer; }

.slider-row { display: flex; align-items: center; gap: 1rem; }
.slider-row input[type="range"] { flex: 1; accent-color: var(--gold); }
.slider-val { min-width: 66px; text-align: right; font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 600; }

.toggle-label { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.toggle-label input[type="checkbox"] { accent-color: var(--gold); width: 16px; height: 16px; }
.toggle-label.small { font-size: 0.85rem; color: var(--muted); font-weight: 400; }
.stock-fields { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.5rem; padding-left: 1.6rem; }
.stock-fields.disabled { opacity: 0.45; }
#stock-overlay-fields { display: flex; flex-direction: column; gap: 0.6rem; }
#stock-overlay-fields.disabled { opacity: 0.45; }
/* AI-listing generation progress (background job + polling) */
.gen-progress { padding: 1.75rem 1rem; text-align: center; }
.gen-progress-text { margin: 0.5rem 0 0; }
.gen-progress .micro { margin-top: 0.6rem; }
.progress-bar { position: relative; height: 8px; max-width: 360px; margin: 0.8rem auto 0; background: var(--border); border-radius: 999px; overflow: hidden; }
/* Indeterminate: a sliver loops across the track so it always reads as "working"
   — coins run in parallel and finish together, so a determinate % bar can't be
   smooth. */
.progress-fill { position: absolute; top: 0; left: 0; width: 40%; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); animation: gr-slide 1.15s ease-in-out infinite; }
@keyframes gr-slide { 0% { left: -45%; } 100% { left: 100%; } }
.spinner-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); animation: gr-pulse 1s ease-in-out infinite; }
@keyframes gr-pulse { 0%, 100% { opacity: 0.25; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1); } }
/* OAuth sign-in buttons (login page) */
.oauth-buttons { display: flex; flex-direction: column; gap: 0.6rem; }
/* White buttons for high contrast on the dark page — also Apple's recommended
   variant for dark backgrounds. */
.btn-apple, .btn-google { display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem; background: #fff; color: #1a1a1a; border: 1px solid #fff; font-weight: 600; }
.btn-apple:hover, .btn-google:hover { background: #ededed; color: #1a1a1a; }
.btn-apple svg { width: 18px; height: 18px; fill: currentColor; margin-top: -2px; }
.btn-google svg { width: 18px; height: 18px; }
.logo-saved { color: var(--gold); }
.field input[type="file"] { font-size: 0.82rem; color: var(--muted); max-width: 100%; }
.field { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; }
.field > span { min-width: 56px; color: var(--muted); }
.field input { padding: 0.4rem 0.6rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.field input[type="text"] { width: 150px; }
.field input[type="number"] { width: 90px; }
.field select { padding: 0.4rem 0.6rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.field input[type="range"] { flex: 1; min-width: 90px; accent-color: var(--gold); }

/* Fold-out tool sections (stock numbers, logo) */
.tool { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tool summary { cursor: pointer; padding: 0.8rem 1rem; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
.tool summary::-webkit-details-marker { display: none; }
.tool summary::before { content: "▸"; color: var(--gold); display: inline-block; transition: transform 0.15s ease; }
.tool[open] summary::before { transform: rotate(90deg); }
.tool[open] summary { border-bottom: 1px solid var(--border); }
.tool-badge { margin-left: auto; font-size: 0.72rem; font-weight: 600; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.12rem 0.55rem; }
.tool-body { display: flex; flex-direction: column; gap: 0.8rem; padding: 0.9rem 1rem 1.1rem; }
.tool-body .stock-fields { margin-top: 0; }

.btn-lg { padding: 0.95rem 1.4rem; font-size: 1.05rem; }
.spinner { display: none; color: var(--gold); padding: 0.5rem 0; font-weight: 600; text-align: center; }
.spinner.htmx-request { display: block; }
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.75rem 0 1rem;
  flex-wrap: wrap;
}
.results-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.result {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem;
  text-align: center;
}
.result img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: #fff; }
.result .dl { display: inline-block; margin-top: 0.5rem; font-size: 0.85rem; }
.failures { margin-top: 1.75rem; color: var(--muted); font-size: 0.9rem; }
.failures ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }

/* AI listings grid */
.listings { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.listing-card { display: flex; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.listing-img { flex: 0 0 120px; display: flex; flex-direction: column; gap: 0.5rem; }
.listing-img img { width: 120px; height: 120px; object-fit: contain; background: #fff; border-radius: 8px; }
.listing-fields { flex: 1; display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.listing-fields > label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: var(--muted); }
.listing-fields input, .listing-fields textarea { padding: 0.5rem 0.6rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 0.95rem; font-family: inherit; }
.listing-fields input:focus, .listing-fields textarea:focus { outline: none; border-color: var(--gold); }
.listing-fields .row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.listing-fields .row > label { flex: 1; min-width: 110px; }
.specifics { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.spec { font-size: 0.78rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0.15rem 0.45rem; color: var(--muted); }
.saved { color: var(--gold); font-size: 0.85rem; min-height: 1.1em; }

/* eBay connect row (sits in the AI listings settings, below the logo section) */
.ebay-connect { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem 0.75rem; margin: 0.25rem 0 1rem; }
.ebay-connect .hint { margin: 0; }
.ebay-status { color: var(--gold); font-weight: 600; }

@media (max-width: 680px) {
  .listing-card { flex-direction: column; }
  .listing-img img { width: 100%; height: auto; aspect-ratio: 1; }
}

@media (max-width: 680px) {
  .steps { grid-template-columns: 1fr; }
  /* Let the header wrap so the page links stay reachable on phones (was hidden) */
  .site-header { flex-wrap: wrap; gap: 0.5rem 0.9rem; padding: 0.9rem 1rem; }
  .nav { width: 100%; flex-wrap: wrap; gap: 0.4rem 0.9rem; font-size: 0.9rem; }
  .results-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* Legal pages (Privacy / Terms) — rendered from bundled markdown */
.legal { max-width: 760px; margin: 0 auto; line-height: 1.6; color: var(--text); }
.legal h1 { font-size: 1.8rem; margin-top: 0; }
.legal h2 { margin-top: 1.8rem; font-size: 1.25rem; }
.legal h3 { margin-top: 1.2rem; font-size: 1.05rem; }
.legal a:not(.btn) { color: var(--gold); }
.legal table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.88rem; }
.legal th, .legal td { border: 1px solid var(--border); padding: 0.5rem 0.6rem; text-align: left; vertical-align: top; }
.legal hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.legal-back { margin-top: 2.5rem; }
.faq .lede { text-align: left; margin: 0.25rem 0 2rem; }
.faq-item { margin: 1.6rem 0; padding-bottom: 1.4rem; border-bottom: 1px solid var(--border); }
.faq-item h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.faq-item p { margin: 0; color: var(--muted); }
.faq-cta { justify-content: flex-start; margin: 2.2rem 0 0; }

/* Pricing page */
.pricing { max-width: 960px; margin: 0 auto; }
.pricing-head { text-align: center; margin-bottom: 1.5rem; }
.pricing-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.pricing-group h2 { font-size: 1.15rem; margin: 0 0 0.25rem; }
.pricing-group .group-sub { color: var(--muted); font-size: 0.9rem; margin: 0 0 1rem; }
.tier-cards { display: flex; flex-direction: column; gap: 1rem; }
.tier-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.tier-card.featured { border-color: var(--gold); }
.tier-badge { position: absolute; top: -0.7rem; right: 1rem; background: var(--gold); color: #1a1407; font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 6px; }
.tier-name { font-weight: 700; font-size: 1.05rem; }
.tier-price .amt { font-size: 1.8rem; font-weight: 700; }
.tier-price .per { color: var(--muted); }
.tier-card ul { list-style: none; padding: 0; margin: 0.25rem 0 0.75rem; display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
.tier-card ul li::before { content: "✓ "; color: var(--gold); }
.tier-card .btn { margin-top: auto; text-align: center; }
.tier-card .is-current { opacity: 0.7; }
.free-callout { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 1.5rem 0 0.5rem; color: var(--muted); }
.pricing-foot { text-align: center; }
@media (max-width: 680px) { .pricing-groups { grid-template-columns: 1fr; } }

/* Account page */
.account { max-width: 640px; margin: 0 auto; }
.account-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin: 1rem 0; display: flex; flex-direction: column; gap: 0.75rem; }
.account-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.account-row .label { color: var(--muted); }
.account-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }
.account-foot { color: var(--muted); margin-top: 1.5rem; }

/* Small button + quota-exhausted upgrade CTA */
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.88rem; }
.upgrade-cta { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem 0.9rem; flex-wrap: wrap; }
.upgrade-cta .cta-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Google sign-in button + "or" divider on the login page */
.btn-google { display: block; width: 100%; text-align: center; }
.auth-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0; color: var(--muted); font-size: 0.85rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* AI-listings upsell (shown to signed-out / non-AI-tier viewers) */
.upsell { max-width: 640px; margin: 1.25rem auto 0; }
.upsell-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.upsell-points li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1rem; color: var(--muted); }
.upsell-points li strong { color: var(--text); }
.upsell-plans { text-align: center; color: var(--muted); margin: 1.5rem 0 0.9rem; }
.upsell-plans strong { color: var(--text); }
.upsell-cta { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
