/* ============================================================
   VORYX — SITE ASSISTANT
   Client-side retrieval assistant. No external requests.
   ============================================================ */

.vx-chat {
  --vx-navy: #042750;
  --vx-blue: #0298DC;
  --vx-orange: #FD7F05;
  --vx-ink: #2C3E52;
  --vx-muted: #64748B;
  --vx-line: rgba(4, 39, 80, 0.10);
  --vx-panel-w: 396px;
  font-family: 'Inter', system-ui, sans-serif;
}

/* ---------- LAUNCHER ---------- */
.vx-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9500;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  border: none;
  border-radius: 999px;
  background: var(--vx-navy);
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(4, 39, 80, 0.32);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.2s ease;
}
.vx-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(2, 152, 220, 0.38);
}
.vx-launcher:focus-visible { outline: 3px solid var(--vx-blue); outline-offset: 3px; }
.vx-launcher__mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  padding: 3px;
  flex: 0 0 auto;
}
.vx-launcher__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.22);
}
.vx-chat.is-open .vx-launcher {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

/* ---------- PANEL ---------- */
.vx-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9600;
  width: var(--vx-panel-w);
  max-width: calc(100vw - 32px);
  height: min(620px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: #F1F4F8;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(4, 39, 80, 0.28);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.vx-chat.is-open .vx-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Header */
.vx-head {
  background: var(--vx-navy);
  color: #fff;
  padding: 16px 16px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
.vx-head__mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  padding: 4px;
  object-fit: contain;
  flex: 0 0 auto;
}
.vx-head__text { flex: 1 1 auto; min-width: 0; }
.vx-head__title {
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.2;
  display: block;
}
.vx-head__sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}
.vx-head__sub::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ADE80;
}
.vx-head__btn {
  background: rgba(255, 255, 255, 0.10);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.2s ease;
}
.vx-head__btn:hover { background: rgba(255, 255, 255, 0.22); }
.vx-head__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Log */
.vx-log {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(4, 39, 80, 0.22) transparent;
}
.vx-log::-webkit-scrollbar { width: 8px; }
.vx-log::-webkit-scrollbar-thumb {
  background: rgba(4, 39, 80, 0.18);
  border-radius: 8px;
}

.vx-msg {
  display: flex;
  margin-bottom: 14px;
  animation: vx-in 0.28s ease both;
}
@keyframes vx-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.vx-msg--user { justify-content: flex-end; }
.vx-bubble {
  max-width: 86%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--vx-ink);
  background: #fff;
  border: 1px solid var(--vx-line);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(15, 30, 60, 0.05);
}
.vx-msg--user .vx-bubble {
  background: var(--vx-navy);
  border-color: var(--vx-navy);
  color: #fff;
  border-top-left-radius: 14px;
  border-top-right-radius: 4px;
}
.vx-bubble p { margin: 0 0 10px; }
.vx-bubble p:last-child { margin-bottom: 0; }
.vx-bubble strong { color: var(--vx-navy); font-weight: 700; }
.vx-msg--user .vx-bubble strong { color: #fff; }
.vx-bubble ul {
  list-style: none;
  margin: 4px 0 10px;
  padding: 0;
}
.vx-bubble li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 5px;
  font-size: 0.84rem;
  line-height: 1.6;
}
.vx-bubble li::before {
  content: '▪';
  position: absolute;
  left: 2px;
  color: var(--vx-orange);
}

/* Metric pills inside an answer */
.vx-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 10px;
}
.vx-metric {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--vx-blue);
  background: rgba(2, 152, 220, 0.08);
  border: 1px solid rgba(2, 152, 220, 0.26);
  border-radius: 6px;
  padding: 4px 8px;
}
.vx-metric span {
  color: var(--vx-muted);
  font-weight: 400;
  margin-left: 5px;
}

/* Source links */
.vx-sources {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--vx-line);
}
.vx-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 8px;
  background: rgba(2, 152, 220, 0.06);
  border: 1px solid rgba(2, 152, 220, 0.22);
  color: var(--vx-navy);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.vx-source:hover {
  background: rgba(2, 152, 220, 0.13);
  border-color: var(--vx-blue);
  transform: translateX(2px);
}
.vx-source::after {
  content: '→';
  color: var(--vx-blue);
  flex: 0 0 auto;
}
.vx-source__kind {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--vx-muted);
  margin-bottom: 2px;
}

/* Typing indicator */
.vx-typing { display: flex; gap: 4px; padding: 4px 2px; }
.vx-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--vx-blue);
  opacity: 0.45;
  animation: vx-bounce 1.1s infinite;
}
.vx-typing span:nth-child(2) { animation-delay: 0.15s; }
.vx-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes vx-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* Suggestion chips */
.vx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  flex: 0 0 auto;
}
.vx-chip {
  background: #fff;
  border: 1px solid rgba(2, 152, 220, 0.32);
  color: var(--vx-navy);
  border-radius: 999px;
  padding: 7px 13px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.vx-chip:hover {
  background: rgba(2, 152, 220, 0.10);
  border-color: var(--vx-blue);
  transform: translateY(-1px);
}
.vx-chip:focus-visible { outline: 2px solid var(--vx-blue); outline-offset: 2px; }

/* Composer */
.vx-form {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid var(--vx-line);
}
.vx-input {
  flex: 1 1 auto;
  border: 1px solid var(--vx-line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--vx-ink);
  background: #F1F4F8;
  resize: none;
  max-height: 96px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.vx-input:focus {
  outline: none;
  border-color: var(--vx-blue);
  box-shadow: 0 0 0 3px rgba(2, 152, 220, 0.14);
}
.vx-input::placeholder { color: #94A3B8; }
.vx-send {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--vx-blue);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.vx-send:hover { background: #0284c7; transform: translateY(-1px); }
.vx-send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.vx-send:focus-visible { outline: 2px solid var(--vx-navy); outline-offset: 2px; }

.vx-foot {
  flex: 0 0 auto;
  padding: 0 14px 10px;
  background: #fff;
  font-size: 0.66rem;
  line-height: 1.5;
  color: #94A3B8;
  text-align: center;
}
.vx-foot a { color: var(--vx-muted); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 520px) {
  .vx-launcher {
    right: 16px;
    bottom: 16px;
    padding: 12px 16px 12px 12px;
    font-size: 0.82rem;
  }
  .vx-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    border-radius: 0;
  }
  .vx-bubble { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  .vx-panel, .vx-launcher, .vx-msg, .vx-chip, .vx-source, .vx-send {
    transition: none !important;
    animation: none !important;
  }
  .vx-typing span { animation: none; }
}

/* Keep the existing contact toast clear of the launcher */
#toast { bottom: 96px !important; }
