/* Help Center v2.0 · estilos modal + FAB + acordeón + multimedia + feedback */

/* ──────────────── FAB (deshabilitado por default) ──────────────── */
#help-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d3b66, #1e6091);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(13, 59, 102, .45);
  z-index: 1040;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
#help-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(13, 59, 102, .6);
}
#help-fab i { font-size: 22px; }
.hide-in-apk #help-fab { display: none; }

/* ──────────────── Modal base ──────────────── */
#help-modal .modal-dialog { max-width: 980px; transition: max-width .25s ease, height .25s ease; }
#help-modal .modal-content { border-radius: 14px; overflow: hidden; }
#help-modal .modal-header {
  background: linear-gradient(135deg, #0d3b66, #1e6091);
  color: #fff;
  border: 0;
  align-items: center;
}
#help-modal .modal-header .hc-header-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: auto;
}
#help-modal .modal-header .hc-header-actions button { padding: 2px 8px; }
#help-modal .modal-header .hc-header-actions .close { padding: 0 .75rem; line-height: 1; }
#help-modal .modal-body { padding: 0; }

/* ──────────────── Layout 2 col ──────────────── */
#help-layout { display: flex; min-height: 480px; max-height: 70vh; transition: max-height .25s ease; }
#help-sidebar {
  width: 300px;
  border-right: 1px solid #eee;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
}
#help-search-wrap { padding: 12px; border-bottom: 1px solid #eee; }
#help-search { width: 100%; }
#help-list { overflow-y: auto; flex: 1; }

/* ──────────────── Acordeón categorías ──────────────── */
.hc-cat { border-bottom: 1px solid #efefef; }
.hc-cat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #eef1f6;
  font-size: 12px;
  font-weight: 600;
  color: #495057;
  cursor: pointer;
  user-select: none;
}
.hc-cat-header:hover { background: #e3e8f1; }
.hc-cat-icon { color: #0d3b66; }
.hc-cat-label { flex: 1; }
.hc-cat-count { font-weight: 600; font-size: 10px; }
.hc-cat-chevron { transition: transform .15s ease; font-size: 10px; color: #6c757d; }
.hc-cat-collapsed .hc-cat-chevron { transform: rotate(-90deg); }
.hc-cat-collapsed .hc-cat-items { display: none; }

/* ──────────────── Items lista ──────────────── */
#help-list .help-item {
  padding: 10px 14px 10px 26px;
  border-bottom: 1px solid #f3f3f3;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff;
}
#help-list .help-item:hover { background: #f0f3fa; }
#help-list .help-item.active { background: #0d3b66; color: #fff; }
#help-list .help-item.active small { color: rgba(255, 255, 255, .85); }
#help-list .help-item i { width: 20px; text-align: center; padding-top: 3px; }
#help-list .help-item strong { display: block; font-size: 13px; }
#help-list .help-item small { color: #6c757d; font-size: 11px; line-height: 1.3; display: block; }
#help-list .help-item-search { padding-left: 14px; background: #fffbe6; }
#help-list .help-item-search:hover { background: #fff3c0; }

/* Highlight de matches en búsqueda */
#help-list mark, #help-content mark {
  background: #fff3a3; color: #533f00; padding: 0 2px; border-radius: 2px;
}

.hc-snippet { font-style: normal; }

/* "Sugerir tema" link */
.hc-suggest-link { color: #0d3b66; text-decoration: underline; }
.hc-suggest-link:hover { color: #4a5dc9; }

/* ──────────────── Contenido doc ──────────────── */
#help-content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 28px;
  font-size: 14px;
  line-height: 1.6;
  background: #fff;
  color: #2d3436;
}
#help-content h1 { color: #0d3b66; font-weight: 700; }
#help-content h2 { margin-top: 22px; color: #1e6091; }
#help-content h3 { margin-top: 18px; color: #495057; }
#help-content table { width: 100%; margin: 14px 0; border-collapse: collapse; }
#help-content table th,
#help-content table td { border: 1px solid #ddd; padding: 6px 10px; }
#help-content table th { background: #f1f3f7; }
#help-content code { background: #f1f3f7; padding: 1px 5px; border-radius: 4px; font-size: 90%; }
#help-content pre { background: #2d2d2d; color: #f4f4f4; padding: 12px; border-radius: 6px; overflow-x: auto; }
#help-content blockquote { border-left: 4px solid #0d3b66; padding: 8px 14px; margin: 12px 0; background: #f8f9ff; color: #495057; }

/* ──────────────── Multimedia ──────────────── */
.hc-video {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin: 14px 0;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.hc-video iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}
.hc-video-hero { margin-top: 0; margin-bottom: 22px; }

img.hc-img {
  max-width: 100%;
  height: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin: 10px 0;
  display: block;
  cursor: zoom-in;
}
.hc-img-zoom { display: inline-block; max-width: 100%; }

/* Lightbox overlay */
.hc-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  z-index: 1060;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.hc-lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
}
.hc-lightbox-close {
  position: absolute;
  top: 18px; right: 22px;
  background: none;
  border: 0;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
}

/* ──────────────── Feedback widget ──────────────── */
.hc-feedback { margin-top: 32px; padding: 14px 0; font-size: 13px; }
.hc-feedback hr { margin: 0 0 12px 0; border-color: #e9ecef; }
.hc-feedback-q { font-weight: 600; color: #495057; margin-bottom: 8px; }
.hc-feedback-buttons { display: flex; gap: 8px; }
.hc-feedback-thanks { color: #198754; font-weight: 600; }

/* ──────────────── Modal modes: full-screen + pip-dock ──────────────── */
#help-modal.hc-fullscreen .modal-dialog { max-width: 98vw; margin: 1vh auto; }
#help-modal.hc-fullscreen #help-layout { max-height: 92vh; min-height: 92vh; }

#help-modal.hc-minimized {
  pointer-events: none;
}
#help-modal.hc-minimized .modal-dialog {
  max-width: 380px;
  margin: 0;
  position: fixed;
  right: 20px;
  bottom: 20px;
  pointer-events: auto;
}
#help-modal.hc-minimized #help-layout {
  display: none;
}
#help-modal.hc-minimized .modal-content {
  height: auto;
}
#help-modal.hc-minimized .modal-header { border-radius: 12px; }
#help-modal.hc-minimized .modal-backdrop.show { opacity: 0 !important; }

/* ──────────────── Botón "?" deep-link en headers de módulos ──────────────── */
a.help-link {
  display: inline-block;
  margin-left: 8px;
  font-size: 16px;
  vertical-align: middle;
  text-decoration: none;
  opacity: .85;
  transition: opacity .15s ease, transform .15s ease;
}
a.help-link:hover {
  opacity: 1;
  transform: scale(1.12);
  text-decoration: none;
}

/* ──────────────── Responsive mobile ──────────────── */
@media (max-width: 768px) {
  #help-layout { flex-direction: column; max-height: 80vh; }
  #help-sidebar { width: 100%; border-right: 0; border-bottom: 1px solid #eee; }
  #help-list { max-height: 240px; }
  #help-modal.hc-fullscreen .modal-dialog,
  #help-modal.hc-minimized .modal-dialog { max-width: 98vw; }
  #help-modal.hc-minimized .modal-dialog { right: 1vw; bottom: 1vw; }
}

/* ──────────────── Print ──────────────── */
/* Esta regla aísla el modal de ayuda al imprimir (oculta todo lo demás).
   DEBE limitarse al caso en que el modal está realmente abierto: el archivo
   se carga globalmente, así que un `body *` sin gate blanqueaba TODA impresión
   del ERP (etiquetas, facturas, etc.). El `:has(#help-modal.show)` activa el
   hack solo con el modal abierto; si el navegador no soporta :has(), la regla
   se descarta y el resto de las impresiones funcionan normal. */
@media print {
  body:has(#help-modal.show) * { visibility: hidden; }
  body:has(#help-modal.show) #help-modal,
  body:has(#help-modal.show) #help-modal * { visibility: visible; }
  body:has(#help-modal.show) #help-modal { position: absolute; left: 0; top: 0; }
  body:has(#help-modal.show) #help-modal .modal-dialog { max-width: 100% !important; margin: 0; }
  body:has(#help-modal.show) #help-modal .modal-header .hc-header-actions,
  body:has(#help-modal.show) #help-sidebar,
  body:has(#help-modal.show) .hc-feedback,
  body:has(#help-modal.show) .hc-video { display: none !important; }
  body:has(#help-modal.show) #help-content { padding: 12px; max-height: none !important; overflow: visible !important; }
}
