/* ============================================================
   Sistema MFA — style.css (corregido y mejorado)
   Tipografía: IBM Plex Sans + IBM Plex Mono (técnico/formal)
   Paleta:     azul marino institucional + acento cian
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:      #0d1b2a;
  --navy-mid:  #1b2d42;
  --cyan:      #00c2cb;
  --cyan-dim:  #007f85;
  --white:     #f4f7fa;
  --gray-light:#e2e8f0;
  --gray-mid:  #94a3b8;
  --error:     #e74c3c;
  --success:   #27ae60;
  --info:      #2980b9;
  --font-sans: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --radius:    6px;
  --shadow:    0 8px 32px rgba(0,0,0,0.18);
}

body {
  font-family: var(--font-sans);
  background: var(--navy);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(0,194,203,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(0,194,203,0.05) 0%, transparent 50%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ─── Shell: sidebar + panel ──────────────────────────────── */
.shell {
  display: flex;
  width: 100%;
  max-width: 860px;
  min-height: 520px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ─── Barra lateral ──────────────────────────────────────── */
.steps-sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--navy-mid);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 36px;
}
.brand-icon { font-size: 22px; color: var(--cyan); }
.brand-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.04em;
}

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

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: default;
  transition: background 0.2s;
}
.step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray-mid);
  min-width: 20px;
  transition: color 0.2s;
}
.step-label {
  font-size: 13px;
  color: var(--gray-mid);
  transition: color 0.2s;
}

.step-item.active {
  background: rgba(0,194,203,0.12);
}
.step-item.active .step-num,
.step-item.active .step-label { color: var(--cyan); }

.step-item.completed .step-num,
.step-item.completed .step-label { color: var(--white); opacity: 0.6; }

.sidebar-footer {
  margin-top: auto;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--gray-mid);
  line-height: 1.8;
}

/* ─── Panel principal ─────────────────────────────────────── */
.main-panel {
  flex: 1;
  background: var(--white);
  padding: 40px 36px;
  overflow-y: auto;
}

.panel-section { animation: fadeIn 0.3s ease; }

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

.section-header { margin-bottom: 28px; }
.section-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--cyan-dim);
  background: rgba(0,194,203,0.1);
  padding: 3px 8px;
  border-radius: 3px;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.success-tag { color: var(--success); background: rgba(39,174,96,0.1); }

.section-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.section-header p {
  font-size: 13px;
  color: var(--gray-mid);
  line-height: 1.6;
}

/* ─── Formularios ─────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
input[type="text"],
input[type="password"],
input[type="tel"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--navy);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,194,203,0.15);
}

/* ─── Campo de teléfono con prefijo de país ───────────────── */
.phone-input {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
.phone-input:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,194,203,0.15);
}
.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--gray-soft, #f3f5f8);
  border-right: 1px solid var(--gray-light);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  user-select: none;
}
.phone-input input[type="tel"] {
  flex: 1;
  border: none;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.08em;
  background: transparent;
  outline: none;
  box-shadow: none;
}
.phone-input input[type="tel"]:focus { box-shadow: none; }

/* ─── Botón principal ─────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 12px 20px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.1s;
  margin-top: 8px;
}
.btn-primary:hover  { background: var(--navy-mid); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Mensajes de estado ──────────────────────────────────── */
.msg {
  font-size: 13px;
  min-height: 20px;
  margin: 8px 0;
  padding: 0 2px;
  border-radius: 3px;
  transition: all 0.2s;
}
.msg.error   { color: var(--error); }
.msg.success { color: var(--success); }
.msg.info    { color: var(--info); }

/* ─── OTP Display ─────────────────────────────────────────── */
.otp-display-box {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.otp-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--gray-mid);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.otp-code {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 0.18em;
}
.otp-hint {
  font-size: 10px;
  color: var(--gray-mid);
  text-align: center;
  font-style: italic;
  margin-top: 2px;
}

/* ─── Barra de progreso del timer ────────────────────────── */
.timer-bar-wrap {
  height: 4px;
  background: var(--gray-light);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.timer-bar {
  height: 100%;
  width: 100%;
  background: var(--cyan);
  border-radius: 2px;
  transform-origin: left;
}
.timer-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray-mid);
  margin-bottom: 14px;
}

/* ─── Panel biométrico ───────────────────────────────────── */
.bio-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
  background: #000;
  aspect-ratio: 4 / 3;
  box-shadow: 0 4px 16px rgba(13, 27, 42, 0.15), inset 0 0 0 1px rgba(0,194,203,0.2);
}
.bio-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scaleX(-1); /* efecto espejo, natural para el usuario */
}

/* Overlay con marco tipo escáner */
.bio-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.bio-frame {
  position: relative;
  width: 62%;
  aspect-ratio: 3 / 4;
  max-width: 240px;
}
.bio-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--cyan);
  filter: drop-shadow(0 0 6px rgba(0,194,203,0.6));
}
.bio-corner.tl { top: 0;    left: 0;    border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.bio-corner.tr { top: 0;    right: 0;   border-left: none;  border-bottom: none; border-radius: 0 4px 0 0; }
.bio-corner.bl { bottom: 0; left: 0;    border-right: none; border-top: none;    border-radius: 0 0 0 4px; }
.bio-corner.br { bottom: 0; right: 0;   border-left: none;  border-top: none;    border-radius: 0 0 4px 0; }

/* Línea de barrido animada */
.bio-scanline {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 12px var(--cyan);
  animation: scan 2.6s ease-in-out infinite;
}
@keyframes scan {
  0%, 100% { top: 6%;  opacity: 0.9; }
  50%      { top: 94%; opacity: 0.9; }
}

/* Barra superior de estado */
.bio-statusbar {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(13, 27, 42, 0.78);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fff;
  text-transform: uppercase;
}
.bio-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #f0a500;
  box-shadow: 0 0 8px currentColor;
  animation: blink 1.4s ease-in-out infinite;
}
.bio-dot.ready  { background: var(--cyan); color: var(--cyan); animation: none; }
.bio-dot.ok     { background: var(--success); color: var(--success); animation: none; }
.bio-dot.error  { background: #e74c3c; color: #e74c3c; animation: none; }
@keyframes blink { 50% { opacity: 0.35; } }

/* Tarjetas con indicadores técnicos */
.bio-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.bio-metric {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bio-metric-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
}
.bio-metric-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
}
.bio-metric-value.ok    { color: var(--success); }
.bio-metric-value.error { color: #e74c3c; }
.bio-metric-value.pending { color: rgba(255,255,255,0.5); }

/* ─── Panel de éxito ─────────────────────────────────────── */
.access-log {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.log-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.log-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  flex-shrink: 0;
}
.log-event { color: var(--white); flex: 1; }
.log-date  { color: var(--gray-mid); font-size: 10px; }

.divider {
  border: none;
  border-top: 1px solid var(--gray-light);
  margin: 24px 0;
}

/* ─── Cuestionario ───────────────────────────────────────── */
.survey-wrap { }

.survey-header { margin-bottom: 22px; }
.survey-header h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.survey-header p {
  font-size: 13px;
  color: var(--gray-mid);
  margin-bottom: 10px;
}
.scale-legend {
  display: flex;
  gap: 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--cyan-dim);
}

.survey-section { margin-bottom: 24px; }
.survey-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-mid);
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-light);
}

.survey-item { margin-bottom: 16px; }
.question-text {
  font-size: 13px;
  color: var(--navy);
  line-height: 1.5;
  margin-bottom: 8px;
}
.q-num {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--cyan-dim);
  margin-right: 4px;
}

/* Escala Likert */
.likert-scale {
  display: flex;
  gap: 8px;
}
.likert-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.likert-option input[type="radio"] { display: none; }
.likert-val {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--gray-light);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-mid);
  transition: all 0.15s;
}
.likert-option:hover .likert-val {
  border-color: var(--cyan);
  color: var(--cyan);
}
.likert-option input:checked + .likert-val {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--cyan);
}

/* Tabla de resultados */
.survey-result {
  margin-top: 24px;
  padding: 20px;
  background: var(--navy);
  border-radius: var(--radius);
  color: var(--white);
}
.survey-result h4 {
  font-size: 15px;
  color: var(--cyan);
  margin-bottom: 8px;
}
.survey-result p {
  font-size: 13px;
  color: var(--gray-mid);
  margin-bottom: 14px;
}
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-family: var(--font-mono);
}
.result-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-mid);
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.result-table td {
  padding: 8px 8px;
  color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.result-table td:last-child { color: var(--cyan); text-align: right; }
.total-row td { color: var(--white) !important; }
.total-row td:last-child { color: var(--cyan) !important; font-size: 16px; }

.survey-note {
  font-size: 11px !important;
  font-style: italic;
  margin-top: 12px !important;
}

/* ─── Alternar Login / Registro ───────────────────────────── */
.auth-switch {
  font-size: 12px;
  color: var(--gray-mid);
  text-align: center;
  margin-top: 16px;
}
.auth-switch a {
  color: var(--cyan-dim);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.auth-switch a:hover { border-color: var(--cyan-dim); }

/* ─── Resumen de datos guardados ──────────────────────────── */
.data-saved {
  background: rgba(39,174,96,0.08);
  border: 1px solid rgba(39,174,96,0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.data-saved-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--success);
  margin-bottom: 8px;
}
.data-saved-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--navy);
  padding: 3px 0;
}
.data-saved-row span:last-child { color: var(--cyan-dim); font-weight: 600; }
.btn-secondary {
  margin-top: 12px;
  width: 100%;
  padding: 9px 16px;
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:hover { border-color: var(--cyan); color: var(--cyan-dim); }

/* ─── Input del OTP (centrado y espaciado) ────────────────── */
.otp-input {
  text-align: center;
  letter-spacing: 0.4em;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
}
#resendBtn { margin-top: 8px; }
#resendBtn:disabled { opacity: 0.5; cursor: not-allowed; border-color: var(--gray-light); color: var(--gray-mid); }

/* ─── Utilidad ────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Responsive ──────────────────────────────────────────── */

/* Tablet / pantallas medianas */
@media (max-width: 860px) {
  body { padding: 12px; }
  .shell { max-width: 100%; min-height: auto; border-radius: 10px; }
  .steps-sidebar { width: 180px; padding: 22px 16px; }
  .main-panel { padding: 28px 24px; }
  h2 { font-size: 18px; }
  .section-header h2 { font-size: 17px; }
}

/* Móvil — el sidebar se mueve arriba como barra horizontal */
@media (max-width: 640px) {
  body { padding: 0; align-items: stretch; }
  .shell {
    flex-direction: column;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }

  /* Sidebar → barra horizontal compacta */
  .steps-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 14px 16px;
    gap: 10px;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .brand { margin-bottom: 0; flex: 0 0 auto; }
  .brand-name { font-size: 12px; }

  .step-list {
    flex-direction: row;
    flex: 1;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: wrap;
  }
  .step-item { padding: 6px 8px; gap: 6px; }
  .step-label { display: none; }            /* solo número en móvil */
  .step-item.active .step-label { display: inline; font-size: 11px; }
  .sidebar-footer { display: none; }

  /* Panel principal */
  .main-panel { padding: 22px 18px; }
  .section-header h2 { font-size: 17px; line-height: 1.3; }
  .section-header p { font-size: 13px; }
  .section-tag { font-size: 10px; }

  /* Inputs y botones más cómodos al tacto */
  input[type="text"],
  input[type="password"],
  input[type="tel"] { font-size: 16px; padding: 12px 14px; }  /* 16px evita zoom en iOS */
  .phone-input input[type="tel"] { font-size: 16px; }
  .btn-primary, .btn-secondary { padding: 14px 18px; font-size: 14px; }

  /* OTP: cuadro más chico */
  .otp-display-box { padding: 14px; }
  .otp-code { font-size: 22px; letter-spacing: 0.3em; }
  .otp-input { font-size: 22px; }

  /* Biometría */
  .bio-wrap { aspect-ratio: 4 / 5; }       /* algo más alto para móvil vertical */
  .bio-frame { width: 70%; }
  .bio-metrics { grid-template-columns: 1fr 1fr; }
  .bio-metric { padding: 8px 10px; }
  .bio-metric-value { font-size: 11px; }
  .bio-statusbar { font-size: 10px; padding: 5px 10px; }

  /* Likert: escala vertical */
  .likert-scale { flex-wrap: wrap; gap: 6px; justify-content: space-between; }
  .likert-option { flex: 1 1 0; min-width: 44px; }
  .likert-val { padding: 10px 0; font-size: 14px; }

  /* Tablas de resultados */
  .result-table { font-size: 12px; }
  .result-table td, .result-table th { padding: 8px 10px; }

  /* Registro de acceso y datos guardados */
  .access-log { padding: 12px; gap: 4px; }
  .log-entry { flex-wrap: wrap; font-size: 11px; }
  .log-date { width: 100%; padding-left: 16px; opacity: 0.55; }
  .data-saved-row { font-size: 11px; flex-wrap: wrap; }

  /* Encuesta */
  .survey-section-title { font-size: 13px; }
  .question-text { font-size: 13px; }
}

/* Móvil pequeño */
@media (max-width: 380px) {
  .main-panel { padding: 18px 14px; }
  .likert-val { font-size: 13px; padding: 8px 0; }
  .otp-code { font-size: 18px; }
  .kpi-value { font-size: 18px; }
}
