/* Alena LMS — Centro de ayuda público (y, más adelante, asistente y soporte). Usa solo los tokens de color de style.css. */

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* <main> tiene un ancho máximo y relleno globales (para las pantallas del panel); aquí cada sección maneja su propio ancho. */
main.public-main { min-height: 60vh; max-width: none; margin: 0; padding: 0; }
.help-wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
.help-narrow { max-width: 720px; }

/* ---------- Inicio ---------- */
.help-hero { padding: 3.5rem 0 2.5rem; background: linear-gradient(180deg, var(--brand-tint) 0%, var(--bg) 100%); text-align: center; }
.help-hero h1 { font-size: clamp(1.85rem, 4.5vw, 2.7rem); line-height: 1.15; margin: 0.6rem 0 0.6rem; }
.help-hero .help-wrap > p { color: var(--text-secondary); font-size: 1.05rem; margin: 0 0 1.5rem; }
.help-search { position: relative; display: flex; gap: 0.5rem; max-width: 640px; margin: 0 auto; }
.help-search > svg { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-disabled); pointer-events: none; }
.help-search input { flex: 1; min-width: 0; padding: 0.85rem 1rem 0.85rem 2.75rem; border: 1.5px solid var(--border-strong); border-radius: 12px; font: inherit; font-size: 1rem; background: var(--surface); color: var(--text); }
.help-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.help-aside .help-search { max-width: none; margin-bottom: 1.5rem; }
.help-aside .help-search .btn { padding-inline: 0.85rem; }
.help-popular { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: 1.25rem 0 0; font-size: 0.875rem; color: var(--text-tertiary); }
.help-popular a { padding: 0.25rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); }
.help-popular a:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }

.help-body { padding: 2.5rem 0 4rem; }
.help-categories { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.help-category { padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); transition: border-color 160ms ease, box-shadow 160ms ease; }
.help-category:hover { border-color: var(--brand); box-shadow: 0 10px 26px rgba(15, 175, 154, 0.12); }
.help-category-head { display: flex; gap: 0.875rem; align-items: flex-start; color: var(--text); margin-bottom: 0.75rem; }
a.help-category-head:hover { color: var(--text); text-decoration: none; }
a.help-category-head:hover h2 { color: var(--brand-dark); }
.help-icon { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-dark); }
.help-icon svg { width: 22px; height: 22px; }
.help-category-head h2 { font-size: 1.1rem; margin: 0 0 0.125rem; text-align: left; max-width: none; }
.help-category-head small { color: var(--text-tertiary); font-size: 0.875rem; line-height: 1.4; display: block; }
.help-category ul { list-style: none; margin: 0; padding: 0; }
.help-category li { border-top: 1px solid var(--border); }
.help-category li a { display: block; padding: 0.55rem 0; color: var(--text); font-size: 0.93rem; }
.help-category li a:hover { color: var(--brand-dark); text-decoration: none; }
.help-more { display: inline-flex; gap: 0.35rem; align-items: center; margin-top: 0.5rem; font-size: 0.875rem; font-weight: 600; }
.help-more svg { width: 15px; height: 15px; }
.help-empty { color: var(--text-tertiary); }
.help-results h2 { font-size: 1.25rem; margin: 0 0 1rem; text-align: left; max-width: none; }

/* ---------- Listas, artículo ---------- */
.help-list { display: grid; gap: 0.75rem; }
.help-item { display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: 12px; color: var(--text-secondary); background: var(--surface); font-size: 0.93rem; }
.help-item strong { color: var(--text); font-size: 1rem; }
.help-item:hover { border-color: var(--brand); color: var(--text-secondary); text-decoration: none; }
.help-item:hover strong { color: var(--brand-dark); }
.help-item-cat { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--brand-dark); }

.help-page { padding: 2.5rem 0 4rem; }
.help-grid { display: grid; gap: 2.5rem; }
@media (min-width: 992px) {
    .help-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 3.5rem; }
    .help-aside { position: sticky; top: 96px; align-self: start; }
}
.help-page h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.2; margin: 0.25rem 0 0.6rem; }
.help-crumbs { font-size: 0.85rem; color: var(--text-tertiary); }
.help-intro { font-size: 1.1rem; color: var(--text-secondary); margin: 0 0 0.5rem; }
.help-updated { font-size: 0.8rem; color: var(--text-tertiary); margin: 0; }
.help-article { min-width: 0; }
.help-content { margin-top: 1.5rem; max-width: 720px; font-size: 1.0625rem; line-height: 1.7; overflow-wrap: anywhere; color: var(--text); }
.help-content h2 { font-size: 1.4rem; margin: 2.2rem 0 0.7rem; text-align: left; max-width: none; line-height: 1.3; }
.help-content h3 { font-size: 1.15rem; margin: 1.6rem 0 0.5rem; }
.help-content p { margin: 0 0 1rem; }
.help-content ul, .help-content ol { padding-left: 1.5rem; margin: 0 0 1.1rem; }
.help-content li { margin-bottom: 0.45rem; }
.help-content ol { list-style: none; counter-reset: step; padding-left: 0; }
.help-content ol > li { counter-increment: step; position: relative; padding-left: 2.6rem; margin-bottom: 0.9rem; }
.help-content ol > li::before { content: counter(step); position: absolute; left: 0; top: 0.1rem; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--brand-tint); color: var(--brand-dark); font-weight: 700; font-size: 0.9rem; display: grid; place-items: center; }
.help-content img { display: block; max-width: 100%; height: auto; margin: 1.25rem 0; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); }
.help-content code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.875em; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; padding: 0.1rem 0.375rem; }
.help-content pre { background: #0f172a; color: #e8ecf1; border-radius: 10px; padding: 1rem; overflow-x: auto; }
.help-content pre code { background: none; border: 0; color: inherit; padding: 0; }
.help-content blockquote { margin: 1.25rem 0; padding: 0.875rem 1.125rem; border-left: 4px solid var(--brand); background: var(--brand-tint); border-radius: 0 10px 10px 0; }
.help-content table { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: 0.95rem; }
.help-content th, .help-content td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left; }
.help-content th { background: var(--bg-secondary); }

.help-feedback { margin: 2.5rem 0 0; padding: 1.25rem 1.5rem; background: var(--bg-secondary); border-radius: var(--radius-lg); max-width: 720px; }
.help-feedback form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.help-feedback span { font-weight: 600; margin-right: 0.5rem; }
.help-feedback p { margin: 0; }
.help-feedback svg { width: 16px; height: 16px; color: var(--brand-dark); vertical-align: -3px; }
.help-related { margin-top: 2.5rem; max-width: 720px; }
.help-related h2 { font-size: 1.1rem; text-align: left; margin: 0 0 0.6rem; max-width: none; }
.help-related ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.help-related a { font-weight: 500; display: inline-flex; gap: 0.4rem; align-items: center; }
.help-related svg { width: 15px; height: 15px; }

.help-side-nav h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); margin: 0 0 0.5rem; text-align: left; max-width: none; }
.help-side-nav ul { list-style: none; padding: 0; margin: 0; }
.help-side-nav a { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.75rem; border-radius: 10px; color: var(--text); font-size: 0.93rem; }
.help-side-nav a svg { width: 17px; height: 17px; color: var(--text-disabled); flex-shrink: 0; }
.help-side-nav a span { margin-left: auto; font-size: 0.75rem; color: var(--text-tertiary); }
.help-side-nav a:hover, .help-side-nav a.active { background: var(--bg-secondary); text-decoration: none; }
.help-side-nav a.active { font-weight: 600; }
.help-side-nav a.active svg { color: var(--brand-dark); }

/* ---------- Contacto ---------- */
.help-contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem; margin-top: 3rem; padding: 1.75rem 2rem; border-radius: var(--radius-lg); background: #0b1f24; color: #fff; }
.help-contact h2 { font-size: 1.25rem; margin: 0 0 0.25rem; text-align: left; max-width: none; color: #fff; }
.help-contact p { margin: 0; color: #c3d3d6; }
.help-contact-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.help-contact .btn-secondary { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.help-contact .btn-secondary:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

@media (max-width: 575.98px) {
    .help-hero { padding: 2.5rem 0 2rem; }
    .help-wrap { padding: 0 1.1rem; }
    .help-contact { padding: 1.5rem 1.25rem; }
    .help-search .btn { padding-inline: 0.9rem; }
    .help-popular a { max-width: 100%; }
    .help-category { padding: 1.25rem; }
}

/* Editor visual de los artículos: imágenes dentro del área de edición */
.rich-editor-area img { max-width: 100%; height: auto; }

/* ---------- Asistente de IA (chat flotante) ---------- */
.assistant { position: fixed; right: 1.25rem; bottom: calc(1.25rem + env(safe-area-inset-bottom)); z-index: 70; }
.assistant[hidden] { display: none; }
.assistant-button { display: block; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; filter: drop-shadow(0 12px 20px rgba(8, 127, 91, 0.35)); transition: transform 160ms ease; }
.assistant-button:hover { transform: scale(1.05); }
.assistant-button:focus-visible { outline: 3px solid rgba(15, 175, 154, 0.5); outline-offset: 3px; }
.assistant-photo { position: relative; display: block; line-height: 0; flex: none; }
.assistant-photo img { width: 3.75rem; height: 3.75rem; border-radius: 50%; object-fit: cover; border: 3px solid var(--brand); background: #fff; }
.assistant-head .assistant-photo img { width: 2.5rem; height: 2.5rem; border: 2px solid rgba(255, 255, 255, 0.85); }
.assistant-online { position: absolute; right: 2px; bottom: 2px; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.assistant.is-open .assistant-button, .assistant.is-open .assistant-greeting { display: none; }

.assistant-greeting { position: absolute; right: calc(100% + 0.75rem); bottom: 0.4rem; width: 250px; padding: 0.85rem 2rem 0.85rem 1rem; background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 16px 16px 4px 16px; box-shadow: 0 18px 36px -18px rgba(15, 23, 42, 0.45); font-size: 0.875rem; line-height: 1.45; cursor: pointer; animation: assistant-pop 0.35s ease-out; }
.assistant-greeting[hidden] { display: none; }
.assistant-greeting p { margin: 0; }
.assistant-greeting-close { position: absolute; top: 0.35rem; right: 0.35rem; width: 1.5rem; height: 1.5rem; border: 0; border-radius: 6px; background: none; color: var(--text-tertiary); cursor: pointer; display: grid; place-items: center; }
.assistant-greeting-close svg { width: 14px; height: 14px; }
.assistant-greeting-close:hover { background: var(--bg-secondary); color: var(--text); }
@keyframes assistant-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.assistant-panel { position: fixed; right: 1.25rem; bottom: calc(1.25rem + env(safe-area-inset-bottom)); width: min(380px, calc(100vw - 2.5rem)); height: min(600px, calc(100dvh - 2.5rem)); display: flex; flex-direction: column; background: #fff; border-radius: 18px; box-shadow: 0 30px 60px -20px rgba(15, 23, 42, 0.5); overflow: hidden; border: 1px solid var(--border); }
.assistant-panel[hidden] { display: none; }
.assistant-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; background: var(--brand-dark); background-image: var(--brand-gradient); color: #fff; }
.assistant-head div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.assistant-head strong { font-size: 0.95rem; }
.assistant-head small { color: rgba(255, 255, 255, 0.85); font-size: 0.75rem; }
.assistant-action { display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; }
.assistant-action svg { width: 18px; height: 18px; }
.assistant-action:hover { background: rgba(255, 255, 255, 0.18); }
.assistant-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; background: var(--bg-secondary); overscroll-behavior: contain; }
.assistant-msg { max-width: 88%; padding: 0.6rem 0.85rem; border-radius: 14px; font-size: 0.9rem; line-height: 1.5; overflow-wrap: anywhere; }
.assistant-msg p { margin: 0 0 0.35rem; }
.assistant-msg p:last-child { margin-bottom: 0; }
.assistant-msg ul { margin: 0.25rem 0 0.35rem; padding-left: 1.1rem; }
.assistant-msg li { margin-bottom: 0.15rem; }
.assistant-assistant { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; color: var(--text); }
.assistant-user { align-self: flex-end; background: var(--brand-dark); color: #fff; border-bottom-right-radius: 4px; }
.assistant-notice { background: #fff8e6; border-color: #f2d48a; }
.assistant-row { display: flex; align-items: flex-end; gap: 0.5rem; max-width: 92%; }
.assistant-row .assistant-msg { max-width: 100%; }
.assistant-mini { flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; object-fit: cover; background: #fff; }
.assistant-typing { display: inline-flex; gap: 0.25rem; padding: 0.85rem 1rem; }
.assistant-typing span { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--text-tertiary); animation: assistant-dot 1.2s infinite ease-in-out; }
.assistant-typing span:nth-child(2) { animation-delay: 0.15s; }
.assistant-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes assistant-dot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.assistant-suggestions { display: flex; flex-wrap: wrap; gap: 0.375rem; padding: 0 1rem; background: var(--bg-secondary); }
.assistant-suggestions:not(:empty) { padding-bottom: 0.75rem; }
.assistant-suggestions button { border: 1px solid var(--brand); background: #fff; color: var(--brand-dark); border-radius: 999px; padding: 0.3rem 0.75rem; font: inherit; font-size: 0.8125rem; cursor: pointer; }
.assistant-suggestions button:hover { background: var(--brand-tint); }
.assistant-form { display: flex; align-items: flex-end; gap: 0.5rem; padding: 0.6rem 0.75rem; border-top: 1px solid var(--border); background: #fff; }
.assistant-form textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--border-strong); border-radius: 12px; padding: 0.55rem 0.75rem; font: inherit; font-size: 0.9375rem; max-height: 120px; background: #fff; color: var(--text); }
.assistant-form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.assistant-form button { flex: none; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; background: var(--brand-dark); background-image: var(--brand-gradient); color: #fff; cursor: pointer; display: grid; place-items: center; }
.assistant-form button svg { width: 18px; height: 18px; }
.assistant-form button:disabled, .assistant-form textarea:disabled { opacity: 0.5; cursor: not-allowed; }
.assistant-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.875rem; padding: 0.5rem 0.875rem 0.75rem; background: #fff; font-size: 0.75rem; color: var(--text-tertiary); }
.assistant-foot button, .assistant-foot a[data-assistant-whatsapp] { display: inline-flex; align-items: center; gap: 0.3rem; border: 0; background: none; padding: 0; font: inherit; font-size: 0.8125rem; font-weight: 600; color: var(--brand-dark); cursor: pointer; }
.assistant-foot a[hidden] { display: none; }
.assistant-foot svg { width: 14px; height: 14px; }
.assistant-foot span { flex-basis: 100%; }
.assistant-foot span a { color: var(--text-tertiary); text-decoration: underline; }
.assistant-lead { max-width: 100%; width: 100%; display: grid; gap: 0.5rem; }
.assistant-lead label { display: grid; gap: 0.125rem; font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); }
.assistant-lead label small { font-weight: 400; color: var(--text-tertiary); }
.assistant-lead input, .assistant-lead textarea, .assistant-lead select { border: 1px solid var(--border-strong); border-radius: 8px; padding: 0.45rem 0.6rem; font: inherit; font-size: 0.875rem; font-weight: 400; color: var(--text); background: #fff; width: 100%; }
.assistant-lead .assistant-accept { display: flex; gap: 0.5rem; align-items: flex-start; font-weight: 400; }
.assistant-lead .assistant-accept input { width: auto; margin-top: 0.2rem; }
.assistant-error { color: var(--danger); font-size: 0.8125rem; margin: 0; }
.assistant-error[hidden] { display: none; }
.assistant-phone { display: flex; }
.assistant-phone > span { display: inline-flex; align-items: center; padding: 0 0.5rem; border: 1px solid var(--border-strong); border-right: 0; border-radius: 8px 0 0 8px; background: var(--bg-secondary); color: var(--text-secondary); font-size: 0.8125rem; font-weight: 400; white-space: nowrap; }
.assistant-phone input { border-radius: 0 8px 8px 0; min-width: 0; flex: 1; }
/* El botón de WhatsApp sube para no taparse con el chat */
.whatsapp-float.with-assistant { bottom: calc(6rem + env(safe-area-inset-bottom)); right: 1.6rem; width: 48px; height: 48px; }
.whatsapp-float.with-assistant svg { width: 24px; height: 24px; }
@media (max-width: 575.98px) {
    .assistant { right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); }
    .assistant-photo img { width: 3.5rem; height: 3.5rem; }
    .assistant-greeting { width: min(240px, calc(100vw - 6rem)); }
    .assistant-panel { inset: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; }
    .whatsapp-float.with-assistant { right: 1.25rem; bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
}
