/* Noxbot — assistant facturation (thème via variables --nox-*) */

.noxbot {
  position: fixed;
  z-index: 10050;
  right: 1.25rem;
  bottom: 1.25rem;
  font-family: var(--font-body);
  pointer-events: none;
}

/* Espace client : panneau ouvert depuis la barre latérale (pas de FAB) */
.noxbot--app.noxbot--sidebar {
  position: static;
  pointer-events: none;
  width: 0;
  height: 0;
  overflow: visible;
}

.noxbot--app.noxbot--sidebar .noxbot__fab {
  display: none !important;
}

.noxbot--app.noxbot--sidebar .noxbot__panel {
  position: fixed;
  left: max(1rem, calc(var(--app-sidebar-width, 220px) + 1rem));
  bottom: 1.25rem;
  right: auto;
  z-index: 10060;
}

@media (max-width: 1080px) {
  .noxbot--app.noxbot--sidebar .noxbot__panel {
    left: 1rem;
    width: min(22rem, calc(100vw - 2rem));
  }
}

.noxbot__fab,
.noxbot__panel {
  pointer-events: auto;
}

.noxbot__fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 3.25rem;
  padding: 0 1rem 0 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--nox-cyan-dim);
  background: linear-gradient(145deg, var(--nox-bg-3), var(--nox-bg-2));
  color: var(--nox-cyan);
  cursor: pointer;
  box-shadow: 0 8px 28px var(--nox-shadow), 0 0 20px var(--nox-cyan-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.noxbot__fab:hover {
  transform: scale(1.05);
}

.noxbot__fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  color: var(--nox-cyan);
}

.noxbot__fab-icon svg {
  display: block;
}

.noxbot__fab-label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--nox-text);
  white-space: nowrap;
}

.noxbot__fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--nox-cyan-dim);
  animation: noxbot-pulse 2.5s ease-out infinite;
  pointer-events: none;
}

@keyframes noxbot-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.35); opacity: 0; }
}

.noxbot__panel {
  position: absolute;
  right: 0;
  bottom: calc(3.5rem + 0.75rem);
  width: min(22rem, calc(100vw - 2rem));
  max-height: min(32rem, calc(100vh - 6rem));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--nox-border);
  background: var(--nox-surface);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 48px var(--nox-shadow);
  overflow: hidden;
}

.noxbot__panel[hidden] {
  display: none !important;
}

.noxbot.is-open .noxbot__fab {
  box-shadow: 0 4px 16px var(--nox-shadow);
}

.noxbot__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--nox-border);
}

.noxbot__head-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.noxbot__reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--nox-muted, #8b9cb3);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.noxbot__reset:hover {
  color: var(--nox-cyan);
  background: rgba(0, 229, 255, 0.08);
}

.noxbot--public .noxbot__reset {
  width: auto;
  min-width: 2rem;
  padding: 0 0.45rem 0 0.35rem;
  gap: 0.3rem;
  border: 1px solid var(--nox-border);
}

.noxbot--public .noxbot__reset-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.noxbot__expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem 0 0.35rem;
  border: 1px solid var(--nox-border);
  border-radius: 8px;
  background: transparent;
  color: var(--nox-muted, #8b9cb3);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.noxbot__expand:hover {
  color: var(--nox-cyan);
  border-color: var(--nox-cyan-dim);
  background: rgba(0, 229, 255, 0.08);
}

.noxbot__expand-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.noxbot__eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nox-cyan);
  margin: 0;
}

.noxbot__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin: 0.15rem 0 0;
  color: var(--nox-text);
}

.noxbot__close {
  background: transparent;
  border: none;
  color: var(--nox-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

.noxbot__messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 10rem;
}

.noxbot__bubble {
  max-width: 92%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.noxbot__bubble--bot {
  align-self: flex-start;
  background: var(--nox-bg-3);
  border: 1px solid var(--nox-border);
  color: var(--nox-text);
}

.noxbot__bubble--user {
  align-self: flex-end;
  background: var(--nox-cyan-dim);
  color: var(--nox-text);
}

.noxbot__bubble--agent {
  align-self: flex-start;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--nox-text);
}

.noxbot__bubble--typing {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.25rem;
  opacity: 0.85;
  font-style: normal;
  font-size: 0.82rem;
  color: var(--nox-muted, #8b9cb3);
}

.noxbot__typing-label {
  margin-right: 0.15rem;
}

.noxbot__typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.noxbot__typing-dots span {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--nox-cyan);
  opacity: 0.35;
  animation: noxbot-dot-bounce 1.2s ease-in-out infinite;
}

.noxbot__typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.noxbot__typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes noxbot-dot-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.noxbot__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.noxbot__chip {
  font-size: 0.75rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--nox-cyan-dim);
  background: transparent;
  color: var(--nox-cyan);
  cursor: pointer;
  transition: background 0.15s ease;
}

.noxbot__chip:hover {
  background: var(--nox-cyan-dim);
}

.noxbot__chip--link {
  text-decoration: none;
  display: inline-block;
}

.noxbot__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--nox-border);
}

.noxbot__input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--nox-border);
  background: var(--nox-bg-2);
  color: var(--nox-text);
  font-size: 0.9rem;
}

.noxbot__input:focus {
  outline: 2px solid var(--nox-cyan-dim);
  border-color: var(--nox-cyan);
}

.noxbot__send {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
}

@media (max-width: 640px) {
  .noxbot:not(.noxbot--sidebar) {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .noxbot__fab {
    padding: 0 0.75rem;
    min-width: 3.25rem;
  }

  .noxbot__fab-label {
    display: none;
  }

  .noxbot__panel {
    width: calc(100vw - 1.5rem);
  }
}

/* Page d’accueil — Noxbot FAQ (même widget, autre rôle) */
.noxbot--public .noxbot__fab {
  border-color: rgba(0, 229, 255, 0.45);
}

.noxbot--public .noxbot__eyebrow {
  color: #8b9cb3;
}

.noxbot--public .noxbot__actions {
  max-height: 12rem;
  overflow-y: auto;
}
