/* ===========================================================================
   support-chat.css — right-side AI support assistant widget for bibamoney.com.
   Lives on top of goga-shell tokens (var(--card)/--primary/--grad-blue/…), so
   it inherits light/dark from <html data-theme> with zero extra theme code.
   Namespaced `.sc-` to stay collision-free when injected onto any page.
   CSP-safe: no inline styles/scripts — pulled in as an external stylesheet.
   =========================================================================== */

/* ---- floating launcher (the micro-robot) ---- */
.sc-launcher{
  position:fixed; right:22px; bottom:22px; z-index:9000;
  display:flex; align-items:center; gap:10px;
  background:var(--card,#101626); border:1px solid var(--border,#243049);
  border-radius:999px; padding:8px 16px 8px 8px;
  box-shadow:var(--shadow-lg); cursor:pointer;
  font-family:'Inter',sans-serif; color:var(--text);
  transition:transform .14s, box-shadow .2s, opacity .2s;
}
.sc-launcher:hover{ transform:translateY(-2px) }
.sc-launcher[hidden]{ display:none }
.sc-launcher__face{
  width:42px; height:42px; border-radius:50%; flex:none; overflow:hidden;
  display:grid; place-items:center; color:#fff; font-size:22px;
  background:var(--grad-blue,linear-gradient(135deg,#2563eb,#7c3aed)); box-shadow:0 6px 16px rgba(37,99,235,.36);
}
/* Branded robot avatar with graceful icon fallback (JS adds .sc-noimg on 404). */
.sc-botimg{ width:100%; height:100%; object-fit:contain; display:block }
.sc-face-ico{ display:none }
.sc-noimg .sc-botimg{ display:none }
.sc-noimg .sc-face-ico{ display:grid; place-items:center }
.sc-launcher__txt{ display:flex; flex-direction:column; line-height:1.15; text-align:left }
.sc-launcher__txt b{ font-size:13.5px; font-weight:800 }
.sc-launcher__txt small{ font-size:11px; color:var(--text2); font-weight:600 }
.sc-launcher__dot{
  position:absolute; top:6px; right:10px; width:11px; height:11px; border-radius:50%;
  background:var(--success); border:2px solid var(--card);
  animation:sc-pulse 2s infinite;
}
@keyframes sc-pulse{ 0%{box-shadow:0 0 0 0 rgba(16,185,129,.5)} 70%{box-shadow:0 0 0 8px rgba(16,185,129,0)} 100%{box-shadow:0 0 0 0 rgba(16,185,129,0)} }

/* ---- panel shell ---- */
.sc-panel{
  position:fixed; right:22px; bottom:22px; z-index:9001;
  width:392px; max-width:calc(100vw - 28px); height:600px; max-height:calc(100vh - 36px);
  display:flex; flex-direction:column; overflow:hidden;
  background:var(--panel); border:1px solid var(--border); border-radius:var(--r);
  box-shadow:var(--shadow-lg); font-family:'Inter',sans-serif; color:var(--text);
  opacity:0; transform:translateY(14px) scale(.98); pointer-events:none;
  transition:opacity .18s, transform .18s, width .22s, height .22s, right .22s, bottom .22s, border-radius .22s;
}
.sc-panel.is-open{ opacity:1; transform:none; pointer-events:auto }
.sc-panel.is-full{
  right:0; bottom:0; top:0; left:auto;
  width:min(560px,100vw); height:100vh; max-height:100vh; border-radius:0;
  border-top:none; border-bottom:none; border-right:none;
}

/* ---- header ---- */
.sc-head{ display:flex; align-items:center; gap:11px; padding:13px 14px;
  background:var(--grad-blue); color:#fff; flex:none }
.sc-head__face{ width:38px; height:38px; border-radius:50%; flex:none; display:grid; place-items:center;
  background:rgba(255,255,255,.16); font-size:20px }
.sc-head__meta{ display:flex; flex-direction:column; line-height:1.2; min-width:0 }
.sc-head__meta b{ font-size:14.5px; font-weight:800 }
.sc-head__meta small{ font-size:11.5px; opacity:.85; display:flex; align-items:center; gap:5px }
.sc-head__meta small::before{ content:""; width:7px; height:7px; border-radius:50%; background:#6ee7b7; flex:none }
.sc-head__btns{ margin-left:auto; display:flex; gap:4px }
.sc-iconbtn{ width:32px; height:32px; border-radius:9px; border:none; cursor:pointer;
  background:rgba(255,255,255,.14); color:#fff; font-size:17px; display:grid; place-items:center; transition:.14s }
.sc-iconbtn:hover{ background:rgba(255,255,255,.28) }

/* ---- adaptive context bar: shows where the user is + why it matters ---- */
.sc-context{ display:flex; align-items:center; gap:8px; padding:9px 14px;
  background:var(--accent-soft); border-bottom:1px solid var(--border);
  font-size:12px; color:var(--text2); flex:none }
.sc-context i{ color:var(--primary); font-size:15px; flex:none }
.sc-context b{ color:var(--text); font-weight:750 }

/* ---- messages ---- */
.sc-body{ flex:1; overflow-y:auto; padding:16px 14px; display:flex; flex-direction:column; gap:12px; background:var(--bg) }
.sc-msg{ max-width:86%; font-size:14px; line-height:1.55; padding:10px 13px; border-radius:14px; white-space:pre-wrap; word-break:break-word }
.sc-msg.bot{ align-self:flex-start; background:var(--card); border:1px solid var(--border); border-bottom-left-radius:5px; box-shadow:var(--shadow) }
.sc-msg.user{ align-self:flex-end; background:var(--grad-blue,linear-gradient(135deg,#2563eb,#7c3aed)); color:#fff; border-bottom-right-radius:5px }
.sc-msg.bot a{ color:var(--primary); font-weight:700 }
.sc-msg.bot strong{ font-weight:800; color:var(--text) }
.sc-msg.bot em{ font-style:italic }
.sc-msg.bot code{ font-family:ui-monospace,monospace; font-size:.9em; background:var(--bg2); padding:1px 5px; border-radius:5px }
.sc-msg.bot h4{ font-size:1.02em; font-weight:800; margin:7px 0 3px }
.sc-msg.bot ul{ margin:5px 0 5px 2px; padding-left:18px }
.sc-msg.bot li{ margin:2px 0 }
.sc-msg__src{ display:block; margin-top:7px; font-size:11px; color:var(--text3) }
.sc-answer-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-top:9px;padding-top:8px;border-top:1px solid var(--border)}
.sc-answer-actions button{min-height:34px;border:1px solid var(--border);border-radius:9px;background:var(--panel);
  color:var(--text2);font:inherit;font-size:11.5px;font-weight:700;padding:6px 9px;cursor:pointer}
.sc-answer-actions button:hover{border-color:var(--primary);color:var(--primary)}
.sc-answer-actions button.is-selected{border-color:var(--success);color:var(--success)}
.sc-answer-actions button.is-down{border-color:var(--danger);color:var(--danger)}
.sc-answer-status{font-size:11px;color:var(--text3)}
.sc-typing{ align-self:flex-start; display:inline-flex; gap:4px; padding:12px 14px; background:var(--card);
  border:1px solid var(--border); border-radius:14px; border-bottom-left-radius:5px }
.sc-typing span{ width:7px; height:7px; border-radius:50%; background:var(--text3); animation:sc-bounce 1.2s infinite }
.sc-typing span:nth-child(2){ animation-delay:.18s } .sc-typing span:nth-child(3){ animation-delay:.36s }
@keyframes sc-bounce{ 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-5px);opacity:1} }

/* ---- suggestion chips (adaptive to page + history) ---- */
.sc-chips{ display:flex; flex-wrap:wrap; gap:7px; padding:10px 14px 4px; flex:none }
.sc-chip{ font-family:inherit; font-size:12.5px; font-weight:650; cursor:pointer;
  background:var(--card); color:var(--text); border:1px solid var(--border2);
  border-radius:999px; padding:7px 13px; transition:.14s; text-align:left }
.sc-chip:hover{ border-color:var(--primary); color:var(--primary) }
.sc-chip i{ color:var(--primary); margin-right:5px }

/* ---- composer ---- */
.sc-foot{ padding:10px 12px 12px; border-top:1px solid var(--border); background:var(--panel); flex:none }
.sc-inputrow{ display:flex; align-items:flex-end; gap:8px; background:var(--card);
  border:1px solid var(--border2); border-radius:14px; padding:6px 6px 6px 14px; transition:border-color .14s }
.sc-inputrow:focus-within{ border-color:var(--primary) }
.sc-input{ flex:1; border:none; background:transparent; resize:none; outline:none; color:var(--text);
  font-family:inherit; font-size:14px; line-height:1.5; max-height:120px; padding:6px 0 }
.sc-send{ width:38px; height:38px; flex:none; border:none; border-radius:11px; cursor:pointer;
  background:var(--grad-blue,linear-gradient(135deg,#2563eb,#7c3aed)); color:#fff; font-size:18px; display:grid; place-items:center; transition:transform .12s, opacity .2s }
.sc-send:hover{ transform:translateY(-1px) }
.sc-send:disabled{ opacity:.45; cursor:default; transform:none }
.sc-foot__row{ display:flex; align-items:center; justify-content:space-between; margin-top:8px; padding:0 2px }
.sc-escalate{ font-family:inherit; font-size:12px; font-weight:700; color:var(--text2); background:none; border:none;
  cursor:pointer; display:inline-flex; align-items:center; gap:5px; transition:color .14s }
.sc-escalate:hover{ color:var(--primary) }
.sc-foot__brand{ font-size:10.5px; color:var(--text3); font-weight:600 }

/* ---- mobile: small panel becomes near-fullscreen ---- */
@media(max-width:560px){
  .sc-panel{ right:0; bottom:calc(62px + env(safe-area-inset-bottom)); width:100vw;
    height:calc(100dvh - 62px - env(safe-area-inset-bottom)); max-height:none; border-radius:16px 16px 0 0; border:none }
  .sc-panel.is-full{ width:100vw }
  .sc-launcher__txt{ display:none }
  .sc-launcher{right:12px;bottom:calc(70px + env(safe-area-inset-bottom));padding:7px}
  .sc-launcher__face{width:40px;height:40px}
  .sc-head{padding-top:max(12px,env(safe-area-inset-top))}
}
