/* ═══════════════════════════════════════════════════════════
   همسان‌گزینی — Frontend (isolated under .hamsan-root)
   Theme: light clinic (ترمه)
   ═══════════════════════════════════════════════════════════ */

.hamsan-root {
  --hg-bg: #F7F6F2;
  --hg-surface: #ffffff;
  --hg-text: #153A59;
  --hg-muted: #7A8891;
  --hg-border: #E7E4DC;
  --hg-accent: #019587;
  --hg-accent-soft: #F0FBF9;
  --hg-cta: #CCE98D;
  --hg-cta-text: #123;
  --hg-danger: #c0392b;
  --hg-radius: 14px;
  --hg-font: 'Vazirmatn', Tahoma, system-ui, sans-serif;

  font-family: var(--hg-font) !important;
  direction: rtl;
  color: var(--hg-text);
  background: var(--hg-bg);
  line-height: 1.7;
  font-size: 14.5px;
  box-sizing: border-box;
  min-height: 60vh;
  padding-bottom: 48px;
  -webkit-font-smoothing: antialiased;
}

.hamsan-root *,
.hamsan-root *::before,
.hamsan-root *::after {
  box-sizing: border-box;
}

.hamsan-root img { max-width: 100%; display: block; }

/* ── Header ── */
.hamsan-root .hg-header {
  background: var(--hg-surface);
  border-bottom: 1px solid var(--hg-border);
  padding: 13px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 12px;
  flex-wrap: wrap;
}
.hamsan-root .hg-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hamsan-root .hg-brand img { height: 36px; width: auto; }
.hamsan-root .hg-brand-title { font-size: 14.5px; font-weight: 700; color: var(--hg-text); }
.hamsan-root .hg-brand-sub { font-size: 11px; color: var(--hg-muted); margin-top: 1px; }
.hamsan-root .hg-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--hg-accent-soft);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  color: #067c70;
  font-weight: 600;
}
.hamsan-root .hg-badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--hg-accent); display: inline-block;
}

/* ── Layout ── */
.hamsan-root .hg-wrap {
  max-width: 940px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ── Hero ── */
.hamsan-root .hg-hero {
  margin-top: 28px;
  background: linear-gradient(135deg, #0d3a4a 0%, #0f5c5a 55%, #1a6b5c 100%);
  border-radius: 22px;
  padding: 36px 32px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hamsan-root .hg-hero-tag {
  display: inline-block;
  background: rgba(255,255,255,.14);
  color: #e8f7e0;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.hamsan-root .hg-hero h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.45;
  margin: 0 0 12px;
  color: #fff;
}
.hamsan-root .hg-hero p {
  font-size: 13.5px;
  opacity: .88;
  line-height: 1.9;
  margin: 0 0 22px;
  max-width: 560px;
}
.hamsan-root .hg-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Buttons ── */
.hamsan-root .hg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  border-radius: 12px;
  padding: 13px 24px;
  font-size: 14px;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
}
.hamsan-root .hg-btn:active { transform: scale(.98); }
.hamsan-root .hg-btn-primary {
  background: var(--hg-cta);
  color: var(--hg-cta-text);
  box-shadow: 0 6px 18px rgba(204,233,141,.28);
}
.hamsan-root .hg-btn-primary:hover { background: #d4f0a0; }
.hamsan-root .hg-btn-ghost {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.3);
}
.hamsan-root .hg-btn-ghost:hover { background: rgba(255,255,255,.2); }
.hamsan-root .hg-btn-outline {
  background: transparent;
  color: var(--hg-text);
  border: 1.5px solid var(--hg-border);
}
.hamsan-root .hg-btn-outline:hover { background: #f3f2ee; }
.hamsan-root .hg-btn-accent {
  background: var(--hg-accent);
  color: #fff;
}
.hamsan-root .hg-btn-accent:hover { background: #018078; }
.hamsan-root .hg-btn-block { width: 100%; }
.hamsan-root .hg-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Cards / sections ── */
.hamsan-root .hg-card {
  background: var(--hg-surface);
  border: 1px solid var(--hg-border);
  border-radius: 18px;
  padding: 22px 24px;
  margin-top: 18px;
}
.hamsan-root .hg-section-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--hg-text);
  margin: 0 0 6px;
}
.hamsan-root .hg-section-sub {
  font-size: 13.5px;
  color: var(--hg-muted);
  margin: 0 0 18px;
}

/* ── How steps ── */
.hamsan-root .hg-how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 12px;
}
.hamsan-root .hg-how-item {
  background: var(--hg-surface);
  border: 1px solid var(--hg-border);
  border-radius: 16px;
  padding: 18px 16px;
}
.hamsan-root .hg-how-num {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--hg-accent-soft);
  color: var(--hg-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 10px;
}
.hamsan-root .hg-how-item h4 {
  font-size: 13.5px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--hg-text);
}
.hamsan-root .hg-how-item p {
  font-size: 12px;
  color: var(--hg-muted);
  margin: 0;
  line-height: 1.85;
}

/* ── Trust pills ── */
.hamsan-root .hg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hamsan-root .hg-pill {
  background: var(--hg-accent-soft);
  color: #067c70;
  font-size: 11.5px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 10px;
}

/* ── Wizard ── */
.hamsan-root .hg-wizard {
  max-width: 720px;
  margin: 28px auto 0;
  padding: 0 18px;
}
.hamsan-root .hg-stepper {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.hamsan-root .hg-step-bar {
  flex: 1;
  min-width: 48px;
}
.hamsan-root .hg-step-bar .bar {
  height: 5px;
  border-radius: 4px;
  background: #e0ddd4;
  transition: background .2s;
}
.hamsan-root .hg-step-bar.done .bar,
.hamsan-root .hg-step-bar.active .bar {
  background: var(--hg-accent);
}
.hamsan-root .hg-step-bar .label {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #AEB6BB;
  text-align: center;
  white-space: nowrap;
}
.hamsan-root .hg-step-bar.active .label,
.hamsan-root .hg-step-bar.done .label {
  color: var(--hg-accent);
}

.hamsan-root .hg-panel {
  background: var(--hg-surface);
  border: 1px solid var(--hg-border);
  border-radius: 18px;
  padding: 26px 24px;
}
.hamsan-root .hg-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.hamsan-root .hg-panel-head h2 {
  font-size: 19px;
  font-weight: 800;
  margin: 0;
  color: var(--hg-text);
}
.hamsan-root .hg-panel-head .step-meta {
  font-size: 12px;
  color: #AEB6BB;
  font-weight: 600;
}
.hamsan-root .hg-panel-desc {
  font-size: 12.5px;
  color: var(--hg-muted);
  margin: 0 0 22px;
  line-height: 1.85;
}

/* ── Form fields ── */
.hamsan-root .hg-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.hamsan-root .hg-field {
  margin-bottom: 14px;
}
.hamsan-root .hg-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--hg-text);
  margin-bottom: 6px;
}
.hamsan-root .hg-field input,
.hamsan-root .hg-field select,
.hamsan-root .hg-field textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--hg-border);
  font-size: 13.5px;
  font-family: inherit;
  background: #FBFAF7;
  color: var(--hg-text);
  outline: none;
  transition: border-color .15s;
}
.hamsan-root .hg-field input:focus,
.hamsan-root .hg-field select:focus,
.hamsan-root .hg-field textarea:focus {
  border-color: var(--hg-accent);
}
.hamsan-root .hg-field textarea {
  min-height: 90px;
  resize: vertical;
}
.hamsan-root .hg-field .ltr {
  direction: ltr;
  text-align: right;
}

/* Choice chips */
.hamsan-root .hg-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hamsan-root .hg-choice {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--hg-border);
  background: #FBFAF7;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: var(--hg-text);
  transition: all .15s;
}
.hamsan-root .hg-choice:hover {
  border-color: var(--hg-accent);
  background: var(--hg-accent-soft);
}
.hamsan-root .hg-choice.active {
  border-color: var(--hg-accent);
  background: var(--hg-accent);
  color: #fff;
}

/* Note box */
.hamsan-root .hg-note {
  background: #F0F7FF;
  border: 1px solid #D0E4F7;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 12.5px;
  color: #2c5a7a;
  line-height: 1.85;
  margin-top: 8px;
}

/* Nav */
.hamsan-root .hg-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ── Test progress ── */
.hamsan-root .hg-test-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--hg-muted);
}
.hamsan-root .hg-progress-bar {
  height: 6px;
  background: #e8e5dc;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 18px;
}
.hamsan-root .hg-progress-bar > span {
  display: block;
  height: 100%;
  background: var(--hg-accent);
  border-radius: 4px;
  transition: width .25s;
}
.hamsan-root .hg-q {
  background: #FBFAF7;
  border: 1px solid var(--hg-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.hamsan-root .hg-q-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--hg-accent);
  margin-bottom: 6px;
}
.hamsan-root .hg-q-text {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--hg-text);
}

/* ── Status / track ── */
.hamsan-root .hg-status-box {
  text-align: center;
  padding: 36px 24px;
}
.hamsan-root .hg-status-icon {
  font-size: 42px;
  margin-bottom: 12px;
}
.hamsan-root .hg-status-box h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 8px;
}
.hamsan-root .hg-status-box p {
  color: var(--hg-muted);
  font-size: 13.5px;
  margin: 0 0 16px;
}

/* ── Toast ── */
.hamsan-root .hg-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #153A59;
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: all .3s;
  box-shadow: 0 8px 28px rgba(0,0,0,.2);
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.hamsan-root .hg-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Disclaimer ── */
.hamsan-root .hg-disclaimer {
  background: #FFF8F0;
  border: 1px solid #F0D9B8;
  border-radius: 12px;
  padding: 16px;
  font-size: 12.5px;
  line-height: 1.95;
  color: #5a4030;
  margin-bottom: 16px;
}
.hamsan-root .hg-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  cursor: pointer;
}
.hamsan-root .hg-check input {
  margin-top: 4px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Payment mock ── */
.hamsan-root .hg-fee {
  background: var(--hg-accent-soft);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.hamsan-root .hg-fee-amount {
  font-size: 20px;
  font-weight: 800;
  color: var(--hg-accent);
}

/* ── Hidden helpers ── */
.hamsan-root .hg-hidden { display: none !important; }
.hamsan-root .hg-view { display: none; }
.hamsan-root .hg-view.active { display: block; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .hamsan-root .hg-hero { padding: 28px 20px; }
  .hamsan-root .hg-hero h1 { font-size: 22px; }
  .hamsan-root .hg-grid2 { grid-template-columns: 1fr; }
  .hamsan-root .hg-panel { padding: 20px 16px; }
  .hamsan-root .hg-header { padding: 12px 14px; }
}

/* MBTI result card */
.hamsan-root .hg-mbti-card {
  margin-top: 20px;
  background: linear-gradient(135deg, #0d3a4a 0%, #0f5c5a 100%);
  color: #fff;
  border-radius: 16px;
  padding: 22px 20px;
  text-align: center;
}
.hamsan-root .hg-mbti-label {
  font-size: 12px;
  opacity: .85;
  margin-bottom: 8px;
}
.hamsan-root .hg-mbti-code {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: .08em;
  margin-bottom: 4px;
}
.hamsan-root .hg-mbti-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #CCE98D;
}
.hamsan-root .hg-mbti-desc {
  font-size: 13px;
  line-height: 1.85;
  opacity: .92;
  margin: 0 0 10px;
}
.hamsan-root .hg-mbti-note {
  font-size: 11.5px;
  opacity: .7;
  margin: 0 0 14px;
}
.hamsan-root .hg-mbti-card .hg-btn {
  margin-top: 4px;
}



/* Card payment visual */
.hg-card-pay { margin-top: 16px; }
.hg-card-visual {
  background: linear-gradient(135deg, #0d3a4a 0%, #0d7377 55%, #019587 100%);
  border-radius: 18px; padding: 22px 20px; color: #fff;
  box-shadow: 0 12px 32px rgba(13,115,119,.28); max-width: 420px;
}
.hg-card-chip { width: 42px; height: 30px; border-radius: 6px; background: linear-gradient(135deg,#e8c96a,#c9a227); margin-bottom: 18px; }
.hg-card-number { font-size: 22px; letter-spacing: 3px; font-weight: 700; direction: ltr; text-align: left; font-family: Vazirmatn, monospace; }
.hg-card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.hg-btn-copy { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-family: inherit; font-size: 12px; }
.hg-btn-copy:hover { background: rgba(255,255,255,.28); }
.hg-section-title { font-size: 14px; }
