/* ============================================================
   NEXT Énergies — Chatbot FAQ — Style widget flottant
   Palette : vert #86C440, anthracite #414142
   ============================================================ */

#ne-chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--vert, #86C440);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, background .2s ease;
}
#ne-chatbot-toggle:hover {
  background: #6FA833;
  transform: scale(1.05);
}
#ne-chatbot-toggle:focus-visible {
  outline: 3px solid #F4A100;
  outline-offset: 3px;
}
#ne-chatbot-toggle .ne-chatbot-toggle-close { display: none; }
#ne-chatbot-toggle.is-open .ne-chatbot-toggle-open { display: none; }
#ne-chatbot-toggle.is-open .ne-chatbot-toggle-close { display: inline; }

#ne-chatbot-toggle .ne-chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #F4A100;
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: .7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* ---------- Panneau ---------- */
#ne-chatbot-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#ne-chatbot-panel.is-open {
  display: flex;
  animation: ne-chatbot-fadein .25s ease;
}

@keyframes ne-chatbot-fadein {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Header ---------- */
.ne-chatbot-header {
  background: linear-gradient(135deg, #86C440 0%, #6FA833 100%);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.ne-chatbot-header__logo {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.ne-chatbot-header__title { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.ne-chatbot-header__sub   { font-size: .73rem; opacity: .9; }
.ne-chatbot-header__status {
  font-size: .72rem;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ne-chatbot-header__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4ff6b;
  animation: ne-chatbot-pulse 2s infinite;
}
@keyframes ne-chatbot-pulse {
  0%,100% { opacity: 1; }
  50%     { opacity: .4; }
}
.ne-chatbot-header__close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: 8px;
  border-radius: 6px;
}
.ne-chatbot-header__close:hover { background: rgba(255,255,255,.2); }

/* ---------- Corps ---------- */
.ne-chatbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  background: #FAFAF8;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.ne-chatbot-body::-webkit-scrollbar { width: 6px; }
.ne-chatbot-body::-webkit-scrollbar-thumb { background: #d4dae1; border-radius: 3px; }

/* ---------- Lignes & bulles ---------- */
.ne-chatbot-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.ne-chatbot-row--user { flex-direction: row-reverse; }

.ne-chatbot-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: .87rem;
  line-height: 1.5;
  animation: ne-chatbot-slideup .25s ease both;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.ne-chatbot-bubble--bot {
  background: #fff;
  color: #414142;
  border-bottom-left-radius: 4px;
  border: 1px solid #EDECEB;
}
.ne-chatbot-bubble--user {
  background: #86C440;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ne-chatbot-bubble strong { font-weight: 700; }
.ne-chatbot-bubble--bot strong { color: #6FA833; }

@keyframes ne-chatbot-slideup {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ne-chatbot-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .8rem;
}
.ne-chatbot-avatar--bot  { background: #86C440; color: #fff; }
.ne-chatbot-avatar--user { background: #c0c8d2; color: #fff; }

/* ---------- Question trouvée + catégorie ---------- */
.ne-chatbot-cat {
  display: inline-block;
  font-size: .65rem;
  background: #86C440;
  color: #fff;
  border-radius: 10px;
  padding: 1px 8px;
  margin-bottom: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.ne-chatbot-qfound {
  font-size: .7rem;
  color: #5F5E5A;
  margin-bottom: 4px;
  font-style: italic;
}

/* ---------- Suggestions ---------- */
.ne-chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.ne-chatbot-sugg-btn {
  background: #fff;
  border: 1.5px solid #86C440;
  color: #6FA833;
  border-radius: 18px;
  padding: 5px 12px;
  font-size: .76rem;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  line-height: 1.3;
  transition: background .15s, color .15s;
}
.ne-chatbot-sugg-btn:hover {
  background: #86C440;
  color: #fff;
}
.ne-chatbot-sugg-btn:focus-visible {
  outline: 2px solid #F4A100;
  outline-offset: 2px;
}

/* ---------- Indicateur de frappe ---------- */
.ne-chatbot-typing {
  display: flex;
  gap: 5px;
  padding: 12px 14px;
  background: #fff;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  border: 1px solid #EDECEB;
  width: fit-content;
}
.ne-chatbot-typing span {
  width: 6px;
  height: 6px;
  background: #86C440;
  border-radius: 50%;
  animation: ne-chatbot-bounce 1.1s infinite;
}
.ne-chatbot-typing span:nth-child(2) { animation-delay: .18s; }
.ne-chatbot-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes ne-chatbot-bounce {
  0%,60%,100% { transform: translateY(0);   opacity: .4; }
  30%         { transform: translateY(-6px); opacity: 1; }
}

/* ---------- Footer / Saisie ---------- */
.ne-chatbot-footer {
  background: #fff;
  border-top: 1px solid #EDECEB;
  padding: 10px 12px;
  flex-shrink: 0;
}
.ne-chatbot-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #FAFAF8;
  border: 1.5px solid #d4dae1;
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
  transition: border-color .15s;
}
.ne-chatbot-input-wrap:focus-within {
  border-color: #86C440;
}
.ne-chatbot-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: .87rem;
  font-family: inherit;
  color: #414142;
  padding: 6px 0;
}
.ne-chatbot-send {
  background: #86C440;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: .9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.ne-chatbot-send:hover:not(:disabled) { background: #6FA833; }
.ne-chatbot-send:disabled {
  background: #d4dae1;
  cursor: not-allowed;
}
.ne-chatbot-send:focus-visible {
  outline: 2px solid #F4A100;
  outline-offset: 2px;
}

.ne-chatbot-disclaimer {
  text-align: center;
  font-size: .68rem;
  color: #5F5E5A;
  margin-top: 6px;
}

/* ---------- Erreur ---------- */
.ne-chatbot-error {
  background: #FFF3E0;
  border: 1px solid #F4A100;
  color: #8B5A00;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .8rem;
}

/* ---------- Responsive mobile ---------- */
@media (max-width: 480px) {
  #ne-chatbot-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 90vh;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }
  #ne-chatbot-toggle {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }
}

/* ---------- Préférence utilisateur (animations réduites) ---------- */
@media (prefers-reduced-motion: reduce) {
  #ne-chatbot-panel.is-open,
  .ne-chatbot-bubble,
  .ne-chatbot-typing span,
  .ne-chatbot-header__dot {
    animation: none !important;
  }
}
