/* Aide en ligne InfoDrone — écran + impression */
:root {
  --help-bg: #0d1117;
  --help-surface: #161b22;
  --help-border: #30363d;
  --help-text: #e6edf3;
  --help-muted: #8b949e;
  --help-accent: #58a6ff;
  --help-accent2: #3fb950;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--help-bg);
  color: var(--help-text);
  line-height: 1.65;
  font-size: 18px;
}

.help-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) 1fr;
  min-height: 100vh;
  gap: 0;
}

.help-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 1.25rem 1rem 2rem;
  background: var(--help-surface);
  border-right: 1px solid var(--help-border);
}

.help-sidebar h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--help-muted);
  margin: 1.5rem 0 0.5rem;
}

.help-sidebar h2:first-child { margin-top: 0; }

.help-sidebar a {
  display: block;
  color: var(--help-accent);
  text-decoration: none;
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

.help-sidebar a:hover { text-decoration: underline; }

.help-nav-sub {
  padding-left: 1rem !important;
  font-size: 0.82rem;
  opacity: 0.92;
}

.help-brand {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.help-main {
  padding: 2rem 2.5rem 4rem;
  /* Assez large pour les figures « petit texte » (jusqu’à ~1320px après réglage OCR) */
  max-width: min(100%, 1400px);
}

.help-banner {
  display: none;
  padding: 1rem 1.25rem;
  background: #3d2f00;
  border: 1px solid #9a6700;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.help-banner.visible { display: block; }

.help-banner a { color: var(--help-accent); }

h1.help-title {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.help-subtitle {
  color: var(--help-muted);
  margin-bottom: 2rem;
}

.help-chapter {
  margin-bottom: 3rem;
  scroll-margin-top: 1rem;
}

.help-chapter h2 {
  font-size: 1.5rem;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--help-border);
  color: #f0f6fc;
}

.help-chapter h3 {
  font-size: 1.28rem;
  margin: 1.5rem 0 0.75rem;
  color: #c9d1d9;
}

.help-chapter p { margin: 0.75rem 0; }

.help-chapter ul, .help-chapter ol {
  margin: 0.5rem 0 1rem 1.25rem;
}

.help-chapter li { margin: 0.35rem 0; }

/* Largeur d’affichage par figure : style inline max-width (voir scripts/adjust_help_figure_widths.py) */
.help-figure {
  margin: 1.25rem auto;
  padding: 0.75rem;
  max-width: min(100%, 1000px); /* repli si figure sans style inline */
  background: var(--help-surface);
  border: 1px solid var(--help-border);
  border-radius: 8px;
}

.help-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 4px;
}

.help-figure figcaption {
  margin-top: 0.75rem;
  font-size: 1.02rem;
  color: var(--help-muted);
  line-height: 1.55;
}

.help-kbd {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  background: var(--help-border);
  border-radius: 4px;
}

.help-perm-list {
  margin: 0.75rem 0 1rem;
  padding-left: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.65;
}

.help-perm-list li {
  margin: 0.4rem 0;
}

.help-perm-title {
  color: var(--help-accent);
  font-weight: 600;
}

.help-note {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  color: var(--help-muted);
  background: var(--help-bg);
  border: 1px solid var(--help-border);
  border-radius: 6px;
}

.help-toolbar {
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.help-toolbar button,
.help-toolbar a.btn-print {
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--help-border);
  background: var(--help-surface);
  color: var(--help-text);
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.help-toolbar button:hover,
.help-toolbar a.btn-print:hover {
  border-color: var(--help-accent);
  color: var(--help-accent);
}

.help-admin-only {
  display: none;
}

.help-admin-only.is-visible {
  display: block;
}

.help-admin-only.help-chapter.is-visible {
  display: block;
}

/* Nav entries for admin — hidden unless .is-visible on parent nav */
.help-nav-admin { display: none; }
.help-nav-admin.is-visible { display: block; }

/* Tableaux de référence des champs (aide scanners / drones) */
.help-field-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0.75rem 0 1.25rem;
}
.help-field-table th,
.help-field-table td {
  border: 1px solid var(--help-border);
  padding: 0.45rem 0.65rem;
  text-align: left;
  vertical-align: top;
}
.help-field-table th {
  background: var(--help-surface);
  color: var(--help-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.help-field-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 900px) {
  .help-layout {
    grid-template-columns: 1fr;
  }
  .help-sidebar {
    position: relative;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--help-border);
  }
}

/* ——— Impression ——— */
@media print {
  body {
    background: #fff !important;
    color: #111 !important;
    font-size: 12pt;
  }

  .help-sidebar,
  .help-toolbar,
  .help-banner,
  .help-no-print {
    display: none !important;
  }

  .help-layout {
    display: block;
  }

  .help-main {
    max-width: 100%;
    padding: 0;
  }

  .help-chapter {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .help-chapter h2 {
    page-break-after: avoid;
    break-after: avoid;
    border-bottom-color: #ccc;
    color: #000 !important;
  }

  .help-chapter h3 { color: #222 !important; }

  .help-note {
    color: #333 !important;
    background: #f5f5f5 !important;
    border-color: #ccc !important;
  }

  .help-perm-title {
    color: #0b4d8c !important;
  }

  .help-figure {
    page-break-inside: avoid;
    break-inside: avoid;
    border: 1px solid #ccc;
    background: #fafafa;
  }

  .help-figure img {
    max-height: 380px;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto;
  }

  .help-figure figcaption {
    color: #444 !important;
  }

  h1.help-title { color: #000 !important; }
  .help-subtitle { color: #555 !important; }

  /* Afficher le contenu admin à l’impression seulement si l’utilisateur l’a imprimé depuis une session admin (classes laissées par le script) */
  .help-admin-only:not(.is-visible) {
    display: none !important;
  }

  .help-admin-only.is-visible {
    display: block !important;
  }

  a[href]::after {
    content: none !important;
  }
}
