/* Nimba, l'assistant virtuel : bulle flottante et fenêtre de discussion */

/* Neutralise les styles généraux des pages (boutons en capitales, zones de texte du site…) */
#nimba button, #nimba textarea { text-transform: none; letter-spacing: normal; margin: 0; box-sizing: border-box; }
#nimba .nimba-saisie textarea { height: 40px; background: #fff; color: #222; width: auto; }
.nimba-bouton {
    position: fixed; right: 20px; bottom: 20px; z-index: 9990;
    width: 68px; height: 68px; border-radius: 50%; border: 3px solid #772432;
    background: #fff; box-shadow: 0 6px 20px rgba(0, 65, 101, .35);
    cursor: pointer; padding: 0; overflow: hidden;
    display: grid; place-items: center;
    transition: transform .2s ease, box-shadow .2s ease;
}
.nimba-bouton:hover, .nimba-bouton:focus-visible { transform: scale(1.06); box-shadow: 0 8px 26px rgba(0, 65, 101, .45); outline: none; }
.nimba-bouton img { height: 54px; width: auto; display: block; }
.nimba-bulle {
    position: fixed; right: 96px; bottom: 34px; z-index: 9990;
    background: #004165; color: #fff; font: 600 13px/1.3 Montserrat, Arial, sans-serif;
    padding: 9px 14px; border-radius: 16px 16px 4px 16px; box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
    max-width: 210px; cursor: pointer;
    animation: nimba-apparait .5s ease both .8s;
}
.nimba-bulle[hidden] { display: none; }
@keyframes nimba-apparait { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.nimba-fenetre {
    position: fixed; right: 20px; bottom: 100px; z-index: 9991;
    width: 380px; max-width: calc(100vw - 32px); height: 580px; max-height: calc(100vh - 120px);
    background: #fff; border-radius: 18px; overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
    display: flex; flex-direction: column;
    font: 14px/1.5 Montserrat, Arial, sans-serif; color: #222;
    opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}
.nimba-fenetre[hidden] { display: none; }
.nimba-fenetre.ouverte { opacity: 1; transform: none; pointer-events: auto; }

.nimba-entete {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    background: linear-gradient(135deg, #004165, #00304b); color: #fff;
}
.nimba-entete .nimba-avatar { width: 42px; height: 42px; }
.nimba-entete strong { display: block; font-size: 16px; letter-spacing: .3px; }
.nimba-entete small { display: block; font-size: 11.5px; opacity: .85; }
.nimba-entete .nimba-actions { margin-left: auto; display: flex; gap: 4px; }
.nimba-entete button {
    background: transparent; border: 0; color: #fff; width: 32px; height: 32px; border-radius: 50%;
    cursor: pointer; font-size: 16px; display: grid; place-items: center;
}
.nimba-entete button:hover, .nimba-entete button:focus-visible { background: rgba(255, 255, 255, .15); outline: none; }

.nimba-avatar {
    flex: none; width: 30px; height: 30px; border-radius: 50%; background: #fff;
    border: 2px solid #F2DF74; display: grid; place-items: center; overflow: hidden;
}
.nimba-avatar img { height: 84%; width: auto; }

.nimba-fil { flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: #f5f7f9; }
.nimba-message { display: flex; gap: 8px; margin-bottom: 12px; align-items: flex-end; }
.nimba-message .nimba-texte {
    max-width: 82%; padding: 10px 13px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere;
}
.nimba-message.nimba .nimba-texte { background: #fff; border: 1px solid #e3e8ec; border-bottom-left-radius: 4px; }
.nimba-message.moi { justify-content: flex-end; }
.nimba-message.moi .nimba-texte { background: #772432; color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.nimba-texte p { margin: 0 0 .6em; }
.nimba-texte p:last-child, .nimba-texte ul:last-child { margin-bottom: 0; }
.nimba-texte ul { margin: 0 0 .6em; padding-left: 1.2em; }
.nimba-texte a { color: #004165; text-decoration: underline; }
.nimba-texte .nimba-sources { margin-top: 8px; padding-top: 6px; border-top: 1px dashed #d5dce1; font-size: 12px; color: #5c6b75; }
.nimba-texte .nimba-sources a { display: block; color: #5c6b75; }
.nimba-message.erreur .nimba-texte { background: #fdecec; border-color: #f3c4c4; color: #8a1f1f; }

.nimba-ecrit .nimba-texte { display: inline-flex; gap: 4px; padding: 13px 14px; }
.nimba-ecrit span { width: 7px; height: 7px; border-radius: 50%; background: #A9B2B1; animation: nimba-point 1.2s infinite ease-in-out; }
.nimba-ecrit span:nth-child(2) { animation-delay: .15s; }
.nimba-ecrit span:nth-child(3) { animation-delay: .3s; }
@keyframes nimba-point { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }

.nimba-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; background: #f5f7f9; }
.nimba-suggestions[hidden] { display: none; }
.nimba-suggestions button {
    border: 1px solid #004165; color: #004165; background: #fff; border-radius: 999px;
    padding: 6px 11px; font: 600 12px/1.2 Montserrat, Arial, sans-serif; cursor: pointer;
}
.nimba-suggestions button:hover, .nimba-suggestions button:focus-visible { background: #004165; color: #fff; outline: none; }

.nimba-saisie { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #e3e8ec; background: #fff; align-items: flex-end; }
.nimba-saisie textarea {
    flex: 1; resize: none; border: 1px solid #cfd8de; border-radius: 12px; padding: 9px 12px;
    font: 14px/1.4 Montserrat, Arial, sans-serif; max-height: 110px; min-height: 40px;
}
.nimba-saisie textarea:focus { outline: none; border-color: #004165; box-shadow: 0 0 0 3px rgba(0, 65, 101, .12); }
.nimba-saisie button {
    flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
    background: #772432; color: #fff; font-size: 16px; display: grid; place-items: center;
}
.nimba-saisie button:disabled { background: #A9B2B1; cursor: default; }
.nimba-mention { padding: 0 12px 8px; background: #fff; font-size: 10.5px; color: #8a979f; text-align: center; }

@media (max-width: 520px) {
    .nimba-bouton { right: 14px; bottom: 14px; width: 60px; height: 60px; }
    .nimba-bouton img { height: 46px; }
    .nimba-bulle { right: 84px; bottom: 26px; }
    .nimba-fenetre { top: 0; right: 0; bottom: 0; width: 100vw; max-width: none; height: 100%; height: 100dvh; max-height: none; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .nimba-fenetre, .nimba-bouton, .nimba-bulle { transition: none; animation: none; }
}
