/* ═══════════════════════════════════════════
   styles.css — Cuestionario IA · UTCJ
   Colores institucionales verdes UTCJ
   Responsive: mobile · tablet · desktop
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Sans+3:wght@300;400;600&display=swap');

/* ── Variables de color ── */
:root {
  --verde:        #1e7a34;   /* verde principal UTCJ */
  --verde-oscuro: #145526;   /* hover / encabezado */
  --verde-claro:  #28a745;   /* acentos / botones */
  --verde-palido: #eaf5ec;   /* fondos suaves */
  --verde-borde:  #a8d5b0;   /* bordes */
  --acento:       #f0a500;   /* dorado para detalles */
  --texto:        #1a2a1c;
  --texto-sec:    #3d5440;
  --fondo:        #f3f7f4;
  --blanco:       #ffffff;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Base ── */
body {
  font-family: 'Source Sans 3', sans-serif;
  background: var(--fondo);
  color: var(--texto);
  font-size: 15px;
  line-height: 1.6;
}

/* ════════════════════════════
   ENCABEZADO
   ════════════════════════════ */
.encabezado {
  background: var(--verde-oscuro);
  color: white;
  padding: 1.8rem 2rem;
  border-bottom: 4px solid var(--acento);
}

.encabezado-inner {
  max-width: 860px;
  margin: 0 auto;
}

.logo-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.logo-placeholder {
  width: 50px;
  height: 50px;
  min-width: 50px;
  background: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Libre Baskerville', serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--verde-oscuro);
  text-align: center;
  line-height: 1.2;
  padding: 4px;
}

.inst-nombre {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.inst-programa {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

h1 {
  font-family: 'Libre Baskerville', serif;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

.subtitulo-enc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  font-style: italic;
}

/* ════════════════════════════
   CONTENEDOR PRINCIPAL
   ════════════════════════════ */
.contenedor {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ════════════════════════════
   CONSENTIMIENTO
   ════════════════════════════ */
.consentimiento {
  background: var(--verde-palido);
  border: 1px solid var(--verde-borde);
  border-left: 4px solid var(--verde-claro);
  border-radius: 6px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.8rem;
  font-size: 14px;
  color: var(--texto-sec);
}

.consentimiento strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--verde);
  margin-bottom: 0.5rem;
}

/* ════════════════════════════
   SECCIONES
   ════════════════════════════ */
.seccion {
  background: var(--blanco);
  border: 1px solid var(--verde-borde);
  border-radius: 8px;
  margin-bottom: 1.6rem;
  overflow: hidden;
}

.seccion-titulo {
  background: var(--verde);
  color: white;
  padding: 0.7rem 1.3rem;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.var-tag {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.8;
}

.seccion-subtitulo {
  background: var(--verde-palido);
  padding: 0.6rem 1.3rem;
  font-size: 13px;
  color: var(--texto-sec);
  border-bottom: 1px solid var(--verde-borde);
  font-style: italic;
}

.seccion-cuerpo {
  padding: 1.1rem 1.3rem;
}

/* tabla-responsive: permite scroll horizontal en pantallas pequeñas */
.tabla-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.8rem;
}

/* ════════════════════════════
   TABLA DEMOGRÁFICA
   ════════════════════════════ */
.tabla-demo {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.tabla-demo tr {
  border-bottom: 1px solid var(--verde-borde);
}

.tabla-demo tr:last-child {
  border-bottom: none;
}

.tabla-demo td {
  padding: 0.75rem 0.5rem;
  vertical-align: top;
}

.tabla-demo td:first-child {
  width: 210px;
  font-weight: 600;
  color: var(--verde);
  padding-right: 1rem;
  vertical-align: middle;
}

/* ── Número de variable ── */
.num-var {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--verde);
  color: white;
  font-size: 11px;
  font-weight: 600;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}

/* ── Nota "puede seleccionar varias" ── */
.nota-multiple {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  font-style: italic;
  color: var(--texto-sec);
  margin-top: 2px;
}

/* ── Grupos de opciones ── */
.opciones-grupo {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.1rem;
  align-items: center;
}

.opciones-grupo label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--texto);
}

.label-con-input {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.opciones-grupo input[type="radio"],
.opciones-grupo input[type="checkbox"] {
  accent-color: var(--verde);
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Inputs de texto ── */
.campo-texto {
  border: 1px solid var(--verde-borde);
  border-radius: 4px;
  padding: 4px 10px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 14px;
  color: var(--texto);
  background: var(--fondo);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.campo-texto:focus {
  border-color: var(--verde-claro);
  background: white;
}

.campo-edad { width: 75px; }
.campo-otro { width: 150px; }

.edad-row {
  align-items: center;
  font-size: 14px;
  color: var(--texto-sec);
}

/* ════════════════════════════
   INSTRUCCIÓN ESCALA
   ════════════════════════════ */
.instruccion-escala {
  background: #fffbe6;
  border: 1px solid #e8d080;
  border-radius: 6px;
  padding: 0.9rem 1.2rem;
  font-size: 13.5px;
  margin-bottom: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.5rem;
  align-items: center;
}

.instruccion-escala strong {
  display: block;
  color: var(--verde);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.escala-valores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
}

.escala-valores span {
  background: var(--verde-palido);
  color: var(--verde);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--verde-borde);
}

/* ════════════════════════════
   TABLA LIKERT
   ════════════════════════════ */
.tabla-likert {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 560px; /* fuerza scroll en mobile antes de colapsar */
}

.tabla-likert thead tr {
  background: var(--verde-palido);
  border-bottom: 2px solid var(--verde-borde);
}

.tabla-likert thead th {
  padding: 0.55rem 0.5rem;
  text-align: center;
  font-weight: 600;
  color: var(--verde);
  font-size: 12px;
  white-space: nowrap;
}

.tabla-likert thead th:first-child,
.tabla-likert thead th:nth-child(2) {
  text-align: left;
}

.col-indicador {
  width: 120px;
}

.tabla-likert tbody tr {
  border-bottom: 1px solid var(--verde-borde);
  transition: background 0.15s;
}

.tabla-likert tbody tr:last-child {
  border-bottom: none;
}

.tabla-likert tbody tr:hover {
  background: var(--verde-palido);
}

.tabla-likert tbody td {
  padding: 0.65rem 0.5rem;
  text-align: center;
  vertical-align: middle;
}

.tabla-likert tbody td:first-child {
  text-align: left;
  font-style: italic;
  color: var(--texto-sec);
  font-size: 12px;
  padding-left: 0.8rem;
}

.tabla-likert tbody td:nth-child(2) {
  text-align: left;
}

.num-pregunta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--verde-claro);
  color: white;
  font-size: 11px;
  font-weight: 600;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.celda-radio input[type="radio"] {
  accent-color: var(--verde);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ════════════════════════════
   ZONA DE ENVÍO
   ════════════════════════════ */
.zona-envio {
  text-align: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--verde-borde);
}

.btn-enviar {
  background: var(--verde);
  color: white;
  border: none;
  padding: 0.85rem 3.5rem;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
  max-width: 340px;
}

.btn-enviar:hover {
  background: var(--verde-claro);
}

.btn-enviar:active {
  transform: scale(0.98);
}

.btn-enviar:disabled {
  background: #8fbc8f;
  cursor: not-allowed;
}

.mensaje-exito,
.mensaje-error {
  display: none;
  border-radius: 8px;
  padding: 1rem 1.4rem;
  margin-top: 1rem;
  font-weight: 600;
  font-size: 14px;
}

.mensaje-exito {
  background: #d4edda;
  border: 1px solid #a8d5b0;
  color: #145526;
}

.mensaje-error {
  background: #fde8e8;
  border: 1px solid #f5b7b7;
  color: #8b1a1a;
}

/* ════════════════════════════
   PIE DE PÁGINA
   ════════════════════════════ */
.pie {
  text-align: center;
  font-size: 12px;
  color: var(--texto-sec);
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--verde-borde);
  font-style: italic;
}

/* ════════════════════════════
   RESPONSIVE — TABLET (≤ 768px)
   ════════════════════════════ */
@media (max-width: 768px) {
  .encabezado {
    padding: 1.3rem 1rem;
  }

  .contenedor {
    padding: 1.3rem 1rem 3rem;
  }

  /* Tabla demográfica: pasa a layout de bloque */
  .tabla-demo,
  .tabla-demo tbody,
  .tabla-demo tr,
  .tabla-demo td {
    display: block;
    width: 100%;
  }

  .tabla-demo tr {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--verde-borde);
  }

  .tabla-demo td:first-child {
    width: 100%;
    padding-right: 0;
    padding-bottom: 0.4rem;
    white-space: normal;
    color: var(--verde);
  }

  .tabla-demo td:last-child {
    padding-top: 0;
  }

  .instruccion-escala {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .btn-enviar {
    max-width: 100%;
    padding: 0.85rem 1rem;
  }
}

/* ════════════════════════════
   RESPONSIVE — MOBILE (≤ 480px)
   ════════════════════════════ */
@media (max-width: 480px) {
  h1 {
    font-size: 1.05rem;
  }

  .logo-placeholder {
    width: 42px;
    height: 42px;
    min-width: 42px;
    font-size: 10px;
  }

  .inst-nombre {
    font-size: 10.5px;
  }

  .inst-programa {
    font-size: 12.5px;
  }

  .subtitulo-enc {
    font-size: 11.5px;
  }

  .seccion-titulo {
    font-size: 12px;
    padding: 0.6rem 1rem;
  }

  .seccion-cuerpo {
    padding: 0.8rem 0.8rem;
  }

  .consentimiento {
    padding: 1rem;
    font-size: 13px;
  }

  .opciones-grupo {
    gap: 0.4rem 0.8rem;
  }

  .escala-valores {
    gap: 0.35rem;
  }

  .escala-valores span {
    font-size: 11px;
    padding: 2px 8px;
  }

  /* En mobile la tabla Likert tiene scroll horizontal */
  .tabla-responsive {
    padding: 0.5rem 0;
  }

  .tabla-likert {
    font-size: 12.5px;
  }

  .num-pregunta {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
}