/* ── Visionex research-brief chatbot widget ──────────────────────────
   Self-contained styles, scoped under #vxChatRoot so nothing here can
   leak into or be affected by a host page's own CSS. Reads the page's
   own brand variables where available, with safe fallbacks for pages
   that don't define the full palette (e.g. --accent, --light, --muted). */

#vxChatRoot {
  --vx-navy:   var(--navy, #0a1628);
  --vx-blue:   var(--blue, #1a56db);
  --vx-accent: var(--accent, #e8b84b);
  --vx-light:  var(--light, #f4f6fb);
  --vx-text:   var(--text, #1c2b4a);
  --vx-muted:  var(--muted, #6b7a99);
  --vx-white:  var(--white, #ffffff);
  --vx-border: var(--border, rgba(26,86,219,0.12));
  font-family: 'DM Sans', -apple-system, sans-serif;
}

#vxChatLauncher {
  position: fixed; right: 24px; bottom: 24px; z-index: 9998;
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--vx-blue), #3b82f6);
  color: #fff; font-size: 1.6rem; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(26,86,219,0.4);
  transition: transform 0.25s, box-shadow 0.25s;
}
#vxChatLauncher:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 14px 38px rgba(26,86,219,0.5); }

/* Attention pulse — a soft expanding ring, repeating until the visitor
   opens the chat for the first time (see chatbot-widget.js). */
#vxChatLauncher.vx-attention::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--vx-blue); animation: vxPulseRing 2.6s cubic-bezier(0.4,0,0.6,1) infinite;
  pointer-events: none;
}
#vxChatLauncher.vx-attention::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--vx-blue); animation: vxPulseRing 2.6s cubic-bezier(0.4,0,0.6,1) infinite;
  animation-delay: 0.6s; pointer-events: none;
}
@keyframes vxPulseRing {
  0%   { transform: scale(1);   opacity: 0.65; }
  70%  { transform: scale(1.65); opacity: 0; }
  100% { transform: scale(1.65); opacity: 0; }
}

#vxChatLauncher .vx-launcher-badge {
  position: absolute; top: -4px; right: -4px; background: var(--vx-accent); color: var(--vx-navy);
  font-size: 0.62rem; font-weight: 800; border-radius: 100px; padding: 3px 7px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* Name label beside the launcher icon — visible until the visitor opens
   the chat for the first time (see stopAttentionPulse() in the JS). */
#vxChatLabel {
  position: fixed; right: 92px; bottom: 38px; z-index: 9997;
  background: var(--vx-white); color: var(--vx-text); font-weight: 700; font-size: 0.82rem;
  padding: 10px 16px; border-radius: 100px; white-space: nowrap;
  box-shadow: 0 10px 28px rgba(10,22,40,0.18); border: 1px solid var(--vx-border);
  opacity: 0; transform: translateX(8px); pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#vxChatLabel::after {
  content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%) rotate(45deg);
  width: 12px; height: 12px; background: var(--vx-white); border-right: 1px solid var(--vx-border);
  border-bottom: 1px solid var(--vx-border);
}
#vxChatLabel.vx-visible { opacity: 1; transform: none; }

@media (max-width: 640px) {
  #vxChatLabel { display: none; }
}

#vxChatPanel {
  position: fixed; right: 24px; bottom: 98px; z-index: 9999;
  width: 360px; max-width: calc(100vw - 32px); height: 520px; max-height: calc(100vh - 140px);
  background: var(--vx-white); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(10,22,40,0.35);
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(16px) scale(0.98); pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#vxChatPanel.vx-open { opacity: 1; transform: none; pointer-events: auto; }

.vx-chat-header {
  background: linear-gradient(135deg, var(--vx-navy) 0%, #0f2044 60%, #132a5e 100%);
  color: #fff; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0;
}
.vx-chat-header-info { display: flex; align-items: center; gap: 10px; }
.vx-chat-header-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0;
}
.vx-chat-header-title { font-weight: 700; font-size: 0.92rem; }
.vx-chat-header-sub { font-size: 0.72rem; color: rgba(255,255,255,0.6); display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.vx-chat-header-sub .dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; display: inline-block; }
#vxChatClose {
  background: rgba(255,255,255,0.1); border: none; color: #fff; width: 28px; height: 28px; border-radius: 8px;
  cursor: pointer; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background 0.2s;
}
#vxChatClose:hover { background: rgba(255,255,255,0.2); }

.vx-chat-body {
  flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px;
  background: var(--vx-light);
}
.vx-chat-body::-webkit-scrollbar { width: 5px; }
.vx-chat-body::-webkit-scrollbar-thumb { background: var(--vx-border); border-radius: 3px; }

.vx-msg { max-width: 82%; font-size: 0.85rem; line-height: 1.55; padding: 10px 14px; border-radius: 14px; animation: vxIn 0.25s ease; word-wrap: break-word; }
@keyframes vxIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.vx-msg-bot { align-self: flex-start; background: var(--vx-white); color: var(--vx-text); border: 1px solid var(--vx-border); border-bottom-left-radius: 4px; }
.vx-msg-user { align-self: flex-end; background: var(--vx-blue); color: #fff; border-bottom-right-radius: 4px; }
.vx-msg-suggest { border-color: rgba(232,184,75,0.4); background: rgba(232,184,75,0.08); }
.vx-msg-suggest a { color: var(--vx-blue); font-weight: 700; text-decoration: none; }
.vx-msg-suggest a:hover { text-decoration: underline; }

.vx-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: var(--vx-white); border: 1px solid var(--vx-border); border-radius: 14px; border-bottom-left-radius: 4px; }
.vx-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--vx-muted); opacity: 0.5; animation: vxBounce 1s infinite; }
.vx-typing span:nth-child(2) { animation-delay: 0.15s; }
.vx-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes vxBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

.vx-chat-footer { border-top: 1px solid var(--vx-border); padding: 12px 14px; background: var(--vx-white); flex-shrink: 0; }

.vx-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.vx-choice-btn {
  background: var(--vx-light); border: 1.5px solid var(--vx-border); color: var(--vx-text);
  font-size: 0.8rem; font-weight: 600; padding: 8px 14px; border-radius: 100px; cursor: pointer;
  font-family: inherit; transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.vx-choice-btn:hover { background: var(--vx-blue); border-color: var(--vx-blue); color: #fff; }

.vx-input-row { display: flex; gap: 8px; }
.vx-input-row input {
  flex: 1; font-family: inherit; font-size: 0.85rem; padding: 10px 14px; border-radius: 100px;
  border: 1.5px solid var(--vx-border); outline: none; color: var(--vx-text); background: var(--vx-light);
  transition: border-color 0.2s;
}
.vx-input-row input:focus { border-color: var(--vx-blue); }
.vx-input-row button {
  background: var(--vx-blue); color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; font-size: 1rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.2s;
}
.vx-input-row button:hover { background: #1446c0; transform: scale(1.05); }
.vx-input-row button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.vx-skip-link { display: block; text-align: center; font-size: 0.72rem; color: var(--vx-muted); margin-top: 8px; cursor: pointer; text-decoration: underline; }
.vx-skip-link:hover { color: var(--vx-blue); }

.vx-error-text { color: #e11d48; font-size: 0.75rem; margin-top: 6px; display: none; }

.vx-restart-row { text-align: center; padding: 4px 0 2px; }
.vx-restart-btn {
  background: none; border: 1.5px solid var(--vx-border); color: var(--vx-muted); font-size: 0.75rem;
  font-weight: 600; padding: 7px 16px; border-radius: 100px; cursor: pointer; font-family: inherit;
  transition: border-color 0.2s, color 0.2s;
}
.vx-restart-btn:hover { border-color: var(--vx-blue); color: var(--vx-blue); }

@media (max-width: 420px) {
  #vxChatPanel { right: 16px; left: 16px; width: auto; bottom: 92px; }
  #vxChatLauncher { right: 16px; bottom: 16px; }
}
