/* forum.css – page forum.html : liste des sujets, fil de discussion, formulaire. */

/* Barre d'outils : recherche, tri, filtre, nombre par page, nouveau sujet */
.forum-outils { display: grid; grid-template-columns: minmax(14rem, 1fr) auto auto; align-items: center; gap: .75rem 1rem;
  margin: 1.25rem 0 1rem; padding: .75rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; }
.forum-recherche { position: relative; margin: 0; }
.forum-recherche input { width: 100%; padding-left: 2.4rem; border-radius: 999px; }
.forum-recherche .loupe { position: absolute; left: .95rem; top: 50%; width: .85rem; height: .85rem; transform: translateY(-60%);
  border: 2px solid var(--muted); border-radius: 50%; pointer-events: none; }
.forum-recherche .loupe::after { content: ''; position: absolute; width: 2px; height: .45rem; background: var(--muted);
  right: -.3rem; bottom: -.4rem; transform: rotate(-45deg); }
.forum-filtres { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.forum-filtres select { width: auto; border-radius: 999px; padding-right: 2rem; }
.sans-rep { display: flex; align-items: center; gap: .4rem; font-size: .9rem; white-space: nowrap; cursor: pointer; }
.sans-rep input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); }
.forum-outils .nouveau { border-radius: 999px; white-space: nowrap; }
@media (max-width: 60rem) { .forum-outils { grid-template-columns: 1fr auto; } .forum-filtres { grid-column: 1 / -1; grid-row: 2; } }
@media (max-width: 36rem) { .forum-outils { grid-template-columns: 1fr; } .forum-outils .nouveau { justify-content: center; } .forum-filtres { grid-row: auto; } }

.forum-resume { display: flex; gap: 1rem; align-items: baseline; margin: 0 .25rem .6rem; font-size: .88rem; color: var(--muted); min-height: 1.4em; }
.forum-resume .effacer { font-size: .85rem; }
.forum-liste { transition: opacity .15s; }
.forum-liste.charge { opacity: .55; }

/* Pastilles d'initiales : 6 teintes douces, lisibles en clair et en sombre */
.avatar { display: inline-grid; place-items: center; flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  font: 600 .88rem/1 var(--sans); letter-spacing: .02em; color: #fff; user-select: none; }
.av-0 { background: #B3202A; } .av-1 { background: #2F5A45; } .av-2 { background: #3D5A80; }
.av-3 { background: #8A5A2B; } .av-4 { background: #6B4C7A; } .av-5 { background: #2E6F73; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .avatar { color: #151B1F; }
  :root:not([data-theme="light"]) .av-0 { background: #E0858B; } :root:not([data-theme="light"]) .av-1 { background: #8FCBA9; }
  :root:not([data-theme="light"]) .av-2 { background: #9DB7DA; } :root:not([data-theme="light"]) .av-3 { background: #D9AE80; }
  :root:not([data-theme="light"]) .av-4 { background: #C3A6D3; } :root:not([data-theme="light"]) .av-5 { background: #86C9CC; }
}
[data-theme="dark"] .avatar { color: #151B1F; }
[data-theme="dark"] .av-0 { background: #E0858B; } [data-theme="dark"] .av-1 { background: #8FCBA9; } [data-theme="dark"] .av-2 { background: #9DB7DA; }
[data-theme="dark"] .av-3 { background: #D9AE80; } [data-theme="dark"] .av-4 { background: #C3A6D3; } [data-theme="dark"] .av-5 { background: #86C9CC; }

/* Liste des sujets : cartes */
.forum-sujets { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.sujet { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 9.5rem; align-items: center; gap: .3rem 1.1rem;
  padding: .95rem 1.1rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; position: relative;
  transition: border-color .15s, box-shadow .15s, transform .15s; }
.sujet:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); box-shadow: 0 4px 16px rgb(0 0 0 / .07); transform: translateY(-1px); }
.sujet:focus-within { border-color: var(--accent); }
.sujet-corps { min-width: 0; }
.sujet-titre { margin: 0; font: 600 1.06rem/1.3 var(--serif); display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; }
.sujet-titre a { color: var(--ink); text-decoration: none; }
.sujet-titre a::after { content: ''; position: absolute; inset: 0; border-radius: 14px; }   /* toute la carte est cliquable */
.sujet-titre a:hover { color: var(--accent); }
.sujet-extrait { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sujet-meta { margin: .3rem 0 0; font-size: .8rem; color: var(--muted); }
.sujet-meta span { color: var(--ink); font-weight: 500; }
.sujet-stats { display: flex; gap: .4rem; }
.bulle { display: grid; justify-items: center; min-width: 4.2rem; padding: .35rem .5rem; border-radius: 10px; background: var(--bg); line-height: 1.15; }
.bulle b { font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.bulle small { font-size: .7rem; color: var(--muted); }
.bulle.active { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.bulle.active b { color: var(--accent); }
.sujet-dernier { margin: 0; font-size: .78rem; line-height: 1.35; color: var(--muted); }
.sujet-dernier b { color: var(--ink); font-weight: 500; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.sujet-dernier span { text-transform: uppercase; letter-spacing: .04em; font-size: .68rem; }
.pastille { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font: 600 .68rem/1.5 var(--sans); letter-spacing: .02em;
  border: 1px solid var(--rule); color: var(--muted); vertical-align: middle; }
.pastille.neuf { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.pastille.auteur { border-color: var(--member); color: var(--member); }
@media (max-width: 52rem) {
  .sujet { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .sujet-stats, .sujet-dernier { grid-column: 2; }
  .sujet-stats { gap: .3rem; }
  .bulle { display: inline-flex; gap: .3rem; align-items: baseline; min-width: 0; padding: .15rem .55rem; }
  .bulle b { font-size: .85rem; }
  .sujet-dernier { display: none; }
}
@media (max-width: 30rem) { .sujet { padding: .85rem .8rem; gap: .25rem .75rem; } .avatar { width: 2.2rem; height: 2.2rem; font-size: .78rem; } }
.forum-vide { padding: 2rem 1.25rem; text-align: center; background: var(--surface); border: 1px dashed var(--rule); border-radius: 14px; }
.forum-vide p { margin: .3rem 0; }

/* Fil de discussion */
.back { margin: 1rem 0 0; font-size: .9rem; }
.fil-entete { margin: .75rem 0 1.25rem; }
.thread-title { font-size: clamp(1.4rem, 3.5vw, 1.9rem); margin: 0 0 .5rem; }
.fil-stats { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.1rem; margin: 0; font-size: .88rem; color: var(--muted); }
.fil-stats .as-button { margin-left: auto; border-radius: 999px; }
.forum-messages { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; position: relative; }
.message { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .8rem; align-items: start; scroll-margin-top: 1.5rem; }
.message-reply { margin-left: clamp(0rem, 4vw, 2.6rem); }
.message-carte { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: .85rem 1.15rem 1rem; min-width: 0; }
.message-root .message-carte { border-left: 4px solid var(--accent); }
.message.cible .message-carte { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.message-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem; margin: 0 0 .45rem; font-size: .84rem; color: var(--muted); }
.message-meta strong { color: var(--ink); }
.message-meta a { color: var(--muted); text-decoration: none; }
.message-meta a:hover { color: var(--accent); text-decoration: underline; }
.message-num { font-variant-numeric: tabular-nums; }
.message-actions { margin-left: auto; display: flex; gap: .9rem; }
.message-actions button { font-size: .8rem; }
.message-body { max-width: 72ch; overflow-wrap: anywhere; }
.message-body > :first-child { margin-top: 0; } .message-body > :last-child { margin-bottom: 0; }
.rappel { font-size: .88rem; padding: .5rem 1rem; border-radius: 10px; background: var(--surface); border: 1px dashed var(--rule); }
.fil-vide { margin: 1.25rem 0 0; color: var(--muted); }
.fil-repondre { margin-top: 2rem; padding: 1.25rem 1.25rem 1.5rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; scroll-margin-top: 1rem; }
.reply-title { font-size: 1.15rem; margin: 0 0 .25rem; }
.fil-repondre .forum-form { margin-top: .75rem; }
@media (max-width: 36rem) {
  .avatar-msg { display: none; }
  .message { grid-template-columns: 1fr; }
  .message-reply { margin-left: .9rem; }
  .message-carte { padding: .75rem .9rem .85rem; }
  .fil-stats .as-button { margin-left: 0; }
  .message-actions { margin-left: 0; width: 100%; }
}

/* Formulaire */
.forum-form { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: .9rem 1rem; max-width: 46rem; margin-top: 1rem; }
.forum-form .wide { grid-column: 1 / -1; }
.forum-form small { color: var(--muted); font-size: .8rem; }
.forum-form .check { display: flex; align-items: center; gap: .5rem; }
.forum-form .check input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--accent); }
.forum-form .actions { display: flex; justify-content: flex-start; }
.forum-form .trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 36rem) { .forum-form { grid-template-columns: 1fr; } }

/* Membres : « Contacter l'auteur » ouvre un petit formulaire sous le message */
.contact-form { display: grid; gap: .6rem; max-width: 40rem; margin-top: .9rem; padding: 1rem; background: var(--surface);
                border: 1px solid var(--rule); border-radius: var(--radius); }
.contact-form .note { margin: 0; }
.contact-form .actions { display: flex; align-items: center; gap: 1rem; }
.contact-ok { margin: 0; color: var(--member); }
