/* =========================================================
   Smart Fragrance Platform — base design system (main.css)
   Persian-first, RTL, minimal white aesthetic with warm caramel accent.
   ========================================================= */

:root {
  --bg: #ffffff;
  --bg-elev: #f6f3ef;
  --bg-card: #f1ece5;
  --line: rgba(40, 30, 20, 0.10);
  --line-strong: rgba(40, 30, 20, 0.18);

  --text: #2b241e;
  --text-muted: #6d6258;
  --text-dim: #978c7f;

  --accent: #b8895c;      /* warm caramel bronze */
  --accent-strong: #c99a6e;
  --accent-deep: #96693c;
  --accent-contrast: #ffffff;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --shadow: 0 24px 60px -28px rgba(43, 36, 30, 0.22);
  --shadow-soft: 0 12px 40px -24px rgba(43, 36, 30, 0.16);

  --container: 1160px;
  --header-h: 76px;

  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

.accent { color: var(--accent-strong); }
.eyebrow {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(216, 162, 90, 0.08);
}

/* ---------- Buttons ---------- */
.btn {
  --btn-pad-y: 11px;
  --btn-pad-x: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-lg { --btn-pad-y: 15px; --btn-pad-x: 30px; font-size: 1.05rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep));
  color: var(--accent-contrast);
  box-shadow: 0 12px 30px -14px rgba(216, 162, 90, 0.7);
}
.btn-primary:hover { transform: translateY(-2px); }

.btn-outline {
  border-color: var(--line-strong);
  color: var(--text);
  background: transparent;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent-strong); }

.btn-ghost { color: var(--text-muted); background: transparent; }
.btn-ghost:hover { color: var(--text); }

.nav-muted { opacity: 0.55; cursor: default; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(16, 11, 8, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: rgba(16, 11, 8, 0.9);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  color: var(--accent-strong);
  background: rgba(216, 162, 90, 0.1);
  border: 1px solid var(--line-strong);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 1.1rem; }
.brand-tag { font-size: 0.72rem; color: var(--text-dim); }

.main-nav { display: flex; align-items: center; gap: 26px; }
.main-nav a {
  font-size: 0.96rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}
.main-nav a:hover { color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 12px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  display: block;
  width: 24px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(48px, 8vw, 96px) 0 clamp(56px, 8vw, 104px);
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  inset-block-start: -20%;
  inset-inline-start: -10%;
  width: 60vw; height: 60vw;
  max-width: 820px; max-height: 820px;
  background: radial-gradient(circle at center, rgba(216, 162, 90, 0.22), transparent 62%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}
.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
}
.hero-copy { max-width: 560px; }
.hero-title {
  margin-top: 22px;
  font-size: clamp(2.1rem, 4.6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.hero-lede {
  margin-top: 22px;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  color: var(--text-muted);
  max-width: 520px;
}
.hero-actions {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.hero-badges {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
}
.hero-badges li {
  position: relative;
  padding-inline-start: 20px;
  font-size: 0.92rem;
  color: var(--text-dim);
}
.hero-badges li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0.7em;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.hero-visual { display: flex; justify-content: center; }
.hero-card {
  position: relative;
  width: min(100%, 440px);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: linear-gradient(160deg, rgba(216, 162, 90, 0.16), rgba(30, 22, 19, 0.4));
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.hero-card img {
  width: 100%;
  height: auto;
  border-radius: calc(var(--radius-lg) - 8px);
  object-fit: cover;
}
.hero-caption {
  position: absolute;
  inset-block-end: 28px;
  inset-inline-start: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--text);
  background: rgba(16, 11, 8, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
}
.hero-caption .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 0 4px rgba(216, 162, 90, 0.2);
}

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section-head { max-width: 640px; margin: 0 auto 48px; text-align: center; }
.section-title {
  margin-top: 16px;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  font-weight: 700;
}
.section-sub { margin-top: 14px; color: var(--text-muted); font-size: 1.05rem; }

/* ---------- How / steps ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.step-card {
  position: relative;
  padding: 34px 28px 30px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.step-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.step-index {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border-radius: 14px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: rgba(216, 162, 90, 0.1);
  border: 1px solid var(--line-strong);
}
.step-title { margin-top: 20px; font-size: 1.2rem; }
.step-text { margin-top: 12px; color: var(--text-muted); }

/* ---------- Features ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
.feature-card {
  padding: 30px 28px;
  background: linear-gradient(160deg, var(--bg-elev), var(--bg-card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.feature-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.feature-title {
  font-size: 1.22rem;
  position: relative;
  padding-inline-start: 18px;
}
.feature-title::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0.25em;
  width: 5px; height: 1.1em;
  border-radius: 4px;
  background: linear-gradient(var(--accent-strong), var(--accent-deep));
}
.feature-text { margin-top: 12px; color: var(--text-muted); }

/* ---------- CTA ---------- */
.cta { padding: clamp(48px, 7vw, 88px) 0; }
.cta-inner {
  text-align: center;
  padding: clamp(40px, 6vw, 72px) 28px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% -20%, rgba(216, 162, 90, 0.22), transparent 60%),
    var(--bg-card);
  border: 1px solid var(--line-strong);
}
.cta-title { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
.cta-sub { margin-top: 14px; margin-bottom: 30px; color: var(--text-muted); font-size: 1.05rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 48px 0 40px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 26px;
}
.footer-brand { max-width: 320px; }
.footer-brand p { margin-top: 10px; color: var(--text-dim); font-size: 0.95rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-nav a { color: var(--text-muted); font-size: 0.95rem; }
.footer-nav a:hover { color: var(--text); }
.footer-note {
  flex-basis: 100%;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { order: -1; }
  .hero-card { width: min(100%, 360px); }
  .steps { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .main-nav, .header-actions { display: none; }
  .nav-toggle { display: flex; }

  .main-nav.is-open {
    display: flex;
    position: absolute;
    inset-block-start: var(--header-h);
    inset-inline: 0;
    flex-direction: column;
    gap: 4px;
    padding: 18px 24px 24px;
    background: rgba(16, 11, 8, 0.97);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }
  .main-nav.is-open a { padding: 8px 0; font-size: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .btn, .step-card, .feature-card { transition: none; }
}

/* =========================================================
   Auth (login/register) + flash messages
   ========================================================= */
.flash-stack { margin-top: 20px; display: grid; gap: 10px; }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 0.95rem;
}
.flash-success { border-color: rgba(120, 200, 140, 0.4); }
.flash-danger, .flash-error { border-color: rgba(220, 110, 110, 0.4); }
.flash-info { border-color: var(--line-strong); }

.auth-narrow { max-width: 440px; }
.auth-head { text-align: center; margin-bottom: 32px; }
.auth-title { font-size: 1.8rem; }
.auth-sub { margin-top: 10px; color: var(--text-muted); }

.auth-error {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(220, 110, 110, 0.4);
  background: rgba(220, 110, 110, 0.08);
  color: var(--text);
  font-size: 0.92rem;
}

.auth-form { display: grid; gap: 18px; }
.auth-field { display: grid; gap: 8px; }
.auth-field label { font-size: 0.9rem; color: var(--text-muted); }
.auth-field input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--accent);
}
.auth-hint { font-size: 0.8rem; color: var(--text-dim); }

.auth-submit { width: 100%; margin-top: 6px; }

.auth-switch {
  margin-top: 22px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.auth-switch a { color: var(--accent); }
.auth-switch a:hover { color: var(--accent-strong); }

.header-user { color: var(--text-muted); font-size: 0.92rem; }
.header-logout-form { display: inline; }
.header-logout-form .btn { padding: 0; }

.q-note-warn {
  border-color: rgba(220, 150, 80, 0.4);
  background: rgba(220, 150, 80, 0.08);
}

/* =========================================================
   Prompt-generating questionnaire (app/templates/prompt_flow/*)
   ========================================================= */
.q-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-elev);
  overflow: hidden;
  margin-bottom: 10px;
}
.q-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}
.q-step-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.q-options { display: grid; gap: 12px; }
.q-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.q-option:has(input:checked) { border-color: var(--accent); }
.q-option input { accent-color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; }

.auth-field textarea {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  resize: vertical;
}
.auth-field textarea:focus { outline: none; border-color: var(--accent); }

.q-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.q-actions .btn-primary { margin-inline-start: auto; }

.prompt-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  padding: 20px;
  margin-top: 10px;
  max-width: 720px;
}
.prompt-box pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.9;
  color: var(--text);
  margin: 0;
}
.prompt-actions { max-width: 720px; }

.q-intro-actions { margin-top: 12px; }

/* Q9: perfume-history search component */
.ps-wrap { display: grid; gap: 14px; }
.ps-search-input, .ps-manual input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
}
.ps-search-input:focus, .ps-manual input:focus { outline: none; border-color: var(--accent); }
.ps-search-input:disabled, .ps-manual input:disabled { opacity: 0.5; }

.ps-results { display: flex; flex-wrap: wrap; gap: 8px; }
.ps-result {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  cursor: pointer;
}
.ps-result:hover { border-color: var(--accent); }
.ps-result:disabled { opacity: 0.5; cursor: default; }
.ps-empty { color: var(--text-dim); font-size: 0.88rem; }

.ps-manual { display: flex; gap: 10px; }
.ps-manual input { flex: 1; }

.ps-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ps-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.88rem;
}
.ps-chip-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
}

.ps-newbie { margin-top: 4px; }
