:root{
  --bg: rgba(30,30,30,0.95);
  --bg2: rgba(50,50,50,0.95);
  --stroke: rgba(255,255,255,0.15);
  --text: rgba(255,255,255,0.95);
  --muted: rgba(255,255,255,0.65);
  --shadow: 0 10px 40px rgba(0,0,0,0.4);
  --primary: #0A84FF;
  --danger: #ff453a;
  --ok: #34c759;
  --radius: 18px;
  --radius2: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}
[data-wcb-theme="light"]{
  --bg: rgba(255,255,255,0.98);
  --bg2: rgba(245,245,245,0.98);
  --stroke: rgba(0,0,0,0.15);
  --text: rgba(0,0,0,0.92);
  --muted: rgba(0,0,0,0.55);
  --shadow: 0 10px 40px rgba(0,0,0,0.15);
}
#website-chatbot-root{ font-family: var(--sans); }

.wcb-btn-fab{
  position:fixed; bottom:20px; right:20px;
  width:54px; height:54px; border-radius:999px;
  background:linear-gradient(135deg, rgba(10,132,255,1), rgba(10,132,255,0.75));
  border:1px solid rgba(255,255,255,0.25);
  box-shadow:var(--shadow); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  z-index:2147483647;
  transition:transform .18s ease, filter .18s ease;
  user-select:none;
}
.wcb-btn-fab:active{ transform:scale(0.98); filter:brightness(0.98); }
.wcb-btn-fab svg{ width:22px; height:22px; fill:rgba(255,255,255,0.96); }

/* ===== MODAL ===== */
.wcb-modal{
  position:fixed; bottom:20px; right:20px;
  width:min(420px, calc(100vw - 28px));
  height:72vh; max-height:72vh;
  border-radius:var(--radius);
  background:var(--bg);
  border:1px solid var(--stroke);
  box-shadow:var(--shadow);
  backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
  z-index:2147483647;
  overflow:hidden;
  transform-origin:bottom right;
  animation:wcb-pop .16s ease-out;
  pointer-events:auto;
}
@keyframes wcb-pop{
  from{transform:scale(0.98); opacity:0.2}
  to{transform:scale(1); opacity:1}
}

/* ===== HEADER ===== */
.wcb-header{
  position:absolute; top:0; left:0; right:0;
  padding:10px 14px;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  border-bottom:1px solid var(--stroke);
  height:48px; z-index:3;
  background:var(--bg);
}
.wcb-title{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.wcb-title strong{
  color:var(--text); font-size:13.5px; letter-spacing:.2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.wcb-title span{ color:var(--muted); font-size:11.5px; }
.wcb-header-actions{ display:flex; align-items:center; gap:8px; }
.wcb-icon-btn{
  width:28px; height:28px; border-radius:8px;
  background:rgba(70,70,70,0.8); border:1px solid rgba(255,255,255,0.15);
  cursor:pointer; display:flex; align-items:center; justify-content:center;
}
[data-wcb-theme="light"] .wcb-icon-btn{
  background:rgba(230,230,230,0.9); border:1px solid rgba(0,0,0,0.15);
}
.wcb-icon-btn svg{ width:14px; height:14px; fill:var(--muted); }
.wcb-icon-btn:hover svg{ fill:var(--text); }

/* ===== COMPOSER (fixed at bottom) ===== */
.wcb-composer{
  position:absolute; bottom:0; left:0; right:0;
  padding:6px 12px 10px 12px;
  border-top:1px solid var(--stroke);
  display:flex; flex-direction:column; gap:6px;
  background:var(--bg);
  z-index:3;
}
.wcb-quick-replies{
  display:flex; gap:6px; flex-wrap:wrap;
  max-height:68px; overflow-y:auto; overflow-x:hidden;
}
.wcb-quick{
  font-size:11px; padding:5px 9px; border-radius:999px;
  background:rgba(80,80,80,0.8); border:1px solid rgba(255,255,255,0.15);
  color:var(--text); cursor:pointer; white-space:nowrap;
}
[data-wcb-theme="light"] .wcb-quick{ background:rgba(235,235,235,0.9); border:1px solid rgba(0,0,0,0.15); }
.wcb-quick:hover{ background:rgba(100,100,100,0.9); }
[data-wcb-theme="light"] .wcb-quick:hover{ background:rgba(220,220,220,0.95); }

.wcb-input-row{ display:flex; gap:8px; align-items:flex-end; }
.wcb-textarea{
  flex:1; min-height:36px; max-height:80px; resize:none;
  padding:8px 10px; border-radius:10px;
  background:rgba(60,60,60,0.8); border:1px solid rgba(255,255,255,0.2);
  color:var(--text); outline:none; font-size:13px; line-height:1.35;
  font-family:var(--sans);
}
.wcb-textarea:disabled{ opacity:0.5; cursor:not-allowed; }
[data-wcb-theme="light"] .wcb-textarea{ border:1px solid rgba(0,0,0,0.2); background:rgba(245,245,245,0.95); }
.wcb-send-btn{
  width:38px; height:38px; border-radius:10px;
  background:rgba(10,132,255,0.3); border:1px solid rgba(10,132,255,0.5);
  cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
[data-wcb-theme="light"] .wcb-send-btn{ background:rgba(10,132,255,0.25); border:1px solid rgba(10,132,255,0.4); }
.wcb-send-btn svg{ width:16px; height:16px; fill:var(--text); }
.wcb-send-btn:disabled{ opacity:.55; cursor:not-allowed; }
.wcb-voice-btn{
  width:38px; height:38px; border-radius:10px;
  background:rgba(10,132,255,0.3); border:1px solid rgba(10,132,255,0.5);
  cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
[data-wcb-theme="light"] .wcb-voice-btn{ background:rgba(10,132,255,0.25); border:1px solid rgba(10,132,255,0.4); }
.wcb-voice-btn svg{ width:16px; height:16px; fill:var(--text); }
.wcb-voice-btn.listening{
  background:rgba(255,69,58,0.18); border:1px solid rgba(255,69,58,0.32);
  animation:wcb-pulse 1.5s infinite;
}
@keyframes wcb-pulse{ 0%,100%{opacity:1} 50%{opacity:0.5} }
.wcb-stop-btn{
  width:38px; height:38px; border-radius:10px;
  background:rgba(255,69,58,0.3); border:1px solid rgba(255,69,58,0.5);
  cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
[data-wcb-theme="light"] .wcb-stop-btn{ background:rgba(255,69,58,0.25); border:1px solid rgba(255,69,58,0.4); }
.wcb-stop-btn svg{ width:16px; height:16px; fill:var(--text); }

.wcb-actions-row{ display:flex; gap:4px; justify-content:space-between; align-items:center; }
.wcb-small-btn{
  font-size:10px; padding:3px 7px; border-radius:6px;
  background:rgba(80,80,80,0.8); border:1px solid rgba(255,255,255,0.15);
  color:var(--text); cursor:pointer;
}
[data-wcb-theme="light"] .wcb-small-btn{ border:1px solid rgba(0,0,0,0.15); background:rgba(235,235,235,0.9); }
.wcb-small-btn:hover{ background:rgba(100,100,100,0.9); }
[data-wcb-theme="light"] .wcb-small-btn:hover{ background:rgba(220,220,220,0.95); }
.wcb-note{ color:var(--muted); font-size:10px; line-height:1.35; font-weight:500; }

.wcb-whatsapp-row{ display:flex; justify-content:center; }
.wcb-whatsapp-btn{
  display:none; align-items:center; gap:6px;
  padding:7px 14px; background:#25D366; border-radius:8px;
  text-decoration:none; color:white; font-size:12px; font-weight:500;
  transition:background 0.2s, transform 0.1s; border:none; cursor:pointer;
}
.wcb-whatsapp-btn:hover{ background:#128C7E; transform:translateY(-1px); }
.wcb-whatsapp-btn:active{ transform:translateY(0); }
.wcb-whatsapp-icon{ font-size:14px; }
.wcb-whatsapp-text{ white-space:nowrap; }

/* ===== MESSAGES (scrollable, between header and composer) ===== */
.wcb-messages{
  position:absolute;
  top:48px;
  left:0; right:0; bottom:0;
  overflow-y:auto; overflow-x:hidden;
  padding:10px 12px;
  scroll-behavior:smooth;
  overflow-anchor:none;
}
.wcb-msg{
  margin:8px 0; width:100%;
  display:flex; flex-direction:column;
}
.wcb-msg.user{ align-items:flex-end; }
.wcb-msg.bot{ align-items:flex-start; }
.wcb-bubble{
  max-width:86%; padding:10px 12px;
  border-radius:var(--radius2);
  border:1px solid rgba(255,255,255,0.2);
  background:rgba(60,60,60,0.9);
  color:var(--text);
  box-shadow:0 6px 20px rgba(0,0,0,0.15);
  white-space:normal; overflow-wrap:anywhere; word-break:break-word;
}
[data-wcb-theme="light"] .wcb-bubble{ border:1px solid rgba(0,0,0,0.15); background:rgba(240,240,240,0.95); }
.wcb-msg.user .wcb-bubble{
  background:linear-gradient(135deg, rgba(10,132,255,0.9), rgba(10,132,255,0.7));
  border:1px solid rgba(10,132,255,0.5); color:white;
}
[data-wcb-theme="light"] .wcb-msg.user .wcb-bubble{
  background:linear-gradient(135deg, rgba(10,132,255,0.85), rgba(10,132,255,0.65));
  border:1px solid rgba(10,132,255,0.4); color:white;
}
.wcb-meta{
  margin-top:4px; display:flex; justify-content:space-between; gap:10px;
  font-size:11px; color:var(--muted); width:100%;
}
.wcb-meta-btn{
  width:18px; height:18px; border:none; background:transparent;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  opacity:0.6; transition:opacity 0.2s;
}
.wcb-meta-btn:hover{ opacity:1; }
.wcb-meta-btn svg{ width:13px; height:13px; fill:var(--muted); }
.wcb-meta-btn:hover svg{ fill:var(--text); }

.wcb-typing{ display:flex; align-items:center; gap:8px; color:var(--muted); font-size:12px; }
.wcb-dots{ display:flex; gap:3px; }
.wcb-dots span{
  width:6px; height:6px; border-radius:999px; background:var(--muted);
  animation:wcb-bounce 1.1s infinite ease-in-out;
}
.wcb-dots span:nth-child(2){ animation-delay:.12s; }
.wcb-dots span:nth-child(3){ animation-delay:.24s; }
@keyframes wcb-bounce{
  0%,80%,100%{transform:translateY(0); opacity:.55}
  40%{transform:translateY(-5px); opacity:1}
}

.wcb-md table{ width:100%; border-collapse:collapse; margin-top:8px; font-size:12px; }
.wcb-md th,.wcb-md td{ border:1px solid rgba(255,255,255,0.16); padding:6px 8px; text-align:left; }
[data-wcb-theme="light"] .wcb-md th,[data-wcb-theme="light"] .wcb-md td{ border:1px solid rgba(0,0,0,0.12); }
.wcb-md code{
  font-family:var(--mono); font-size:12px;
  background:rgba(255,255,255,0.08); padding:2px 5px; border-radius:6px;
  border:1px solid rgba(255,255,255,0.12);
}
[data-wcb-theme="light"] .wcb-md code{ background:rgba(0,0,0,0.05); border:1px solid rgba(0,0,0,0.10); }
.wcb-md pre{
  background:rgba(0,0,0,0.18); border:1px solid rgba(255,255,255,0.14);
  padding:8px; border-radius:10px; overflow:auto; margin-top:8px;
}
[data-wcb-theme="light"] .wcb-md pre{ background:rgba(0,0,0,0.06); border:1px solid rgba(0,0,0,0.10); }
.wcb-md pre code{ background:transparent; border:none; padding:0; }

.wcb-fade-in{ animation:wcb-fade-in .16s ease-out; }
@keyframes wcb-fade-in{ from{opacity:0} to{opacity:1} }

.wcb-fab-notif{
  position:absolute; top:-8px; right:-6px;
  min-width:18px; height:18px; padding:0 6px;
  background:rgba(255,69,58,1); color:white; font-size:11px;
  border-radius:999px; display:flex; align-items:center; justify-content:center;
  border:2px solid rgba(0,0,0,0.18);
}
[data-wcb-theme="light"] .wcb-fab-notif{ border:2px solid rgba(255,255,255,0.65); }

.wcb-rating-stars{ display:flex; gap:4px; }
.wcb-star{
  background:none; border:none; font-size:24px; cursor:pointer;
  color:var(--muted); transition:color 0.2s, transform 0.1s; padding:0; line-height:1;
}
.wcb-star:hover{ transform:scale(1.1); }
