/* 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;
}

/* Animation "Réfléchit..." */
@keyframes pulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.4;
    }
}

.thinking-anim {
    color: #7f8c8d;
    font-style: italic;
    animation: pulse 1.5s infinite ease-in-out;
    display: inline-block;
}

/* Style du bouton Stop (quand l'IA génère) */
#send-btn.stop-mode {
    background-color: #e74c3c !important;
    /* Rouge */
}

#send-btn.stop-mode:hover {
    background-color: #c0392b !important;
}

/* PREVIEW FICHIER */
.file-preview {
    display: flex;
    flex-direction: column;
    /* Affichage vertical */
    align-items: flex-start;
    /* Alignement à gauche */
    gap: 5px;
    /* Espacement plus petit */
    padding: 10px;
    background: #fff;
    border: 2px solid #e74c3c;
    /* Cadre rouge */
    border-radius: 8px;
    margin-bottom: 10px;
    /* Juste une marge en bas pour séparer du texte */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    max-height: 150px;
    /* Limite de hauteur avec scroll si beaucoup de fichiers */
    overflow-y: auto;
}

.file-chip {
    display: flex;
    align-items: center;
    background: #f1f2f6;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: #2c3e50;
    border: 1px solid #dfe4ea;
}

.file-chip .remove-file {
    margin-left: 8px;
    cursor: pointer;
    color: #e74c3c;
    font-weight: bold;
    font-size: 16px;
    line-height: 1;
}

.file-chip .remove-file:hover {
    color: #c0392b;
}