/* ZONE DE CHAT */
#chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px 40px; /* Plus d'espace sur les côtés */
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 20px; /* Espace entre les messages */
}

/* STYLE DE BASE DES MESSAGES */
.message {
  padding: 20px 24px;
  border-radius: 18px;
  max-width: 80%; /* Moins large pour faire "bulle" */
  line-height: 1.6; /* Texte plus aéré */
  font-size: 15px;
  position: relative;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Légère ombre */
}

/* MESSAGE UTILISATEUR (Droite) */
.message.user {
  align-self: flex-end; /* Colle la bulle à droite */
  background: #3498db; /* Bleu */
  color: white;
  border-bottom-right-radius: 4px; /* Petit effet "bulle" */
  margin-left: auto; /* Force la position à droite */
  text-align: left; /* IMPORTANT : Le texte reste lisible de gauche à droite */
}

/* MESSAGE ASSISTANT (Gauche) */
.message.assistant {
  align-self: flex-start; /* Colle la bulle à gauche */
  background: white;
  color: #2c3e50;
  border-bottom-left-radius: 4px; /* Petit effet "bulle" */
  border: 1px solid #eef0f2;
}

/* --- STYLES POUR LE CONTENU MARKDOWN (Headers, Listes, etc.) --- */

/* Les paragraphes */
.message p {
  margin-bottom: 10px;
}
.message p:last-child {
  margin-bottom: 0;
}

/* Titres dans les messages (H1, H2, H3...) */
.message h1, .message h2, .message h3, .message h4 {
  font-weight: 700;
  margin-top: 20px;
  margin-bottom: 10px;
  color: #2c3e50;
}

.message.user h1, .message.user h2, .message.user h3 {
  color: white; /* Titres blancs si l'utilisateur en met */
}

/* Le premier élément ne doit pas avoir de marge en haut */
.message > *:first-child {
  margin-top: 0;
}

/* Listes à puces et numérotées */
.message ul, .message ol {
  margin-left: 20px;
  margin-bottom: 15px;
}

.message li {
  margin-bottom: 5px;
  padding-left: 5px;
}

/* Texte en gras */
.message strong {
  font-weight: 700;
}

/* Lignes de séparation (hr) */
.message hr {
  border: 0;
  height: 1px;
  background: #e0e0e0;
  margin: 20px 0;
}

/* Liens */
.message a {
  color: #3498db;
  text-decoration: none;
}
.message.user a {
  color: #e0f7fa;
  text-decoration: underline;
}

/* Blocs de code */
.message pre {
  background: #282c34;
  color: #abb2bf;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 15px 0;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 14px;
}

/* Pensées de l'assistant */
.assistant-thought {
  background: #fff8e1;
  border-left: 4px solid #ffc107;
  padding: 12px 16px;
  margin-bottom: 15px;
  border-radius: 4px;
  font-style: italic;
  font-size: 14px;
  color: #665c26;
}
/* SEARCH RESULTS */
.assistant-search {
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    overflow: hidden;
}

.search-header {
    background: #eee;
    padding: 5px 10px;
    font-weight: bold;
    font-size: 0.9em;
    color: #555;
    border-bottom: 1px solid #ddd;
}

.search-content {
    padding: 10px;
    font-size: 0.9em;
    color: #333;
    overflow-x: auto; /* Pour les tableaux larges */
}

.search-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.search-content th, .search-content td {
    border: 1px solid #ccc;
    padding: 6px;
    text-align: left;
}

.search-content th {
    background: #f0f0f0;
}
