/* Bouton rond */
#chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #ffffff;
    color: white;
    font-size: 26px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 9999;
}

/* Chatbox cachée par défaut */
#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 340px;
    height: 460px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Segoe UI', Arial, sans-serif;
    z-index: 9999;
    animation: fadeIn 0.3s ease-in-out;
}

/* Header */
#chat-header {
    background: #4fa862;
    color: white;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}

#chat-close {
    cursor: pointer;
    font-size: 18px;
    transition: 0.2s;
}

#chat-close:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

/* Corps du chat */
#chat-body {
    flex: 1;
    padding: 12px;
    background: #f5f5f5;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

/* Conteneur de message complet */
.message-wrapper {
    display: flex;
    gap: 8px;
    width: 100%; /* important pour que le client-bulle puisse aller à droite */
    animation: messageAppear 0.2s ease-in-out;
}

/* Bot à gauche */
.message-wrapper.bot {
    flex-direction: row; /* avatar à gauche */
    justify-content: flex-start;
    align-items: flex-start;
}

/* Client à droite */
.message-wrapper.client {
    flex-direction: row-reverse; /* avatar à droite */
    justify-content: flex-end;   /* bulle collée à droite */
    align-items: flex-start;     /* alignement top avec avatar */
}

/* Avatar */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

/* Bulles de messages */
.bot-message, .client-message {
    padding: 10px 14px;
    max-width: 70%;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Bulles bot */
.bot-message {
    background: #ffffff;
    color: #333;
    border-radius: 14px 14px 14px 4px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

/* Bulles client */
.client-message {
    background: #4fa862;
    color: #ffffff;
    border-radius: 14px 14px 4px 14px;
    box-shadow: 0 3px 10px rgba(79,168,98,0.3);
    margin-left: auto;
}

/* Animation apparition message */
@keyframes messageAppear {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Container input */
#chat-input-container {
    display: flex;
    padding: 12px;
    border-top: 1px solid #e0e0e0;
    background: #ffffff;
}

/* Champ texte */
#chat-input {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #ddd;
    outline: none;
    font-size: 14px;
    transition: 0.2s;
}

#chat-input:focus {
    border-color: #4fa862;
    box-shadow: 0 0 0 2px rgba(79,168,98,0.15);
}

/* Bouton envoyer */
#chat-input-container button {
    margin-left: 8px;
    padding: 10px 14px;
    border: none;
    background: #4fa862;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}

#chat-input-container button:hover {
    background: #449955;
    transform: translateY(-1px);
}

#chat-input-container button:active {
    transform: scale(0.97);
}
