/* =========================================================
   Tests psicológicos — Dashboard Vanessa Henao
   Estilos del catálogo, realización y resultados
   ========================================================= */

/* ---------- Secciones dentro de pagina-tests ---------- */
.tests-seccion {
  margin-bottom: 2.4rem;
}
.tests-seccion:last-child { margin-bottom: 0; }

.tests-seccion-cab {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}
.tests-seccion-cab h3 {
  margin: 0.2rem 0 0;
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--text);
}
.tests-seccion-intro {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-soft);
  max-width: 62ch;
}
.tests-vacio {
  padding: 2rem 1.4rem;
  text-align: center;
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.6;
  border: 1px dashed var(--border);
  border-radius: var(--radio-card-sm);
  background: var(--surface);
}

/* ---------- Grid de tests validados ---------- */
.tests-validados-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.test-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.2rem;
  /* fondo y borde vienen de la base .card en estilos.css */
  border-radius: var(--radio-card-sm);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.test-card:hover {
  border-color: var(--terra);
  box-shadow: var(--sombra-card-hover-terra);
  transform: translateY(-2px);
}
.test-card-icono {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
}
.test-card-sigla {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.test-card-info h4 {
  margin: 0.15rem 0 0;
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.test-card-desc {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-soft);
}
.test-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.7rem;
  font-size: var(--t-sm);
  color: var(--text-soft);
}
.test-card-meta span {
  padding: 0.2rem 0.55rem;
  border-radius: var(--radio-pildora);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.test-card-cta {
  margin-top: auto;
  padding-top: 0.4rem;
}
.test-card-cta .btn { width: 100%; justify-content: center; }

/* ---------- Modal de realización ---------- */
.tr-modal {
  max-width: 860px;
  width: min(860px, calc(100vw - 2rem));
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  padding: 1.3rem 1.5rem 1.1rem;
}

@media (max-width: 639px) {
  .modal-fondo { align-items: flex-start; overflow-y: auto; padding: 1rem 0.6rem; }
  .tr-modal { width: 100%; max-height: calc(100dvh - 2rem); }
}
.tr-cab { flex-shrink: 0; margin-bottom: 0.7rem; }

.tr-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.4rem;
  margin-right: -0.4rem;
}
.tr-scroll::-webkit-scrollbar { width: 8px; }
.tr-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.tr-descripcion {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-soft);
}

.tr-nombre-campo {
  display: block;
  margin-bottom: 1.1rem;
}

.tr-instrucciones {
  padding: 0.9rem 1.1rem;
  border-radius: 0.7rem;
  background: rgba(169, 116, 75, 0.08);
  border-left: 3px solid var(--terra);
  margin-bottom: 1.4rem;
}
.tr-instrucciones p:last-child {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.55;
}

/* ---------- Pregunta ---------- */
.tr-pregunta {
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 1rem 1.1rem;
  margin: 0 0 0.75rem;
  background: var(--surface);
  transition: border-color 0.2s, background 0.2s;
}
.tr-pregunta.respondida {
  border-color: rgba(95, 158, 112, 0.4);
  background: rgba(95, 158, 112, 0.05);
}
.tr-pregunta legend {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0 0.3rem;
  margin-left: -0.3rem;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
}
.tr-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--terra);
  color: #fff;
  font-size: var(--t-xs);
  font-weight: 700;
  margin-top: 0.05rem;
}

/* ---------- Opciones ---------- */
.tr-opciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-left: 2.1rem;
}
.tr-opcion {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-size: 0.78rem;
  color: var(--text);
}
.tr-opcion:hover { border-color: var(--terra); }
.tr-opcion input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
/* El radio real está oculto: el foco de teclado se dibuja en la etiqueta,
   igual que en .cf-chip o .sf-radio. */
.tr-opcion:has(input:focus-visible) {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.tr-op-valor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-soft);
  font-family: 'Montserrat', sans-serif;
  font-size: var(--t-xs);
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
}
.tr-opcion:has(input:checked),
.tr-opcion input:checked ~ * { }   /* placeholder para navegadores sin :has */
.tr-opcion:has(input:checked) {
  border-color: var(--terra);
  background: rgba(169, 116, 75, 0.10);
  color: var(--terra);
}
.tr-opcion:has(input:checked) .tr-op-valor {
  background: var(--terra);
  color: #fff;
}

@media (max-width: 639px) {
  .tr-opciones { padding-left: 0; }
  .tr-opcion { flex: 1 1 calc(50% - 0.25rem); justify-content: flex-start; }
}

/* ---------- Barra de progreso y pie ---------- */
.tr-pie {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.5rem;
  align-items: center;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--border);
}
.tr-progreso {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.tr-progreso-barra-cont {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.tr-progreso-barra {
  height: 100%;
  width: 0%;
  background: var(--terra);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.tr-progreso-texto {
  font-size: var(--t-xs);
  color: var(--text-soft);
  font-family: 'Montserrat', sans-serif;
}
.tr-fuente {
  flex-shrink: 0;
  margin: 0.6rem 0 0;
  font-size: var(--t-sm);
  color: var(--text-soft);
  font-style: italic;
  text-align: center;
}
.error[hidden] { display: none !important; }

/* ---------- Panel de resultado ---------- */
.tr-res-cab { margin-bottom: 1rem; }
.tr-res-cab h3 {
  margin: 0.2rem 0 0;
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--text);
}
.tr-res-persona {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  color: var(--text-soft);
}
.tr-res-persona strong { color: var(--text); }

.tr-res-puntaje {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  padding: 1.4rem 1.6rem;
  border-radius: var(--radio-card-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}
.tr-res-num {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--terra);
  font-family: 'Playfair Display', serif;
}
.tr-res-num span { font-size: 3rem; line-height: 1; }
.tr-res-num small {
  margin-top: 0.35rem;
  font-family: 'Montserrat', sans-serif;
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.tr-res-nivel {
  padding: 0.55rem 1.1rem;
  border-radius: var(--radio-pildora);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
}

.tr-res-grafica {
  padding: 1rem 1.2rem;
  border-radius: var(--radio-card-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 1.4rem;
  overflow-x: auto;
}

.tr-res-bloque {
  margin-bottom: 1.2rem;
}
.tr-res-bloque h4 {
  margin: 0 0 0.4rem;
  font-family: 'Montserrat', sans-serif;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--terra);
}
.tr-res-bloque p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
}

.tr-bandera {
  display: flex;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  border-radius: 0.7rem;
  background: rgba(178, 58, 58, 0.10);
  border-left: 3px solid var(--error);
  margin-bottom: 1.4rem;
  color: var(--error);
}
.tr-bandera strong {
  display: block;
  margin-bottom: 0.3rem;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
}
.tr-bandera p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.55;
}

.tr-res-nota {
  margin: 1.2rem 0;
  font-size: 0.75rem;
  color: var(--text-soft);
  font-style: italic;
  line-height: 1.55;
}

.tr-res-botones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

/* ---------- Historial de resultados ---------- */
#tests-historial-lista {
  display: grid;
  gap: 0.7rem;
}
.tests-hist-fila {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border-radius: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
}
.tests-hist-info h5 {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tests-hist-sigla {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radio-pildora);
  background: var(--surface-2);
}
.tests-hist-info p {
  margin: 0.25rem 0 0;
  font-size: var(--t-md);
  color: var(--text-soft);
}
.tests-hist-punt {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}
.tests-hist-punt small {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-size: var(--t-xs);
  color: var(--text-soft);
  font-weight: 400;
  margin-top: 0.15rem;
}
.tests-hist-nivel {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radio-pildora);
  font-family: 'Montserrat', sans-serif;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tests-hist-acciones { display: flex; gap: 0.35rem; }
.tests-hist-acciones button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--text-soft);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.tests-hist-acciones button:hover {
  color: var(--terra);
  border-color: var(--terra);
}

@media (max-width: 700px) {
  .tests-hist-fila {
    grid-template-columns: 1fr auto;
  }
  .tests-hist-nivel { grid-column: 1 / -1; justify-self: flex-start; }
  .tests-hist-acciones { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ---------- CTA de sesión de lectura en el resultado ---------- */
.tr-res-lectura {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1.2rem 1.3rem;
  margin: 1.4rem 0;
  border-radius: var(--radio-card-sm);
  background: rgba(169, 116, 75, 0.08);
  border: 1px solid rgba(169, 116, 75, 0.3);
}
.tr-res-lectura-icono {
  display: inline-flex;
  padding: 0.65rem;
  border-radius: var(--radio-pildora);
  background: rgba(169, 116, 75, 0.15);
  color: var(--terra);
  flex-shrink: 0;
}
.tr-res-lectura-texto strong {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.tr-res-lectura-texto p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-soft);
}
@media (max-width: 700px) {
  .tr-res-lectura { grid-template-columns: auto 1fr; }
  .tr-res-lectura .btn { grid-column: 1 / -1; justify-content: center; }
}
