/* ═══════════════════════════════════════════════════════════════
   KLINAFY - SISTEMA DE AYUDA Y DOCUMENTACIÓN
   help-module.css
   
   Estilos para guías desplegables, Q&A y centro de ayuda
   Compatible con el sistema de diseño "Clinical Luxury" de Klinafy
   ═══════════════════════════════════════════════════════════════ */

/* ============================================
   VARIABLES LOCALES
   ============================================ */
:root {
  --help-primary: #1a6fc4;
  --help-primary-light: #e8f2fc;
  --help-primary-dark: #0e4d8a;
  --help-accent: #0ea5e9;
  --help-success: #10b981;
  --help-warning: #f59e0b;
  --help-danger: #ef4444;
  --help-text: #1e293b;
  --help-text-secondary: #64748b;
  --help-border: #e2e8f0;
  --help-bg: #f8fafc;
  --help-card-bg: #ffffff;
  --help-radius: 12px;
  --help-shadow: 0 4px 24px rgba(0,0,0,0.08);
  --help-shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --help-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   BOTÓN FLOTANTE DE AYUDA
   ============================================ */
.help-fab {
  position: fixed;
  bottom: 150px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--help-primary) 0%, var(--help-accent) 100%);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(26, 111, 196, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  z-index: 9998;
  transition: var(--help-transition);
}

.help-fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 24px rgba(26, 111, 196, 0.45);
}

.help-fab:active {
  transform: scale(0.95);
}

.help-fab .help-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: var(--help-warning);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* ============================================
   MODAL PRINCIPAL DE AYUDA
   ============================================ */
.help-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: helpFadeIn 0.2s ease;
}

.help-modal-overlay.active {
  display: flex;
}

@keyframes helpFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes helpSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.help-modal {
  background: var(--help-bg);
  border-radius: 16px;
  width: 100%;
  max-width: 780px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--help-shadow-lg);
  overflow: hidden;
  animation: helpSlideUp 0.3s ease;
}

/* ============================================
   HEADER DEL MODAL
   ============================================ */
.help-modal-header {
  background: linear-gradient(135deg, var(--help-primary) 0%, var(--help-primary-dark) 100%);
  color: white;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.help-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-modal-header h2 span {
  font-size: 24px;
}

.help-close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--help-transition);
}

.help-close-btn:hover {
  background: rgba(255,255,255,0.3);
}

/* ============================================
   NAVEGACIÓN POR TABS
   ============================================ */
.help-tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid var(--help-border);
  padding: 0 12px;
  gap: 4px;
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.help-tab {
  padding: 12px 16px;
  border: none;
  background: none;
  color: var(--help-text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: var(--help-transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-tab:hover {
  color: var(--help-primary);
  background: var(--help-primary-light);
}

.help-tab.active {
  color: var(--help-primary);
  border-bottom-color: var(--help-primary);
}

.help-tab .tab-icon {
  font-size: 16px;
}

/* ============================================
   BUSCADOR
   ============================================ */
.help-search-container {
  padding: 16px 24px 8px;
  flex-shrink: 0;
}

.help-search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 2px solid var(--help-border);
  border-radius: 10px;
  font-size: 14px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 14px center;
  outline: none;
  transition: var(--help-transition);
  box-sizing: border-box;
}

.help-search-input:focus {
  border-color: var(--help-primary);
  box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.1);
}

/* ============================================
   ÁREA DE CONTENIDO SCROLLABLE
   ============================================ */
.help-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
  scroll-behavior: smooth;
}

.help-content::-webkit-scrollbar {
  width: 6px;
}
.help-content::-webkit-scrollbar-track {
  background: transparent;
}
.help-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* ============================================
   SECCIÓN DE CONTENIDO
   ============================================ */
.help-section {
  display: none;
}

.help-section.active {
  display: block;
}

.help-section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--help-text);
  margin: 0 0 16px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--help-primary-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-section-title .section-icon {
  font-size: 20px;
}

/* ============================================
   ACORDEÓN / DESPLEGABLE
   ============================================ */
.help-accordion {
  margin-bottom: 10px;
  border-radius: var(--help-radius);
  overflow: hidden;
  border: 1px solid var(--help-border);
  background: var(--help-card-bg);
  transition: var(--help-transition);
}

.help-accordion:hover {
  border-color: #c7d8ea;
}

.help-accordion.open {
  border-color: var(--help-primary);
  box-shadow: 0 2px 12px rgba(26, 111, 196, 0.08);
}

.help-accordion-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  transition: var(--help-transition);
}

.help-accordion-header:hover {
  background: var(--help-primary-light);
}

.help-accordion .acc-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.help-accordion .acc-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--help-text);
  flex: 1;
}

.help-accordion .acc-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.acc-badge.free { background: #e2e8f0; color: #475569; }
.acc-badge.plus { background: #fff7ed; color: #c2410c; border: 1px solid #fb923c; }
.acc-badge.pro { background: #faf5ff; color: #7c3aed; border: 1px solid #a855f7; }

.help-accordion .acc-chevron {
  width: 20px;
  height: 20px;
  transition: transform 0.25s ease;
  color: var(--help-text-secondary);
  flex-shrink: 0;
}

.help-accordion.open .acc-chevron {
  transform: rotate(180deg);
}

.help-accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.25s ease;
}

.help-accordion.open .help-accordion-body {
  max-height: 2000px;
  padding: 0 18px 18px;
}

/* Contenido dentro del acordeón */
.help-accordion-body p {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--help-text-secondary);
  margin: 0 0 10px 0;
}

.help-accordion-body p:last-child {
  margin-bottom: 0;
}

.help-accordion-body strong {
  color: var(--help-text);
}

/* ============================================
   PASOS NUMERADOS
   ============================================ */
.help-steps {
  counter-reset: step-counter;
  padding: 0;
  margin: 12px 0 0 0;
  list-style: none;
}

.help-steps li {
  counter-increment: step-counter;
  position: relative;
  padding: 10px 0 10px 44px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--help-text-secondary);
  border-bottom: 1px dashed var(--help-border);
}

.help-steps li:last-child {
  border-bottom: none;
}

.help-steps li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 10px;
  width: 28px;
  height: 28px;
  background: var(--help-primary-light);
  color: var(--help-primary);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   TIPS / NOTAS
   ============================================ */
.help-tip {
  background: #fffbeb;
  border-left: 4px solid var(--help-warning);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.5;
  color: #92400e;
}

.help-tip::before {
  content: '💡 ';
}

.help-note {
  background: var(--help-primary-light);
  border-left: 4px solid var(--help-primary);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--help-primary-dark);
}

.help-note::before {
  content: 'ℹ️ ';
}

.help-warning {
  background: #fef2f2;
  border-left: 4px solid var(--help-danger);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.5;
  color: #991b1b;
}

.help-warning::before {
  content: '⚠️ ';
}

/* ============================================
   CATEGORÍAS Q&A
   ============================================ */
.help-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.help-category-card {
  background: white;
  border: 2px solid var(--help-border);
  border-radius: var(--help-radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--help-transition);
  text-align: center;
}

.help-category-card:hover {
  border-color: var(--help-primary);
  background: var(--help-primary-light);
  transform: translateY(-2px);
}

.help-category-card.selected {
  border-color: var(--help-primary);
  background: var(--help-primary-light);
}

.help-category-card .cat-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.help-category-card .cat-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--help-text);
}

.help-category-card .cat-count {
  font-size: 11px;
  color: var(--help-text-secondary);
  margin-top: 4px;
}

/* ============================================
   GUÍA RÁPIDA CONTEXTUAL (In-page)
   ============================================ */
.help-inline-guide {
  background: linear-gradient(135deg, var(--help-primary-light) 0%, #f0f7ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--help-radius);
  padding: 14px 18px;
  margin: 12px 0;
  cursor: pointer;
  transition: var(--help-transition);
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-inline-guide:hover {
  border-color: var(--help-primary);
}

.help-inline-guide .guide-icon {
  font-size: 18px;
}

.help-inline-guide .guide-text {
  font-size: 13px;
  color: var(--help-primary-dark);
  font-weight: 500;
}

/* ============================================
   NO RESULTADOS
   ============================================ */
.help-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--help-text-secondary);
}

.help-no-results .no-results-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.help-no-results p {
  font-size: 14px;
  margin: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .help-modal {
    max-height: 95vh;
    border-radius: 12px 12px 0 0;
    margin-top: auto;
  }
  
  .help-modal-header {
    padding: 16px 18px;
  }
  
  .help-modal-header h2 {
    font-size: 17px;
  }
  
  .help-tabs {
    padding: 0 8px;
  }
  
  .help-tab {
    padding: 10px 12px;
    font-size: 12px;
  }
  
  .help-content {
    padding: 12px 16px 20px;
  }
  
  .help-category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .help-fab {
    bottom: 150px;
    right: 16px;
    width: 46px;
    height: 46px;
    font-size: 20px;
  }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */
[data-theme="dark"] .help-modal,
.dark .help-modal {
  --help-bg: #1e293b;
  --help-card-bg: #334155;
  --help-text: #f1f5f9;
  --help-text-secondary: #94a3b8;
  --help-border: #475569;
  --help-primary-light: rgba(26, 111, 196, 0.15);
}

[data-theme="dark"] .help-search-input,
.dark .help-search-input {
  background-color: #334155;
  border-color: #475569;
  color: #f1f5f9;
}

[data-theme="dark"] .help-category-card,
.dark .help-category-card {
  background: #334155;
  border-color: #475569;
}

[data-theme="dark"] .help-accordion,
.dark .help-accordion {
  background: #334155;
  border-color: #475569;
}

[data-theme="dark"] .help-tip {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
}

[data-theme="dark"] .help-note {
  background: rgba(26, 111, 196, 0.1);
  color: #60a5fa;
}
