@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Instrument+Serif&display=swap');

/* ── Phase management ─────────────────────────────────────── */
[data-tcfo-phase][hidden] { display: none !important; }
[data-tcfo-question][hidden] { display: none !important; }

/* ── Variables ───────────────────────────────────────────── */
.tcfo-widget {
  --navy:       #0A2F6E;
  --navy-dark:  #071E4A;
  --navy-light: #1A4499;
  --accent:     #2563EB;
  --white:      #FFFFFF;
  --off-white:  #F7F8FC;
  --gray-100:   #EEF0F7;
  --gray-200:   #D1D5E8;
  --gray-500:   #6B7280;
  --gray-700:   #374151;
  --green:      #059669;
  --green-bg:   #D1FAE5;
  --green-dark: #065F46;
  --red:        #DC2626;
  --red-bg:     #FEE2E2;
  --red-dark:   #991B1B;
  --amber:      #D97706;
  --amber-bg:   #FEF3C7;
  --amber-dark: #92400E;
  --serif:      'Instrument Serif', Georgia, serif;
  --sans:       'DM Sans', system-ui, sans-serif;
  --radius:     12px;
  --radius-lg:  20px;
  --shadow:     0 4px 24px rgba(10,47,110,0.10);
}

/* ── Wrapper ─────────────────────────────────────────────── */
.tcfo-widget.test-section {
  padding: 80px 5%;
  background: var(--off-white);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
.tcfo-widget .test-wrapper {
  max-width: 780px;
  margin: 0 auto;
}

/* ── Intro ───────────────────────────────────────────────── */
.tcfo-widget .test-header {
  text-align: center;
  margin-bottom: 36px;
}
.tcfo-widget .section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: 10px;
}
.tcfo-widget .section-title {
  font-family: var(--serif);
  font-size: clamp(26px, 3vw, 38px);
  color: var(--navy);
  line-height: 1.2;
  margin-bottom: 12px;
}
.tcfo-widget .section-sub {
  font-size: 16px;
  color: var(--gray-500);
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto;
}
.tcfo-widget .tcfo-intro-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow);
  text-align: center;
}
.tcfo-widget .tcfo-stats {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.tcfo-widget .tcfo-stat { text-align: center; }
.tcfo-widget .tcfo-stat strong {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 4px;
}
.tcfo-widget .tcfo-stat span { font-size: 12px; color: var(--gray-500); }
.tcfo-widget .tcfo-footer-note { font-size: 12px; color: var(--gray-500); margin-top: 16px; }

/* ── Progress ────────────────────────────────────────────── */
.tcfo-widget .progress-wrap { margin-bottom: 32px; }
.tcfo-widget .progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.tcfo-widget .progress-label { font-size: 13px; color: var(--gray-500); }
.tcfo-widget .progress-count { font-size: 13px; font-weight: 600; color: var(--navy); }
.tcfo-widget .progress-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}
.tcfo-widget .progress-fill {
  height: 100%;
  background: var(--navy);
  border-radius: 3px;
  transition: width .4s ease;
}
.tcfo-widget .progress-dots {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.tcfo-widget .progress-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gray-200);
  transition: background .3s, transform .2s;
}
.tcfo-widget .progress-dot.is-answered { background: var(--navy); }
.tcfo-widget .progress-dot.is-current  { background: var(--accent); transform: scale(1.35); }

/* ── Question card ───────────────────────────────────────── */
.tcfo-widget .question-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.tcfo-widget .question-num { font-size: 12px; color: var(--gray-500); margin-bottom: 8px; }
.tcfo-widget .question-text {
  font-size: 18px;
  font-weight: 500;
  color: var(--navy);
  line-height: 1.45;
  margin-bottom: 24px;
}
.tcfo-widget .options-list { display: flex; flex-direction: column; gap: 10px; }
.tcfo-widget .option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: left;
  background: var(--white);
  font-family: var(--sans);
  width: 100%;
}
.tcfo-widget .option-btn:hover { border-color: var(--navy); background: var(--gray-100); }
.tcfo-widget .option-btn.is-selected { border-color: var(--navy); background: var(--gray-100); }
.tcfo-widget .option-btn.is-selected .opt-radio { background: var(--navy); border-color: var(--navy); }
.tcfo-widget .option-btn.is-selected .opt-radio::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--white);
}
.tcfo-widget .opt-radio {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--gray-200);
  flex-shrink: 0;
  transition: background .2s, border-color .2s;
  position: relative;
}
.tcfo-widget .opt-text { font-size: 14px; color: var(--gray-700); line-height: 1.4; }

/* ── Nav buttons ─────────────────────────────────────────── */
.tcfo-widget .q-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tcfo-widget .btn-prev {
  background: transparent;
  border: 1.5px solid var(--gray-200);
  color: var(--gray-500);
  font-family: var(--sans);
  font-size: 14px; font-weight: 500;
  padding: 11px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.tcfo-widget .btn-prev:hover:not(:disabled) { border-color: var(--navy); color: var(--navy); }
.tcfo-widget .btn-prev:disabled { opacity: .35; cursor: not-allowed; }
.tcfo-widget .btn-next {
  background: var(--navy);
  color: var(--white);
  border: none;
  font-family: var(--sans);
  font-size: 14px; font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
.tcfo-widget .btn-next:hover:not(:disabled) { background: var(--navy-light); }
.tcfo-widget .btn-next:disabled { opacity: .35; cursor: not-allowed; }
.tcfo-widget .q-hint { font-size: 13px; color: var(--gray-500); }

/* ── Result + Analysis shared ────────────────────────────── */
.tcfo-widget .result-section { max-width: 780px; margin: 0 auto; display: block !important; }

.tcfo-widget .perfil-banner {
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.tcfo-widget .perfil-banner::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  opacity: .08;
  background: currentColor;
}
.tcfo-widget .perfil-badge {
  display: inline-block;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
  border: 1px solid currentColor;
  opacity: .9;
}
.tcfo-widget .perfil-title {
  font-family: var(--serif);
  font-size: clamp(22px, 2.5vw, 32px);
  line-height: 1.2;
  margin-bottom: 10px;
}
.tcfo-widget .perfil-sub { font-size: 15px; line-height: 1.65; opacity: .85; }

.tcfo-widget .perfil-banner.perfil--listo    { background: var(--green-bg); color: var(--green-dark); }
.tcfo-widget .perfil-banner.perfil--creciendo { background: var(--amber-bg); color: var(--amber-dark); }
.tcfo-widget .perfil-banner.perfil--operando { background: var(--red-bg);   color: var(--red-dark);   }

.tcfo-widget .tcfo-score-display { margin-top: 16px; }
.tcfo-widget .tcfo-score-num { font-size: 40px; font-weight: 900; line-height: 1; }
.tcfo-widget .tcfo-score-max { font-size: 20px; opacity: .5; margin-left: 4px; }

/* ── Gate form ───────────────────────────────────────────── */
.tcfo-widget .result-gate {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  text-align: center;
}
.tcfo-widget .result-gate h3 { font-size: 18px; font-weight: 600; color: var(--navy); margin-bottom: 8px; }
.tcfo-widget .result-gate > p {
  font-size: 14px; color: var(--gray-500);
  margin-bottom: 24px; line-height: 1.55;
  max-width: 480px; margin-left: auto; margin-right: auto;
}
.tcfo-widget .result-gate-form {
  display: flex; flex-direction: column; gap: 12px;
  max-width: 440px; margin: 0 auto;
}
.tcfo-widget .result-gate-form input {
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: var(--sans); font-size: 14px;
  outline: none; transition: border-color .2s;
  width: 100%; color: var(--gray-700); background: var(--white);
}
.tcfo-widget .result-gate-form input:focus { border-color: var(--navy); }
.tcfo-widget .result-gate-form input.is-invalid { border-color: var(--red); }
.tcfo-widget .result-gate-form button {
  background: var(--navy); color: var(--white); border: none;
  padding: 13px 20px; border-radius: var(--radius);
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity .2s;
}
.tcfo-widget .result-gate-form button:hover:not(:disabled) { opacity: .85; }
.tcfo-widget .result-gate-form button:disabled { opacity: .5; cursor: not-allowed; }
.tcfo-widget .result-gate-privacy { font-size: 12px; color: var(--gray-500); margin-top: 12px; }
.tcfo-widget .result-gate-privacy a { color: var(--accent); text-decoration: none; }

/* ── Loading ─────────────────────────────────────────────── */
.tcfo-widget .tcfo-loading-wrap { text-align: center; padding: 80px 20px; }
.tcfo-widget .tcfo-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: tcfo-spin .8s linear infinite;
  margin: 0 auto 20px;
}
@keyframes tcfo-spin { to { transform: rotate(360deg); } }
.tcfo-widget .tcfo-loading-wrap p { font-size: 15px; color: var(--gray-500); }

/* ── Scores section ──────────────────────────────────────── */
.tcfo-widget .scores-section {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow); margin-bottom: 24px;
}
.tcfo-widget .scores-title { font-size: 14px; font-weight: 600; color: var(--navy); margin-bottom: 20px; }
.tcfo-widget .score-row { margin-bottom: 16px; }
.tcfo-widget .score-row:last-child { margin-bottom: 0; }
.tcfo-widget .score-row-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.tcfo-widget .score-row-label { font-size: 14px; color: var(--gray-700); }
.tcfo-widget .score-row-val   { font-size: 14px; font-weight: 600; color: var(--navy); }
.tcfo-widget .score-bar {
  height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden;
}
.tcfo-widget .score-bar-fill { height: 100%; border-radius: 4px; transition: width .8s ease; }

/* ── Hallazgos ───────────────────────────────────────────── */
.tcfo-widget .hallazgos-section {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow); margin-bottom: 24px;
}
.tcfo-widget .hallazgos-title { font-size: 14px; font-weight: 600; color: var(--navy); margin-bottom: 16px; }
.tcfo-widget .hallazgo-item {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 12px; padding: 14px; border-radius: 10px; background: var(--off-white);
}
.tcfo-widget .hallazgo-item:last-child { margin-bottom: 0; }
.tcfo-widget .hallazgo-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.tcfo-widget .hallazgo-icon.icon--danger  { background: var(--red-bg); }
.tcfo-widget .hallazgo-icon.icon--warning { background: var(--amber-bg); }
.tcfo-widget .hallazgo-icon.icon--success { background: var(--green-bg); }
.tcfo-widget .hallazgo-body { flex: 1; min-width: 0; }
.tcfo-widget .hallazgo-area {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--gray-500); margin-bottom: 3px;
}
.tcfo-widget .hallazgo-text {
  font-size: 14px; font-weight: 600; color: var(--navy); line-height: 1.4; margin-bottom: 4px;
}
.tcfo-widget .hallazgo-risk { font-size: 13px; color: var(--gray-500); line-height: 1.5; }

/* ── CTA result ──────────────────────────────────────────── */
.tcfo-widget .cta-result {
  border-radius: var(--radius-lg); padding: 32px; margin-bottom: 24px;
  background: #EFF6FF; border: 1px solid #BFDBFE;
}
.tcfo-widget .cta-result.perfil--listo    { background: var(--green-bg); border-color: #6EE7B7; }
.tcfo-widget .cta-result.perfil--creciendo { background: var(--amber-bg); border-color: #FCD34D; }
.tcfo-widget .cta-result.perfil--operando { background: var(--red-bg);   border-color: #FCA5A5; }
.tcfo-widget .cta-result h3 {
  font-size: 19px; font-weight: 600; margin-bottom: 10px; line-height: 1.3; color: var(--navy);
}
.tcfo-widget .cta-result p {
  font-size: 14px; line-height: 1.65; margin-bottom: 24px; color: var(--gray-700);
}
.tcfo-widget .cta-result-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.tcfo-widget .btn-cta-main {
  background: var(--navy-dark); color: var(--white); border: none;
  padding: 14px 24px; border-radius: var(--radius);
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity .2s;
  text-decoration: none; display: inline-block;
}
.tcfo-widget .btn-cta-main:hover { opacity: .85; color: var(--white); }

/* ── Error ───────────────────────────────────────────────── */
.tcfo-widget .tcfo-error-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 40px; text-align: center; box-shadow: var(--shadow);
}
.tcfo-widget .tcfo-error-card p { font-size: 15px; color: var(--gray-700); margin-bottom: 20px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .tcfo-widget.test-section { padding: 48px 4%; }
  .tcfo-widget .question-card { padding: 24px 20px; }
  .tcfo-widget .question-text { font-size: 16px; }
  .tcfo-widget .tcfo-stats { gap: 20px; }
  .tcfo-widget .q-hint { display: none; }
  .tcfo-widget .result-gate,
  .tcfo-widget .cta-result,
  .tcfo-widget .perfil-banner { padding: 24px 20px; }
  .tcfo-widget .cta-result-btns { flex-direction: column; }
}
