/*
 * Composants des pages de conversation (contact.html, unban.html) et des pages de lecture (règlement,
 * formation, remise à niveau) : cartes, bandeaux de statut, conversation, zone de saisie, historique.
 *
 * Elle se charge APRÈS /site/site.css, dont elle reprend les jetons (couleurs, verre, ressorts) : le
 * site n'a qu'une charte. Les noms de classes sont ceux qu'emploient les scripts de ces pages — ils
 * construisent leur HTML par gabarits, les renommer aurait demandé de réécrire chaque gabarit pour un
 * gain nul.
 */

/* ---------- Mise en page ---------- */

.page-corps {
  padding-bottom: clamp(64px, 8vw, 110px);
}

/* Les deux bandeaux sont des rappels de contexte : ils prennent le strict nécessaire, la conversation
   absorbe tout le reste. */
.layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 260px;
  gap: 14px;
  align-items: start;
}

/* Sous 1150 px, l'historique passe sous la conversation plutôt que de l'étrangler : c'est la colonne la
   moins consultée des trois. */
@media (max-width: 1150px) {
  .layout { grid-template-columns: 290px minmax(0, 1fr); }
  .layout > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .layout > :last-child { grid-column: auto; }
}

.side { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Carte : le panneau de verre du site ---------- */

.card {
  position: relative;
  isolation: isolate;
  padding: 22px;
  border-radius: var(--r-surface);
  background: var(--verre-fond), var(--verre-teinte);
  -webkit-backdrop-filter: var(--verre-flou);
  backdrop-filter: var(--verre-flou);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.12),
    inset 0 -1px 0 rgb(255 255 255 / 0.03),
    0 30px 80px -30px rgb(0 0 0 / 0.85);
}

/* Même arête réfractée que .verre (voir site.css). */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: linear-gradient(140deg, rgb(255 255 255 / 0.3), rgb(255 255 255 / 0.05) 36%, rgb(255 255 255 / 0.02) 62%, rgb(255 90 100 / 0.26));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
}

@media (prefers-reduced-transparency: reduce) {
  .card {
    background: var(--noir-3);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.card h2 {
  font-size: 19px;
  font-weight: 620;
  letter-spacing: -0.02em;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--encre);
}

.section-title .rl-icon {
  color: var(--rouge-vif);
}

/* ---------- Identité ---------- */

.identity { display: flex; align-items: center; gap: 14px; }

.identity img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 3px var(--noir-2),
    0 0 0 5px rgb(255 59 78 / 0.5);
}

.identity-name { font-size: 17px; font-weight: 620; letter-spacing: -0.02em; line-height: 1.2; }
.identity-sub { font-size: 13px; color: var(--encre-3); margin-top: 3px; }

.meta-line {
  font-size: 13px;
  color: var(--encre-3);
  margin-top: 4px;
}

/* ---------- Bandeaux de statut ---------- */

.banner {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  border-radius: var(--r-interne);
  padding: 13px 15px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.banner .rl-icon { flex: none; margin-top: 2px; }

.banner-danger { background: rgb(255 59 78 / 0.1); box-shadow: inset 0 0 0 1px rgb(255 59 78 / 0.28); color: #ffc4bd; }
.banner-ok { background: var(--vert-fond); box-shadow: inset 0 0 0 1px rgb(61 220 132 / 0.3); color: #9ff0c1; }
.banner-warn { background: var(--ambre-fond); box-shadow: inset 0 0 0 1px rgb(245 185 78 / 0.3); color: #fbd99a; }

/* ---------- Sanctions ---------- */

.sanction-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: none;
}

.sanction-list::-webkit-scrollbar { display: none; }

.sanction {
  position: relative;
  padding: 11px 13px 11px 17px;
  border-radius: 14px;
  background: rgb(0 0 0 / 0.2);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.06);
  overflow: hidden;
}

.sanction::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--rouge);
}

.sanction.is-revoked { opacity: 0.55; }
.sanction.is-revoked::before { background: var(--encre-3); }
.sanction-title { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.sanction-title .rl-icon { color: var(--rouge-vif); }
.sanction-reason { font-size: 13px; color: var(--encre-2); margin-top: 3px; line-height: 1.45; }
.sanction-meta { font-size: 12px; color: var(--encre-3); margin-top: 5px; }

/* ---------- Statistiques ---------- */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.tile {
  border-radius: 14px;
  padding: 12px 13px;
  background: rgb(0 0 0 / 0.2);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.06);
}

.tile-value { font-size: 20px; font-weight: 620; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tile-label { font-size: 12px; color: var(--encre-3); margin-top: 2px; }

/* ---------- Historique des demandes ---------- */

.histo-list { display: flex; flex-direction: column; gap: 6px; }

.histo-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border-radius: 14px;
  background: rgb(255 255 255 / 0.03);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.06);
  color: var(--encre);
  transition: background-color 0.2s, box-shadow 0.2s;
}

.histo-item:hover { background: rgb(255 255 255 / 0.06); }
.histo-item.is-current { background: rgb(255 59 78 / 0.08); box-shadow: inset 0 0 0 1px rgb(255 107 92 / 0.45); }

.histo-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.histo-titre { font-size: 14px; font-weight: 600; }
.histo-meta { font-size: 12px; color: var(--encre-3); }

/* Reprend les couleurs des bandeaux de statut, en plus compact. */
.histo-pastille {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgb(255 255 255 / 0.06);
  color: var(--encre-3);
}

/* ---------- Conversation ----------
   Hauteur fixée en vh : le fil doit défiler à l'intérieur de la carte, pas allonger la page — sinon la
   zone de saisie descend hors de l'écran dès que la conversation s'allonge. */

.talk { display: flex; flex-direction: column; min-height: 520px; height: calc(100vh - 150px); }
.talk-head { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--trait); }
.talk-head .section-title { margin-bottom: 0; font-size: 16px; }
.talk-intro { font-size: 14px; color: var(--encre-2); line-height: 1.55; margin: 6px 0 0; }

.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 4px 12px;
  scrollbar-width: thin;
}

.row { display: flex; align-items: flex-end; gap: 9px; max-width: min(78%, 760px); animation: bulle 0.45s var(--ressort) both; }
.row--me { align-self: flex-end; flex-direction: row-reverse; }
.row--staff { align-self: flex-start; }

@keyframes bulle {
  from { opacity: 0; translate: 0 8px; scale: 0.97; }
}

.row img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: none;
  object-fit: cover;
}

.bubble {
  padding: 11px 15px;
  border-radius: 20px;
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Mes messages en rouge plein, ceux de l'équipe en verre : on sait qui parle sans lire le nom. */
.row--me .bubble {
  color: #fff;
  background: linear-gradient(180deg, #ec3048, #b8132c);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.22);
  border-bottom-right-radius: 7px;
}

.row--staff .bubble {
  background: rgb(255 255 255 / 0.07);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
  border-bottom-left-radius: 7px;
}

.bubble-meta { font-size: 11.5px; color: var(--encre-3); margin-top: 5px; }
.row--me .bubble-meta { text-align: right; }

.bubble img.attach { max-width: 220px; border-radius: 12px; margin-top: 8px; display: block; cursor: zoom-in; }

/* ---------- Saisie ---------- */

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border-radius: 24px;
  padding: 7px 7px 7px 10px;
  margin-top: 12px;
  background: rgb(0 0 0 / 0.3);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.09),
    inset 0 2px 6px rgb(0 0 0 / 0.25);
  transition: box-shadow 0.25s var(--sortie);
}

.composer:focus-within {
  box-shadow:
    inset 0 0 0 1px rgb(255 107 92 / 0.7),
    0 0 0 4px rgb(255 59 78 / 0.14);
}

.composer textarea {
  flex: 1;
  resize: none;
  border: none;
  background: none;
  color: var(--encre);
  font-size: 15px;
  line-height: 1.45;
  max-height: 140px;
  outline: none;
  padding: 8px 4px;
}

.composer textarea::placeholder { color: var(--encre-3); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  color: var(--encre-2);
  background: rgb(255 255 255 / 0.06);
  font-size: 17px;
  transition: color 0.2s, background-color 0.2s, scale 0.45s var(--ressort), opacity 0.2s;
}

.icon-btn:hover:not(:disabled) { color: var(--encre); background: rgb(255 255 255 / 0.11); }
.icon-btn:active:not(:disabled) { scale: 0.9; }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn .rl-icon { vertical-align: 0; }

.send-btn {
  color: #fff;
  background: linear-gradient(180deg, #f2384d, #a10e26);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3), 0 6px 18px -6px var(--rouge-halo);
}

.send-btn:hover:not(:disabled) { color: #fff; background: linear-gradient(180deg, #ff4a5e, #b3122a); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px 5px 12px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.06);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
  font-size: 12.5px;
}

.chip button { color: var(--encre-3); font-size: 14px; }
.chip button:hover { color: var(--rouge-vif); }

/* ---------- États ---------- */

.state { font-size: 14.5px; color: var(--encre-2); line-height: 1.6; margin: 0; }

/* Bouton principal des pages de conversation et de lecture : le bouton rouge du site, en plus compact. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgb(60 0 8 / 0.35);
  background: linear-gradient(180deg, #f2384d 0%, #d4172f 52%, #a10e26 100%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.34),
    inset 0 -3px 8px rgb(70 0 10 / 0.35),
    0 0 0 1px rgb(255 82 98 / 0.55),
    0 12px 32px -10px var(--rouge-halo);
  transition: scale 0.5s var(--ressort), box-shadow 0.35s var(--sortie), opacity 0.2s;
}

.btn:hover { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.4), inset 0 -3px 8px rgb(70 0 10 / 0.35), 0 0 0 1px rgb(255 110 124 / 0.7), 0 18px 44px -10px rgb(255 59 78 / 0.6); }
.btn:active:not(:disabled) { scale: 0.965; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.center-state { display: grid; place-items: center; min-height: 46vh; text-align: center; gap: 16px; padding: 20px 0; }

/* Visionneuse des pièces jointes. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modale);
  display: grid;
  place-items: center;
  padding: 30px;
  background: rgb(4 2 3 / 0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: fondu 0.25s var(--sortie) both;
}

.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: var(--r-interne);
  box-shadow: 0 40px 100px -20px rgb(0 0 0 / 0.9);
  animation: modale-entree 0.5s var(--ressort) both;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  background: rgb(255 255 255 / 0.1);
}

.lightbox-close:hover { background: rgb(255 255 255 / 0.18); }

/* ---------- Bandeau de retour (demande acceptée) ---------- */

/* Vert plutôt que l'accent rouge du site : c'est la seule bonne nouvelle de la page, elle doit se
   distinguer au premier coup d'œil des bandeaux de sanction qui l'entourent. */
.retour-band {
  margin-top: 14px;
  padding: 18px 20px;
  border-radius: var(--r-interne);
  background: var(--vert-fond);
  box-shadow: inset 0 0 0 1px rgb(61 220 132 / 0.32);
}

.retour-titre {
  font-size: 16px;
  font-weight: 620;
  color: var(--vert);
  margin-bottom: 6px;
}

.retour-btn {
  margin-top: 12px;
  color: #05130b;
  text-shadow: none;
  background: linear-gradient(180deg, #5ef0a0, #2cbf6e);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.4), 0 12px 30px -10px rgb(61 220 132 / 0.5);
}

.retour-btn:hover { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), 0 16px 40px -10px rgb(61 220 132 / 0.6); }

.retour-actions { margin-top: 12px; }
