body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f5f5f5;
    margin: 0;
}

/* --- Bouton flottant 💬 --- */
.chat-toggle {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    background: #004080;
    /* Bleu BEA */
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px !important;
    height: 60px !important;
    font-size: 28px;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: background 0.3s, transform 0.2s;
    z-index: 100000 !important;
}

.chat-toggle:hover {
    background: #002d5a;
    /* Bleu plus foncé */
    transform: scale(1.05);
}

/* --- Fenêtre chatbot flottante --- */
.chat-container {
    position: fixed !important;
    bottom: 90px !important;
    right: 20px !important;
    width: auto !important;
    max-width: 350px !important;
    height: 480px !important;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid #004080;
    animation: fadeIn 0.3s ease-in-out;
    z-index: 99999 !important;
}

/* Animation ouverture */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- En-tête --- */
.chat-header {
    background: #004080;
    color: white;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-weight: bold;
}

.chat-header img {
    height: 26px;
}

/* Bouton ✖ */
#close-chat {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    margin-left: auto;
    transition: color 0.3s;
}

#close-chat:hover {
    color: #ffcccc;
}

/* --- Zone de messages --- */
.chat-box {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
}

/* Scrollbar custom */
.chat-box::-webkit-scrollbar {
    width: 6px;
}

.chat-box::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 10px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* Messages */
.bot-message,
.user-message {
    margin: 8px 0;
    padding: 10px 14px;
    border-radius: 10px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.bot-message {
    background: #e6f0ff;
    /* Bleu très clair */
    color: #003366;
    align-self: flex-start;
    /* gauche */
}

.user-message {
    background: #d9f7ff;
    /* Bleu clair */
    color: #004080;
    align-self: flex-end;
    /* droite */
    text-align: right;
}

/* --- Zone de saisie --- */
.chat-input {
    display: flex;
    border-top: 1px solid #ccc;
    background: white;
}

.chat-input input {
    flex: 1;
    padding: 12px;
    border: none;
    outline: none;
    font-size: 14px;
}

.chat-input button {
    background: #004080;
    color: white;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.chat-input button:hover {
    background: #002d5a;
}

/* === Adaptation du bouton de fermeture pour l’arabe === */
html[lang="ar"] #close-chat {
    margin-left: 0 !important;
    margin-right: auto !important;
    left: 10px !important;
    right: auto !important;
}

/* === Position par défaut (français / anglais) === */
html:not([lang="ar"]) #close-chat {
    right: 10px !important;
    left: auto !important;
}

/* --- Sélecteur de langue --- */
.chat-lang-switch {
    margin-left: auto;
    margin-right: 10px;
}

.chat-lang-switch select {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.chat-lang-switch select option {
    color: #000;
}

/* --- Responsive mobile --- */
@media (max-width: 600px) {
    .chat-container {
        max-width: 90% !important;
        right: 5%;
        height: 75vh !important;
    }
}