/* ==========================================================
   discussion.css — le fil de discussion, en commentaires
   ----------------------------------------------------------
   Avant : des bulles arrondies empilees, qui donnaient au fil
   l'air d'un chat de jeu. Ici c'est un fil de commentaires de
   documentation : angles droits, une seule regle de separation,
   un filet vertical qui rattache les reponses a leur message.
   Aucune fonction n'est retiree — c'est de la presentation.
   ========================================================== */

.forum-wrap { max-width: 940px; margin: 0 auto; }

/* ---------- la barre d'outils ---------- */
.forum-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md) var(--r-md) 0 0;
  border-bottom: 0;
}
.forum-search, .forum-sort, .forum-cats .pill {
  border-radius: 3px;            /* angles droits, comme demande */
}
.forum-search {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; background: var(--bg-card);
  border: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px;
}
.forum-cats { display: flex; gap: 3px; flex-wrap: wrap; }
.forum-cats .pill {
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  padding: 5px 10px; border: 1px solid transparent;
  color: var(--ink-2); background: transparent; cursor: pointer;
  transition: background .14s, color .14s;
}
.forum-cats .pill:hover { background: var(--bg-card); }
.forum-cats .pill.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------- le fil ---------- */
.forum-list, .posts { border: 1px solid var(--line); border-radius: 0 0 var(--r-md) var(--r-md); overflow: hidden; }

.post {
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-card);
  padding: 20px 24px;
  transition: background .16s;
}
.post:last-child { border-bottom: 0; }
.post:hover { background: #fdfbf6; }

.post-byline {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-3);
  letter-spacing: .02em; margin-bottom: 8px;
}
.post-byline .author-link { color: var(--ink); font-weight: 500; text-decoration: none; }
.post-byline .author-link:hover { color: var(--blue); }

.post-avatar, .avatar {
  width: 26px; height: 26px; border-radius: 3px;   /* carre, pas rond */
  object-fit: cover; flex: none; background: var(--bg-soft);
}

.post-title { font-size: 17px; font-weight: 500; letter-spacing: -0.015em; margin-bottom: 6px; }
.post-body { font-size: 14.5px; line-height: 1.62; color: var(--ink-2); max-width: 74ch; }

.post-cat {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--blue);
  background: rgba(29,78,216,.07); border: 1px solid rgba(29,78,216,.18);
  padding: 2px 7px; border-radius: 3px;
}

.post-actions {
  display: flex; align-items: center; gap: 4px; margin-top: 14px;
  padding-top: 12px; border-top: 1px dashed var(--line);
}
.act-btn {
  font-family: var(--mono); font-size: 11.5px;
  padding: 5px 10px; border-radius: 3px;
  border: 1px solid transparent; background: transparent;
  color: var(--ink-3); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .14s, color .14s, border-color .14s;
}
.act-btn:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--line); }
.act-btn.voted, .act-btn.active { color: var(--blue); border-color: rgba(29,78,216,.3); background: rgba(29,78,216,.06); }
.act-btn.danger:hover { color: #c0392b; border-color: #e8c4be; background: #fdf3f1; }

/* ---------- les reponses : rattachees par un filet ---------- */
.replies, .post-replies {
  margin: 14px 0 0 12px;
  padding-left: 18px;
  border-left: 2px solid var(--line);
}
.reply {
  padding: 13px 0;
  border-bottom: 1px dashed var(--line);
}
.reply:last-child { border-bottom: 0; padding-bottom: 0; }
.reply-body { font-size: 14px; line-height: 1.6; color: var(--ink-2); }

/* ---------- le composeur ---------- */
.composer {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg-card); padding: 16px 18px; margin-bottom: 22px;
}
.composer textarea, .composer input[type="text"] {
  width: 100%; border: 1px solid var(--line); border-radius: 3px;
  background: var(--bg); padding: 10px 12px;
  font-family: var(--sans); font-size: 14.5px; line-height: 1.55;
  color: var(--ink); resize: vertical;
}
.composer textarea:focus, .composer input:focus { outline: 2px solid rgba(29,78,216,.35); outline-offset: -1px; border-color: var(--blue); }
.composer-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.composer-kind { display: flex; gap: 3px; }
.composer-kind button { border-radius: 3px; font-family: var(--mono); font-size: 11.5px; padding: 5px 10px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink-2); }
.composer-kind button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.composer-gate {
  padding: 22px; text-align: center; color: var(--ink-3); font-size: 14px;
  border: 1px dashed var(--line-2); border-radius: var(--r-md); background: var(--bg-card);
}

/* ---------- etats ---------- */
.forum-empty, .forum-error, .forum-loading, .notif-empty {
  padding: 40px 24px; text-align: center; color: var(--ink-3); font-size: 14px;
  background: var(--bg-card);
}
.forum-error { color: var(--ink-3); }
.forum-error b { display: block; color: #c0392b; font-size: 15px; margin-bottom: 6px; }

.notif-panel { border-radius: var(--r-sm); }
.notif-badge { border-radius: 3px; font-family: var(--mono); font-size: 10px; }

.load-more {
  width: 100%; padding: 13px; border-radius: 0 0 var(--r-md) var(--r-md);
  border: 1px solid var(--line); border-top: 0;
  background: var(--bg-soft); font-family: var(--mono); font-size: 12px;
  color: var(--ink-2); cursor: pointer;
}
.load-more:hover { background: var(--bg-card); color: var(--ink); }

/* ==========================================================
   Le meme fil, en section commentaires sous une page
   ----------------------------------------------------------
   Monte sous la doc et sous les pages du marketplace. C'est
   le meme composant et la meme API ; seul l'en-tete change.
   ========================================================== */
.discussion-section {
  margin-top: 72px; padding-top: 34px;
  border-top: 1px solid var(--line);
}
.discussion-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px;
}
.discussion-head h2 { font-size: 20px; margin: 0; letter-spacing: -0.02em; }
.discussion-head .count {
  font-family: var(--mono); font-size: 12px; color: var(--ink-3);
}
.discussion-section .forum-wrap { max-width: none; }
.discussion-section .forum-toolbar { display: none; }

/* ==========================================================
   Éditeur markdown
   ========================================================== */
.md-editor { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-card); overflow: hidden; }
.md-editor.over { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(29,78,216,.14); }
.md-tabs { display: flex; align-items: center; gap: 2px; padding: 6px 8px; background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.md-tab {
  font-family: var(--mono); font-size: 11.5px; padding: 5px 11px;
  border: 1px solid transparent; border-radius: 3px; background: none;
  color: var(--ink-3); cursor: pointer;
}
.md-tab.active { background: var(--bg-card); border-color: var(--line); color: var(--ink); }
.md-tools { margin-left: auto; display: flex; gap: 1px; }
.md-tool {
  width: 28px; height: 26px; display: grid; place-items: center;
  border: 0; background: none; border-radius: 3px; cursor: pointer;
  font-family: var(--mono); font-size: 12px; color: var(--ink-3);
}
.md-tool:hover { background: var(--bg-card); color: var(--ink); }
.md-body { position: relative; }
.md-text {
  width: 100%; border: 0; outline: 0; resize: vertical; display: block;
  padding: 13px 15px; font-family: var(--mono); font-size: 13.5px;
  line-height: 1.65; background: var(--bg-card); color: var(--ink); min-height: 130px;
}
.md-preview { padding: 13px 15px; min-height: 130px; font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }
.md-preview h3, .md-preview h4 { margin: 14px 0 6px; }
.md-preview ul, .md-preview ol { margin: 0 0 12px 20px; }
.md-preview blockquote {
  border-left: 2px solid var(--line-2); padding-left: 14px;
  margin: 0 0 12px; color: var(--ink-3);
}
.md-preview code { font-family: var(--mono); font-size: .88em; background: var(--bg-soft); padding: 1px 5px; border-radius: 3px; }
.md-img { max-width: 100%; border: 1px solid var(--line); border-radius: 3px; margin: 8px 0; }
.md-mention { color: var(--blue); text-decoration: none; font-weight: 500; }
.md-mention:hover { text-decoration: underline; }
.md-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 12px; border-top: 1px solid var(--line); background: var(--bg-soft);
}
.md-hint { font-size: 12px; color: var(--ink-4); flex: 1; min-width: 200px; }
.md-send { border-radius: 3px; }
.md-mentions {
  position: absolute; left: 12px; bottom: 8px; z-index: 20;
  border: 1px solid var(--line-2); border-radius: 3px; background: var(--bg-card);
  box-shadow: 0 6px 20px rgba(0,0,0,.12); min-width: 220px; overflow: hidden;
}
.md-mention-item {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 7px 11px; cursor: pointer; font-size: 13px; color: var(--ink-2);
}
.md-mention-item:hover { background: rgba(29,78,216,.07); }
.md-mention-item b { color: var(--ink); }

/* ==========================================================
   Fil : imbrication, états, modération
   ========================================================== */
.th-post { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-card); padding: 22px 24px; margin-bottom: 18px; }
.th-title { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; margin: 0 0 8px; }
.th-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.th-badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 3px;
  border: 1px solid var(--line); color: var(--ink-3); background: var(--bg-soft);
}
.th-badge.pinned   { color: var(--blue); border-color: rgba(29,78,216,.3); background: rgba(29,78,216,.07); }
.th-badge.locked   { color: #7a5c14; border-color: rgba(217,155,30,.4); background: rgba(217,155,30,.10); }
.th-badge.resolved { color: #2e7d32; border-color: rgba(46,125,50,.3); background: rgba(46,125,50,.07); }
.th-badge.cat      { color: var(--ink-2); }

.reply-tree { margin-top: 20px; }
.reply {
  padding: 14px 0; border-top: 1px solid var(--line);
}
.reply[data-depth="1"] { margin-left: 22px; padding-left: 16px; border-left: 2px solid var(--line); }
.reply[data-depth="2"] { margin-left: 44px; padding-left: 16px; border-left: 2px solid var(--line); }
.reply[data-depth="3"] { margin-left: 66px; padding-left: 16px; border-left: 2px solid var(--line); }
.reply[data-depth="4"] { margin-left: 88px; padding-left: 16px; border-left: 2px solid var(--line); }
.reply[data-depth="5"] { margin-left: 106px; padding-left: 16px; border-left: 2px solid var(--line); }
.reply.accepted {
  background: rgba(46,125,50,.04); border-left: 2px solid #2e7d32;
  padding-left: 16px; border-radius: 0 3px 3px 0;
}
.reply-accepted-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: #2e7d32;
  border: 1px solid rgba(46,125,50,.3); background: rgba(46,125,50,.07);
  padding: 1px 7px; border-radius: 3px;
}
.reply-actions { display: flex; gap: 4px; margin-top: 10px; align-items: center; }
.reply-vote {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 11.5px;
  padding: 4px 9px; border: 1px solid var(--line); border-radius: 3px;
  background: var(--bg); color: var(--ink-3); cursor: pointer;
}
.reply-vote.on { color: var(--blue); border-color: rgba(29,78,216,.3); background: rgba(29,78,216,.06); }
.reply-form { margin: 12px 0 0; }

.mod-bar {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding: 10px 14px; margin-bottom: 16px;
  border: 1px dashed var(--line-2); border-radius: 3px; background: var(--bg-soft);
}
.mod-bar .lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-4); margin-right: 4px; }
.mod-bar button { font-family: var(--mono); font-size: 11.5px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--bg-card); color: var(--ink-2); cursor: pointer; }
.mod-bar button:hover { border-color: var(--blue); color: var(--blue); }
.mod-bar button.danger:hover { border-color: #e8c4be; color: #a3341f; }

.forum-search-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.forum-search-bar input[type=search] {
  flex: 1; min-width: 220px; padding: 8px 12px;
  border: 1px solid var(--line-2); border-radius: 3px;
  background: var(--bg-card); font-size: 14px; color: var(--ink);
}
.forum-search-bar select {
  padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 3px;
  background: var(--bg-card); font-family: var(--mono); font-size: 12px; color: var(--ink);
}
