/* ============================================================
   Module Documentation — _docs.css
   Aligné sur le design system « extension » (app.css) :
   #2c3e50 anthracite, #3498db bleu, #16a085 vert doc.
   ============================================================ */

/* ─── Bouton Docs de la barre du haut ───────────────────────
   Il porte AUSSI la classe .top-nav-audit pour hériter du
   gabarit existant ; ces règles ne font qu'ajuster la teinte. */
.top-nav-docs {
  color: #fff;
}
.top-nav-docs:hover {
  color: #1abc9c;
}
.top-nav-docs.active {
  color: #16a085;
}

/* ─── Sommaire ───────────────────────────────────────────── */
.docs-container .header-section h3 {
  display: flex;
  align-items: center;
  gap: 10px; /* app.css ne pose sa marge que sur .fa, pas sur .fa-regular */
}
.docs-container .header-section h3 .fa-circle-question,
.docs-container .header-section h3 .fa-regular {
  color: #1abc9c;
}

.docs-search-form {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}
.docs-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #95a5a6;
  font-size: 14px;
  pointer-events: none;
}
.docs-search-input {
  flex: 1 1 auto;
  padding: 10px 14px 10px 36px;
  border: 1px solid #34495e;
  border-radius: 6px;
  background: #34495e;
  color: #ecf0f1;
  font-size: 14px;
}
.docs-search-input::placeholder {
  color: #95a5a6;
}
.docs-search-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.docs-cat-count {
  margin-left: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #555;
  background: rgba(0, 0, 0, 0.07);
  border-radius: 20px;
  padding: 1px 9px;
}

.docs-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.docs-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 13px 15px;
  border: 1px solid #e1e5ea;
  border-left: 3px solid #16a085;
  border-radius: 6px;
  background: #fff;
  text-decoration: none;
  color: #2c3e50;
  transition:
    box-shadow 0.15s,
    border-color 0.15s,
    transform 0.12s;
}
.docs-card:hover {
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
  border-left-color: #1abc9c;
  transform: translateY(-1px);
}
.docs-card-title {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.docs-card-summary {
  font-size: 12.5px;
  color: #7f8c8d;
  line-height: 1.45;
}
.docs-card-lang {
  font-size: 11px;
  color: #b9770e;
}

/* ─── Badges ─────────────────────────────────────────────── */
.docs-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 7px;
  border-radius: 9px;
  line-height: 16px;
}
.docs-badge-draft {
  background: #fef9e7;
  color: #b9770e;
}
.docs-badge-shared {
  background: #e8f8f2;
  color: #138d75;
}
.docs-badge-owner {
  background: #eef2fb;
  color: #3b5b92;
}
.docs-badge-admin {
  background: #fdecea;
  color: #c0392b;
}
.docs-badge-lang {
  background: #ecf0f1;
  color: #7f8c8d;
}

/* ─── Fil d'Ariane ───────────────────────────────────────── */
.docs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #bdc3c7;
}
.docs-breadcrumb a {
  color: #5dade2;
  text-decoration: none;
}
.docs-breadcrumb a:hover {
  text-decoration: underline;
}

/* ─── Page : sidebar + contenu ───────────────────────────── */
.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  align-items: start;
}
.docs-sidebar {
  background: #fff;
  border: 1px solid #e1e5ea;
  border-radius: 6px;
  padding: 14px 16px;
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}
.docs-sidebar-search {
  position: relative;
  margin-bottom: 14px;
}
.docs-sidebar-search .fa {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #95a5a6;
  font-size: 12px;
  pointer-events: none;
}
.docs-sidebar-search input {
  padding-left: 30px;
  font-size: 13px;
  height: 34px;
}
.docs-sidebar-cat {
  margin-bottom: 14px;
}
.docs-sidebar-cat-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7f8c8d;
  margin-bottom: 5px;
}
.docs-sidebar-cat-title .fa {
  margin-right: 5px;
  opacity: 0.7;
}
.docs-sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.docs-sidebar-list a {
  display: block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  color: #34495e;
  text-decoration: none;
  line-height: 1.35;
}
.docs-sidebar-list a:hover {
  background: #f4f6f8;
}
.docs-sidebar-list a.active {
  background: #e8f8f2;
  color: #138d75;
  font-weight: 600;
}

.docs-main {
  background: #fff;
  border: 1px solid #e1e5ea;
  border-radius: 6px;
  padding: 22px 28px;
  min-width: 0;
}

/* ─── Sommaire « sur cette page » ────────────────────────── */
.docs-page-toc {
  background: #f8fafb;
  border: 1px solid #e4e8ec;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 13px;
}
.docs-page-toc summary {
  cursor: pointer;
  font-weight: 700;
  color: #34495e;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.docs-page-toc ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}
.docs-page-toc li.lvl-3 {
  padding-left: 16px;
}
.docs-page-toc a {
  color: #2980b9;
  text-decoration: none;
  line-height: 1.7;
}
.docs-page-toc a:hover {
  text-decoration: underline;
}

/* ─── Corps de page rendu ────────────────────────────────── */
/* La mesure de lecture (~78 caractères) s'applique au TEXTE, pas au bloc :
   figures et tableaux ont besoin de toute la largeur disponible, sinon une
   capture d'écran arrive réduite de moitié et devient illisible. */
.docs-body {
  font-size: 14.5px;
  line-height: 1.7;
  color: #2c3e50;
  max-width: none;
}
.docs-body > p,
.docs-body > ul,
.docs-body > ol,
.docs-body > blockquote,
.docs-body > h2,
.docs-body > h3,
.docs-body > h4,
.docs-body > .doc-callout,
.docs-body > details {
  max-width: 78ch;
}
.docs-body h2,
.docs-body h3,
.docs-body h4 {
  color: #2c3e50;
  scroll-margin-top: 20px;
}
.docs-body h2 {
  font-size: 20px;
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #ecf0f1;
}
.docs-body h3 {
  font-size: 16.5px;
  margin: 24px 0 8px;
}
.docs-body h4 {
  font-size: 14.5px;
  margin: 18px 0 6px;
}
.docs-body p {
  margin: 0 0 14px;
}
.docs-body ul,
.docs-body ol {
  margin: 0 0 14px;
  padding-left: 24px;
}
.docs-body li {
  margin-bottom: 5px;
}
.docs-body a {
  color: #2980b9;
}
.docs-body code {
  background: #f4f6f8;
  color: #c0392b;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12.5px;
}
.docs-body pre {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 14px 16px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
}
.docs-body pre code {
  background: none;
  color: inherit;
  padding: 0;
}
.docs-body blockquote {
  margin: 0 0 14px;
  padding: 4px 16px;
  border-left: 3px solid #bdc3c7;
  color: #5a6877;
  font-style: italic;
}
.docs-body hr {
  border: 0;
  border-top: 1px solid #e4e8ec;
  margin: 26px 0;
}

.doc-anchor {
  margin-left: 8px;
  color: #cfd6dc;
  text-decoration: none;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.12s;
}
.docs-body h2:hover .doc-anchor,
.docs-body h3:hover .doc-anchor {
  opacity: 1;
}

.doc-table-wrap {
  overflow-x: auto;
  margin: 0 0 16px;
}
.docs-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.docs-body th,
.docs-body td {
  border: 1px solid #e1e5ea;
  padding: 7px 11px;
  text-align: left;
}
.docs-body thead th {
  background: #f4f6f8;
  font-weight: 700;
  color: #34495e;
}
.docs-body tbody tr:nth-child(even) {
  background: #fafbfc;
}

.doc-figure {
  margin: 22px 0;
}
.doc-figure img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 1px solid #e1e5ea;
  border-radius: 6px;
  display: block;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
  cursor: zoom-in;
}
/* Clic sur une capture : agrandissement plein écran (doc-help.js) */
.doc-figure img.doc-zoomed {
  position: fixed;
  inset: 3vh 3vw;
  width: auto;
  height: auto;
  max-width: 94vw;
  max-height: 94vh;
  margin: auto;
  z-index: 10700;
  cursor: zoom-out;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  background: #fff;
  object-fit: contain;
}
.doc-zoom-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 10699;
}
.doc-figure figcaption {
  margin-top: 7px;
  font-size: 12.5px;
  color: #7f8c8d;
  font-style: italic;
}

/* ─── Encadrés ::: ───────────────────────────────────────── */
.doc-callout {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 6px;
  margin: 0 0 16px;
  border-left: 3px solid #3498db;
  background: #eef4fb;
  font-size: 13.5px;
  line-height: 1.6;
}
.doc-callout > .fa,
.doc-callout > i {
  margin-top: 2px;
  font-size: 15px;
  color: #3498db;
}
.doc-callout-body > :last-child {
  margin-bottom: 0;
}
.doc-callout-title {
  font-weight: 700;
  margin-bottom: 4px;
}
.doc-callout-tip {
  background: #e8f8f2;
  border-left-color: #16a085;
}
.doc-callout-tip > i {
  color: #16a085;
}
.doc-callout-warning {
  background: #fdf6ec;
  border-left-color: #f39c12;
}
.doc-callout-warning > i {
  color: #d68910;
}
.doc-callout-danger {
  background: #fdecea;
  border-left-color: #e74c3c;
}
.doc-callout-danger > i {
  color: #c0392b;
}
.doc-callout-steps {
  background: #f4f6f8;
  border-left-color: #7f8c8d;
}
.doc-callout-steps > i {
  color: #7f8c8d;
}

/* ─── Pied de page ───────────────────────────────────────── */
.docs-page-footer {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 32px;
  padding-top: 14px;
  border-top: 1px solid #ecf0f1;
  font-size: 12px;
  color: #95a5a6;
}
.docs-help-key {
  margin-left: auto;
  font-family: monospace;
  font-size: 11px;
}

/* ─── Résultats de recherche ─────────────────────────────── */
.docs-results {
  list-style: none;
  margin: 0;
  padding: 0;
}
.docs-result {
  padding: 13px 0;
  border-bottom: 1px solid #f0f3f5;
}
.docs-result:last-child {
  border-bottom: none;
}
.docs-result-title {
  font-size: 15px;
  font-weight: 600;
  color: #2980b9;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.docs-result-title:hover {
  text-decoration: underline;
}
.docs-result-summary {
  font-size: 12.5px;
  color: #7f8c8d;
  margin-top: 3px;
}
.docs-result-excerpt {
  font-size: 13px;
  color: #34495e;
  margin-top: 5px;
  line-height: 1.55;
}
.docs-result-excerpt mark {
  background: #fcf3cf;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

/* ─── Bouton d'aide contextuelle ─────────────────────────── */
.doc-help-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: #b0bcc6;
  font-size: 13px;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.12s;
}
.doc-help-btn:hover {
  color: #16a085;
}

/* ─── Drawer d'aide ──────────────────────────────────────── */
.doc-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 10500;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s,
    visibility 0.2s;
}
.doc-drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}
.doc-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 520px;
  max-width: 92vw;
  background: #fff;
  box-shadow: -6px 0 28px rgba(0, 0, 0, 0.22);
  z-index: 10501;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}
.doc-drawer.open {
  transform: translateX(0);
}
body.doc-drawer-lock {
  overflow: hidden;
}
.doc-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  background: #2c3e50;
  color: #fff;
}
.doc-drawer-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.doc-drawer-close {
  background: none;
  border: none;
  color: #bdc3c7;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.doc-drawer-close:hover {
  color: #fff;
}
.doc-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px;
}
.doc-drawer-body .docs-body {
  max-width: none;
  font-size: 14px;
}
.doc-drawer-loading {
  text-align: center;
  color: #95a5a6;
  padding: 40px 0;
  font-size: 20px;
}
.doc-drawer-error {
  color: #c0392b;
  background: #fdecea;
  padding: 12px;
  border-radius: 6px;
  font-size: 13px;
}
.doc-drawer-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #ecf0f1;
  background: #fafbfc;
}
.doc-drawer-footer .doc-drawer-full {
  margin-left: auto;
}

/* ─── Retour en haut ─────────────────────────────────────── */
#docs-back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: #16a085;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.2s,
    transform 0.2s,
    visibility 0.2s,
    background 0.15s;
}
#docs-back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#docs-back-to-top:hover {
  background: #138d75;
}

/* ============================================================
   ÉDITEUR
   ============================================================ */
.docs-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 18px;
}
.docs-meta-full {
  grid-column: 1 / -1;
}

.docs-editor-lang-badge {
  margin-left: 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: #16a085;
  color: #fff;
  padding: 2px 9px;
  border-radius: 10px;
  vertical-align: middle;
}
.docs-editor-langs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}
.docs-editor-langs-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #95a5a6;
  font-weight: 700;
  margin-right: 4px;
}

.docs-loc-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid transparent;
}
.docs-loc-pill.ok {
  background: #e8f8f2;
  color: #138d75;
  border-color: #a9dfbf;
}
.docs-loc-pill.stale {
  background: #fdf6ec;
  color: #b9770e;
  border-color: #f0d9b5;
}
.docs-loc-pill.missing {
  background: #f4f6f8;
  color: #95a5a6;
  border-color: #dfe4ea;
}
.docs-loc-pill.current {
  background: #16a085;
  color: #fff;
  border-color: #138d75;
}
.docs-locale-cell {
  white-space: nowrap;
}
.docs-locale-cell .docs-loc-pill {
  margin: 0 1px;
}

.docs-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  padding: 7px 9px;
  background: #f4f6f8;
  border: 1px solid #dfe4ea;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}
.docs-editor-toolbar button {
  min-width: 30px;
  height: 28px;
  border: 1px solid transparent;
  background: none;
  border-radius: 4px;
  cursor: pointer;
  color: #34495e;
  font-size: 13px;
  font-weight: 600;
}
.docs-editor-toolbar button:hover {
  background: #fff;
  border-color: #dfe4ea;
}
.docs-editor-toolbar .sep {
  width: 1px;
  height: 18px;
  background: #dfe4ea;
  margin: 0 5px;
}
.docs-toolbar-hint {
  margin-left: auto;
  font-size: 11px;
  color: #95a5a6;
  font-style: italic;
}

.docs-editor-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid #dfe4ea;
  border-radius: 0 0 6px 6px;
  overflow: hidden;
  min-height: 480px;
}
.docs-editor-pane {
  position: relative;
  min-width: 0;
}
.docs-editor-textarea {
  width: 100%;
  height: 100%;
  min-height: 480px;
  border: none;
  border-right: 1px solid #dfe4ea;
  padding: 16px 18px;
  font-family: "SF Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.65;
  color: #2c3e50;
  resize: vertical;
}
.docs-editor-textarea:focus {
  outline: none;
  background: #fffef9;
}
.docs-editor-preview-pane {
  background: #fff;
  overflow-y: auto;
  max-height: 70vh;
}
.docs-editor-preview-head {
  position: sticky;
  top: 0;
  background: #fafbfc;
  border-bottom: 1px solid #ecf0f1;
  padding: 6px 18px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #95a5a6;
  z-index: 1;
}
.docs-editor-preview-pane .docs-body {
  padding: 16px 18px;
  max-width: none;
}

.docs-editor-dropzone {
  position: absolute;
  inset: 8px;
  border: 2px dashed #16a085;
  border-radius: 6px;
  background: rgba(232, 248, 242, 0.94);
  color: #138d75;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  pointer-events: none;
}
.docs-editor-dropzone.active {
  display: flex;
}

.docs-editor-status {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
}
.docs-editor-status.is-ok {
  color: #138d75;
}
.docs-editor-status.is-busy {
  color: #7f8c8d;
}
.docs-editor-status.is-dirty {
  color: #b9770e;
}
.docs-editor-status.is-error {
  color: #c0392b;
}
.docs-editor-autosave {
  margin-left: auto;
  font-size: 11.5px;
  color: #95a5a6;
  font-style: italic;
}

.docs-reference {
  margin-top: 16px;
  border: 1px solid #e4e8ec;
  border-radius: 6px;
  padding: 10px 14px;
  background: #fafbfc;
}
.docs-reference summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: #34495e;
}
.docs-reference-body pre {
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.6;
  color: #5a6877;
  background: #fff;
  border: 1px solid #ecf0f1;
  border-radius: 4px;
  padding: 12px;
  max-height: 320px;
  overflow-y: auto;
}

/* ─── Modale (révisions) ─────────────────────────────────── */
.doc-modal {
  position: fixed;
  inset: 0;
  z-index: 10600;
}
.doc-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.doc-modal-dialog {
  position: relative;
  max-width: 760px;
  margin: 6vh auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  max-height: 84vh;
}
.doc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
}
.doc-modal-header h3 {
  margin: 0;
  font-size: 16px;
}
.doc-modal-x {
  border: none;
  background: none;
  font-size: 18px;
  cursor: pointer;
  color: #6b7280;
}
.doc-modal-x:hover {
  color: #111;
}
.doc-modal-body {
  padding: 12px 18px;
  overflow-y: auto;
}
.doc-modal-footer {
  padding: 12px 18px;
  border-top: 1px solid #e5e7eb;
  text-align: right;
}

.doc-rev-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.doc-rev-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}
.doc-rev-date {
  font-family: monospace;
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}
.doc-rev-title {
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-rev-author,
.doc-rev-len {
  color: #7f8c8d;
  font-size: 12px;
  white-space: nowrap;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .docs-sidebar {
    position: static;
    max-height: none;
  }
  .docs-editor-split {
    grid-template-columns: 1fr;
  }
  .docs-editor-textarea {
    border-right: none;
    border-bottom: 1px solid #dfe4ea;
    min-height: 340px;
  }
  .docs-editor-preview-pane {
    max-height: 50vh;
  }
}
