/* Components: tabs, cards, buttons, option buttons, form fields, badges,
   progress bar, collapsibles. */

/* ── Tab bar ───────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  gap: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 7px;
  letter-spacing: 0.01em;
  transition: background 160ms, color 160ms;
}

.tab:hover { color: var(--text); background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.tab.active {
  background: var(--accent);
  color: #fff;
}

html[data-theme="light"] .tab.active { color: #fff; }

/* ── Progress bar ──────────────────────────────────────────── */

.progress-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 20px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.progress-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  padding: 4px 6px;
  border-radius: 6px;
  font-family: inherit;
  color: inherit;
  text-align: left;
}

.progress-step.clickable {
  cursor: pointer;
  transition: background 160ms;
}

.progress-step.clickable:hover {
  background: var(--accent-light);
}

.progress-step.clickable:hover .progress-dot {
  border-color: var(--accent);
  color: var(--accent);
}

.progress-step.clickable:hover .progress-label {
  color: var(--accent);
}

.progress-step.clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.progress-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
}

.progress-label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.progress-step.done .progress-dot {
  border-color: var(--green);
  color: var(--green);
}

.progress-step.done .progress-label { color: var(--green); }

.progress-step.active .progress-dot {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.progress-step.active .progress-label { color: var(--accent); font-weight: 600; }

.progress-connector {
  flex: 1;
  min-width: 10px;
  height: 2px;
  background: var(--line);
  border-radius: 1px;
}

.progress-connector.done { background: var(--green); }

@media (max-width: 640px) {
  .progress-label { display: none; }
  .progress-connector { min-width: 6px; }
}

/* ── Cards ─────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

@media (prefers-reduced-motion: no-preference) {
  .card.question-card {
    animation: card-fade-in 200ms cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Buttons ───────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 160ms, border-color 160ms, transform 160ms;
}

.btn:hover { background: var(--accent-light); border-color: var(--accent); }
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.btn-row-left,
.btn-row-right {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Form fields ───────────────────────────────────────────── */

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-row.single { grid-template-columns: 1fr; }

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.field label .req { color: var(--red); margin-left: 2px; }

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 14px;
  transition: border-color 160ms, box-shadow 160ms;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field .hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Question card ─────────────────────────────────────────── */

.q-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.q-label {
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

.q-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 14px;
}

.q-help {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  white-space: pre-wrap;
  padding: 12px 14px;
  background: var(--surface-alt);
  border-left: 3px solid var(--line);
  border-radius: 6px;
  margin-bottom: 14px;
}

.q-why {
  margin-bottom: 14px;
}

.q-why-toggle {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.q-why-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.q-why-toggle .arrow {
  display: inline-block;
  transition: transform 200ms;
}
.q-why-toggle[aria-expanded="true"] .arrow { transform: rotate(90deg); }

.q-why-body {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.auto-banner {
  padding: 8px 12px;
  background: var(--accent-light);
  border: 1px dashed var(--accent);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

/* ── Option buttons ────────────────────────────────────────── */

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-alt);
  color: var(--text);
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  transition: border-color 160ms, background 160ms;
}

.option-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.option-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.option-btn .radio {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.option-btn.selected .radio {
  border-color: var(--accent);
  background: var(--accent);
}
.option-btn.selected .radio::after {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

.option-btn .shortcut {
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-left: auto;
  flex-shrink: 0;
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
}

/* ── Intake form helper text ───────────────────────────────── */

.intake-intro {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 18px;
}

.intake-intro strong { color: var(--text); }
