/* =====================================================================
   OptiBot — assistant OPTITECH (chargé sur toutes les pages publiques)
   ===================================================================== */
.sr-only{
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

.optibot{
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}
.optibot > *{ pointer-events: auto; }
.optibot *{ transition: none; }

/* lanceur */
.optibot_lanceur{
    position: relative;
    width: 60px; height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--blue, #0249AE);
    box-shadow: 0 10px 26px rgba(2,73,174,.38);
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s ease, box-shadow .2s ease;
}
.optibot_lanceur:hover{ transform: scale(1.06); }
.optibot_lanceur:focus-visible{ outline: 3px solid var(--yellow, #FDBD56); outline-offset: 3px; }
.optibot_lanceur i{ font-size: 30px; color: #fff; }
.optibot_pastille{
    position: absolute;
    top: 4px; right: 4px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--yellow, #FDBD56);
    border: 2px solid #fff;
}
.optibot.ouvert .optibot_pastille{ display: none; }

/* invitation */
.optibot_teaser{
    position: relative;
    max-width: 240px;
    background: #fff;
    border-radius: 16px 16px 4px 16px;
    padding: 12px 34px 12px 14px;
    box-shadow: 0 10px 30px rgba(0,23,61,.16);
    cursor: pointer;
    animation: optibot_entree .3s ease;
}
.optibot_teaser[hidden]{ display: none; }
.optibot_teaser p{ font-size: 14px; color: #00173D; line-height: 1.4; }
.optibot_teaser_fermer{
    position: absolute; top: 6px; right: 6px;
    border: none; background: none; cursor: pointer;
}
.optibot_teaser_fermer i{ font-size: 18px; color: #5b6478; }

/* panneau */
.optibot_panneau{
    width: 370px;
    max-width: calc(100vw - 24px);
    height: min(600px, calc(100dvh - 120px));
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0,23,61,.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: optibot_entree .25s ease;
}
.optibot_panneau[hidden]{ display: none; }
@keyframes optibot_entree{ from{ opacity: 0; transform: translateY(12px); } to{ opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce){ .optibot_panneau, .optibot_teaser{ animation: none; } }

.optibot_tete{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px 14px 16px;
    background: #00173D;
    background-image: radial-gradient(circle at 100% 0, rgba(253,189,86,.3), transparent 50%);
}
.optibot_avatar{
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--yellow, #FDBD56);
    display: flex; align-items: center; justify-content: center;
    flex: none;
}
.optibot_avatar i{ font-size: 24px; color: #00173D; }
.optibot_tete > div{ flex: 1; min-width: 0; }
.optibot_nom{ font-size: 16px; font-weight: 700; color: #fff; }
.optibot_statut{ font-size: 12px; color: #c9d6ef; }
.optibot_statut::before{
    content: "";
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #3ddc84;
    margin-right: 6px;
    vertical-align: middle;
}
.optibot_tete button{
    border: none; background: rgba(255,255,255,.1);
    width: 34px; height: 34px; border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.optibot_tete button:hover{ background: rgba(255,255,255,.2); }
.optibot_tete button i{ font-size: 20px; color: #fff; }

.optibot_fil{
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f4f7fd;
}
.optibot_msg{
    max-width: 86%;
    font-size: 14.5px;
    line-height: 1.45;
    padding: 10px 13px;
    border-radius: 16px;
    word-wrap: break-word;
}
.optibot_msg.bot{ align-self: flex-start; background: #fff; color: #1f2a44; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,23,61,.06); }
.optibot_msg.moi{ align-self: flex-end; background: var(--blue, #0249AE); color: #fff; border-bottom-right-radius: 4px; }
.optibot_msg.tape{ display: flex; gap: 4px; padding: 14px; }
.optibot_msg.tape span{
    width: 7px; height: 7px; border-radius: 50%;
    background: #9aa7c0;
    animation: optibot_point 1s infinite ease-in-out;
}
.optibot_msg.tape span:nth-child(2){ animation-delay: .15s; }
.optibot_msg.tape span:nth-child(3){ animation-delay: .3s; }
@keyframes optibot_point{ 0%,80%,100%{ opacity: .3; transform: translateY(0); } 40%{ opacity: 1; transform: translateY(-3px); } }

/* cartes de service dans la conversation */
.optibot_carte{
    align-self: stretch;
    background: #fff;
    border: 1px solid #dfe6f3;
    border-left: 4px solid var(--yellow, #FDBD56);
    border-radius: 12px;
    padding: 12px 14px;
}
.optibot_carte_cat{ font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--blue, #0249AE); }
.optibot_carte_nom{ font-size: 15px; font-weight: 700; color: #00173D; margin: 2px 0 4px; }
.optibot_carte_resume{ font-size: 13px; color: #5b6478; line-height: 1.4; }
.optibot_carte_actions{ display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.optibot_carte_actions a, .optibot_carte_actions button{
    font-size: 13px; font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
}
.optibot_carte_actions a{ color: var(--blue, #0249AE); border: 1px solid var(--blue, #0249AE); }
.optibot_carte_actions button{ color: #fff; background: var(--blue, #0249AE); border: 1px solid var(--blue, #0249AE); }

/* liens de contact */
.optibot_liens{ display: grid; gap: 6px; align-self: stretch; }
.optibot_lien{
    display: flex; align-items: center; gap: 10px;
    background: #fff;
    border: 1px solid #dfe6f3;
    border-radius: 12px;
    padding: 10px 12px;
}
.optibot_lien i{ font-size: 20px; color: var(--blue, #0249AE); }
.optibot_lien span{ font-size: 14px; font-weight: 600; color: #00173D; }
.optibot_lien.wa{ background: #1fa855; border-color: #1fa855; }
.optibot_lien.wa i, .optibot_lien.wa span{ color: #fff; }

/* réponses rapides */
.optibot_choix{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: #f4f7fd;
    max-height: 160px;
    overflow-y: auto;
}
.optibot_choix:empty{ display: none; }
.optibot_bouton{
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13.5px; font-weight: 600;
    color: var(--blue, #0249AE);
    background: #fff;
    border: 1.5px solid var(--blue, #0249AE);
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;
}
.optibot_bouton span{ font-size: 13.5px; color: inherit; }
.optibot_bouton i{ font-size: 16px; color: inherit; }
.optibot_bouton:hover{ background: var(--blue, #0249AE); color: #fff; }

/* formulaire de coordonnées */
.optibot_form{
    align-self: stretch;
    background: #fff;
    border-radius: 14px;
    padding: 12px;
    display: grid;
    gap: 8px;
    border: 1px solid #dfe6f3;
}
.optibot_champ{ display: grid; gap: 3px; }
.optibot_champ span{ font-size: 12px; font-weight: 600; color: #00173D; }
.optibot_champ input, .optibot_champ textarea{
    font-size: 14px;
    color: #1f2a44;
    border: 1px solid #c9d3e6;
    border-radius: 8px;
    padding: 8px 10px;
    outline: none;
    resize: vertical;
}
.optibot_champ input:focus, .optibot_champ textarea:focus{ border-color: var(--blue, #0249AE); }
.optibot_champ .invalide{ border-color: #db1702; }
.optibot_envoyer{
    font-size: 14px; font-weight: 700;
    color: #fff;
    background: var(--blue, #0249AE);
    border: none;
    border-radius: 999px;
    padding: 10px;
    cursor: pointer;
}
.optibot_envoyer:disabled{ opacity: .6; }

/* saisie libre */
.optibot_saisie{
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #dfe6f3;
    background: #fff;
}
.optibot_saisie input{
    flex: 1;
    font-size: 15px;
    border: 1px solid #dfe6f3;
    border-radius: 999px;
    padding: 10px 14px;
    outline: none;
    background: #f4f7fd;
}
.optibot_saisie input:focus{ border-color: var(--blue, #0249AE); background: #fff; }
.optibot_saisie button{
    width: 42px; height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--yellow, #FDBD56);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.optibot_saisie button i{ font-size: 20px; color: #00173D; }

/* mobile */
@media screen and (max-width: 760px){
    .optibot{ right: 14px; bottom: 14px; }
    .optibot.optibot_haut{ bottom: 86px; }
    .optibot_lanceur{ width: 54px; height: 54px; }
    .optibot.ouvert{ right: 0; bottom: 0; left: 0; top: 0; align-items: stretch; gap: 0; }
    .optibot.ouvert .optibot_panneau{
        position: fixed;
        inset: 0;
        width: 100%; max-width: none;
        height: 100%;
        height: 100dvh;
        border-radius: 0;
    }
    .optibot.ouvert .optibot_lanceur{ display: none; }
}

/* =====================================================================
   v6 : salutation automatique, chat avec un conseiller, pastille de messages
   ===================================================================== */
.optibot_teaser{ max-width: 300px; padding: 14px 34px 14px 14px; border-radius: 18px 18px 4px 18px; }
.optibot_teaser_tete{ display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.optibot_teaser_tete strong{ font-size: 14px; font-weight: 800; color: #00173D; }
.optibot_avatar.petit{ width: 30px; height: 30px; flex: none; }
.optibot_avatar.petit i{ font-size: 18px; }
.optibot_en_ligne{ display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #1b7f4b; }
.optibot_en_ligne::before{ content: ""; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.optibot_teaser .optibot_teaser_texte{ font-size: 15px; color: #1f2a44; line-height: 1.45; min-height: 22px; }
.optibot_points{ display: inline-flex; gap: 4px; padding: 6px 0; }
.optibot_points span{ width: 7px; height: 7px; border-radius: 50%; background: #9aa7c0; animation: optibot_point 1s infinite ease-in-out; }
.optibot_points span:nth-child(2){ animation-delay: .15s; }
.optibot_points span:nth-child(3){ animation-delay: .3s; }
.optibot_teaser_actions{ display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.optibot_teaser_actions[hidden]{ display: none; }
.optibot_teaser_actions button{
    border: 1px solid #cfdbf1; background: #f4f7fc; color: #00173D; cursor: pointer;
    padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; font-family: inherit;
}
.optibot_teaser_actions button:first-child{ background: var(--blue, #0249AE); border-color: var(--blue, #0249AE); color: #fff; }
.optibot_teaser_actions button:hover{ filter: brightness(1.06); }

.optibot_pastille.compte{
    top: -4px; right: -4px; width: auto; height: auto; min-width: 22px; padding: 2px 6px;
    border-radius: 999px; background: #e11d48; color: #fff; font-size: 12px; font-weight: 800; line-height: 16px; text-align: center;
}

.optibot_msg.agent{
    align-self: flex-start; display: flex; flex-direction: column; gap: 4px;
    background: #fff8e8; color: #1f2a44; border: 1px solid #fde3b0; border-bottom-left-radius: 4px;
}
.optibot_msg.agent span{ font-size: 14px; color: #1f2a44; line-height: 1.45; white-space: pre-wrap; }
.optibot_msg.agent .optibot_msg_auteur{ font-size: 12px; font-weight: 800; color: #b1790b; }

.optibot_form_court{ gap: 8px; }
.optibot_form_actions{ display: flex; gap: 8px; align-items: center; }
.optibot_form_actions .optibot_envoyer{ flex: 1; }
.optibot_plus_tard{ border: none; background: none; color: #5b6478; font-size: 14px; cursor: pointer; text-decoration: underline; font-family: inherit; }

@media screen and (max-width: 760px){
    .optibot_teaser{ max-width: min(300px, calc(100vw - 90px)); }
}
.optibot_champ select{ width: 100%; min-height: 40px; border: 1px solid #c9d3e6; border-radius: 10px; padding: 6px 8px; font-size: 15px; background: #fff; font-family: inherit; }
