/* bevadai chat widget */
#cb-btn{position:fixed;bottom:24px;right:24px;z-index:9999;border-radius:28px;background:var(--accent);color:#fff;border:none;cursor:pointer;box-shadow:0 4px 20px rgba(29,92,180,.35),var(--sh-lg);display:flex;align-items:center;gap:.5rem;padding:0 20px;height:56px;transition:transform .2s,background .2s,box-shadow .2s,border-radius .2s;animation:cb-entrance .5s ease-out}
#cb-btn:hover{transform:scale(1.05);background:var(--accent-hover);box-shadow:0 6px 28px rgba(29,92,180,.45),var(--sh-lg)}
#cb-btn svg{width:24px;height:24px;fill:currentColor;flex-shrink:0}
#cb-btn .cb-btn-label{font-family:'Instrument Sans',sans-serif;font-size:.85rem;font-weight:700;letter-spacing:.2px;white-space:nowrap}
#cb-btn.open{border-radius:50%;width:56px;padding:0;justify-content:center}
#cb-btn.open .cb-btn-label{display:none}
#cb-btn.open svg.ico-chat{display:none}
#cb-btn:not(.open) svg.ico-close{display:none}
@keyframes cb-entrance{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}

#cb-panel{position:fixed;bottom:88px;right:20px;z-index:9998;width:380px;max-height:520px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r);box-shadow:var(--sh-lg);display:none;flex-direction:column;overflow:hidden}
#cb-panel.open{display:flex}

#cb-header{padding:.75rem 1rem;border-bottom:1px solid var(--border-light);display:flex;align-items:center;gap:.5rem;flex-shrink:0}
#cb-header .cb-logo{font-family:'Fraunces',serif;font-weight:900;font-size:1rem;color:var(--accent)}
#cb-header .cb-badge{font-size:.7rem;background:var(--accent-soft);color:var(--accent);padding:.15rem .5rem;border-radius:99px;font-weight:600}

#cb-msgs{flex:1;overflow-y:auto;padding:.75rem;display:flex;flex-direction:column;gap:.5rem;min-height:0}
#cb-msgs::-webkit-scrollbar{width:4px}
#cb-msgs::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}

.cb-msg{max-width:85%;padding:.6rem .85rem;border-radius:var(--rs);font-size:.85rem;line-height:1.5;word-wrap:break-word;white-space:pre-wrap}
.cb-msg.user{align-self:flex-end;background:var(--accent);color:#fff;border-bottom-right-radius:4px}
.cb-msg.bot{align-self:flex-start;background:var(--surface-2);color:var(--text);border-bottom-left-radius:4px}
.cb-msg.bot a{color:var(--accent);text-decoration:underline}

.cb-nav-btn{display:inline-block;margin-top:.4rem;padding:.3rem .7rem;background:var(--accent-soft);color:var(--accent);border:1px solid var(--accent-med);border-radius:var(--rs);font-size:.78rem;font-weight:600;cursor:pointer;text-decoration:none;transition:background .15s}
.cb-nav-btn:hover{background:var(--accent-med)}

.cb-typing{align-self:flex-start;padding:.6rem .85rem;background:var(--surface-2);border-radius:var(--rs);display:flex;gap:4px;align-items:center}
.cb-typing span{width:6px;height:6px;border-radius:50%;background:var(--text-3);animation:cb-dot .6s infinite alternate}
.cb-typing span:nth-child(2){animation-delay:.2s}
.cb-typing span:nth-child(3){animation-delay:.4s}
@keyframes cb-dot{to{opacity:.3;transform:translateY(-3px)}}

.cb-suggest{display:flex;flex-wrap:wrap;gap:.4rem;padding:.5rem .75rem}
.cb-suggest button{background:var(--surface-2);color:var(--text-2);border:1px solid var(--border-light);border-radius:99px;padding:.35rem .75rem;font-size:.78rem;font-family:inherit;cursor:pointer;transition:background .15s,border-color .15s}
.cb-suggest button:hover{background:var(--accent-soft);border-color:var(--accent-med);color:var(--accent)}

#cb-input-wrap{display:flex;padding:.5rem;border-top:1px solid var(--border-light);gap:.4rem;flex-shrink:0}
#cb-input{flex:1;border:1.5px solid var(--border);border-radius:var(--rs);padding:.55rem .75rem;font-size:.85rem;font-family:inherit;background:var(--surface);color:var(--text);outline:none;transition:border-color .15s}
#cb-input:focus{border-color:var(--accent)}
#cb-input::placeholder{color:var(--text-3)}
#cb-send{background:var(--accent);color:#fff;border:none;border-radius:var(--rs);padding:.55rem .75rem;font-size:.85rem;font-weight:700;font-family:inherit;cursor:pointer;transition:background .15s;white-space:nowrap}
#cb-send:hover{background:var(--accent-hover)}
#cb-send:disabled{opacity:.5;cursor:not-allowed}

/* RTL support */
html[dir="rtl"] #cb-btn{right:auto;left:20px}
html[dir="rtl"] #cb-panel{right:auto;left:20px}
html[dir="rtl"] .cb-msg.user{border-bottom-right-radius:var(--rs);border-bottom-left-radius:4px}
html[dir="rtl"] .cb-msg.bot{border-bottom-left-radius:var(--rs);border-bottom-right-radius:4px}

/* Mobile: full-screen overlay */
@media(max-width:640px){
  #cb-panel{bottom:0;right:0;left:0;width:100%;max-height:100%;height:100dvh;border-radius:0;border:none}
  #cb-panel.open{position:fixed;top:0}
  #cb-btn{bottom:16px;right:16px;height:48px;padding:0 16px}
  #cb-btn svg{width:22px;height:22px}
  #cb-btn .cb-btn-label{font-size:.8rem}
  html[dir="rtl"] #cb-btn{right:auto;left:16px}
}

@supports(padding:env(safe-area-inset-bottom)){
  #cb-input-wrap{padding-bottom:max(.5rem,env(safe-area-inset-bottom))}
  #cb-btn{bottom:max(20px,calc(env(safe-area-inset-bottom) + 8px))}
}
