/* Vision on crmseries.com. Matches Vision Assistant in the crmSeries web app (Next: _AICopilotChat.cshtml):
   navy header, gold sparkle, indigo accent. Always light, like the app.
   Layer 40: above the site's sticky header (20), below its modals (50). */
.vz {
  --vz-navy: #2c3e6b;
  --vz-navy-dark: #1e2d5a;
  --vz-accent: #4361ee;
  --vz-accent-light: #6f86f5;
  --vz-ink: #1a2540;
  --vz-muted: #6f7c9a;
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--vz-ink);
}
.vz *, .vz *::before, .vz *::after { box-sizing: border-box; }

/* ---------- Launcher: "Ask Vision" ---------- */
.vz-launcher {
  position: relative; display: flex; align-items: center; gap: 9px; height: 50px; padding: 0 20px 0 16px;
  border: 1px solid rgba(255,255,255,.18); border-radius: 26px; cursor: pointer;
  background: linear-gradient(120deg, var(--vz-navy) 0%, var(--vz-navy-dark) 100%); color: #fff;
  box-shadow: 0 6px 20px rgba(44,62,107,.38); animation: vz-breathe 3.2s ease-in-out infinite;
  transition: transform .15s ease, padding .2s ease;
  margin-left: auto;
}
.vz-launcher:hover { transform: translateY(-1px); }
.vz-launcher:active { transform: translateY(0); }
.vz-launcher:focus-visible { outline: 3px solid #ffc43d; outline-offset: 3px; }
.vz-launcher svg { width: 20px; height: 20px; fill: #ffc43d; flex-shrink: 0; animation: vz-gold-twinkle 3.6s ease-in-out infinite; }
.vz-launcher-label { font-size: 15px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.vz-open .vz-launcher { padding: 0 15px; animation: none; }
.vz-open .vz-launcher-label { display: none; }
@keyframes vz-breathe {
  0%, 100% { box-shadow: 0 6px 20px rgba(44,62,107,.38), 0 0 0 0 rgba(67,97,238,.28); }
  50% { box-shadow: 0 6px 20px rgba(44,62,107,.38), 0 0 0 9px rgba(67,97,238,0); }
}

/* Dust motes around the sparkle, as in the app */
.vz-launcher::before, .vz-launcher::after, .vz-avatar::before, .vz-avatar::after, .vz-msg-icon-thinking::before, .vz-msg-icon-thinking::after {
  content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, #fff3d6 0%, #ffc94d 55%, rgba(255,201,77,0) 75%);
}
.vz-launcher::before, .vz-avatar::before, .vz-msg-icon-thinking::before { top: 4px; right: 6px; animation: vz-mote-a 3.6s ease-in-out infinite .5s; }
.vz-launcher::after, .vz-avatar::after, .vz-msg-icon-thinking::after { width: 3.5px; height: 3.5px; bottom: 8px; left: 10px; animation: vz-mote-b 3.6s ease-in-out infinite 1.9s; }
.vz-launcher::before { top: 7px; right: 12px; }
.vz-launcher::after { bottom: 11px; left: 15px; }
.vz-open .vz-launcher::before, .vz-open .vz-launcher::after { display: none; }
@keyframes vz-mote-a { 0%, 100% { opacity: 0; transform: translate(0,0) scale(.4); } 50% { opacity: 1; transform: translate(-5px,-7px) scale(1); } }
@keyframes vz-mote-b { 0%, 100% { opacity: 0; transform: translate(0,0) scale(.3); } 50% { opacity: .85; transform: translate(6px,5px) scale(.85); } }
@keyframes vz-gold-twinkle {
  0%, 100% { fill: #ffc43d; transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 0 rgba(255,196,61,0)); }
  35% { transform: scale(1.16) rotate(-10deg); }
  50% { fill: #ffcf4d; transform: scale(1.26) rotate(6deg); filter: drop-shadow(0 0 5px rgba(255,196,61,.9)) drop-shadow(0 0 11px rgba(255,196,61,.4)); }
  68% { transform: scale(1.08) rotate(9deg); }
}
@keyframes vz-gold-twinkle-light {
  0%, 100% { fill: #ffffff; transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 0 rgba(255,196,61,0)); }
  35% { transform: scale(1.16) rotate(-10deg); }
  50% { fill: #ffcf4d; transform: scale(1.26) rotate(6deg); filter: drop-shadow(0 0 5px rgba(255,196,61,.9)) drop-shadow(0 0 11px rgba(255,196,61,.4)); }
  68% { transform: scale(1.08) rotate(9deg); }
}

/* ---------- Panel ---------- */
.vz-panel {
  position: absolute; right: 0; bottom: 64px; width: 404px; height: min(680px, calc(100vh - 120px));
  display: flex; flex-direction: column; overflow: hidden; background: #fff; border-radius: 18px;
  box-shadow: 0 20px 60px rgba(20,30,60,.22), 0 4px 14px rgba(20,30,60,.10);
  opacity: 0; visibility: hidden; transform: scale(.94) translateY(8px); transform-origin: bottom right; pointer-events: none;
  transition: opacity .2s ease, transform .24s cubic-bezier(.34,1.56,.64,1), visibility 0s linear .24s;
}
.vz-open .vz-panel { opacity: 1; visibility: visible; transform: scale(1) translateY(0); pointer-events: auto; transition: opacity .2s ease, transform .24s cubic-bezier(.34,1.56,.64,1); }

.vz-header { background: linear-gradient(120deg, var(--vz-navy) 0%, var(--vz-navy-dark) 100%); padding: 16px 16px 14px; display: flex; align-items: center; gap: 11px; flex-shrink: 0; user-select: none; }
.vz-avatar { position: relative; width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.vz-avatar svg { width: 20px; height: 20px; fill: #fff; animation: vz-gold-twinkle-light 4.4s ease-in-out infinite .6s; }
.vz-header-text { flex: 1; min-width: 0; }
.vz-title { font-size: 14px; font-weight: 700; color: #fff; margin: 0; line-height: 1.25; letter-spacing: .01em; }
.vz-header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.vz-icon-btn { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; cursor: pointer; background: rgba(255,255,255,.1); color: rgba(255,255,255,.85); display: flex; align-items: center; justify-content: center; transition: background .14s; }
.vz-icon-btn:hover { background: rgba(255,255,255,.22); color: #fff; }
.vz-icon-btn svg { width: 15px; height: 15px; fill: currentColor; }
.vz-close { font-size: 19px; line-height: 1; }

/* ---------- Messages ---------- */
.vz-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px 12px; display: flex; flex-direction: column; gap: 12px; background: #fafbfe; scroll-behavior: smooth; overscroll-behavior: contain; }
.vz-messages.vz-welcome-active { padding-top: 8px; padding-bottom: 6px; }
.vz-messages::-webkit-scrollbar { width: 5px; }
.vz-messages::-webkit-scrollbar-thumb { background: #d0daf0; border-radius: 4px; }

.vz-welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 12px 18px 8px; gap: 8px; }
.vz-welcome p { font-size: 13px; color: #556080; line-height: 1.5; margin: 0; max-width: 290px; }
.vz-welcome-mark { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eef2ff 0%, #e2e9fb 100%); border: 1px solid #d6def3; margin-bottom: 2px; }
.vz-welcome-mark svg { width: 22px; height: 22px; fill: var(--vz-navy); }
.vz-welcome-title { color: var(--vz-ink); font-size: 17px; font-weight: 700; line-height: 1.25; }
.vz .vz-welcome-hint { color: #7a86a3; font-size: 11.5px; }

.vz-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; animation: vz-fadein .22s ease; }
.vz-msg.vz-user { justify-content: flex-end; }
@keyframes vz-fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.vz-msg-icon { position: relative; width: 28px; height: 28px; border-radius: 9px; background: #eef2fc; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.vz-msg-icon svg { width: 15px; height: 15px; fill: var(--vz-navy); }
.vz-msg-icon-thinking svg { animation: vz-spin-glint 2.2s ease-in-out infinite; transform-origin: center; }
.vz-msg-icon-pop { animation: vz-pop-in .5s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes vz-spin-glint {
  0%, 100% { fill: var(--vz-navy); transform: rotate(0deg) scale(1); filter: drop-shadow(0 0 0 rgba(255,196,61,0)); }
  50% { fill: #ffcf4d; transform: rotate(180deg) scale(1.3); filter: drop-shadow(0 0 6px rgba(255,196,61,.95)) drop-shadow(0 0 13px rgba(255,196,61,.45)); }
}
@keyframes vz-pop-in { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* The 84% cap lives on the column, not the bubble (see the note in the app's stylesheet). */
.vz-msg-col { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 84%; }
.vz-msg.vz-user .vz-msg-col { align-items: flex-end; }
.vz-bubble { padding: 10px 13px; border-radius: 15px; font-size: 13.5px; line-height: 1.58; word-break: break-word; }
.vz-bubble > * { margin: 0; }
.vz-bubble > * + * { margin-top: 8px; }
.vz-bubble a { color: var(--vz-accent); text-decoration: underline; text-underline-offset: 2px; }
.vz-bot .vz-bubble { background: #fff; border: 1px solid #e3e9f7; color: var(--vz-ink); border-radius: 4px 15px 15px 15px; box-shadow: 0 1px 3px rgba(20,30,60,.05); }
.vz-user .vz-bubble { background: linear-gradient(135deg, var(--vz-accent) 0%, var(--vz-navy) 100%); color: #fff; border-radius: 15px 4px 15px 15px; }
.vz-kind-off-topic .vz-bubble { border-left: 3px solid #d39b2a; background: #fffdf7; }
.vz-kind-security .vz-bubble { border-left: 3px solid #c0392b; background: #fffafa; }
.vz-list { padding-left: 19px; }
.vz-list li { margin: 3px 0; }
.vz-list li::marker { color: var(--vz-accent); font-weight: 700; }

.vz-typing { display: flex; align-items: center; gap: 4px; padding: 11px 15px; background: #fff; border: 1px solid #e3e9f7; border-radius: 4px 15px 15px 15px; width: fit-content; box-shadow: 0 1px 3px rgba(20,30,60,.05); }
.vz-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--vz-accent-light); display: inline-block; animation: vz-bounce 1.25s ease infinite; }
.vz-typing span:nth-child(2) { animation-delay: .18s; }
.vz-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes vz-bounce { 0%, 75%, 100% { transform: translateY(0); } 35% { transform: translateY(-5px); } }

/* Book a demo */
.vz-cta { display: inline-flex; align-items: center; padding: 8px 15px; border-radius: 20px; font-size: 13px; font-weight: 700; color: #fff; text-decoration: none; background: linear-gradient(135deg, var(--vz-accent) 0%, var(--vz-navy) 100%); box-shadow: 0 2px 8px rgba(44,62,107,.25); }
.vz-cta:hover { filter: brightness(1.08); color: #fff; }

/* ---------- Suggestions: shown with the welcome ---------- */
.vz-suggestions-label { display: none; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--vz-muted); padding: 2px 14px 0; background: #fafbfe; }
.vz-suggestions { display: none; flex-direction: column; gap: 8px; padding: 6px 14px 14px; flex-shrink: 0; background: #fafbfe; }
.vz-show-suggestions .vz-suggestions-label { display: block; }
.vz-show-suggestions .vz-suggestions { display: flex; }
.vz-suggestion { background: #fff; border: 1px solid #dde3f0; border-radius: 20px; padding: 7px 12px; min-height: 34px; font: inherit; font-size: 12.5px; line-height: 1.25; text-align: left; color: var(--vz-navy); cursor: pointer; transition: background .15s, border-color .15s; overflow-wrap: anywhere; }
.vz-suggestion:hover { background: #f0f4ff; border-color: var(--vz-accent-light); }

/* ---------- Input ---------- */
.vz-footer { display: flex; gap: 8px; align-items: flex-end; padding: 12px 14px; margin: 0; background: #fff; border-top: 1px solid #eaeff8; flex-shrink: 0; }
.vz-input { flex: 1; min-height: 38px; max-height: 96px; padding: 9px 12px; border: 1.5px solid #dde3f0; border-radius: 11px; background: #f8faff; font: inherit; font-size: 13.5px; line-height: 1.45; color: var(--vz-ink); resize: none; outline: none; transition: border-color .15s; }
.vz-input:focus { border-color: var(--vz-accent-light); background: #fff; }
.vz-send { width: 38px; height: 38px; flex-shrink: 0; border: 0; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--vz-accent) 0%, var(--vz-navy) 100%); transition: transform .1s, opacity .15s; }
.vz-send svg { width: 17px; height: 17px; fill: #fff; }
.vz-send:active:not(:disabled) { transform: scale(.94); }
.vz-send:disabled { opacity: .45; cursor: default; }
.vz-disclaimer { margin: 0; padding: 0 14px 10px; background: #fff; flex-shrink: 0; text-align: center; font-size: 10.5px; color: #98a2b8; }

/* ---------- Phones: panel fills the screen above the button ---------- */
@media (max-width: 600px) {
  .vz { right: 12px; bottom: 12px; }
  .vz-panel { position: fixed; left: 8px; right: 8px; top: 8px; bottom: 74px; width: auto; height: auto; }
  .vz-launcher { height: 48px; padding: 0 16px 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .vz-launcher, .vz-launcher svg, .vz-avatar svg, .vz-msg-icon-thinking svg, .vz-msg-icon-pop, .vz-msg, .vz-typing span { animation: none; }
  .vz-launcher::before, .vz-launcher::after, .vz-avatar::before, .vz-avatar::after, .vz-msg-icon-thinking::before, .vz-msg-icon-thinking::after { display: none; }
  .vz-panel, .vz-open .vz-panel { transition: none; }
}
@media print { .vz { display: none; } }
