/* ==========================================================================
   VSN · chat do site (ponte para o WhatsApp via Apollo Bot)
   Tema próprio (escuro), independente da página em que está.
   ========================================================================== */
.vsn-chat, .vsn-chat * { box-sizing: border-box; }
.vsn-chat {
  --c-bg: #0b0b0f;
  --c-panel: #111117;
  --c-ink: #f4f1ea;
  --c-dim: #8a8580;
  --c-line: rgba(244, 241, 234, 0.12);
  --c-orange: #f26a1b;
  --c-green: #25d366;
  --c-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --c-font: "Space Grotesk", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --c-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 90;
  font-family: var(--c-font);
  color: var(--c-ink);
  line-height: 1.4;
}
html.vsn-chat-on .whatsapp-float, html.vsn-chat-on .wa-float { display: none !important; }
html.vsn-chat-on .language-switch { bottom: 84px; }

/* ---- botão flutuante ---- */
.vsn-chat-btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 18px 0 14px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--c-green); color: #062b15;
  font: 700 0.95rem/1 var(--c-font);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(37, 211, 102, 0.5);
  transition: transform 0.35s var(--c-ease), box-shadow 0.35s var(--c-ease);
  animation: vsnPulse 2.8s ease-out 1.2s 3;
}
.vsn-chat-btn:hover { transform: translateY(-2px); }
.vsn-chat-btn svg { width: 24px; height: 24px; fill: currentColor; flex: 0 0 auto; }
.vsn-chat-btn .vsn-badge {
  position: absolute; top: -6px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--c-orange); color: #fff; font: 800 0.72rem/22px var(--c-mono);
  text-align: center; display: none; box-shadow: 0 0 0 2px var(--c-bg);
}
.vsn-chat-btn.has-unread .vsn-badge { display: block; }
.vsn-chat-btn { position: relative; }
.vsn-chat.open .vsn-chat-btn { display: none; }
@keyframes vsnPulse {
  0% { box-shadow: 0 10px 30px rgba(0,0,0,.35), 0 0 0 0 rgba(37,211,102,.55); }
  100% { box-shadow: 0 10px 30px rgba(0,0,0,.35), 0 0 0 18px rgba(37,211,102,0); }
}

/* ---- painel ---- */
.vsn-chat-panel {
  display: none; flex-direction: column;
  width: 370px; max-width: calc(100vw - 28px);
  height: 560px; max-height: calc(100vh - 28px - env(safe-area-inset-bottom));
  border: 1px solid var(--c-line); border-radius: 18px; overflow: hidden;
  background: var(--c-panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  transform-origin: bottom right;
  animation: vsnOpen 0.35s var(--c-ease);
}
.vsn-chat.open .vsn-chat-panel { display: flex; }
@keyframes vsnOpen { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }

.vsn-chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px 12px; border-bottom: 1px solid var(--c-line);
  background: linear-gradient(180deg, rgba(242,106,27,0.12), transparent);
}
.vsn-chat-mark {
  width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto;
  background: var(--c-orange); color: #fff; display: grid; place-items: center;
  font: 900 0.8rem/1 Inter, Arial, sans-serif; letter-spacing: -0.02em;
}
.vsn-chat-title { flex: 1; min-width: 0; }
.vsn-chat-title strong { display: block; font-size: 0.98rem; letter-spacing: -0.01em; }
.vsn-chat-title small { display: flex; align-items: center; gap: 6px; color: var(--c-dim); font: 600 0.68rem/1.3 var(--c-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.vsn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-dim); flex: 0 0 auto; }
.vsn-dot.on { background: var(--c-green); box-shadow: 0 0 0 3px rgba(37,211,102,0.2); }
.vsn-chat-x {
  width: 34px; height: 34px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--c-dim); font-size: 1.3rem; line-height: 1;
}
.vsn-chat-x:hover { background: rgba(255,255,255,0.06); color: var(--c-ink); }

.vsn-chat-body {
  flex: 1; overflow-y: auto; padding: 14px 12px 6px;
  display: flex; flex-direction: column; gap: 8px;
  background:
    radial-gradient(600px 300px at 100% 0%, rgba(242,106,27,0.06), transparent 60%),
    var(--c-bg);
  scroll-behavior: smooth;
}
.vsn-msg { max-width: 84%; padding: 9px 12px; border-radius: 14px; font-size: 0.92rem; white-space: pre-wrap; word-wrap: break-word; animation: vsnIn 0.25s var(--c-ease); }
.vsn-msg.out { align-self: flex-end; background: var(--c-orange); color: #fff; border-bottom-right-radius: 4px; }
.vsn-msg.in  { align-self: flex-start; background: #1c1c25; border: 1px solid var(--c-line); border-bottom-left-radius: 4px; }
.vsn-msg.sys { align-self: center; max-width: 92%; text-align: center; color: var(--c-dim); font-size: 0.78rem; background: transparent; padding: 4px 8px; }
.vsn-msg.sys a { color: var(--c-ink); text-decoration: underline; }
.vsn-meta { display: block; margin-top: 4px; font: 500 0.64rem/1 var(--c-mono); opacity: 0.7; text-align: right; }
.vsn-msg.in .vsn-meta { text-align: left; }
@keyframes vsnIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.vsn-chat-foot { border-top: 1px solid var(--c-line); background: var(--c-panel); padding: 10px 12px 10px; }
.vsn-chat-name { display: flex; gap: 8px; margin-bottom: 8px; }
.vsn-chat-name input, .vsn-chat-form textarea {
  width: 100%; border: 1px solid var(--c-line); border-radius: 12px; background: #0e0e13; color: var(--c-ink);
  font: 500 0.92rem/1.4 var(--c-font); padding: 10px 12px; outline: none;
}
.vsn-chat-name input { padding: 8px 12px; font-size: 0.85rem; }
.vsn-chat-name input:focus, .vsn-chat-form textarea:focus { border-color: rgba(242,106,27,0.6); }
.vsn-chat-form { display: flex; gap: 8px; align-items: flex-end; }
.vsn-chat-form textarea { resize: none; max-height: 120px; min-height: 42px; }
.vsn-chat-send {
  width: 44px; height: 44px; flex: 0 0 auto; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--c-orange); color: #fff; display: grid; place-items: center;
  transition: transform 0.2s var(--c-ease), opacity 0.2s;
}
.vsn-chat-send:disabled { opacity: 0.45; cursor: default; }
.vsn-chat-send:not(:disabled):hover { transform: translateY(-1px); }
.vsn-chat-send svg { width: 20px; height: 20px; fill: currentColor; }
.vsn-chat-alt { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font: 600 0.66rem/1.3 var(--c-mono); color: var(--c-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.vsn-chat-alt a { color: var(--c-green); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.vsn-chat-alt a:hover { text-decoration: underline; }
.vsn-chat-alt a svg { width: 14px; height: 14px; fill: currentColor; }
.vsn-chat-alt code { color: var(--c-dim); }

@media (max-width: 520px) {
  .vsn-chat { right: 0; bottom: 0; left: 0; display: flex; justify-content: flex-end; padding: 0 14px max(14px, env(safe-area-inset-bottom)); pointer-events: none; }
  .vsn-chat > * { pointer-events: auto; }
  .vsn-chat.open { padding: 0; }
  .vsn-chat-panel { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .vsn-chat-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .vsn-chat-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .vsn-chat-btn span { display: none; }
  .vsn-chat-btn { width: 56px; padding: 0; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .vsn-chat-btn, .vsn-chat-panel, .vsn-msg { animation: none; }
}

/* ---- Apollo Bot ---- */
.vsn-chat-powered {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 12px 10px; border-top: 1px dashed var(--c-line); background: var(--c-panel);
  color: var(--c-dim); text-decoration: none; font: 500 0.7rem/1 var(--c-mono); letter-spacing: 0.03em;
}
.vsn-chat-powered:hover { color: var(--c-ink); }
.vsn-chat-powered svg { width: 16px; height: 16px; border-radius: 4px; flex: 0 0 auto; }
.vsn-chat-powered b { color: var(--c-ink); font-weight: 700; }

/* ---- avaliação ao encerrar ---- */
.vsn-rate { align-self: center; text-align: center; padding: 10px 14px; border: 1px solid var(--c-line); border-radius: 14px; background: #14141b; animation: vsnIn 0.25s var(--c-ease); }
.vsn-rate-q { display: block; font-size: 0.85rem; margin-bottom: 4px; }
.vsn-stars { display: flex; justify-content: center; gap: 2px; }
.vsn-stars button { border: 0; background: none; cursor: pointer; font-size: 1.7rem; line-height: 1; color: #3a3a46; padding: 2px 3px; transition: transform 0.15s var(--c-ease), color 0.15s; }
.vsn-stars button.on { color: #f5b93f; }
.vsn-stars button:hover { transform: scale(1.15); }
.vsn-rate-done { font-size: 0.85rem; color: #f5b93f; }

/* ---- duas telas: lista ↔ conversa ---- */
.vsn-chat-back {
  display: none; width: 34px; height: 34px; margin-left: -4px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--c-ink); font-size: 1.7rem; line-height: 1; padding-bottom: 4px;
}
.vsn-chat-back:hover { background: rgba(255,255,255,0.06); }
.vsn-chat.view-chat .vsn-chat-back { display: inline-grid; place-items: center; }
.vsn-chat.view-chat .vsn-chat-mark { display: none; }
.vsn-chat.view-list .vsn-chat-body, .vsn-chat.view-list .vsn-chat-foot { display: none; }
.vsn-chat.view-chat .vsn-list { display: none; }

.vsn-list { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--c-bg); }
.vsn-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 8px; font: 700 0.72rem/1 var(--c-mono); color: var(--c-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.vsn-new {
  border: 1px solid rgba(242,106,27,0.5); border-radius: 999px; background: rgba(242,106,27,0.12); color: var(--c-ink); cursor: pointer;
  font: 700 0.78rem/1 var(--c-font); padding: 8px 12px; transition: background 0.2s, transform 0.2s var(--c-ease);
}
.vsn-new:hover { background: var(--c-orange); color: #fff; transform: translateY(-1px); }
.vsn-new-closed { display: none; width: 100%; padding: 12px; border-radius: 12px; font-size: 0.9rem; }
.vsn-list-items { flex: 1; overflow-y: auto; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.vsn-empty { margin: 30px 0; text-align: center; color: var(--c-dim); font-size: 0.85rem; }
.vsn-item {
  display: block; width: 100%; text-align: left; padding: 11px 12px; border: 1px solid var(--c-line); border-radius: 14px; cursor: pointer;
  background: #14141b; color: var(--c-ink); font-family: var(--c-font); transition: border-color 0.2s, background 0.2s;
}
.vsn-item:hover { border-color: rgba(242,106,27,0.5); background: #191922; }
.vsn-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.vsn-item-top b { font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vsn-item-top time { flex: 0 0 auto; font: 500 0.64rem/1 var(--c-mono); color: var(--c-dim); }
.vsn-item-sub { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 4px; font-size: 0.78rem; color: var(--c-dim); }
.vsn-item-sub > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vsn-st { flex: 0 0 auto; font: 700 0.6rem/1 var(--c-mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 7px; border-radius: 999px; }
.vsn-st.on { color: var(--c-green); background: rgba(37,211,102,0.12); }
.vsn-st.off { color: #f5b93f; background: rgba(245,185,63,0.1); }
.vsn-item.unread { border-color: rgba(242,106,27,0.6); }
.vsn-item.unread .vsn-item-top b { color: #fff; }
.vsn-item.unread .vsn-item-top b::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--c-orange); vertical-align: middle; }
