/* ── VerbaSave AI Chat Widget ─────────────────────────────────────────────── */

/* Bubble trigger */
#vs-chat-bubble {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  left: auto !important;
  top: auto !important;
  z-index: 8800;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #4F8EF7;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(79,142,247,.45);
  transition: transform .18s, box-shadow .18s;
}
#vs-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(79,142,247,.6);
}
#vs-chat-bubble svg { color: #fff; }

/* PRO lock badge on bubble */
#vs-chat-bubble .chat-lock {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #F0B429;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #000;
  font-family: 'Nunito', sans-serif;
}

/* Panel */
#vs-chat-panel {
  position: fixed !important;
  bottom: 88px !important;
  right: 24px !important;
  left: auto !important;
  top: auto !important;
  z-index: 8900;
  width: 360px;
  height: 520px;
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, rgba(255,255,255,.1));
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Nunito', sans-serif;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#vs-chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Panel header */
.vsc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
  flex-shrink: 0;
}
.vsc-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4F8EF7, #9B59F7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vsc-header-icon svg { color: #fff; }
.vsc-header-text { flex: 1; }
.vsc-header-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1, #fff);
  line-height: 1.2;
}
.vsc-header-sub {
  font-size: 11px;
  color: var(--text-3, rgba(255,255,255,.4));
  margin-top: 1px;
}
.vsc-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-3, rgba(255,255,255,.4));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.vsc-close:hover {
  background: rgba(255,255,255,.08);
  color: var(--text-1, #fff);
}

/* Messages area */
.vsc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.vsc-messages::-webkit-scrollbar { width: 4px; }
.vsc-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

/* Message bubbles */
.vsc-msg {
  display: flex;
  gap: 8px;
  max-width: 100%;
}
.vsc-msg.user { flex-direction: row-reverse; }
.vsc-msg-body {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.vsc-msg.user .vsc-msg-body {
  background: #4F8EF7;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.vsc-msg.assistant .vsc-msg-body {
  background: var(--card, rgba(255,255,255,.06));
  color: var(--text-1, #fff);
  border-bottom-left-radius: 4px;
}
/* Markdown-light formatting in AI replies */
.vsc-msg.assistant .vsc-msg-body strong { font-weight: 700; }
.vsc-msg.assistant .vsc-msg-body ul { margin: 6px 0; padding-left: 18px; }
.vsc-msg.assistant .vsc-msg-body li { margin-bottom: 3px; }

/* Typing indicator */
.vsc-typing .vsc-msg-body {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}
.vsc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3, rgba(255,255,255,.35));
  animation: vscBounce 1.1s infinite;
}
.vsc-dot:nth-child(2) { animation-delay: .18s; }
.vsc-dot:nth-child(3) { animation-delay: .36s; }
@keyframes vscBounce {
  0%,80%,100% { transform: translateY(0); }
  40%         { transform: translateY(-6px); }
}

/* Counter bar */
.vsc-counter {
  padding: 4px 14px 2px;
  font-size: 10px;
  color: var(--text-3, rgba(255,255,255,.35));
  text-align: right;
  flex-shrink: 0;
}
.vsc-counter.warn { color: #F05A5A; }

/* Input row */
.vsc-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border, rgba(255,255,255,.08));
  flex-shrink: 0;
}
.vsc-input {
  flex: 1;
  background: var(--input-bg, rgba(255,255,255,.06));
  border: 1px solid var(--border, rgba(255,255,255,.1));
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: 'Nunito', sans-serif;
  color: var(--text-1, #fff);
  outline: none;
  resize: none;
  min-height: 36px;
  max-height: 90px;
  line-height: 1.5;
  transition: border-color .15s;
}
.vsc-input::placeholder { color: var(--text-3, rgba(255,255,255,.3)); }
.vsc-input:focus { border-color: #4F8EF7; }
.vsc-send {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: #4F8EF7;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background .15s, opacity .15s;
  align-self: flex-end;
}
.vsc-send:hover { background: #3a7ce8; }
.vsc-send:disabled { opacity: .4; cursor: default; }

/* Pro gate overlay (inside panel) */
.vsc-pro-gate {
  position: absolute;
  inset: 0;
  background: rgba(10,10,20,.88);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  z-index: 10;
}
.vsc-pro-gate h3 {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin: 0;
}
.vsc-pro-gate p {
  font-size: 13px;
  color: rgba(255,255,255,.55);
  margin: 0;
  line-height: 1.5;
}
.vsc-pro-gate .vsc-upgrade-btn {
  margin-top: 4px;
  padding: 9px 20px;
  background: linear-gradient(135deg, #F0B429, #e8a010);
  color: #000;
  font-weight: 800;
  font-size: 13px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity .15s;
}
.vsc-pro-gate .vsc-upgrade-btn:hover { opacity: .88; }
