/* ===== Nexora / site AI assistant widget — fully self-contained ===== */
.nx-ai, .nx-ai * { box-sizing: border-box; }
.nx-ai {
  --nx-primary: #6d5efc;
  --nx-primary-2: #2dd4ff;
  --nx-bg: #0f1422;
  --nx-surface: #161f33;
  --nx-text: #e8ecf5;
  --nx-muted: #9aa6c2;
  --nx-border: rgba(255,255,255,.1);
  position: fixed; right: 22px; bottom: 22px; z-index: 2147483000;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Launcher button */
.nx-ai__launcher {
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--nx-primary), var(--nx-primary-2));
  color: #fff; font-size: 26px; display: grid; place-items: center;
  box-shadow: 0 12px 30px -8px rgba(109,94,252,.7); transition: transform .2s ease, box-shadow .2s;
}
.nx-ai__launcher:hover { transform: translateY(-3px) scale(1.04); }
.nx-ai__launcher:active { transform: scale(.96); }

/* Panel */
.nx-ai__panel {
  position: absolute; right: 0; bottom: 74px;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  background: var(--nx-bg); border: 1px solid var(--nx-border); border-radius: 18px;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.7); overflow: hidden;
  display: flex; flex-direction: column;
  transform-origin: bottom right; transform: scale(.9) translateY(10px); opacity: 0;
  pointer-events: none; transition: transform .22s ease, opacity .22s ease;
}
.nx-ai.open .nx-ai__panel { transform: none; opacity: 1; pointer-events: auto; }
.nx-ai.open .nx-ai__launcher { transform: rotate(90deg); }

.nx-ai__header {
  padding: 16px 18px; background: linear-gradient(135deg, rgba(109,94,252,.25), rgba(45,212,255,.12));
  border-bottom: 1px solid var(--nx-border); display: flex; align-items: center; gap: 10px;
}
.nx-ai__avatar {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px;
  background: linear-gradient(135deg, var(--nx-primary), var(--nx-primary-2)); color: #fff;
}
.nx-ai__title { color: var(--nx-text); font-weight: 700; font-size: .98rem; line-height: 1.2; }
.nx-ai__subtitle { color: var(--nx-muted); font-size: .76rem; }
.nx-ai__close { margin-left: auto; background: none; border: 0; color: var(--nx-muted); font-size: 20px; cursor: pointer; line-height: 1; }
.nx-ai__close:hover { color: var(--nx-text); }

/* Messages */
.nx-ai__messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.nx-ai__messages::-webkit-scrollbar { width: 8px; }
.nx-ai__messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; }

.nx-msg { max-width: 85%; padding: 11px 14px; border-radius: 14px; font-size: .9rem; line-height: 1.5; color: var(--nx-text); white-space: normal; word-wrap: break-word; }
.nx-msg--user { align-self: flex-end; background: linear-gradient(135deg, var(--nx-primary), #7c6ffd); border-bottom-right-radius: 4px; }
.nx-msg--bot { align-self: flex-start; background: var(--nx-surface); border: 1px solid var(--nx-border); border-bottom-left-radius: 4px; }
.nx-msg p { margin: 0 0 8px; } .nx-msg p:last-child { margin-bottom: 0; }
.nx-msg ul, .nx-msg ol { margin: 6px 0; padding-left: 20px; }
.nx-msg li { margin: 2px 0; }
.nx-msg code { background: rgba(0,0,0,.35); padding: 1px 5px; border-radius: 5px; font-size: .85em; }
.nx-msg pre { background: rgba(0,0,0,.4); padding: 10px 12px; border-radius: 10px; overflow-x: auto; margin: 8px 0; }
.nx-msg pre code { background: none; padding: 0; }
.nx-msg a { color: var(--nx-primary-2); }

.nx-ai__typing { display: inline-flex; gap: 4px; align-items: center; }
.nx-ai__typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--nx-muted); animation: nxbounce 1.2s infinite ease-in-out; }
.nx-ai__typing span:nth-child(2){ animation-delay: .15s; } .nx-ai__typing span:nth-child(3){ animation-delay: .3s; }
@keyframes nxbounce { 0%,60%,100%{ transform: translateY(0); opacity:.5 } 30%{ transform: translateY(-5px); opacity:1 } }

/* Suggestion chips */
.nx-ai__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.nx-ai__chip { background: var(--nx-surface); border: 1px solid var(--nx-border); color: var(--nx-text); font-size: .8rem; padding: 7px 12px; border-radius: 999px; cursor: pointer; transition: border-color .2s, background .2s; }
.nx-ai__chip:hover { border-color: var(--nx-primary); background: rgba(109,94,252,.15); }

/* Input */
.nx-ai__form { padding: 12px; border-top: 1px solid var(--nx-border); display: flex; gap: 8px; align-items: flex-end; background: var(--nx-bg); }
.nx-ai__input {
  flex: 1; resize: none; max-height: 120px; min-height: 44px; padding: 11px 13px;
  background: var(--nx-surface); border: 1px solid var(--nx-border); border-radius: 12px;
  color: var(--nx-text); font-family: inherit; font-size: .9rem; line-height: 1.4; outline: none;
}
.nx-ai__input:focus { border-color: var(--nx-primary); box-shadow: 0 0 0 3px rgba(109,94,252,.2); }
.nx-ai__input::placeholder { color: var(--nx-muted); }
.nx-ai__send {
  width: 44px; height: 44px; flex: 0 0 auto; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--nx-primary), var(--nx-primary-2)); color: #fff;
  font-size: 18px; display: grid; place-items: center; transition: opacity .2s, transform .2s;
}
.nx-ai__send:hover { transform: translateY(-1px); }
.nx-ai__send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .nx-ai__panel, .nx-ai__launcher, .nx-ai__typing span { transition: none; animation: none; }
}
