/* ============================================================
   CHATBOT — BOX ANTI-NUISIBLES ASSISTANT
   Bulle flottante bas-droite + panneau premium intégré à la DA.
   ============================================================ */

#chatbotRoot{position:fixed; bottom:20px; right:20px; z-index:900; font-family:'Poppins',sans-serif;}

/* ---- Bubble (closed state) ---- */
#chatbotToggle{
  width:56px; height:56px; border-radius:50%; background:var(--green);
  display:flex; align-items:center; justify-content:center; color:#06170F;
  box-shadow:0 8px 24px rgba(0,0,0,.4); border:none; cursor:pointer;
  transition:transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease;
  position:relative;
}
#chatbotToggle:hover{transform:scale(1.06);}
#chatbotToggle:focus-visible{outline:2px solid var(--green); outline-offset:4px;}
#chatbotToggle svg{width:24px; height:24px;}
#chatbotToggle .cb-close-icon{display:none;}
#chatbotRoot.open #chatbotToggle .cb-chat-icon{display:none;}
#chatbotRoot.open #chatbotToggle .cb-close-icon{display:block;}
#chatbotToggle .cb-pulse{
  position:absolute; inset:-4px; border-radius:50%; border:1.5px solid var(--green);
  opacity:0; animation:cbPulse 2.6s ease-out infinite;
}
@keyframes cbPulse{0%{opacity:.6; transform:scale(.9);} 100%{opacity:0; transform:scale(1.35);}}
#chatbotRoot.open #chatbotToggle .cb-pulse{display:none;}

/* ---- Panel (open state) ---- */
#chatbotPanel{
  position:absolute; bottom:70px; right:0; width:360px; height:min(560px, 74vh);
  background:var(--base); border:1px solid var(--line-strong); border-radius:10px;
  box-shadow:0 24px 60px rgba(0,0,0,.55); display:flex; flex-direction:column;
  opacity:0; transform:translateY(16px) scale(.97); pointer-events:none;
  transition:opacity .22s ease, transform .22s cubic-bezier(.2,.8,.2,1);
  overflow:hidden;
}
#chatbotRoot.open #chatbotPanel{opacity:1; transform:translateY(0) scale(1); pointer-events:auto;}

.cb-header{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:16px 18px; border-bottom:1px solid var(--line); background:var(--surface); flex:0 0 auto;
}
.cb-header-title{display:flex; align-items:center; gap:10px; font-size:13.5px; font-weight:700;}
.cb-header-title .cb-dot{width:7px; height:7px; border-radius:50%; background:var(--green); box-shadow:0 0 8px var(--green); flex:0 0 auto;}
.cb-header-sub{font-size:10.5px; color:var(--text-muted); font-family:'JetBrains Mono',monospace; margin-top:2px;}
#chatbotCloseBtn{background:none; border:none; color:var(--text-muted); cursor:pointer; padding:4px; display:flex;}
#chatbotCloseBtn:hover{color:var(--text);}
#chatbotCloseBtn:focus-visible{outline:2px solid var(--green); outline-offset:2px;}

.cb-messages{
  flex:1 1 auto; overflow-y:auto; padding:16px 18px; display:flex; flex-direction:column; gap:12px;
  scroll-behavior:smooth;
}
.cb-msg{max-width:85%; font-size:13.5px; line-height:1.55; animation:cbMsgIn .25s ease;}
@keyframes cbMsgIn{from{opacity:0; transform:translateY(6px);} to{opacity:1; transform:translateY(0);}}
.cb-msg.bot{align-self:flex-start; background:var(--surface); border:1px solid var(--line); padding:10px 13px; border-radius:2px 10px 10px 10px; color:var(--text);}
.cb-msg.user{align-self:flex-end; background:var(--green-dim); border:1px solid var(--green); padding:10px 13px; border-radius:10px 2px 10px 10px; color:var(--text);}
.cb-msg .cb-card{margin-top:8px; padding:12px; background:var(--surface-2); border:1px solid var(--line-strong); border-radius:4px;}
.cb-msg .cb-card .k{font-family:'JetBrains Mono',monospace; font-size:10px; color:var(--text-muted); letter-spacing:.06em; margin-bottom:2px;}
.cb-msg .cb-card .v{font-size:13.5px; font-weight:700; margin-bottom:8px;}
.cb-msg .cb-card .v:last-child{margin-bottom:0;}
.cb-msg .cb-cta{display:inline-flex; align-items:center; gap:6px; margin-top:10px; padding:9px 14px; background:var(--green); color:#06170F; font-size:12.5px; font-weight:700; border-radius:2px; text-decoration:none;}
.cb-msg .cb-cta:hover{filter:brightness(1.08);}
.cb-typing{align-self:flex-start; display:flex; gap:4px; padding:12px 14px; background:var(--surface); border:1px solid var(--line); border-radius:2px 10px 10px 10px;}
.cb-typing span{width:6px; height:6px; border-radius:50%; background:var(--text-muted); animation:cbTyping 1.1s ease-in-out infinite;}
.cb-typing span:nth-child(2){animation-delay:.15s;} .cb-typing span:nth-child(3){animation-delay:.3s;}
@keyframes cbTyping{0%,100%{opacity:.3; transform:translateY(0);} 50%{opacity:1; transform:translateY(-3px);}}

.cb-quick-replies{display:flex; flex-wrap:wrap; gap:7px; padding:0 18px 12px; flex:0 0 auto;}
.cb-quick-replies button{
  font-family:'JetBrains Mono',monospace; font-size:11.5px; padding:8px 12px; border-radius:100px;
  border:1px solid var(--line-strong); color:var(--text); background:none; cursor:pointer;
  transition:border-color .2s ease, color .2s ease, background .2s ease;
}
.cb-quick-replies button:hover{border-color:var(--green); color:var(--green); background:var(--green-dim);}
.cb-quick-replies button:focus-visible{outline:2px solid var(--green); outline-offset:2px;}

.cb-input-row{display:flex; gap:8px; padding:14px 16px; border-top:1px solid var(--line); background:var(--surface); flex:0 0 auto;}
.cb-input-row input{
  flex:1; background:var(--surface-2); border:1px solid var(--line-strong); border-radius:2px;
  padding:10px 12px; color:var(--text); font-size:13px; font-family:'Poppins',sans-serif;
}
.cb-input-row input:focus{outline:none; border-color:var(--green);}
.cb-input-row button{
  width:38px; height:38px; border-radius:2px; background:var(--green); border:none; color:#06170F;
  display:flex; align-items:center; justify-content:center; cursor:pointer; flex:0 0 auto;
  transition:filter .2s ease;
}
.cb-input-row button:hover{filter:brightness(1.08);}
.cb-input-row button:focus-visible{outline:2px solid var(--green); outline-offset:2px;}
.cb-input-row button:disabled{opacity:.4; cursor:default;}

@media (prefers-reduced-motion: reduce){
  #chatbotToggle .cb-pulse{display:none;}
  .cb-msg{animation:none;}
  #chatbotPanel{transition:opacity .12s linear;}
}

@media (max-width:480px){
  #chatbotRoot{bottom:14px; right:14px;}
  #chatbotPanel{
    position:fixed; inset:auto 10px 82px 10px; width:auto; height:min(70vh, 520px);
  }
}
