/* ============================================================
   tests.css — Sección "Tests y Evaluaciones" (perfil personal)
   Mantiene la identidad RUTINIX: tema oscuro, acentos, tipografías
   Black Han Sans (display) + DM Sans (texto).
   ============================================================ */

/* ── Overlay del perfil ──────────────────────────────────── */
#perfil-overlay {
  position: fixed;
  inset: 0;
  /* Por DEBAJO de la barra de navegación (#rutinix-nav = 10000) para que la
     barra superior siga visible y funcional dentro de la sección de tests. */
  z-index: 9000;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: none;
  opacity: 0;
}
#perfil-overlay.open { display: block; animation: fadeUp 0.35s ease; opacity: 1; }

/* padding-top deja hueco para la barra fija de 62px */
.perfil-wrap { max-width: 1080px; margin: 0 auto; padding: calc(62px + 1.2rem) 1.2rem 5rem; }

.perfil-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.4rem 0 1.6rem;
}
.perfil-close {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 0.55rem 0.9rem; border-radius: 10px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: 0.85rem; font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}
.perfil-close:hover { border-color: var(--accent); }
.perfil-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.perfil-logo { font-family: 'Black Han Sans', sans-serif; letter-spacing: 0.04em; font-size: 1.05rem; }
.perfil-logo span { color: var(--accent); }

/* ── Cabecera del perfil ─────────────────────────────────── */
.perfil-header { margin-bottom: 2rem; }
.perfil-kicker {
  font-family: 'Space Mono', monospace; font-size: 0.72rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem;
}
.perfil-title {
  font-family: 'Black Han Sans', sans-serif; font-size: clamp(1.8rem, 5vw, 2.8rem);
  line-height: 1.05; letter-spacing: 0.01em;
}
.perfil-title span { color: var(--accent); }
.perfil-account {
  display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.9rem;
  font-size: 0.85rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 0.45rem 0.85rem; border-radius: 99px;
}
.perfil-account .ti { color: var(--accent); }

/* ── Aviso de sección opcional ───────────────────────────── */
.perfil-note {
  display: flex; gap: 0.7rem; align-items: flex-start;
  background: rgba(71,200,255,0.06);
  border: 1px solid rgba(71,200,255,0.25);
  border-radius: 14px; padding: 0.9rem 1.1rem; margin-bottom: 2rem;
  font-size: 0.86rem; color: #b9d9e8; line-height: 1.5;
}
.perfil-note .ti { color: var(--accent3); font-size: 1.2rem; flex-shrink: 0; }

.perfil-section-h {
  font-family: 'Black Han Sans', sans-serif; font-size: 1.25rem;
  margin-bottom: 0.3rem;
}
.perfil-section-sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 1.3rem; }

/* ── Grid de tarjetas de test ────────────────────────────── */
.tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.test-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 1.1rem 1.1rem 1.2rem;
  cursor: pointer; transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  /* Es un <a>: anulamos el aspecto de enlace (azul + subrayado) */
  text-decoration: none; color: var(--text);
}
.test-card, .test-card:hover, .test-card:focus, .test-card:visited { text-decoration: none; }
.test-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,0.35); }
.test-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.test-card-name { color: var(--text); }

.test-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.85rem; }
.test-card-icon {
  font-size: 1.55rem; line-height: 1; width: 46px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.test-card-meta { display: flex; flex-direction: column; gap: 0.15rem; text-align: right; }
.test-card-meta span { font-size: 0.7rem; color: var(--muted); white-space: nowrap; }

.test-card-name { font-family: 'Black Han Sans', sans-serif; font-size: 1.05rem; line-height: 1.15; margin-bottom: 0.35rem; }
.test-card-desc { font-size: 0.83rem; color: var(--muted); line-height: 1.45; margin-bottom: 0.9rem; flex: 1; }

.test-card-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.72rem; color: var(--accent);
  background: rgba(232,255,71,0.08); border: 1px solid rgba(232,255,71,0.22);
  padding: 0.35rem 0.6rem; border-radius: 8px; margin-bottom: 0.9rem;
  line-height: 1.3;
}
.test-card-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.test-card-badge--empty { color: var(--muted); background: var(--surface); border-color: var(--border); }

.test-card-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  width: 100%; padding: 0.6rem; border-radius: 10px; cursor: pointer;
  background: var(--accent); color: #0a0a0a; border: none;
  font-family: 'Black Han Sans', sans-serif; font-size: 0.78rem; letter-spacing: 0.04em;
  transition: filter 0.15s;
}
.test-card-btn:hover { filter: brightness(1.08); }

/* ── Página individual de test (test.php) ────────────────── */
.test-page-wrap { max-width: 620px; margin: 0 auto; padding: calc(62px + 1.5rem) 1.1rem 5rem; }
.test-page-breadcrumb { font-size: 0.8rem; color: var(--muted); margin-bottom: 1.2rem; }
/* Subrayado siempre: los enlaces dentro de texto no deben distinguirse solo
   por color (accesibilidad — Lighthouse "link-in-text-block"). */
.test-page-breadcrumb a { color: var(--accent); text-decoration: underline; }
.test-page-breadcrumb a:hover { text-decoration: none; }
.test-page-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.6rem; }
.test-page-icon {
  font-size: 1.8rem; width: 56px; height: 56px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
}
.test-page-h1 { font-family: 'Black Han Sans', sans-serif; font-size: clamp(1.6rem, 4.5vw, 2.3rem); line-height: 1.05; }
.test-page-method {
  display: inline-block; font-family: 'Space Mono', monospace; font-size: 0.7rem;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent3); margin-bottom: 1rem;
}
.test-page-intro { font-size: 0.95rem; color: #c8c8c8; line-height: 1.6; margin-bottom: 1.4rem; }
.test-page-meta { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
.test-page-meta span {
  font-size: 0.74rem; color: var(--muted); background: var(--surface);
  border: 1px solid var(--border); border-radius: 99px; padding: 0.35rem 0.8rem;
}
.test-page-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 1.6rem 1.4rem 1.8rem;
}
.test-page-seo { margin-top: 2.5rem; }
.test-page-seo h2 { font-family: 'Black Han Sans', sans-serif; font-size: 1.05rem; margin: 1.6rem 0 0.6rem; }
.test-page-seo p { font-size: 0.9rem; color: #b8b8b8; line-height: 1.7; margin-bottom: 0.8rem; }

@media (max-width: 560px) { .test-page-wrap { padding-top: calc(62px + 1rem); } }

/* ── Modal de test (runner, solo en index.html) ──────────── */
#test-modal {
  position: fixed; inset: 0; z-index: 10060; /* por encima del perfil y de la barra */
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 5.5rem 1rem 4rem; /* deja aire arriba para que se vea bien la cabecera */
}
#test-modal.open { display: flex; }

.test-modal-box {
  position: relative; width: 100%; max-width: 560px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 1.6rem 1.4rem 1.8rem;
  animation: modalIn 0.3s ease;
}
.test-modal-back {
  position: absolute; top: 1rem; right: 1rem;
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  border-radius: 10px; cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.test-modal-back:hover { color: var(--text); border-color: var(--accent); }
.test-modal-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.test-modal-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.3rem; padding-right: 2.5rem; }
.test-modal-icon {
  font-size: 1.5rem; width: 48px; height: 48px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
}
.test-modal-name { font-family: 'Black Han Sans', sans-serif; font-size: 1.15rem; line-height: 1.1; }
.test-modal-method { font-size: 0.76rem; color: var(--muted); margin-top: 0.15rem; }

.test-intro { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }

/* ── Formulario de medición ──────────────────────────────── */
.test-form { display: flex; flex-direction: column; gap: 1rem; }
.test-field { display: flex; flex-direction: column; gap: 0.35rem; }
.test-field label { font-size: 0.84rem; font-weight: 500; color: var(--text); }
.test-field-unit { color: var(--muted); font-weight: 400; }
.test-field input, .test-field select {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 0.7rem 0.85rem; border-radius: 10px; font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem; width: 100%; transition: border-color 0.15s;
}
.test-field input:focus, .test-field select:focus { outline: none; border-color: var(--accent); }
.test-field input.invalid { border-color: var(--accent2); }
.test-field-err { font-size: 0.76rem; color: var(--accent2); min-height: 0.9rem; }

.test-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; padding: 0.85rem; margin-top: 0.4rem; border: none; cursor: pointer;
  background: var(--accent); color: #0a0a0a; border-radius: 12px;
  font-family: 'Black Han Sans', sans-serif; font-size: 0.9rem; letter-spacing: 0.05em;
  transition: filter 0.15s;
}
.test-submit:hover { filter: brightness(1.08); }

/* ── Cuestionario (pregunta a pregunta) ──────────────────── */
.test-progress { margin-bottom: 1.2rem; }
.test-progress-row { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin-bottom: 0.45rem; font-family: 'Space Mono', monospace; }
.test-progress-track { height: 6px; background: var(--card); border-radius: 99px; overflow: hidden; }
.test-progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.35s ease; }

.test-q-area {
  display: inline-block; font-family: 'Space Mono', monospace; font-size: 0.68rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent3);
  margin-bottom: 0.5rem;
}
.test-q-text { display: block; font-size: 1.12rem; font-weight: 700; line-height: 1.3; margin-bottom: 1.1rem; }

/* Medición: un dato por pantalla */
.test-step-field { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.3rem; }
.test-step-input {
  flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 0.85rem 0.95rem; border-radius: 12px; font-family: 'DM Sans', sans-serif; font-size: 1.05rem;
  transition: border-color 0.15s;
}
.test-step-input:focus { outline: none; border-color: var(--accent); }
.test-step-input.invalid { border-color: var(--accent2); }
.test-step-unit { color: var(--muted); font-size: 0.95rem; white-space: nowrap; }

.test-opts { display: flex; flex-direction: column; gap: 0.6rem; }
.test-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 0.85rem 1rem; border-radius: 12px;
  font-family: 'DM Sans', sans-serif; font-size: 0.92rem;
  transition: border-color 0.15s, background 0.15s;
}
.test-opt:hover { border-color: var(--accent); }
.test-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.test-opt-check {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border);
  flex-shrink: 0; transition: border-color 0.15s, background 0.15s; position: relative;
}
.test-opt.selected { border-color: var(--accent); background: rgba(232,255,71,0.06); }
.test-opt.selected .test-opt-check { border-color: var(--accent); background: var(--accent); }
.test-opt.selected .test-opt-check::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 6px; height: 10px; border: solid #0a0a0a; border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}

.test-q-err { font-size: 0.8rem; color: var(--accent2); min-height: 1rem; margin-top: 0.6rem; }

.test-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-top: 1.3rem; }
.test-nav-prev {
  display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 0.65rem 1rem; border-radius: 10px; font-family: 'DM Sans', sans-serif; font-size: 0.85rem;
  transition: color 0.15s, border-color 0.15s;
}
.test-nav-prev:hover { color: var(--text); border-color: var(--text); }
.test-nav-next {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  background: var(--accent); color: #0a0a0a; border: none;
  padding: 0.7rem 1.3rem; border-radius: 10px;
  font-family: 'Black Han Sans', sans-serif; font-size: 0.78rem; letter-spacing: 0.04em;
  transition: filter 0.15s;
}
.test-nav-next:hover { filter: brightness(1.08); }

/* ── Resultado ───────────────────────────────────────────── */
.test-result { text-align: center; }
.test-disclaimer {
  font-size: 0.74rem; color: var(--muted); line-height: 1.5;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.7rem 0.85rem; text-align: left;
}
.test-disclaimer--top { margin-bottom: 1.4rem; }
.test-result-value { font-family: 'Black Han Sans', sans-serif; font-size: 3rem; line-height: 1; margin-bottom: 0.7rem; }
.test-result-cat {
  display: inline-block; font-family: 'Black Han Sans', sans-serif; font-size: 0.85rem;
  letter-spacing: 0.05em; padding: 0.4rem 0.9rem; border-radius: 99px; border: 1px solid;
  margin-bottom: 1.1rem;
}
.test-gauge { height: 10px; background: var(--card); border-radius: 99px; overflow: hidden; margin: 0 auto 1.2rem; max-width: 320px; }
.test-gauge-fill { height: 100%; width: 0; border-radius: 99px; transition: width 0.6s ease; }
.test-result-explain { font-size: 0.92rem; color: var(--text); line-height: 1.55; max-width: 440px; margin: 0 auto 1.4rem; }

.test-radar-wrap { position: relative; height: 300px; max-width: 380px; margin: 0 auto 1.4rem; }

.test-metrics { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin-bottom: 1.5rem; }
.test-metric {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.7rem 0.95rem; text-align: center; min-width: 120px;
}
.test-metric-label { display: block; font-size: 0.72rem; color: var(--muted); margin-bottom: 0.25rem; }
.test-metric-value { display: block; font-family: 'Space Mono', monospace; font-size: 0.95rem; color: var(--text); }

.test-recs-title { font-family: 'Black Han Sans', sans-serif; font-size: 1.05rem; text-align: left; margin-bottom: 0.9rem; }
.test-recs { display: flex; flex-direction: column; gap: 0.7rem; text-align: left; margin-bottom: 1.6rem; }
.test-rec {
  display: flex; gap: 0.75rem; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 0.85rem 0.95rem;
}
.test-rec-icon { font-size: 1.25rem; line-height: 1.2; flex-shrink: 0; }
.test-rec-area {
  font-family: 'Space Mono', monospace; font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.25rem;
}
.test-rec-text { font-size: 0.86rem; color: var(--text); line-height: 1.5; }

.test-result-actions { display: flex; flex-direction: column; gap: 0.6rem; }
.test-back-tests { justify-content: center; }
.test-login-note {
  font-size: 0.84rem; color: var(--text); line-height: 1.5; text-align: center;
  background: rgba(71,200,255,0.06); border: 1px solid rgba(71,200,255,0.25);
  border-radius: 10px; padding: 0.7rem 0.9rem; margin-bottom: 0.2rem;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 560px) {
  .tests-grid { grid-template-columns: 1fr; }
  .test-result-value { font-size: 2.4rem; }
  .test-modal-box { padding: 1.3rem 1.1rem 1.5rem; }
}

/* ── Accesibilidad: movimiento reducido ──────────────────── */
@media (prefers-reduced-motion: reduce) {
  #perfil-overlay.open, .test-modal-box { animation: none; }
  .test-card, .test-gauge-fill, .test-progress-fill,
  .test-card-btn, .test-submit, .test-nav-next { transition: none; }
  .test-card:hover { transform: none; }
}
