/* ===================================================================
   chat.css — l'application de conversation de Noxva AI.

   Elle vit A COTE du site, pas dedans : styles.css porte la charte
   (couleurs, typographie), cette feuille porte la mise en page d'une
   application plein ecran. Aucune couleur n'est redefinie ici, tout
   vient des variables de la charte.
   =================================================================== */

.app {
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--texte);
  font-family: "Open Sans", system-ui, sans-serif;
}

/* Deux colonnes : la liste des conversations, puis le fil.
   La largeur passe a 0 quand le panneau est replie -- une transition sur
   grid-template-columns anime proprement, la ou un display:none saccade. */
.app-grille {
  display: grid;
  grid-template-columns: 272px 1fr;
  height: 100vh;
  transition: grid-template-columns .18s ease;
}
.app-grille.replie { grid-template-columns: 0 1fr; }

/* ---------- colonne des conversations ---------- */
.cote {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
}
.cote-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 10px;
}
.cote-marque {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--texte);
  font-family: Montserrat, sans-serif;
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.cote-marque .logo { width: 26px; height: 26px; flex: 0 0 26px; }

.icone {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--texte-2);
  cursor: pointer;
}
.icone svg { width: 19px; height: 19px; }
.icone:hover { background: var(--bg); color: var(--texte); }

.cote-nouvelle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 12px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--texte);
  font-family: Montserrat, sans-serif;
  font-weight: 600;
  font-size: .87rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cote-nouvelle svg { width: 17px; height: 17px; flex: 0 0 17px; }
.cote-nouvelle:hover { border-color: var(--indigo); box-shadow: var(--ombre); }

.cote-liste {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
}
.cote-groupe {
  padding: 12px 8px 6px;
  font-family: Montserrat, sans-serif;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--texte-2);
}
.conv {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 8px 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--texte);
  font: inherit;
  font-size: .87rem;
  text-align: left;
  cursor: pointer;
}
.conv:hover { background: var(--bg); }
.conv.actif { background: var(--bg); font-weight: 600; }
.conv-nom {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-suppr {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  flex: 0 0 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--texte-2);
  cursor: pointer;
  opacity: 0;
}
.conv:hover .conv-suppr, .conv.actif .conv-suppr { opacity: 1; }
.conv-suppr:hover { background: #F3D9D6; color: var(--erreur); }
.conv-suppr svg { width: 14px; height: 14px; }

.cote-vide {
  padding: 18px 10px;
  font-size: .84rem;
  color: var(--texte-2);
  line-height: 1.55;
}

.cote-pied {
  display: flex;
  gap: 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  white-space: nowrap;
}
.cote-pied a {
  font-size: .8rem;
  color: var(--texte-2);
  text-decoration: none;
}
.cote-pied a:hover { color: var(--navy); text-decoration: underline; }

/* ---------- le fil ---------- */
.fil {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.fil-tete {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.fil-titre {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Montserrat, sans-serif;
  font-size: .98rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.icone-deplier { display: none; }
.app-grille.replie .icone-deplier { display: grid; }

/* ---------- le selecteur de modele ---------- */
.choix { position: relative; flex: 0 0 auto; }
.choix-bouton {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--texte);
  font-family: Montserrat, sans-serif;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease;
}
.choix-bouton:hover { border-color: var(--indigo); }
.choix-fleche { width: 15px; height: 15px; color: var(--texte-2); }
.choix-nom { white-space: nowrap; }

.pastille {
  width: 7px; height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--gris);
}
.pastille.vivant { background: var(--ok); }
.pastille.mort { background: var(--erreur); }

.choix-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 40;
  width: 328px;
  max-width: calc(100vw - 32px);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--ombre-forte);
}
.choix-item {
  display: block;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--texte);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.choix-item:hover { background: var(--bg); }
.choix-item.actif { background: var(--bg); }
.choix-item strong {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: Montserrat, sans-serif;
  font-size: .87rem;
  font-weight: 700;
}
.choix-item .coche { color: var(--navy); font-size: .95rem; line-height: 1; }
.choix-item span {
  display: block;
  margin-top: 3px;
  font-size: .8rem;
  line-height: 1.45;
  color: var(--texte-2);
}
.choix-item em {
  display: block;
  margin-top: 5px;
  font-family: "JetBrains Mono", monospace;
  font-size: .72rem;
  font-style: normal;
  color: var(--texte-2);
}

/* ---------- les messages ---------- */
.fil-corps { flex: 1; overflow-y: auto; }
.fil-flux {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.msg { margin-bottom: 26px; }
.msg-role {
  margin-bottom: 6px;
  font-family: Montserrat, sans-serif;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--texte-2);
}
.msg-corps {
  font-size: .97rem;
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-moi .msg-corps {
  padding: 12px 15px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.msg-ia .msg-role { color: var(--navy); }
.msg-erreur .msg-corps {
  padding: 12px 15px;
  border-radius: 12px;
  background: #FCEEEC;
  border: 1px solid #F0C8C2;
  color: #8C2A1E;
  font-size: .9rem;
}

/* Le curseur qui clignote pendant que le modele ecrit. */
.curseur {
  display: inline-block;
  width: .5em; height: 1.05em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--indigo);
  animation: bat 1s steps(2, start) infinite;
}
@keyframes bat { to { visibility: hidden; } }

/* ---------- l'accueil, quand le fil est vide ---------- */
.accueil { padding: 52px 0 0; text-align: center; }
.accueil h2 {
  margin: 0 0 10px;
  font-family: Montserrat, sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.accueil p {
  max-width: 470px;
  margin: 0 auto 26px;
  color: var(--texte-2);
  line-height: 1.65;
}
.suggestions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
  text-align: left;
}
.suggestion {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--texte);
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.suggestion:hover { border-color: var(--indigo); box-shadow: var(--ombre); }

/* ---------- l'entrainement en cours ---------- */
.entrainement-sur {
  margin: 0 0 10px;
  font-family: Montserrat, sans-serif;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--or-fonce);
}
.entrainement-but {
  max-width: 470px;
  margin: 0 auto 8px;
  font-family: Montserrat, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
}

/* La jauge : un seul filet, sans decoration. Ce qui compte est qu'elle
   avance -- une barre trop ornee donne envie de la regarder plutot que de
   revenir plus tard. */
.jauge {
  max-width: 470px;
  height: 8px;
  margin: 24px auto 10px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}
.jauge-remplie {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--indigo), var(--or));
  transition: width .6s ease;
}
.entrainement-chiffres {
  margin: 0 auto 22px;
  font-size: .88rem;
  color: var(--texte-2);
}
.entrainement-chiffres strong {
  font-family: Montserrat, sans-serif;
  color: var(--encre);
}
.entrainement-mesures {
  display: flex;
  justify-content: center;
  gap: 14px;
}
.entrainement-mesures div {
  min-width: 118px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.entrainement-mesures strong {
  display: block;
  font-family: Montserrat, sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--navy);
}
.entrainement-mesures span {
  display: block;
  margin-top: 2px;
  font-size: .76rem;
  color: var(--texte-2);
}

.renvoi-local {
  margin-top: 22px;
  font-size: .86rem;
  color: var(--texte-2);
}
.renvoi-local a { color: var(--navy); font-weight: 600; }

/* ---------- la zone de saisie ---------- */
.composeur {
  padding: 0 24px 18px;
  background: linear-gradient(to bottom, transparent, var(--bg) 26px);
}
.composeur-boite {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 760px;
  margin: 0 auto;
  padding: 9px 9px 9px 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--ombre);
}
.composeur-boite:focus-within { border-color: var(--indigo); }
.composeur-boite textarea {
  flex: 1;
  max-height: 190px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--texte);
  font: inherit;
  font-size: .97rem;
  line-height: 1.6;
  resize: none;
}
.envoyer {
  display: grid;
  place-items: center;
  width: 35px; height: 35px;
  flex: 0 0 35px;
  border: 0;
  border-radius: 9px;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease;
}
.envoyer svg { width: 18px; height: 18px; }
.envoyer:hover:not(:disabled) { background: var(--navy-clair); }
.envoyer:disabled { background: var(--border); color: var(--texte-2); cursor: not-allowed; }

.composeur-note {
  max-width: 760px;
  margin: 8px auto 0;
  font-size: .76rem;
  color: var(--texte-2);
  text-align: center;
}

/* ---------- petits ecrans ---------- */
@media (max-width: 860px) {
  /* La colonne passe par-dessus le fil au lieu de le comprimer : en
     dessous de 860 px, deux colonnes ne laissent plus de place au texte. */
  .app-grille { grid-template-columns: 0 1fr; }
  .cote {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
    width: 272px;
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: var(--ombre-forte);
  }
  .app-grille:not(.replie) .cote { transform: translateX(0); }
  .icone-deplier { display: grid; }
  .app-grille:not(.replie) .icone-deplier { display: grid; }
  .fil-flux, .composeur-boite, .composeur-note { max-width: none; }
  .suggestions { grid-template-columns: 1fr; }
  .choix-nom { max-width: 108px; overflow: hidden; text-overflow: ellipsis; }
}
