/* GENERA AI — trilha /diagnostico. Reusa tokens e componentes de styles.css. */

.diag-body { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg-soft); }
.diag-nav { flex-shrink: 0; }
.diag-exit { padding: 8px 14px; font-size: 13px; }
.diag-main { flex: 1; position: relative; padding: 0 0 64px; }

/* Fundo com grid sutil (mesma linguagem do hero) */
.diag-main::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 900px 500px at 50% 0%, black, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 900px 500px at 50% 0%, black, transparent 70%);
  opacity: 0.5;
}

/* Progresso */
.diag-progress { position: sticky; top: 72px; z-index: 50; }
.diag-progress-bar { height: 3px; background: var(--border); }
.diag-progress-fill {
  height: 100%; width: 0; background: var(--brand-gradient);
  transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.diag-shell { position: relative; max-width: 720px; margin: 0 auto; padding: 40px 24px 0; }
.diag-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-mute); margin-bottom: 14px; min-height: 18px;
}
.diag-meta .diag-ai-tag {
  display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0;
  font-family: 'Inter', system-ui, sans-serif; font-size: 12px; font-weight: 500; color: var(--text-soft);
}
.diag-meta .diag-ai-tag::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--neon);
  box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.2);
}

.diag-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 36px; box-shadow: var(--shadow-md);
  animation: diag-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.diag-card.is-swapping { animation: none; }
@keyframes diag-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .diag-card { animation: none; } }

.diag-card h1, .diag-card h2 {
  font-size: clamp(24px, 3.4vw, 32px); line-height: 1.15; letter-spacing: -0.025em;
  font-weight: 700; color: var(--blue-950); outline: none;
}
.diag-card h1 { font-size: clamp(30px, 4.4vw, 42px); letter-spacing: -0.03em; }
.diag-card .diag-sub { margin-top: 12px; color: var(--text-soft); font-size: 16px; line-height: 1.55; }
.diag-card .diag-sub + * { margin-top: 26px; }
.diag-card h1 + * , .diag-card h2 + fieldset { margin-top: 26px; }

.diag-intro-list { list-style: none; margin: 28px 0 0; display: grid; gap: 12px; }
.diag-intro-list li {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft);
}
.diag-intro-list .n {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--brand-blue);
  padding-top: 3px; min-width: 22px;
}
.diag-intro-list strong { display: block; font-weight: 600; color: var(--text); font-size: 15px; }
.diag-intro-list span { color: var(--text-soft); font-size: 14px; }

/* Perguntas */
fieldset { border: none; margin: 0; padding: 0; }
fieldset + fieldset { margin-top: 28px; }
legend, .diag-q {
  display: block; font-weight: 600; font-size: 16px; color: var(--text); margin-bottom: 12px; padding: 0;
}
legend .opt, .diag-q .opt { font-weight: 400; color: var(--text-mute); font-size: 13px; margin-left: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--bg);
  color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.2;
  transition: all 0.15s ease; text-align: left;
}
.chip:hover { border-color: var(--brand-blue); background: var(--bg-soft); }
.chip:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 2px; }
.chip[aria-pressed="true"], .chip[aria-checked="true"] {
  background: var(--blue-900); color: white; border-color: var(--blue-900);
}
.chip[aria-pressed="true"]::before, .chip[aria-checked="true"]::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--neon); flex-shrink: 0;
}
.chips.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.chips.is-grid .chip { border-radius: 12px; padding: 14px; align-items: flex-start; }
.chip small { display: block; font-weight: 400; color: inherit; opacity: 0.7; font-size: 12.5px; margin-top: 3px; }
.chip.is-disabled { opacity: 0.45; pointer-events: none; }

/* Escala (maturidade) */
.scale { display: grid; gap: 8px; }
.scale .chip { border-radius: 12px; justify-content: flex-start; padding: 12px 14px; }
.scale .chip .lvl {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-mute);
  min-width: 18px;
}
.scale .chip[aria-checked="true"] .lvl { color: var(--neon); }

.diag-input, .diag-textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 12px 14px; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.diag-textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.diag-input:focus, .diag-textarea:focus {
  outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(39, 92, 219, 0.15);
}
.diag-input[aria-invalid="true"] { border-color: #E5484D; }
.diag-field { display: grid; gap: 8px; }
.diag-field label { font-weight: 600; font-size: 14px; }
.diag-field .hint { font-size: 12.5px; color: var(--text-mute); }
.diag-field .err { font-size: 13px; color: #E5484D; display: none; }
.diag-field.has-error .err { display: block; }
.diag-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .diag-grid-2 { grid-template-columns: 1fr; } }
.diag-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.consent { display: flex; gap: 12px; align-items: flex-start; margin-top: 28px; padding: 16px; border-radius: var(--radius); background: var(--bg-soft); border: 1px solid var(--border); }
.consent input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand-blue); flex-shrink: 0; }
.consent label { font-size: 13.5px; color: var(--text-soft); line-height: 1.5; }
.consent label a { color: var(--brand-blue); text-decoration: underline; }

/* IA "pensando" */
.diag-thinking { display: flex; align-items: center; gap: 14px; padding: 18px 0; color: var(--text-soft); font-size: 15px; }
.diag-dots { display: inline-flex; gap: 5px; }
.diag-dots i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--brand-cyan);
  animation: diag-bounce 1.1s ease-in-out infinite;
}
.diag-dots i:nth-child(2) { animation-delay: 0.15s; }
.diag-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes diag-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-5px); opacity: 1; } }

.diag-ai-note {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 22px; padding: 12px 14px;
  border-radius: 12px; background: rgba(39, 92, 219, 0.06); border: 1px solid rgba(39, 92, 219, 0.18);
  font-size: 13.5px; color: var(--text-soft); line-height: 1.5;
}
.diag-ai-note svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--brand-blue); margin-top: 2px; }

/* Resultado */
.result-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-top: 24px; padding: 20px; border-radius: var(--radius); background: var(--blue-950); color: white; }
.result-gauge { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.result-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.result-gauge circle { fill: none; stroke-width: 8; }
.result-gauge .track { stroke: rgba(255,255,255,0.12); }
.result-gauge .val { stroke: var(--neon); stroke-linecap: round; transition: stroke-dashoffset 0.9s cubic-bezier(0.2, 0.8, 0.2, 1); }
.result-gauge .num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 500;
}
.result-head .lvl-label { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.6); }
.result-head .lvl { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.result-head .lvl-desc { font-size: 14px; color: rgba(255,255,255,0.75); margin-top: 6px; max-width: 460px; line-height: 1.5; }

.result-section { margin-top: 28px; }
.result-section h3 { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-mute); font-family: 'JetBrains Mono', monospace; font-weight: 500; margin-bottom: 12px; }
.usecase { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--bg-soft); }
.usecase + .usecase { margin-top: 12px; }
.usecase-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.usecase h4 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.usecase .squad { display: inline-block; margin-top: 6px; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--brand-blue); background: rgba(39, 92, 219, 0.08); padding: 3px 8px; border-radius: 6px; }
.usecase .impact { font-size: 12px; font-weight: 600; white-space: nowrap; padding: 4px 10px; border-radius: 999px; }
.impact.alto { background: rgba(0, 230, 118, 0.15); color: #0B7A3E; }
.impact.medio { background: rgba(39, 92, 219, 0.1); color: var(--brand-blue); }
.usecase-body { margin-top: 12px; display: grid; gap: 8px; font-size: 14px; color: var(--text-soft); line-height: 1.55; }
.usecase-body b { color: var(--text); font-weight: 600; }
.usecase-body.is-locked { position: relative; user-select: none; }
.usecase-body.is-locked > p { filter: blur(5px); opacity: 0.55; pointer-events: none; }
.usecase-body .lock {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.usecase-body .lock svg { width: 15px; height: 15px; }
.result-list { list-style: none; display: grid; gap: 8px; }
.result-list li { display: flex; gap: 10px; font-size: 14px; color: var(--text-soft); line-height: 1.5; }
.result-list li::before { content: "→"; color: var(--brand-cyan); font-weight: 700; flex-shrink: 0; }
.result-unlock {
  margin-top: 28px; padding: 20px; border-radius: var(--radius); border: 1px dashed var(--border-strong);
  display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.result-unlock p { font-size: 14px; color: var(--text-soft); max-width: 380px; }
.result-unlock strong { color: var(--text); display: block; font-size: 15px; margin-bottom: 2px; }

/* utilitários (CSP: sem style inline) */
.diag-hint-sub { font-size: 12.5px; color: var(--text-mute); margin: -6px 0 10px; }
.mt-16 { margin-top: 16px; }
.done-small { font-size: 13.5px; }
.done-box a { text-decoration: underline; }
.done-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* Verificação de e-mail */
.diag-code { font-family: 'JetBrains Mono', monospace; font-size: 28px; letter-spacing: 0.35em; text-align: center; max-width: 280px; padding: 14px; }
.diag-inline-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.diag-inline-actions .btn-back[disabled] { opacity: 0.5; cursor: default; }
.verified-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; padding: 8px 12px; border-radius: 999px; background: rgba(0, 230, 118, 0.12); color: #0B7A3E; font-size: 13.5px; }
.verified-chip svg { width: 14px; height: 14px; }
.verified-chip b { color: var(--text); font-weight: 600; }
.verified-chip button { font-size: 12.5px; color: var(--text-soft); text-decoration: underline; padding: 0 2px; }
.verified-chip + fieldset { margin-top: 26px; }

/* Etapa final */
.windows { display: grid; gap: 10px; }
.done-box { text-align: center; padding: 8px 0 0; }
.done-box .check {
  width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 230, 118, 0.15); color: #0B7A3E;
}
.done-box .check svg { width: 30px; height: 30px; }
.done-box p { color: var(--text-soft); margin-top: 10px; }
.done-summary { margin-top: 24px; text-align: left; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; line-height: 1.6; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 16px; white-space: pre-wrap; max-height: 260px; overflow: auto; color: var(--text-soft); }

/* Ações */
.diag-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.diag-actions .spacer { flex: 1; }
.btn-back { color: var(--text-soft); padding: 10px 12px; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; border-radius: 10px; }
.btn-back:hover { color: var(--text); background: var(--bg); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 12px; }
.diag-footnote { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--text-mute); min-height: 18px; }
.diag-footnote a { color: var(--text-soft); text-decoration: underline; }
.diag-error { margin-top: 12px; font-size: 13.5px; color: #E5484D; }

.diag-footer { border-top: 1px solid var(--border); padding: 20px 0; font-size: 13px; color: var(--text-mute); }
.diag-footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.diag-footer a:hover { color: var(--text); }
.diag-noscript h1 { margin-bottom: 12px; }
.diag-noscript p { color: var(--text-soft); margin-bottom: 20px; }

@media (max-width: 640px) {
  .diag-shell { padding: 24px 16px 0; }
  .diag-card { padding: 24px 20px; border-radius: 16px; }
  .diag-exit { display: none; }
  .diag-actions .btn-lg { width: 100%; justify-content: center; }
  .diag-actions .spacer { display: none; }
  .diag-actions { flex-direction: column-reverse; align-items: stretch; }
  .btn-back { justify-content: center; }
}

/* ===== DARK ===== */
[data-theme="dark"] .diag-body { background: var(--blue-950); }
[data-theme="dark"] .diag-card { background: #0A1A3A; }
[data-theme="dark"] .diag-card h1, [data-theme="dark"] .diag-card h2 { color: white; }
[data-theme="dark"] .chip { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .chip:hover { background: rgba(255,255,255,0.07); border-color: var(--brand-cyan); }
[data-theme="dark"] .chip[aria-pressed="true"], [data-theme="dark"] .chip[aria-checked="true"] { background: white; color: var(--blue-950); border-color: white; }
[data-theme="dark"] .chip[aria-checked="true"] .lvl { color: var(--brand-blue); }
[data-theme="dark"] .diag-input, [data-theme="dark"] .diag-textarea { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .diag-intro-list li, [data-theme="dark"] .consent, [data-theme="dark"] .usecase, [data-theme="dark"] .done-summary { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .result-head { background: #050e22; border: 1px solid rgba(255,255,255,0.08); }
[data-theme="dark"] .impact.alto { color: var(--neon-soft); }
[data-theme="dark"] .impact.medio { color: var(--brand-cyan); background: rgba(0,196,217,0.12); }
[data-theme="dark"] .usecase .squad { color: var(--brand-cyan); background: rgba(0,196,217,0.1); }
[data-theme="dark"] .diag-ai-note { background: rgba(0,196,217,0.06); border-color: rgba(0,196,217,0.2); }
[data-theme="dark"] .diag-ai-note svg { color: var(--brand-cyan); }
[data-theme="dark"] .btn-back:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .done-box .check { color: var(--neon-soft); }
[data-theme="dark"] .verified-chip { color: var(--neon-soft); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .diag-body { background: var(--blue-950); }
  :root:not([data-theme="light"]) .diag-card { background: #0A1A3A; }
  :root:not([data-theme="light"]) .diag-card h1, :root:not([data-theme="light"]) .diag-card h2 { color: white; }
  :root:not([data-theme="light"]) .chip { background: rgba(255,255,255,0.03); }
  :root:not([data-theme="light"]) .chip:hover { background: rgba(255,255,255,0.07); border-color: var(--brand-cyan); }
  :root:not([data-theme="light"]) .chip[aria-pressed="true"], :root:not([data-theme="light"]) .chip[aria-checked="true"] { background: white; color: var(--blue-950); border-color: white; }
  :root:not([data-theme="light"]) .chip[aria-checked="true"] .lvl { color: var(--brand-blue); }
  :root:not([data-theme="light"]) .diag-input, :root:not([data-theme="light"]) .diag-textarea { background: rgba(255,255,255,0.04); }
  :root:not([data-theme="light"]) .diag-intro-list li, :root:not([data-theme="light"]) .consent, :root:not([data-theme="light"]) .usecase, :root:not([data-theme="light"]) .done-summary { background: rgba(255,255,255,0.03); }
  :root:not([data-theme="light"]) .result-head { background: #050e22; border: 1px solid rgba(255,255,255,0.08); }
  :root:not([data-theme="light"]) .impact.alto { color: var(--neon-soft); }
  :root:not([data-theme="light"]) .impact.medio { color: var(--brand-cyan); background: rgba(0,196,217,0.12); }
  :root:not([data-theme="light"]) .usecase .squad { color: var(--brand-cyan); background: rgba(0,196,217,0.1); }
  :root:not([data-theme="light"]) .diag-ai-note { background: rgba(0,196,217,0.06); border-color: rgba(0,196,217,0.2); }
  :root:not([data-theme="light"]) .diag-ai-note svg { color: var(--brand-cyan); }
  :root:not([data-theme="light"]) .btn-back:hover { background: rgba(255,255,255,0.06); }
  :root:not([data-theme="light"]) .done-box .check { color: var(--neon-soft); }
  :root:not([data-theme="light"]) .verified-chip { color: var(--neon-soft); }
}
