/* Déclaration des variables */
:root {
    --font-family: 'Helvetica Neue', Arial, sans-serif;
    --background-color: #1a1d21;
    --text-color: #e0e0e0;
    --header-background-color: #242830;
    --message-user-bg: #2C5282;
    --message-bot-bg: #2d3748;
    --button-bg: #38b2ac;
    --button-hover-bg: #319795;
    --input-border-color: #4a5568;
    --input-bg-color: #2d3748;
    --border-radius: 20px;
    --message-border-radius: 12px;
    --message-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    --message-line-height: 1.4;
    --font-size: 1em;
    --typing-indicator-color: #a0aec0;
    --typing-indicator-bg: #2d3748;
    --markdown-header-color: #4fd1c5;
    --markdown-bg-color: #1a202c;
    --code-bg-color: #2d3748;
}

/* Réinitialisation des styles par défaut */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Style du corps de la page */
body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin: 0;
}

/* Style de l'en-tête */
header {
    background-color: var(--header-background-color);
    text-align: center;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--input-border-color);
}

/* Style du logo */
.logo {
    width: 150px;
    height: auto;
}

/* Style du texte de l'en-tête */
.text-entete {
    font-size: 1.2em;
    line-height: var(--message-line-height);
    max-width: 80%;
    margin: 0 auto;
    display: none;
}

/* Style de la boîte de chat */
#chatbox {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 auto;
    width: 100%;
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
    background: var(--background-color);
}

/* Style des messages */
.message {
    max-width: 80%;
    padding: 10px 15px;
    font-size: var(--font-size);
    line-height: var(--message-line-height);
    word-wrap: break-word;
    border-radius: var(--message-border-radius);
    box-shadow: var(--message-shadow);
}

/* Messages de l'utilisateur */
.message.user {
    align-self: flex-end;
    background-color: var(--message-user-bg);
    color: #ffffff;
    border-radius: var(--border-radius) var(--border-radius) 0 var(--border-radius);
}

/* Messages du chatbot */
.message.bot {
    align-self: flex-start;
    background-color: var(--message-bot-bg);
    color: var(--text-color);
    border-radius: var(--border-radius) var(--border-radius) var(--border-radius) 0;
}

/* Style pour le rendu Markdown */
.message.bot h1, 
.message.bot h2, 
.message.bot h3 {
    color: var(--markdown-header-color);
    margin-top: 10px;
    margin-bottom: 5px;
}

.message.bot ul {
    padding-left: 20px;
    list-style-type: disc;
}

.message.bot ol {
    padding-left: 20px;
    list-style-type: decimal;
}

.message.bot pre {
    background: var(--markdown-bg-color);
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    overflow-x: auto;
}

.message.bot code {
    background: var(--code-bg-color);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
}

/* Style pour l'indicateur de frappe */
.typing-indicator {
    font-style: italic;
    color: var(--typing-indicator-color);
    align-self: flex-start;
    padding: 10px;
    border-radius: 10px;
    background: var(--typing-indicator-bg);
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Animation des points de l'indicateur */
.dot-container .dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 3px;
    background-color: var(--typing-indicator-color);
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

.dot-container .dot:nth-child(1) { animation-delay: 0s; }
.dot-container .dot:nth-child(2) { animation-delay: 0.2s; }
.dot-container .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* Style du formulaire de chat */
#chatForm {
    display: flex;
    padding: 10px;
    background-color: var(--input-bg-color);
    border-top: 1px solid var(--input-border-color);
    position: relative;
    margin: 0 auto;
    width: 100%;
}

/* Champ de saisie */
#userInput {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--input-border-color);
    border-radius: var(--border-radius);
    font-size: var(--font-size);
    outline: none;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Bouton d'envoi */
#chatForm button {
    background-color: var(--button-bg);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    margin-left: 10px;
    font-size: var(--font-size);
    cursor: pointer;
    transition: background-color 0.3s;
}

#chatForm button:hover {
    background-color: var(--button-hover-bg);
}

/* Media queries pour les petits écrans */
@media (max-width: 600px) {
    .text-entete {
        font-size: 1em;
        padding: 10px;
    }

    #chatbox {
        max-width: 100%;
    }

    #chatForm {
        max-width: 100%;
    }

    #chatForm button {
        padding: 10px;
        margin-left: 5px;
    }
}