/* NEXSPIRE — NexAgent chat widget (MD-driven, non-interrupting).
 * Modern, friendly, glassmorphism, latest-gen feel. */

/* ===== Floating bubble ===== */
.nx-chat__bubble {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2E6FF7 0%, #00B8D4 100%);
  color: #fff;
  border: 0;
  cursor: pointer;
  box-shadow: 0 14px 40px -8px rgba(46, 111, 247, 0.45),
              0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  display: flex; align-items: center; justify-content: center;
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1),
              box-shadow .22s ease;
  font-family: inherit;
}
.nx-chat__bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 22px 50px -10px rgba(46, 111, 247, 0.6),
              0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}
.nx-chat__bubble:active { transform: scale(0.96); }
.nx-chat__bubble svg { width: 26px; height: 26px; }

/* Subtle pulse ring (non-aggressive, slow) */
.nx-chat__bubble-pulse {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(46, 111, 247, 0.22);
  animation: nxChatPulse 3s ease-out infinite;
  pointer-events: none;
}
@keyframes nxChatPulse {
  0%   { transform: scale(0.9);  opacity: 0.55; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* Hover-only tooltip (never auto-pops) */
.nx-chat__bubble::after {
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  background: rgba(11, 13, 16, 0.95);
  color: #fff;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  letter-spacing: 0.005em;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.nx-chat__bubble:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }
.nx-chat__bubble.is-active .nx-chat__bubble-pulse { display: none; }

/* ===== Panel ===== */
.nx-chat__panel {
  position: fixed;
  right: 1.5rem;
  bottom: 5.5rem;
  z-index: 9001;
  width: 400px;
  max-width: calc(100vw - 2.5rem);
  height: 600px;
  max-height: calc(100vh - 7rem);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  color: #0b0d10;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 22px;
  box-shadow: 0 32px 64px -20px rgba(15, 23, 42, 0.4),
              0 0 0 1px rgba(46, 111, 247, 0.05);
  display: flex; flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .22s cubic-bezier(.4, 0, .2, 1),
              transform .22s cubic-bezier(.4, 0, .2, 1),
              visibility 0s linear .22s;
  font-family: inherit;
}
.nx-chat__panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear 0s;
}
[data-theme="dark"] .nx-chat__panel {
  background: rgba(17, 21, 26, 0.92);
  color: #e6edf3;
  border-color: rgba(46, 111, 247, 0.15);
  box-shadow: 0 32px 64px -20px rgba(0, 0, 0, 0.6);
}

/* ===== Head ===== */
.nx-chat__head {
  padding: 16px 20px;
  background: linear-gradient(135deg, #2E6FF7 0%, #00B8D4 100%);
  color: #fff;
  display: flex; align-items: center; gap: 12px;
  position: relative;
}
.nx-chat__head::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% -20%, rgba(255, 255, 255, 0.18), transparent 50%);
  pointer-events: none;
}
.nx-chat__head-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.nx-chat__head-info { flex-grow: 1; min-width: 0; position: relative; }
.nx-chat__head-title { font-size: 15px; font-weight: 700; line-height: 1.1; letter-spacing: -0.005em; }
.nx-chat__head-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; opacity: 0.92; margin-top: 3px;
}
.nx-chat__head-status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #10ffa0;
  box-shadow: 0 0 0 2.5px rgba(16, 255, 160, 0.25), 0 0 8px rgba(16, 255, 160, 0.5);
  animation: nxLiveDot 2.4s ease-in-out infinite;
}
@keyframes nxLiveDot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}
.nx-chat__head-close {
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  color: #fff;
  cursor: pointer;
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.85;
  transition: all .15s ease;
  position: relative;
}
.nx-chat__head-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.22); }

/* ===== Body ===== */
.nx-chat__body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 18px 16px 6px;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
  background: transparent;
}
.nx-chat__body::-webkit-scrollbar { width: 6px; }
.nx-chat__body::-webkit-scrollbar-thumb { background: rgba(46, 111, 247, 0.25); border-radius: 3px; }

.nx-chat__msg {
  max-width: 86%;
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  letter-spacing: -0.005em;
  animation: nxMsgIn .26s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes nxMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nx-chat__msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2E6FF7 0%, #00B8D4 100%);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 18px -6px rgba(46, 111, 247, 0.4);
}
.nx-chat__msg--bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.7);
  color: #0b0d10;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-bottom-left-radius: 6px;
  backdrop-filter: blur(8px);
}
[data-theme="dark"] .nx-chat__msg--bot {
  background: rgba(17, 21, 26, 0.6);
  color: #e6edf3;
  border-color: rgba(46, 111, 247, 0.18);
}
.nx-chat__msg a { color: #2E6FF7; text-decoration: underline; text-underline-offset: 2px; font-weight: 500; }
.nx-chat__msg--user a { color: #fff; opacity: 0.95; }
.nx-chat__msg strong { font-weight: 700; }
.nx-chat__msg em { font-style: italic; opacity: 0.85; }
.nx-chat__msg ul { margin: 6px 0; padding-left: 20px; }
.nx-chat__msg li { margin: 3px 0; }
.nx-chat__msg hr { border: 0; border-top: 1px dashed rgba(46, 111, 247, 0.25); margin: 10px 0; }
.nx-chat__msg code {
  background: rgba(46, 111, 247, 0.08);
  color: #2E6FF7;
  padding: 1px 6px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
}

.nx-chat__typing {
  align-self: flex-start;
  display: flex; gap: 5px;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  backdrop-filter: blur(8px);
}
[data-theme="dark"] .nx-chat__typing { background: rgba(17, 21, 26, 0.6); border-color: rgba(46, 111, 247, 0.18); }
.nx-chat__typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2E6FF7, #00B8D4);
  animation: nxTyping 1.3s infinite;
}
.nx-chat__typing span:nth-child(2) { animation-delay: 0.18s; }
.nx-chat__typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes nxTyping {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1;   }
}

/* ===== Lead capture inline form ===== */
.nx-chat__lead {
  align-self: stretch;
  margin: 6px 0 4px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(46, 111, 247, 0.08), rgba(0, 184, 212, 0.05));
  border: 1px solid rgba(46, 111, 247, 0.25);
  border-radius: 16px;
  animation: nxMsgIn .3s cubic-bezier(.34, 1.56, .64, 1);
}
.nx-chat__lead-title { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; color: #0b0d10; }
[data-theme="dark"] .nx-chat__lead-title { color: #e6edf3; }
.nx-chat__lead-sub { font-size: 12.5px; color: rgba(15, 23, 42, 0.72); margin-bottom: 14px; line-height: 1.45; }
[data-theme="dark"] .nx-chat__lead-sub { color: rgba(230, 237, 243, 0.72); }
.nx-chat__lead-row { margin-bottom: 8px; }
.nx-chat__lead-row label {
  display: block; font-size: 11px; font-weight: 600; color: rgba(15, 23, 42, 0.7);
  letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 4px;
}
[data-theme="dark"] .nx-chat__lead-row label { color: rgba(230, 237, 243, 0.7); }
.nx-chat__lead-row input {
  width: 100%; padding: 9px 12px; font-size: 13.5px;
  border: 1px solid rgba(15, 23, 42, 0.15); border-radius: 9px;
  background: rgba(255, 255, 255, 0.85); color: #0b0d10; font-family: inherit;
  transition: border-color .15s ease;
}
[data-theme="dark"] .nx-chat__lead-row input { background: rgba(17, 21, 26, 0.85); color: #e6edf3; border-color: rgba(46, 111, 247, 0.18); }
.nx-chat__lead-row input:focus { outline: 0; border-color: #2E6FF7; }
.nx-chat__lead-actions { display: flex; gap: 8px; margin-top: 12px; }
.nx-chat__lead-submit {
  flex-grow: 1; padding: 10px 14px;
  background: linear-gradient(135deg, #2E6FF7, #00B8D4); color: #fff;
  border: 0; border-radius: 9px; font-weight: 600; font-size: 13.5px;
  cursor: pointer; transition: transform .12s ease; font-family: inherit;
}
.nx-chat__lead-submit:hover:not(:disabled) { transform: translateY(-1px); }
.nx-chat__lead-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.nx-chat__lead-skip {
  padding: 10px 12px; background: transparent;
  color: rgba(15, 23, 42, 0.6); border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 9px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
[data-theme="dark"] .nx-chat__lead-skip { color: rgba(230, 237, 243, 0.6); border-color: rgba(46, 111, 247, 0.18); }
.nx-chat__lead-skip:hover { color: #2E6FF7; border-color: #2E6FF7; }

.nx-chat__suggestions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 16px 10px;
}
.nx-chat__suggestion {
  font-size: 12px; padding: 7px 12px;
  border: 1px solid rgba(15, 23, 42, 0.12); border-radius: 100px;
  background: rgba(255, 255, 255, 0.7); color: #0b0d10;
  cursor: pointer; transition: all .14s ease; font-family: inherit;
  backdrop-filter: blur(6px);
}
.nx-chat__suggestion:hover { border-color: #2E6FF7; color: #2E6FF7; transform: translateY(-1px); }
[data-theme="dark"] .nx-chat__suggestion { background: rgba(17, 21, 26, 0.6); color: #e6edf3; border-color: rgba(46, 111, 247, 0.18); }

.nx-chat__form {
  padding: 12px 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  display: flex; gap: 10px; align-items: flex-end;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
}
[data-theme="dark"] .nx-chat__form { background: rgba(11, 13, 16, 0.6); border-color: rgba(46, 111, 247, 0.15); }
.nx-chat__input {
  flex-grow: 1; padding: 11px 14px;
  border: 1px solid rgba(15, 23, 42, 0.12); border-radius: 13px;
  font-family: inherit; font-size: 13.5px; resize: none;
  background: rgba(255, 255, 255, 0.85); color: #0b0d10;
  max-height: 110px; line-height: 1.45;
  transition: border-color .14s ease, box-shadow .14s ease;
}
[data-theme="dark"] .nx-chat__input { background: rgba(17, 21, 26, 0.85); color: #e6edf3; border-color: rgba(46, 111, 247, 0.18); }
.nx-chat__input:focus { outline: 0; border-color: #2E6FF7; box-shadow: 0 0 0 3px rgba(46, 111, 247, 0.12); }

.nx-chat__send {
  width: 42px; height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #2E6FF7 0%, #00B8D4 100%);
  color: #fff; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .14s ease, box-shadow .14s ease;
  flex-shrink: 0;
  box-shadow: 0 6px 16px -6px rgba(46, 111, 247, 0.5);
}
.nx-chat__send:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 8px 20px -6px rgba(46, 111, 247, 0.65); }
.nx-chat__send:disabled { opacity: 0.5; cursor: not-allowed; }
.nx-chat__send svg { width: 18px; height: 18px; }

.nx-chat__footer {
  padding: 8px 14px 10px;
  font-size: 10.5px;
  color: rgba(15, 23, 42, 0.42);
  text-align: center;
  background: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.01em;
}
[data-theme="dark"] .nx-chat__footer { background: rgba(11, 13, 16, 0.6); color: rgba(230, 237, 243, 0.42); }
.nx-chat__footer strong { color: #2E6FF7; font-weight: 600; }

@media (max-width: 480px) {
  .nx-chat__panel {
    right: 0.75rem; bottom: 4.75rem;
    width: calc(100vw - 1.5rem);
    height: calc(100vh - 6rem);
    border-radius: 18px;
  }
  .nx-chat__bubble { right: 1rem; bottom: 1rem; }
  .nx-chat__bubble::after { display: none; }
}
