/* ayuda.css — Centro de ayuda de Ruta (doc 87 §4). Mismas clases help-* que genera
   intranet/help/render_ayuda.php, vestidas con los tokens --a3-* de Ruta (doc 42 §5).
   Mobile-first desde 320 px; sin dependencias de Bootstrap JS. */

.help-skip {
  position: absolute;
  left: -999px;
  top: var(--a3-space-2);
  z-index: 100;
  padding: var(--a3-space-2) var(--a3-space-3);
  background: var(--a3-surface);
  color: var(--a3-primary);
  border-radius: var(--a3-radius-sm);
  box-shadow: var(--a3-shadow-card);
}
.help-skip:focus { left: var(--a3-space-2); }

/* ---------- Cabecera de artículo ---------- */
.help-hero { margin: 0 0 var(--a3-space-4); }
.help-breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--a3-space-1);
  margin: 0 0 var(--a3-space-3);
  padding: 0;
  font-size: 0.85rem;
  color: var(--a3-text-muted);
}
.help-breadcrumb li + li::before { content: "›"; margin-right: var(--a3-space-1); }
.help-breadcrumb a { color: var(--a3-primary); text-decoration: none; }
.help-hero-main { display: flex; gap: var(--a3-space-3); align-items: flex-start; }
.help-hero-icon {
  flex: none;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--a3-radius-md);
  background: var(--a3-info-bg);
  color: var(--a3-primary);
  font-size: 1.5rem;
}
.help-kicker {
  margin: 0 0 var(--a3-space-1);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--a3-text-muted);
}
.help-h1 { font-size: 1.4rem; line-height: 1.25; margin: 0 0 var(--a3-space-1); }
.help-subtitle { margin: 0 0 var(--a3-space-2); color: var(--a3-text-muted); }
.help-lead { margin: 0; font-size: 1.02rem; }
.help-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--a3-space-2);
  align-items: center;
  margin-top: var(--a3-space-3);
}
.help-btn,
.help-btn:link,
.help-btn:visited {
  display: inline-flex;
  align-items: center;
  gap: var(--a3-space-1);
  min-height: 40px;
  padding: 0 var(--a3-space-3);
  border: 1px solid var(--a3-border);
  border-radius: 999px;
  background: var(--a3-surface);
  color: var(--a3-text);
  font: inherit;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
}
.help-btn-primary,
.help-btn-primary:link,
.help-btn-primary:visited {
  background: var(--a3-primary);
  border-color: var(--a3-primary);
  color: #fff;
}
.help-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--a3-space-1);
  font-size: 0.78rem;
  padding: 2px var(--a3-space-2);
  border-radius: 999px;
  background: var(--a3-surface-muted);
  color: var(--a3-text-muted);
}
.help-badge-success { background: var(--a3-success-bg); color: var(--a3-success); }
.help-badge-info { background: var(--a3-info-bg); color: var(--a3-primary); }
.help-badge-warning { background: var(--a3-warning-bg); color: var(--a3-warning); }

/* ---------- Índice plegable ---------- */
.help-toc {
  margin: 0 0 var(--a3-space-4);
  border: 1px solid var(--a3-border);
  border-radius: var(--a3-radius-md);
  background: var(--a3-surface);
}
.help-toc summary {
  min-height: var(--a3-tap-min);
  display: flex;
  align-items: center;
  gap: var(--a3-space-2);
  padding: 0 var(--a3-space-3);
  font-weight: 600;
  cursor: pointer;
}
.help-toc ul { margin: 0; padding: 0 var(--a3-space-3) var(--a3-space-2) var(--a3-space-3); list-style: none; }
.help-toc li a {
  display: block;
  padding: var(--a3-space-2) 0;
  border-top: 1px solid var(--a3-border);
  color: var(--a3-primary);
  text-decoration: none;
}

/* ---------- Cuerpo ---------- */
.help-article { scroll-margin-top: var(--a3-space-3); }
.help-article a { color: var(--a3-primary); }
.help-section { margin: 0 0 var(--a3-space-5); scroll-margin-top: var(--a3-space-3); }
.help-h2 { font-size: 1.15rem; margin: 0 0 var(--a3-space-2); scroll-margin-top: var(--a3-space-3); }
.help-h3 { font-size: 1rem; margin: 0 0 var(--a3-space-1); }
.help-intro-body { font-size: 1.02rem; }
.help-article p { margin: 0 0 var(--a3-space-3); }
.help-article ul, .help-article ol { padding-left: 1.3rem; margin: 0 0 var(--a3-space-3); }
.help-article li { margin-bottom: var(--a3-space-1); }
.help-article code {
  font-size: 0.9em;
  background: var(--a3-surface-muted);
  padding: 0 4px;
  border-radius: 4px;
}
.help-anchor { display: block; position: relative; top: calc(var(--a3-space-3) * -1); }

/* Figuras: capturas de móvil, centradas y acotadas para no ocupar toda la pantalla */
.help-figure { margin: 0 0 var(--a3-space-4); text-align: center; }
.help-figure-btn {
  display: inline-block;
  padding: 0;
  border: 1px solid var(--a3-border);
  border-radius: var(--a3-radius-md);
  background: var(--a3-surface);
  box-shadow: var(--a3-shadow-card);
  overflow: hidden;
  cursor: zoom-in;
  max-width: 100%;
}
.help-figure img { display: block; max-width: 100%; height: auto; }
.help-figure-lg img { max-height: 70vh; width: auto; }
.help-figure-sm img { max-height: 46vh; width: auto; }
.help-figcaption { margin-top: var(--a3-space-2); font-size: 0.9rem; color: var(--a3-text-muted); text-align: left; }

/* Avisos (mismos cuatro niveles que la intranet) */
.help-callout {
  border-left: 4px solid var(--a3-primary);
  background: var(--a3-info-bg);
  border-radius: var(--a3-radius-sm);
  padding: var(--a3-space-3);
  margin: 0 0 var(--a3-space-3);
}
.help-callout-title { font-weight: 700; margin-bottom: var(--a3-space-1); }
.help-callout-body > :last-child { margin-bottom: 0; }
.help-callout-warning { border-color: var(--a3-warning); background: var(--a3-warning-bg); }
.help-callout-danger { border-color: var(--a3-danger); background: var(--a3-danger-bg); }
.help-callout-success { border-color: var(--a3-success); background: var(--a3-success-bg); }

/* Ejemplo */
.help-example {
  border: 1px dashed var(--a3-border);
  border-radius: var(--a3-radius-md);
  padding: var(--a3-space-3);
  background: var(--a3-surface);
}
.help-example-label { font-weight: 700; color: var(--a3-warning); margin-bottom: var(--a3-space-2); }
.help-example > :last-child { margin-bottom: 0; }

/* Acciones */
.help-actions { display: grid; gap: var(--a3-space-2); }
.help-action {
  display: flex;
  gap: var(--a3-space-3);
  padding: var(--a3-space-3);
  background: var(--a3-surface);
  border: 1px solid var(--a3-border);
  border-radius: var(--a3-radius-md);
}
.help-action-icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--a3-radius-sm);
  background: var(--a3-surface-muted);
  color: var(--a3-primary);
  font-size: 1.2rem;
}
.help-action-body > :last-child { margin-bottom: 0; }

/* Pasos */
.help-steps { list-style: none; padding: 0; margin: 0; counter-reset: paso; }
.help-step { display: flex; gap: var(--a3-space-3); margin: 0 0 var(--a3-space-4); }
.help-step-num {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--a3-primary);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.help-step-body { min-width: 0; flex: 1; }
.help-step-body > :last-child { margin-bottom: 0; }
.help-step-screen {
  font-size: 0.88rem;
  color: var(--a3-text-muted);
  margin-bottom: var(--a3-space-2);
}
.help-step-screen-locked { color: var(--a3-warning); }

/* Tabla de campos */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.help-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; background: var(--a3-surface); }
.help-table th, .help-table td { padding: var(--a3-space-2); border-bottom: 1px solid var(--a3-border); text-align: left; vertical-align: top; }
.help-table thead th { background: var(--a3-surface-muted); }
.help-table tbody th { white-space: nowrap; }

/* FAQ nativa */
.help-faq-details {
  border: 1px solid var(--a3-border);
  border-radius: var(--a3-radius-sm);
  background: var(--a3-surface);
  margin: 0 0 var(--a3-space-2);
}
.help-faq-details summary {
  min-height: var(--a3-tap-min);
  display: flex;
  align-items: center;
  padding: var(--a3-space-2) var(--a3-space-3);
  font-weight: 600;
  cursor: pointer;
}
.help-faq-body { padding: 0 var(--a3-space-3) var(--a3-space-2); }
.help-faq-body > :last-child { margin-bottom: 0; }

/* Lista de requisitos */
.help-checklist { list-style: none; padding: 0; margin: 0; }
.help-checklist li { display: flex; gap: var(--a3-space-2); margin-bottom: var(--a3-space-2); }
.help-checklist i { color: var(--a3-success); flex: none; margin-top: 2px; }

/* Tarjetas (relacionados y portada) */
.help-cards { display: grid; gap: var(--a3-space-2); }
.help-card,
.help-card:link,
.help-card:visited {
  display: flex;
  gap: var(--a3-space-3);
  align-items: flex-start;
  padding: var(--a3-space-3);
  background: var(--a3-surface);
  border: 1px solid var(--a3-border);
  border-radius: var(--a3-radius-md);
  box-shadow: var(--a3-shadow-card);
  color: var(--a3-text);
  text-decoration: none;
  min-height: var(--a3-row-height);
}
.help-card-icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--a3-radius-sm);
  background: var(--a3-info-bg);
  color: var(--a3-primary);
  font-size: 1.2rem;
}
.help-card-body { display: flex; flex-direction: column; min-width: 0; }
.help-card-kicker { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--a3-text-muted); }
.help-card-title { font-weight: 600; }
.help-card-text { font-size: 0.9rem; color: var(--a3-text-muted); }

/* ---------- Portada ---------- */
.help-hero-home { margin-bottom: var(--a3-space-5); }
.help-search {
  position: relative;
  margin-top: var(--a3-space-3);
}
.help-search > i { position: absolute; left: var(--a3-space-3); top: 50%; transform: translateY(-50%); color: var(--a3-text-muted); }
.help-search-input {
  width: 100%;
  min-height: var(--a3-control-height);
  font-size: 16px;
  padding: 0 var(--a3-space-3) 0 2.4rem;
  border: 1px solid var(--a3-border);
  border-radius: var(--a3-radius-md);
  background: var(--a3-surface);
}
.help-search-count { display: block; margin-top: var(--a3-space-1); font-size: 0.85rem; color: var(--a3-text-muted); }
.help-home-section { margin-bottom: var(--a3-space-6); }
.help-muted { color: var(--a3-text-muted); }
.help-area { margin-bottom: var(--a3-space-3); }
.help-area-title { margin-bottom: var(--a3-space-2); }
.help-home-pie { font-size: 0.85rem; text-align: center; }

/* ---------- Imagen ampliada ---------- */
.help-zoom {
  border: 0;
  padding: 0;
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  background: #0f171e;
  color: #fff;
}
.help-zoom::backdrop { background: rgba(0, 0, 0, 0.7); }
.help-zoom-barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--a3-space-2) var(--a3-space-3);
  min-height: var(--a3-tap-min);
}
.help-zoom-cerrar {
  width: var(--a3-tap-min);
  height: var(--a3-tap-min);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 1.3rem;
}
.help-zoom img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - var(--a3-tap-min) - var(--a3-space-3));
  margin: 0 auto;
  object-fit: contain;
}

/* ---------- Pantallas anchas (tablet, escritorio) ---------- */
@media (min-width: 720px) {
  .help-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help-figure-lg img, .help-figure-sm img { max-height: 60vh; }
}

/* ---------- Impresión / guardar como PDF ---------- */
@media print {
  .cabecera-a3, .nav-inferior, .help-skip, .help-hero-actions, .help-toc, .help-zoom,
  .aviso-conexion, #ruta-aviso-actualizacion { display: none !important; }
  body { padding: 0; background: #fff; }
  .help-figure-btn { border: 0; box-shadow: none; }
  .help-card, .help-action, .help-callout, .help-example { break-inside: avoid; }
  .help-faq-details { break-inside: avoid; }
  .help-faq-details[open] summary { font-weight: 700; }
}
