/* ═══ Funnel Base ═══
   Shared styles for multi-screen funnels (quiz, marketplace, etc.).
   Requires: tokens.css, reset.css */

/* ── Funnel + Screens ── */
.funnel {
  position: relative;
  width: 100%; height: 100vh;
  overflow: hidden;
}
.screen {
  position: absolute;
  inset: 0;
  transform: translateX(100%);
  transition: transform 420ms var(--ease);
  overflow-y: auto;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.active { transform: translateX(0); }
.screen.exit-left { transform: translateX(-100%); }
.screen.exit-right { transform: translateX(100%); }

/* ── Thinking / Transition Screen — Dark ── */
.thinking-screen { background: var(--color-bg-thinking); overflow: hidden; }
.thinking-screen::before {
  content: '';
  position: absolute;
  top: -100px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(76,176,146,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}
.thinking-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
  padding: 60px 24px 40px;
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

/* Phase label */
.phase-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 20px;
  transition: opacity 0.4s var(--ease);
}

/* Progress ring */
.progress-ring-wrap {
  position: relative;
  width: 120px; height: 120px;
  margin-bottom: 24px;
}
.progress-ring { width: 120px; height: 120px; }
.progress-ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 3.5;
}
.progress-ring-fg {
  fill: none;
  stroke: var(--color-green);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.8s var(--ease);
}
.progress-pct {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px; font-weight: 800;
  color: #fff; letter-spacing: -0.02em;
}

/* Thinking text */
.thinking-headline {
  font-size: 20px; font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.thinking-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 28px;
}

/* Step feed */
.thinking-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-bottom: 24px;
}
.tf-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.4);
  opacity: 0;
  max-height: 60px;
  transform: translateY(8px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease),
              background 0.4s, color 0.4s, max-height 0.4s var(--ease),
              padding 0.4s var(--ease), margin-bottom 0.4s var(--ease);
}
.tf-step.visible { opacity: 1; transform: translateY(0); }
.tf-step.active { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.06); }
.tf-step.done { color: var(--color-green); background: rgba(76,176,146,0.08); }
.tf-step-icon { width: 20px; flex-shrink: 0; font-size: 15px; line-height: 1; text-align: center; }
.tf-step-text { flex: 1; text-align: left; }
.tf-step-status {
  flex-shrink: 0; width: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.tf-step.done .tf-step-status { color: var(--color-green); }
.tf-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: pulseDot 1s ease-in-out infinite;
}

/* Thinking completion card */
.thinking-complete {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  padding: 28px 24px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  pointer-events: none;
  width: 100%;
}
.thinking-complete.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.thinking-complete-icon { font-size: 32px; margin-bottom: 14px; }
.thinking-complete-heading {
  font-size: 17px; font-weight: 700;
  color: #fff; margin-bottom: 6px; line-height: 1.4;
}
.thinking-complete-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 22px; line-height: 1.4;
}

/* ── Shared button ── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 16px 32px;
  background: var(--color-primary); color: #fff;
  border: none; border-radius: 12px;
  font-family: inherit; font-size: 16px; font-weight: 700;
  letter-spacing: -0.01em;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(255,132,18,0.3);
  width: 100%; max-width: 400px;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255,132,18,0.35);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary.disabled,
.btn-primary:disabled { opacity: 0.4; pointer-events: none; }

/* ── Form fields ── */
.field-wrap { display: flex; flex-direction: column; gap: 6px; position: relative; }
.phone-wrap { flex-direction: row; align-items: center; }
.phone-flag {
  position: absolute; left: 14px; top: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1; width: 20px;
  pointer-events: none; z-index: 1;
}
.phone-wrap input { padding-left: 48px; }
.field-wrap label {
  font-size: 13px; font-weight: 600; color: #374151;
}
.field-wrap input, .field-wrap select {
  width: 100%; padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-family: inherit; font-size: 15px;
  color: var(--color-dark); background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none; appearance: none;
}
.field-wrap input:focus, .field-wrap select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255,132,18,0.1);
}
.field-wrap.has-error input, .field-wrap.has-error select {
  border-color: var(--color-red);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.08);
}
.field-wrap select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* ── Results-ready banner ── */
.results-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(76,176,146,0.08);
  border: 1px solid rgba(76,176,146,0.15);
  border-radius: 100px;
  margin-bottom: 20px;
  font-size: 12px; font-weight: 600;
  color: #065f46;
}
.results-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-green);
  flex-shrink: 0;
  animation: pulseDot 1.5s ease-in-out infinite;
}

/* ── Contact progress segments ── */
.contact-progress {
  display: flex; gap: 5px;
  width: 100%; max-width: 180px;
  margin-bottom: 24px;
}
.cp-seg {
  flex: 1; height: 4px;
  border-radius: 2px;
  background: #e5e7eb;
  transition: background 0.4s var(--ease);
}
.cp-seg.active { background: var(--color-green); }

/* ── Success animation ── */
.success-ring {
  width: 80px; height: 80px;
  position: relative; margin: 0 auto;
}
.success-ring svg { width: 80px; height: 80px; }
.ring-bg { fill: none; stroke: #ecfdf5; stroke-width: 3; }
.ring-fg {
  fill: none; stroke: var(--color-green); stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 227; stroke-dashoffset: 227;
  animation: ringDraw 0.7s var(--ease) forwards;
  transform-origin: center; transform: rotate(-90deg);
}
.check-mark {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px;
}
.check-mark path {
  fill: none; stroke: var(--color-green);
  stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 30; stroke-dashoffset: 30;
  animation: checkDraw 0.4s var(--ease) 0.5s forwards;
}

/* ── Confetti ── */
#confettiCanvas {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 200;
}

/* ── Animations ── */
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ringDraw { to { stroke-dashoffset: 0; } }
@keyframes checkDraw { to { stroke-dashoffset: 0; } }

/* ── Lead error message ── */
.lead-error {
  margin-top: 12px;
  padding: 10px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: var(--color-red);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  animation: fadeUp 0.3s var(--ease);
}

/* ── Responsive: small phones ── */
@media (max-width: 480px) {
  .btn-primary { padding: 14px 24px; font-size: 15px; }
  .thinking-headline { font-size: 18px; }
  .progress-ring-wrap { width: 100px; height: 100px; }
  .progress-ring { width: 100px; height: 100px; }
  .progress-pct { font-size: 20px; }
  .results-banner { font-size: 11px; padding: 6px 12px; }
}
