/* ============================================================
   SOFTART BLUEPRINT — FORM STYLES
   ============================================================ */

:root {
  --bg:            #07070f;
  --bg-2:          #0d0d1c;
  --bg-3:          #14142a;
  --border:        #191930;
  --border-2:      #252545;
  --accent:        #6366f1;
  --accent-h:      #8b5cf6;
  --accent-glow:   rgba(99, 102, 241, 0.22);
  --accent-light:  rgba(99, 102, 241, 0.10);
  --success:       #10b981;
  --success-light: rgba(16, 185, 129, 0.10);
  --error:         #f43f5e;
  --error-light:   rgba(244, 63, 94, 0.10);
  --text-1:        #f0eff8;
  --text-2:        #9b99c4;
  --text-3:        #52506e;
  --r-sm:          6px;
  --r-md:          10px;
  --r-lg:          14px;
  --r-xl:          18px;
  --ease:          cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out:      cubic-bezier(0.0, 0.0, 0.2, 1);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Ambient background orbs ────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: -200px; left: -100px;
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(99,102,241,0.065) 0%, transparent 68%);
  pointer-events: none; z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: -180px; right: -80px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(139,92,246,0.05) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

/* ── App Shell ──────────────────────────────────────────── */
#app {
  position: relative; z-index: 1;
  height: 100vh;
  display: flex; flex-direction: column;
}

/* ── Progress Bar ───────────────────────────────────────── */
.progress-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; background: var(--border);
  z-index: 1000;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-h));
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 0.55s var(--ease);
}

/* ── Header ─────────────────────────────────────────────── */
.header {
  position: fixed; top: 2px; left: 0; right: 0;
  height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 44px;
  z-index: 999;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid transparent;
  transition: opacity 0.3s ease, border-color 0.3s ease;
}
.header.hidden { opacity: 0; pointer-events: none; }
.header.scrolled { border-color: var(--border); }

.logo { display: flex; align-items: center; gap: 10px; user-select: none; }
.logo-icon { flex-shrink: 0; }
.logo-text {
  font-size: 15px; font-weight: 600; letter-spacing: -0.3px;
  color: var(--text-1);
}
.logo-text em {
  font-style: normal; color: var(--accent-h);
  font-weight: 400; margin-left: 2px;
}

.question-counter {
  font-size: 12px; font-weight: 500;
  color: var(--text-3); letter-spacing: 0.6px;
}

/* ── Main ───────────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto; overflow-x: hidden;
  padding: 86px 44px 110px;
  display: flex; align-items: center; justify-content: center;
  scrollbar-width: none;
}
.main::-webkit-scrollbar { display: none; }

/* ── Loading ────────────────────────────────────────────── */
.loading-state {
  display: flex; flex-direction: column;
  align-items: center; gap: 16px;
  color: var(--text-3); font-size: 14px;
}
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Welcome ────────────────────────────────────────────── */
.welcome-screen {
  text-align: center; max-width: 620px; width: 100%;
  animation: fadeUp 0.6s var(--ease) both;
}

.welcome-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  background: var(--accent-light);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
  color: var(--accent-h); letter-spacing: 1px;
  text-transform: uppercase; margin-bottom: 36px;
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-h);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.75); }
}

.welcome-title {
  font-size: clamp(30px, 4.5vw, 50px);
  font-weight: 800; line-height: 1.12;
  letter-spacing: -2px;
  margin-bottom: 22px;
  background: linear-gradient(160deg, #f0eff8 30%, #9b99c4 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: 17px; line-height: 1.75; color: var(--text-2);
  max-width: 460px; margin: 0 auto 44px;
}

.welcome-cta {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 17px 36px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-h) 100%);
  border: none; border-radius: var(--r-xl);
  color: #fff; font-size: 16px; font-weight: 600;
  font-family: inherit; cursor: pointer; letter-spacing: -0.2px;
  box-shadow: 0 8px 32px var(--accent-glow);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.welcome-cta::before {
  content: '';
  position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  transition: left 0.5s ease;
}
.welcome-cta:hover { transform: translateY(-3px); box-shadow: 0 14px 42px var(--accent-glow); }
.welcome-cta:hover::before { left: 100%; }
.welcome-cta:active { transform: translateY(-1px); }

.welcome-meta {
  margin-top: 28px;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 8px 0;
  font-size: 13px; color: var(--text-3);
}
.welcome-meta-item {
  display: flex; align-items: center; gap: 6px; padding: 0 16px;
}
.welcome-meta-item svg { opacity: 0.6; }
.meta-sep {
  width: 1px; height: 14px; background: var(--border-2);
}

/* ── Question Screen ────────────────────────────────────── */
.question-screen {
  width: 100%; max-width: 680px; margin: 0 auto;
  animation: fadeUp 0.42s var(--ease) both;
}
.question-screen.from-top { animation-name: fadeDown; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(36px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-36px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp { /* already defined */ }

.q-meta {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px;
}
.section-badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  background: var(--accent-light);
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 100px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--accent-h);
}
.q-num {
  margin-left: auto;
  font-size: 12px; color: var(--text-3); font-weight: 500;
}

.question-text {
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 700; line-height: 1.38;
  letter-spacing: -0.6px; color: var(--text-1);
  margin-bottom: 6px;
}
.question-hint {
  font-size: 13px; color: var(--text-3);
  margin-bottom: 28px; line-height: 1.5;
}
.q-required-star {
  color: var(--accent-h); margin-left: 4px; font-size: 14px;
}

/* ── Input: Text / Email / Phone ────────────────────────── */
.input-wrap { position: relative; }
.text-input {
  width: 100%; background: transparent;
  border: none; border-bottom: 2px solid var(--border-2);
  color: var(--text-1);
  font-size: 22px; font-family: inherit; font-weight: 400;
  padding: 8px 0 14px; outline: none;
  caret-color: var(--accent);
  transition: border-color 0.2s ease;
}
.text-input::placeholder { color: var(--text-3); }
.text-input:focus { border-bottom-color: transparent; }

.underline-anim {
  position: absolute; bottom: 0; left: 0;
  height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-h));
  transition: width 0.35s var(--ease);
  border-radius: 2px;
}
.text-input:focus ~ .underline-anim { width: 100%; }

/* ── Input: Textarea ────────────────────────────────────── */
.textarea-input {
  width: 100%; min-height: 150px;
  background: var(--bg-2);
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 16px; font-family: inherit; line-height: 1.72;
  padding: 16px 18px; outline: none; resize: vertical;
  caret-color: var(--accent);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.textarea-input::placeholder { color: var(--text-3); }
.textarea-input:focus { border-color: var(--accent); background: var(--bg-3); }
.textarea-hint {
  font-size: 12px; color: var(--text-3);
  margin-top: 8px; text-align: right;
}

/* ── Input: Options (select / radio / multiselect) ──────── */
.options-hint {
  font-size: 13px; color: var(--text-3);
  margin-bottom: 16px;
}
.options-list {
  display: flex; flex-direction: column; gap: 7px;
  max-height: 380px; overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.options-list::-webkit-scrollbar { width: 4px; }
.options-list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

.option-card {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer; user-select: none;
  transition: border-color 0.14s ease, background 0.14s ease;
  outline: none;
}
.option-card:hover { border-color: var(--border-2); background: var(--bg-3); }
.option-card:focus-visible { border-color: var(--accent); outline: none; }
.option-card.selected { border-color: var(--accent); background: var(--accent-light); }

.option-key {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; min-width: 26px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: 11px; font-weight: 700; color: var(--text-3);
  transition: all 0.14s ease; font-feature-settings: 'tnum';
}
.option-card.selected .option-key {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.option-card:hover:not(.selected) .option-key { border-color: var(--accent-h); color: var(--accent-h); }

.option-text {
  font-size: 14.5px; font-weight: 450; color: var(--text-2);
  line-height: 1.45; transition: color 0.14s;
  flex: 1;
}
.option-card.selected .option-text { color: var(--text-1); }
.option-card:hover .option-text { color: var(--text-1); }

.option-check {
  margin-left: auto; flex-shrink: 0; opacity: 0;
  transition: opacity 0.14s ease;
}
.option-card.selected .option-check { opacity: 1; }

/* ── Input: Checkbox ────────────────────────────────────── */
.checkbox-card {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 24px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer; user-select: none;
  transition: all 0.15s ease; outline: none;
  max-width: 560px;
}
.checkbox-card:hover { border-color: var(--border-2); }
.checkbox-card.checked { border-color: var(--success); background: var(--success-light); }
.checkbox-card:focus-visible { border-color: var(--accent); }

.cb-box {
  width: 24px; height: 24px; min-width: 24px;
  border: 1.5px solid var(--border-2); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.checkbox-card.checked .cb-box { background: var(--success); border-color: var(--success); }

.cb-check { display: none; }
.checkbox-card.checked .cb-check { display: block; }

.cb-text {
  font-size: 15px; line-height: 1.55; color: var(--text-2);
  transition: color 0.15s;
}
.checkbox-card.checked .cb-text { color: var(--text-1); }

/* ── Error ──────────────────────────────────────────────── */
.error-msg {
  display: flex; align-items: flex-start; gap: 9px;
  margin-top: 14px; padding: 11px 15px;
  background: var(--error-light);
  border: 1px solid rgba(244,63,94,0.18);
  border-radius: var(--r-sm);
  font-size: 13px; color: var(--error); font-weight: 500;
  animation: shake 0.28s ease;
  line-height: 1.5;
}
.error-msg svg { flex-shrink: 0; margin-top: 1px; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  22%     { transform: translateX(-7px); }
  66%     { transform: translateX(7px); }
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 14px 44px 26px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to top, var(--bg) 55%, transparent 100%);
  z-index: 999;
}
.footer-hint {
  font-size: 13px; color: var(--text-3);
  display: flex; align-items: center; gap: 7px;
}
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 8px;
  background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: 5px; border-bottom-width: 2px;
  font-size: 11px; font-family: inherit; color: var(--text-2);
}

.btn-ghost {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 18px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-3); font-size: 14px; font-weight: 500;
  font-family: inherit; cursor: pointer;
  transition: all 0.15s ease;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--border-2); color: var(--text-2); background: var(--bg-2); }
.btn-ghost:disabled { opacity: 0.28; cursor: not-allowed; }

.btn-next {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  border: none; border-radius: var(--r-md);
  color: #fff; font-size: 15px; font-weight: 600;
  font-family: inherit; cursor: pointer; letter-spacing: -0.2px;
  transition: all 0.18s var(--ease);
}
.btn-next:hover:not(:disabled) {
  background: var(--accent-h); transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}
.btn-next:active:not(:disabled) { transform: translateY(0); }
.btn-next:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-next.submit-mode {
  background: linear-gradient(135deg, var(--accent), var(--accent-h));
  padding: 13px 28px; font-size: 15px;
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* ── Success ────────────────────────────────────────────── */
.success-screen {
  text-align: center; max-width: 540px; width: 100%;
  animation: fadeUp 0.5s var(--ease) both;
}
.success-ring {
  width: 78px; height: 78px;
  background: var(--success-light);
  border: 2px solid rgba(16,185,129,0.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 36px;
  animation: popIn 0.5s var(--ease) 0.15s both;
}
@keyframes popIn {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.success-title {
  font-size: 34px; font-weight: 800; letter-spacing: -1.2px;
  margin-bottom: 14px;
  background: linear-gradient(160deg, #f0eff8 30%, #9b99c4 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.success-body {
  font-size: 16px; color: var(--text-2); line-height: 1.72;
  margin-bottom: 36px;
}
.success-ref {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px;
  background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  font-size: 12.5px; color: var(--text-3);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  letter-spacing: 0.3px;
}

/* ── Connection Error ───────────────────────────────────── */
.conn-error {
  text-align: center; max-width: 460px;
  animation: fadeUp 0.4s var(--ease) both;
}
.conn-error-icon {
  width: 64px; height: 64px;
  background: var(--error-light);
  border: 1.5px solid rgba(244,63,94,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 28px;
}
.conn-error h2 {
  font-size: 22px; font-weight: 700; letter-spacing: -0.5px;
  color: var(--text-1); margin-bottom: 12px;
}
.conn-error p {
  font-size: 15px; color: var(--text-2); line-height: 1.7;
  margin-bottom: 28px;
}
.conn-error code {
  background: var(--bg-3); padding: 2px 8px;
  border-radius: var(--r-sm); font-size: 13px; color: var(--accent-h);
}
.btn-retry {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px;
  background: var(--bg-2); border: 1.5px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text-2); font-size: 14px; font-weight: 500;
  font-family: inherit; cursor: pointer;
  transition: all 0.15s ease;
}
.btn-retry:hover { border-color: var(--accent); color: var(--text-1); }

/* ── Conditional Sub-field ──────────────────────────────── */
.cf-area {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  animation: fadeUp 0.26s var(--ease) both;
}

.cf-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cf-optional {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-32px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .header { padding: 0 20px; }
  .main { padding: 80px 20px 105px; }
  .footer { padding: 12px 20px 22px; }

  .logo-text { display: none; }
  .footer-hint { display: none; }

  .question-text { font-size: 20px; letter-spacing: -0.4px; }
  .text-input { font-size: 19px; }
  .options-list { max-height: 300px; }

  .welcome-title { font-size: clamp(26px, 8vw, 36px); }
  .welcome-subtitle { font-size: 16px; }
  .welcome-cta { padding: 15px 28px; font-size: 15px; }
  .welcome-meta { gap: 6px 0; font-size: 12px; }

  .btn-ghost { padding: 10px 14px; font-size: 13px; }
  .btn-next  { padding: 12px 18px; font-size: 14px; }
}

@media (max-width: 400px) {
  .btn-ghost span { display: none; }
}
