/* ============================================================
   score-engine.css - FEAT-SCORES Sprint 9b
   ------------------------------------------------------------
   Estilos compartilhados entre todos os scores renderizados via
   /apps/_engine/?id=<score>. Extraído de imc.css mantendo a
   identidade visual (header azul + card branco + desc/form/result
   sections) com partes genéricas: Likert (q-item), interp-box
   colorida por classify, sub-scale strip, alerts, references.

   Carregar após base.css + utils.css. Não duplica regras de
   base/_logo_branding. NÃO contém estilo IMC-específico
   (age-toggle, imc-bar, ref-table) - cada app que precisar de
   widgets além do padrão estende em CSS próprio.
   ============================================================ */

html { scroll-behavior: smooth; }
body {
  font-family: Montserrat, 'Montserrat-fallback', sans-serif;
  background: var(--az);
  color: var(--az);
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed; right: -100px; top: -100px;
  width: 480px; height: 480px;
  border: 56px solid rgba(1, 169, 206, .09);
  border-radius: 50%;
  pointer-events: none; z-index: 0;
}
body::after {
  content: '';
  position: fixed; left: -70px; bottom: -70px;
  width: 300px; height: 300px;
  border: 36px solid rgba(1, 169, 206, .06);
  border-radius: 50%;
  pointer-events: none; z-index: 0;
}
main, .hdr, footer { position: relative; z-index: 1; }

/* HEADER */
.hdr { justify-content: space-between; }
.hdr-title {
  color: #fff; font-size: 13px; font-weight: 600;
  letter-spacing: .06em; opacity: .85;
}

/* MAIN + CARD */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 60px;
}
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shh);
  width: 100%;
  max-width: 700px;
  overflow: hidden;
}

/* DESCRIÇÃO (top de cada score) */
.desc {
  padding: 32px 36px 24px;
  border-bottom: 1px solid var(--bd);
}
.desc-tag {
  font-size: 10px; font-weight: 700;
  letter-spacing: .15em; text-transform: uppercase;
  color: var(--ci); margin-bottom: 8px;
}
.desc h1 {
  font-size: 22px; font-weight: 900;
  color: var(--az); margin-bottom: 10px;
  line-height: 1.25;
}
.desc h1 span { color: var(--ci); }
.desc p {
  font-size: 13px; color: var(--ci2);
  line-height: 1.75;
}
.desc-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(1, 169, 206, .08);
  border: 1px solid rgba(1, 169, 206, .2);
  color: var(--ci);
  font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 20px;
  margin-top: 12px;
}

/* FORM + LIKERT */
.form-area { padding: 28px 36px; }
.engine-instructions {
  font-size: 13px; color: var(--ci2);
  line-height: 1.75; margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--bg);
  border-left: 3px solid var(--ci);
  border-radius: 6px;
}

/* .q-item/.q-text/.q-num/.likert/.lbox removidos: agora em score-common.css (AUD-30.4.1)
 * score-engine usa estrutura HTML diferente (.lbox clicável direto + radio visível +
 * .lbox.selected). Overrides visuais específicos mantidos abaixo sem redefinir o seletor base. */
.q-list { display: flex; flex-direction: column; gap: 12px; }

.btn-calc {
  width: 100%;
  padding: 15px;
  background: var(--ci);
  border: none;
  border-radius: 8px;
  font-family: Montserrat, 'Montserrat-fallback', sans-serif;
  font-size: 12px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: #fff; cursor: pointer;
  transition: all var(--tr);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 18px;
}
.btn-calc:hover {
  background: #019ab8;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(1, 169, 206, .35);
}
.btn-calc:disabled {
  background: var(--bd);
  cursor: not-allowed;
  transform: none; box-shadow: none;
}

/* RESULTADO */
.result-area {
  display: none;
  border-top: 1px solid var(--bd);
  padding: 28px 36px;
}
.result-area.visible {
  display: block;
  animation: fadeUp .4s ease both;
}
.score-display {
  text-align: center;
  margin-bottom: 24px;
}
.score-value {
  font-size: 56px; font-weight: 900;
  color: var(--az); line-height: 1;
  letter-spacing: -1.5px;
}
.score-of {
  font-size: 13px; font-weight: 600;
  color: var(--ci2);
  margin-top: 6px;
}

/* Interpretação (cor varia por classify[].label.toLowerCase()) */
.interp-box {
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 18px;
  border: 1px solid transparent;
  background: rgba(1, 169, 206, .06);
  border-color: rgba(1, 169, 206, .2);
}
.interp-box.normal,
.interp-box.minimo,
.interp-box.negativo { background: rgba(60, 130, 92, .06); border-color: rgba(60, 130, 92, .2); }
.interp-box.leve { background: rgba(245, 158, 11, .06); border-color: rgba(245, 158, 11, .2); }
.interp-box.moderado,
.interp-box.borderline { background: rgba(249, 115, 22, .06); border-color: rgba(249, 115, 22, .2); }
.interp-box.grave,
.interp-box.severo,
.interp-box.positivo { background: rgba(239, 68, 68, .06); border-color: rgba(239, 68, 68, .2); }
.interp-title {
  font-size: 15px; font-weight: 900;
  margin-bottom: 8px;
  color: var(--ci);
}
.interp-box.normal .interp-title,
.interp-box.minimo .interp-title,
.interp-box.negativo .interp-title { color: var(--ve); }
.interp-box.leve .interp-title { color: #d97706; }
.interp-box.moderado .interp-title,
.interp-box.borderline .interp-title { color: #ea580c; }
.interp-box.grave .interp-title,
.interp-box.severo .interp-title,
.interp-box.positivo .interp-title { color: #dc2626; }
.interp-text {
  font-size: 13px;
  color: var(--ci2);
  line-height: 1.75;
}

/* Sub-escalas */
.subs-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.sub-cell {
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.sub-cell-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ci2);
  margin-bottom: 4px;
}
.sub-cell-value {
  font-size: 22px; font-weight: 900;
  color: var(--az);
  line-height: 1;
}

/* Alerts críticos (alta severidade) */
.engine-alert {
  background: rgba(239, 68, 68, .08);
  border: 1px solid rgba(239, 68, 68, .35);
  border-left: 4px solid #dc2626;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  color: #7f1d1d;
  margin-bottom: 16px;
  line-height: 1.6;
}
.engine-alert strong { color: #991b1b; }

.references {
  font-size: 11px;
  color: var(--ci2);
  line-height: 1.65;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--bd);
}
.references-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ci);
  margin-bottom: 6px;
}

.btn-recalc {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1.5px solid var(--bd);
  border-radius: 8px;
  font-family: Montserrat, 'Montserrat-fallback', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ci2);
  cursor: pointer;
  transition: all var(--tr);
  margin-top: 8px;
}
.btn-recalc:hover {
  border-color: var(--ci);
  color: var(--ci);
}

/* DISCLAIMER */
.disclaimer {
  background: var(--az);
  color: rgba(255, 255, 255, .55);
  font-size: 11px;
  line-height: 1.7;
  padding: 20px 36px;
  text-align: center;
}
.disclaimer strong { color: rgba(255, 255, 255, .8); }
.disclaimer a { color: var(--ci); text-decoration: none; }

footer {
  background: #162e3c;
  color: rgba(255, 255, 255, .35);
  font-size: 11px;
  text-align: center;
  padding: 14px 20px;
}
footer a { color: rgba(255, 255, 255, .5); text-decoration: none; }

/* Estados de loading/erro do engine */
.engine-loading,
.engine-error {
  padding: 40px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--ci2);
}
.engine-error { color: #dc2626; }

@media (max-width: 600px) {
  .desc, .form-area, .result-area { padding: 22px 20px; }
  .score-value { font-size: 44px; }
  .hdr-title { display: none; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
