/* ═══════════════════════════════════════════════════════════════
   {{brand_name}} — Knowledge base SPA (Lot 10.b)
   Layout 3 colonnes responsive mobile-first.
   Réutilise les design tokens de theme.css (couleurs, fonts).
═══════════════════════════════════════════════════════════════ */

/* ── Reset spécifique help (page dédiée, peut diverger de l'app) ── */
.help-body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Skip link (a11y) — visible uniquement au focus clavier ── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 9999;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 6px 0;
  text-decoration: none;
  font-weight: 600;
  transition: top .15s;
}
.skip-link:focus { top: 0; }

/* ── Header sticky ─────────────────────────────────────────── */
.help-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 20, .92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.help-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
}
.help-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.help-brand-name {
  font-weight: 700;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--accent), var(--electric));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.help-brand-sub {
  font-size: .8rem;
  color: var(--text2);
  font-weight: 500;
}

.help-search-wrap {
  position: relative;
  max-width: 640px;
  width: 100%;
  justify-self: center;
}
.help-search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  padding: 11px 56px 11px 18px;
  transition: border-color .15s, box-shadow .15s;
}
.help-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, .18);
}
.help-search-input::placeholder { color: var(--text2); }
.help-search-kbd {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  background: var(--surface2);
  color: var(--text2);
  font-family: var(--font-mono);
  font-size: .7rem;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  pointer-events: none;
}
.help-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  max-height: min(60vh, 480px);
  overflow-y: auto;
  z-index: 50;
}
.help-search-results[hidden] { display: none; }
.help-search-result {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: background .12s;
}
.help-search-result:last-child { border-bottom: none; }
.help-search-result:hover,
.help-search-result.is-active {
  background: var(--surface2);
}
.help-search-result-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: .95rem;
}
.help-search-result-snippet {
  color: var(--text2);
  font-size: .85rem;
  line-height: 1.45;
}
.help-search-result-cat {
  display: inline-block;
  font-size: .7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  margin-right: 8px;
}
.help-search-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text2);
}
.help-search-cta {
  display: block;
  padding: 14px 16px;
  text-align: center;
  background: linear-gradient(135deg, rgba(102, 126, 234, .15), rgba(0, 212, 255, .12));
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  border-top: 1px solid var(--border);
}
.help-search-cta:hover { background: var(--surface2); }

.help-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.help-back-app {
  color: var(--text2);
  text-decoration: none;
  font-size: .88rem;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .15s, color .15s;
}
.help-back-app:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Locale switcher reuse styles from prospection.css if besoin — minimal here */
.locale-switcher { position: relative; }
.locale-switcher-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 1rem;
  cursor: pointer;
}
.locale-switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  padding: 4px 0;
  display: none;
  z-index: 60;
}
.locale-switcher.is-open .locale-switcher-menu { display: block; }
.locale-switcher-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; background: none; border: none;
  color: var(--text); padding: 8px 14px; cursor: pointer; font-size: .88rem;
}
.locale-switcher-menu button:hover { background: var(--surface2); }

/* ── Main 3-col layout ─────────────────────────────────────── */
.help-main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 220px;
  gap: 40px;
  align-items: start;
}

/* ── Sidebar (left) ────────────────────────────────────────── */
.help-sidebar {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  font-size: .9rem;
}
.help-sidebar-cat {
  margin-bottom: 18px;
}
.help-sidebar-cat-title {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text2);
  margin-bottom: 6px;
  padding: 0 4px;
}
.help-sidebar-cat-pages { list-style: none; margin: 0; padding: 0; }
.help-sidebar-cat-pages li { margin: 0; }
.help-sidebar-cat-pages a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  transition: background .12s, color .12s;
  font-weight: 500;
}
.help-sidebar-cat-pages a:hover { background: var(--surface); }
.help-sidebar-cat-pages a.is-active {
  background: rgba(102, 126, 234, .15);
  color: var(--accent);
  font-weight: 600;
}

/* ── Content (center) ──────────────────────────────────────── */
.help-content {
  min-width: 0; /* pour que les pre overflow correctement */
  font-size: 1rem;
}
.help-content:focus { outline: none; }

.help-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--text2);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.help-breadcrumbs a { color: var(--text2); text-decoration: none; }
.help-breadcrumbs a:hover { color: var(--text); }
.help-breadcrumbs .sep { opacity: .5; }
.help-breadcrumbs .current { color: var(--text); font-weight: 500; }

.help-page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 8px;
  line-height: 1.2;
}
.help-page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: .82rem;
  color: var(--text2);
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.help-page-meta-tag {
  background: var(--surface);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: .72rem;
  color: var(--accent);
}

.help-content h2,
.help-content h3,
.help-content h4 {
  font-weight: 700;
  letter-spacing: -.015em;
  margin: 32px 0 12px;
  scroll-margin-top: 88px; /* pour que les anchors ne soient pas cachés sous le header sticky */
  position: relative;
}
.help-content h2 { font-size: 1.45rem; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.help-content h3 { font-size: 1.18rem; }
.help-content h4 { font-size: 1.02rem; color: var(--text2); }

.help-content .anchor {
  position: absolute;
  left: -28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text2);
  text-decoration: none;
  font-size: .9rem;
  opacity: 0;
  transition: opacity .15s;
  padding: 4px 6px;
}
.help-content h2:hover .anchor,
.help-content h3:hover .anchor,
.help-content h4:hover .anchor,
.help-content .anchor:focus { opacity: 1; }
.help-content .anchor:hover { color: var(--accent); }

.help-content p { margin: 0 0 14px; }
.help-content ul, .help-content ol { margin: 0 0 14px 22px; }
.help-content li { margin-bottom: 6px; }
.help-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.help-content a:hover { color: var(--electric); }
.help-content strong { font-weight: 700; color: var(--text); }
.help-content em { font-style: italic; }

.help-content code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .88em;
}
.help-content pre {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 16px 0;
}
.help-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: .85rem;
  line-height: 1.5;
}
.help-content pre .help-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: .72rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s;
}
.help-content pre:hover .help-copy-btn,
.help-content pre .help-copy-btn:focus { opacity: 1; }
.help-content pre .help-copy-btn:hover { color: var(--text); }
.help-content pre .help-copy-btn.is-copied { color: var(--success); }

/* Prism syntax tokens */
.tok-comment { color: var(--text2); font-style: italic; }
.tok-string  { color: #4ecdc4; }
.tok-keyword { color: #a855f7; font-weight: 600; }
.tok-number  { color: #ffa502; }
.tok-flag    { color: var(--electric); }
.tok-key     { color: var(--accent); }

.help-content blockquote {
  border-left: 3px solid var(--accent);
  background: rgba(102, 126, 234, .06);
  padding: 12px 18px;
  margin: 16px 0;
  border-radius: 0 8px 8px 0;
  color: var(--text);
}
.help-content blockquote p:last-child { margin-bottom: 0; }

.help-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: .9rem;
}
.help-content th,
.help-content td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.help-content th {
  background: var(--surface);
  font-weight: 600;
}

.help-content img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 12px 0;
  cursor: zoom-in;
}

.help-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

/* ── Feedback widget bottom ────────────────────────────────── */
.help-feedback {
  margin-top: 48px;
  padding: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.help-feedback-q {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.help-feedback-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.help-feedback-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 22px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s;
}
.help-feedback-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.help-feedback-btn.is-selected {
  background: rgba(102, 126, 234, .18);
  border-color: var(--accent);
}
.help-feedback-thanks {
  margin-top: 14px;
  color: var(--success);
  font-size: .9rem;
}
.help-feedback-cta {
  margin-top: 18px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
}
.help-feedback-cta-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: .9rem;
}
.help-feedback-cta-link:hover { text-decoration: underline; }

/* ── TOC right ─────────────────────────────────────────────── */
.help-toc {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  font-size: .82rem;
  color: var(--text2);
}
.help-toc-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text2);
  margin-bottom: 10px;
  padding: 0 4px;
}
.help-toc-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.help-toc-list li { margin: 0; }
.help-toc-list a {
  display: block;
  padding: 4px 10px;
  color: var(--text2);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: color .12s, border-color .12s;
}
.help-toc-list a:hover { color: var(--text); }
.help-toc-list a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
}
.help-toc-list .level-3 { padding-left: 22px; }
.help-toc-list .level-4 { padding-left: 32px; font-size: .92em; }

/* ── Home page ─────────────────────────────────────────────── */
.help-home-hero {
  text-align: center;
  padding: 32px 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.help-home-hero h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -.025em;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.help-home-hero p {
  color: var(--text2);
  font-size: 1.05rem;
  max-width: 640px;
  margin: 0 auto;
}
.help-home-cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 32px 0;
}
.help-home-cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.help-home-cat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}
.help-home-cat-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}
.help-home-cat-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.help-home-cat-desc {
  color: var(--text2);
  font-size: .85rem;
  margin-bottom: 12px;
  line-height: 1.5;
}
.help-home-cat-pages {
  font-size: .75rem;
  color: var(--accent);
  font-weight: 600;
}

/* ── Lightbox ──────────────────────────────────────────────── */
.help-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 200;
  cursor: zoom-out;
}
.help-lightbox-backdrop.is-open {
  display: flex;
}
.help-lightbox-img {
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.help-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.help-lightbox-close:hover { background: rgba(255, 255, 255, .2); }

/* ── Toast (réutilise pattern app — minimal) ───────────────── */
.toast-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  min-width: 220px;
  font-size: .9rem;
}
.toast.is-ok { border-left-color: var(--success); }
.toast.is-error { border-left-color: var(--danger); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .help-main {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 28px;
  }
  .help-toc {
    display: none;
  }
}
@media (max-width: 800px) {
  .help-header-inner {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .help-search-wrap { order: 2; max-width: none; }
  .help-back-app { display: none; }
  .help-main {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 20px 16px;
  }
  .help-sidebar {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
  }
  .help-page-title { font-size: 1.6rem; }
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
