/* ========= Chatbot widget ========= */
.chatbot-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid rgba(255,255,255,.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  transition: transform .2s, background .2s;
}
.chatbot-toggle:hover { transform: scale(1.08); background: var(--accent); }
.chatbot-toggle svg { width: 26px; height: 26px; }

.chatbot-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 9001;
  width: 380px;
  max-height: 520px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 6px;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.chatbot-panel.is-open { visibility: visible; pointer-events: all; display: flex; }

.chatbot-panel__header {
  padding: 14px 18px;
  background: var(--ink);
  color: var(--paper);
  font-family: 'Inter Tight', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: .03em;
}
.chatbot-panel__header-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--live);
  display: inline-block;
  margin-right: 8px;
  animation: crtPulse 2s infinite;
}
.chatbot-panel__close {
  background: none; border: none; color: var(--paper);
  cursor: pointer; font-size: 1.1rem; padding: 0 4px;
  opacity: .7; transition: opacity .2s;
}
.chatbot-panel__close:hover { opacity: 1; }

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 360px;
}

.chatbot-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 4px;
  font-family: 'Inter Tight', sans-serif;
  font-size: .87rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.chatbot-msg--bot {
  background: var(--paper-2);
  color: var(--ink);
  align-self: flex-start;
  border: 1px solid rgba(14,14,12,.08);
}
.chatbot-msg--user {
  background: var(--ink);
  color: var(--paper);
  align-self: flex-end;
}
.chatbot-msg--typing {
  font-style: italic;
  color: var(--mono-dim);
  background: transparent;
  padding: 4px 0;
}

.chatbot-input-row {
  display: flex;
  border-top: 1px solid rgba(14,14,12,.1);
  background: var(--paper);
}
.chatbot-input-row input {
  flex: 1;
  border: none;
  padding: 14px 16px;
  font-family: 'Inter Tight', sans-serif;
  font-size: .87rem;
  background: transparent;
  color: var(--ink);
  outline: none;
}
.chatbot-input-row input::placeholder { color: var(--mono-dim); }
.chatbot-input-row button {
  background: none;
  border: none;
  padding: 0 16px;
  cursor: pointer;
  color: var(--ink);
  font-size: 1.1rem;
  transition: color .2s;
}
.chatbot-input-row button:hover { color: var(--accent); }

/* ========= Micro button ========= */
.chatbot-mic {
  background: none; border: none;
  padding: 0 12px; cursor: pointer;
  color: var(--mono-dim);
  display: flex; align-items: center;
  transition: color .2s;
}
.chatbot-mic svg { width: 18px; height: 18px; }
.chatbot-mic:hover { color: var(--ink); }
.chatbot-mic.is-recording { color: #fff; background: #e63946; border-radius: 50%; }

/* Indicateur d'enregistrement */
.chatbot-rec-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #e63946;
  color: #fff;
  font-family: 'Inter Tight', sans-serif;
  font-size: .78rem;
}
.chatbot-rec-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: recBlink .8s infinite;
}
@keyframes recBlink { 0%,100%{opacity:1} 50%{opacity:.3} }
.chatbot-rec-text { flex: 1; }
.chatbot-rec-timer {
  font-family: var(--font-mono, monospace);
  font-size: .75rem;
  opacity: .8;
}

/* ========= Typing dots ========= */
.typing-dots { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mono-dim);
  animation: dotBounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotBounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* ========= Handoff form ========= */
.chatbot-handoff-form {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px 0;
}
.chatbot-handoff-input {
  border: 1px solid rgba(14,14,12,.15);
  border-radius: 4px;
  padding: 8px 12px;
  font-family: 'Inter Tight', sans-serif;
  font-size: .85rem;
  background: var(--paper);
  color: var(--ink);
  outline: none;
}
.chatbot-handoff-input:focus { border-color: var(--accent); }

/* ========= Lien inline ========= */
.chatbot-link {
  display: inline-block;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff !important;
  text-decoration: none;
  border-radius: 4px;
  font-family: 'Inter Tight', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  margin: 4px 0;
  transition: opacity .2s;
}
.chatbot-link:hover { opacity: .85; }

/* ========= Badge notification ========= */
.chatbot-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #e63946;
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: badgePulse 2s infinite;
  pointer-events: none;
}
@keyframes badgePulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.2)} }

/* ========= Bulle proactive ========= */
.chatbot-bubble-proactive {
  position: fixed;
  bottom: 92px;
  right: 28px;
  z-index: 9002;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 12px 16px;
  max-width: 260px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  animation: bubbleSlideUp .3s ease;
}
.chatbot-bubble__text {
  font-family: 'Inter Tight', sans-serif;
  font-size: .85rem;
  line-height: 1.45;
  color: var(--ink);
}
.chatbot-bubble__close {
  background: none; border: none;
  font-size: 1rem; cursor: pointer;
  color: var(--mono-dim);
  padding: 0; line-height: 1;
  flex-shrink: 0;
}
.chatbot-bubble__close:hover { color: var(--ink); }
@keyframes bubbleSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Fleche vers le toggle */
.chatbot-bubble-proactive::after {
  content: '';
  position: absolute;
  bottom: -7px; right: 20px;
  width: 12px; height: 12px;
  background: var(--paper);
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  transform: rotate(45deg);
}

/* ========= Quick replies ========= */
.chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}
.chatbot-quick-reply {
  border: 1px solid var(--ink);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .82rem;
  font-family: 'Inter Tight', sans-serif;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  transition: background .15s, color .15s;
}
.chatbot-quick-reply:hover { background: var(--ink); color: var(--paper); }

/* ========= Disclaimer RGPD ========= */
.chatbot-disclaimer {
  padding: 6px 16px 8px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: .65rem;
  color: var(--mono-dim);
  text-align: center;
  border-top: 1px solid rgba(14,14,12,.06);
}
.chatbot-disclaimer a { color: var(--mono-dim); text-decoration: underline; }

/* ========= Animation panel ========= */
.chatbot-panel {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease, width .4s ease, left .4s ease, right .4s ease, bottom .4s ease, max-height .4s ease;
}
.chatbot-panel.is-open {
  opacity: 1;
  transform: translateY(0);
}


/* ========= Config page ========= */
.config-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px;
}
.config-page h1 {
  font-family: 'Instrument Serif', serif;
  font-size: 2rem;
  margin-bottom: 8px;
}
.config-page .config-subtitle {
  color: var(--mono-dim);
  font-family: 'Inter Tight', sans-serif;
  font-size: .9rem;
  margin-bottom: 32px;
}

.config-login {
  max-width: 320px;
  margin: 80px auto;
  text-align: center;
}
.config-login h2 {
  font-family: 'Instrument Serif', serif;
  font-size: 1.5rem;
  margin-bottom: 16px;
}
.config-login input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  text-align: center;
  letter-spacing: .2em;
  margin-bottom: 12px;
}
.config-login .config-error {
  color: var(--accent);
  font-size: .85rem;
  min-height: 20px;
}

.config-add {
  margin-bottom: 32px;
  padding: 20px;
  border: 1px solid rgba(14,14,12,.12);
  border-radius: 4px;
  background: var(--paper-2);
}
.config-add label {
  display: block;
  font-family: 'Inter Tight', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
  color: var(--mono-dim);
}
.config-add input,
.config-add textarea {
  width: 100%;
  border: 1px solid rgba(14,14,12,.15);
  border-radius: 2px;
  padding: 10px 12px;
  font-family: 'Inter Tight', sans-serif;
  font-size: .9rem;
  background: var(--paper);
  color: var(--ink);
  margin-bottom: 12px;
  resize: vertical;
}
.config-add textarea { min-height: 120px; }
.config-add button {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 10px 24px;
  border-radius: 2px;
  cursor: pointer;
  font-family: 'Inter Tight', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  transition: background .2s;
}
.config-add button:hover { background: var(--accent); }

.config-entries { list-style: none; padding: 0; }
.config-entry {
  padding: 16px;
  border: 1px solid rgba(14,14,12,.08);
  border-radius: 4px;
  margin-bottom: 12px;
  background: var(--paper);
  position: relative;
}
.config-entry__title {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 6px;
}
.config-entry__content {
  font-family: 'Inter Tight', sans-serif;
  font-size: .85rem;
  color: var(--mono-dim);
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 120px;
  overflow-y: auto;
}
.config-entry__meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  color: var(--mono-dim);
  margin-top: 8px;
}
.config-entry__delete {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: 1px solid rgba(14,14,12,.15);
  border-radius: 2px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: .78rem;
  color: var(--mono-dim);
  transition: color .2s, border-color .2s;
}
.config-entry__delete:hover { color: var(--accent); border-color: var(--accent); }

.config-empty {
  text-align: center;
  padding: 40px;
  color: var(--mono-dim);
  font-family: 'Inter Tight', sans-serif;
  font-style: italic;
}

@media (max-width: 480px) {
  .chatbot-panel { width: calc(100vw - 24px); right: 12px; bottom: 88px; }
  .chatbot-toggle { bottom: 16px; right: 16px; }
}
