/* ==========================================================================
   DIAGNÓSTICO DE DEBIDA DILIGENCIA — FLUJO PASO A PASO (CAMPAÑAS)
   Estética editorial-corporativa en tonos suaves, sin distracciones
   ========================================================================== */

:root {
  /* Soft Neutrals */
  --bg-page: #f6f7f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f4f8;

  /* Brand Primary */
  --brand-navy: #001248;
  --brand-navy-hover: #0e2464;
  --brand-navy-active: #000b2e;
  --brand-tint: #eef2f8;
  --brand-ring: rgba(0, 18, 72, 0.14);

  /* Soft Status Accents */
  --sage-text: #127c5d;
  --sage-bg: #edf7f3;
  --sage-border: rgba(18, 124, 93, 0.22);

  --error-text: #b42318;
  --error-bg: #fef3f2;
  --error-border: #f04438;
  --error-ring: rgba(240, 68, 56, 0.14);

  /* Typography */
  --text-primary: #101828;
  --text-secondary: #475467;
  --text-muted: #667085;
  --text-inverse: #ffffff;

  /* Borders & Hairline Elevation */
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;
  --shadow-card:
    0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 32px -12px rgba(0, 18, 72, 0.08),
    0 0 0 1px rgba(16, 24, 40, 0.06);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-normal: 260ms var(--ease-out);
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-primary);
  background-color: var(--bg-page);
}

svg {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--brand-navy);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   CENTERED SINGLE-CARD VIEWPORT
   ========================================================================== */
.page-main {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.form-shell {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-card {
  width: 100%;
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ==========================================================================
   PROGRESS BAR (SEPARATED ABOVE CARD, NO STEP NUMBERS)
   ========================================================================== */
.progress-track {
  width: 100%;
  height: 7px;
  background-color: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.05);
}

.progress-fill {
  height: 100%;
  width: 11%;
  background-color: var(--brand-navy);
  border-radius: var(--radius-full);
  transition: width 320ms var(--ease-out);
}

.card-body {
  padding: 32px 34px 30px;
}

/* Intro (shown gently at top of question steps) */
.card-intro {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(1.25rem, 3vw, 1.45rem);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-wrap: balance;
  margin-bottom: 6px;
}

.card-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   STEP PANELS & QUESTION STAGE
   ========================================================================== */
.step-panel {
  animation: stepIn 220ms var(--ease-out);
}

.question-stage {
  animation: stepIn 200ms var(--ease-out);
}

.question-fieldset {
  border: 0;
  min-width: 0;
}

.question-legend {
  display: block;
  width: 100%;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(1.0625rem, 2.6vw, 1.1875rem);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

.req-mark {
  color: var(--error-text);
  margin-left: 2px;
}

/* Stacked & Grid Radio Cards */
.radio-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-card-list.radio-card-list--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 12px 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.option-card:hover {
  border-color: var(--border-strong);
  background-color: #fafbfd;
}

.option-card:active {
  transform: scale(0.99);
}

.option-card.is-selected {
  border-color: var(--brand-navy);
  background-color: var(--brand-tint);
  box-shadow: inset 0 0 0 1px rgba(0, 18, 72, 0.14);
}

.option-card:has(input:focus-visible) {
  outline: 2px solid var(--brand-navy);
  outline-offset: 2px;
}

.option-native-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.option-radio-dot {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border-medium);
  background-color: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition-fast);
}

.option-radio-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--brand-navy);
  transform: scale(0);
  transition: transform var(--transition-fast);
}

.option-card.is-selected .option-radio-dot {
  border-color: var(--brand-navy);
}

.option-card.is-selected .option-radio-dot::after {
  transform: scale(1);
}

.option-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.option-card.is-selected .option-text {
  color: var(--brand-navy);
  font-weight: 500;
}

/* Binary Sí / No Chips */
.chip-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.chip-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.chip-option:hover {
  border-color: var(--border-strong);
  background-color: #fafbfd;
}

.chip-option:active {
  transform: scale(0.985);
}

.chip-option.is-selected {
  border-color: var(--brand-navy);
  background-color: var(--brand-tint);
  color: var(--brand-navy);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(0, 18, 72, 0.14);
}

.chip-option:has(input:focus-visible) {
  outline: 2px solid var(--brand-navy);
  outline-offset: 2px;
}

/* Step Navigation Footer */
.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  min-height: 36px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-left: -10px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
}

.btn-ghost:hover {
  color: var(--brand-navy);
  background-color: var(--bg-subtle);
}

.btn-ghost--center {
  margin-left: 0;
  justify-content: center;
  width: 100%;
  padding: 10px 14px;
}

.btn-inline-next {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background-color: var(--brand-tint);
  color: var(--brand-navy);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color var(--transition-fast);
}

.btn-inline-next:hover {
  background-color: #e2e9f5;
}

/* ==========================================================================
   FINAL CONTACT STEP
   ========================================================================== */
.contact-header {
  margin-bottom: 20px;
}

.contact-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(1.1875rem, 2.8vw, 1.35rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 6px;
}

.contact-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.contact-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background-color: var(--bg-surface);
  font-size: 1rem;
  color: var(--text-primary);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}

.form-input::placeholder {
  color: #98a2b3;
}

.form-input:hover {
  border-color: var(--border-strong);
}

.form-input:focus {
  outline: none;
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.form-input.is-invalid {
  border-color: var(--error-border);
  background-color: #fffbfa;
}

.form-input.is-invalid:focus {
  box-shadow: 0 0 0 3px var(--error-ring);
}

/* Consent & Disclaimer Box */
.consent-box {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast);
}

.consent-box.is-invalid {
  border-color: rgba(240, 68, 56, 0.55);
  background-color: var(--error-bg);
}

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.consent-checkbox {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.consent-custom-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background-color: var(--bg-surface);
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.consent-checkbox:checked + .consent-custom-check {
  background-color: var(--brand-navy);
  border-color: var(--brand-navy);
  color: var(--text-inverse);
}

.consent-checkbox:focus-visible + .consent-custom-check {
  outline: 2px solid var(--brand-navy);
  outline-offset: 2px;
}

.consent-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.consent-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.consent-disclaimer {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.consent-error {
  padding-left: 32px;
}

/* Validation & Feedback */
.field-error {
  display: none;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--error-text);
  margin-top: 6px;
  line-height: 1.35;
}

.field-error.visible {
  display: block;
}

.form-feedback {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.45;
  background-color: var(--error-bg);
  border: 1px solid rgba(240, 68, 56, 0.25);
  color: var(--error-text);
}

.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

/* ==========================================================================
   PRIMARY & SECONDARY BUTTONS
   ========================================================================== */
.btn-primary {
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  background-color: var(--brand-navy);
  color: var(--text-inverse);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.btn-primary:hover {
  background-color: var(--brand-navy-hover);
  box-shadow: 0 4px 12px rgba(0, 18, 72, 0.18);
}

.btn-primary:active {
  background-color: var(--brand-navy-active);
  transform: scale(0.99);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  width: 100%;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-medium);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

/* ==========================================================================
   EVALUATING STATE (1-2s SIMULATED DELAY)
   ========================================================================== */
.evaluating-state {
  padding: 48px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: stepIn 220ms var(--ease-out);
}

.eval-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--brand-tint);
  border-top-color: var(--brand-navy);
  animation: spin 0.75s linear infinite;
  margin-bottom: 20px;
}

.eval-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.eval-subtitle {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  max-width: 380px;
}

/* ==========================================================================
   DIAGNOSTIC RESULT STATE
   ========================================================================== */
.result-state {
  text-align: center;
  padding: 4px 0;
  animation: stepIn 260ms var(--ease-out);
}

.result-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.result-badge.is-required {
  background-color: var(--brand-tint);
  color: var(--brand-navy);
  border: 1px solid rgba(0, 18, 72, 0.14);
}

.result-badge.is-recommended {
  background-color: #fdf6ec;
  color: #9a5b13;
  border: 1px solid rgba(180, 114, 24, 0.24);
}

.result-badge.is-low {
  background-color: var(--sage-bg);
  color: var(--sage-text);
  border: 1px solid var(--sage-border);
}

.result-flags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}

.result-flag-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  background-color: var(--bg-subtle);
  color: var(--brand-navy);
  border: 1px solid var(--border-subtle);
}

.result-flag-pill.is-alert {
  background-color: #fdf6ec;
  color: #9a5b13;
  border-color: rgba(180, 114, 24, 0.24);
}

.result-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-wrap: balance;
}

.result-greeting {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--brand-navy);
  margin-bottom: 10px;
}

.result-description {
  font-size: 0.925rem;
  color: var(--text-secondary);
  max-width: 460px;
  margin: 0 auto 20px;
  line-height: 1.55;
}

.result-details-box {
  text-align: left;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 22px;
}

.result-details-heading {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.result-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-points li {
  position: relative;
  padding-left: 18px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.result-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--brand-navy);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-footnote {
  margin-top: 16px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ==========================================================================
   ANIMATIONS & RESPONSIVE
   ========================================================================== */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes stepIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 560px) {
  .page-main {
    padding: 16px 12px;
  }

  .form-card {
    border-radius: 16px;
  }

  .card-body {
    padding: 22px 16px 22px;
  }

  .radio-card-list.radio-card-list--grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .option-card {
    min-height: 46px;
    padding: 11px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   EMBED MODE (?embed=1 para modal/iframe en la landing)
   ========================================================================== */
body.is-embed {
  min-height: auto;
  background-color: transparent;
}

body.is-embed .page-main {
  padding: 2px 2px 6px;
  align-items: flex-start;
}

body.is-embed .form-shell {
  max-width: 100%;
  gap: 8px;
}

body.is-embed .form-card {
  box-shadow: none;
  border: 1px solid var(--border-subtle);
}

body.is-embed .card-body {
  padding: 20px 22px 18px;
}

body.is-embed .card-intro {
  margin-bottom: 16px;
  padding-bottom: 14px;
}

@media (max-width: 560px) {
  body.is-embed .card-body {
    padding: 20px 16px 18px;
  }
}
