/* ══════════════════════════════════════════════════════════════════════
   ASSISTANT IA — widget de chat (espace candidatures)
   ══════════════════════════════════════════════════════════════════════ */
.wr-ai { position: fixed; right: 22px; bottom: 22px; z-index: 1200; }

/* Bouton flottant */
.wr-ai__fab {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 18px; border: none; border-radius: 999px; cursor: pointer;
  background: var(--wr-violet, #8A63C1); color: #fff;
  box-shadow: 0 10px 30px rgba(138, 99, 193, .38);
  font-weight: 700; font-size: 14.5px; transition: transform .15s ease, box-shadow .15s ease;
}
.wr-ai__fab:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(138, 99, 193, .46); }
.wr-ai__fab svg { width: 21px; height: 21px; }

/* Panneau */
.wr-ai__panel {
  position: absolute; right: 0; bottom: 0;
  width: 380px; max-width: calc(100vw - 32px); height: 540px; max-height: calc(100vh - 90px);
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--wr-line, #EEF1F7); border-radius: 20px;
  box-shadow: 0 24px 70px rgba(30, 27, 46, .22); overflow: hidden;
  animation: wr-ai-in .22s ease;
}
.wr-ai__panel[hidden], .wr-ai__fab[hidden] { display: none; }
@keyframes wr-ai-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.wr-ai__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--wr-line, #EEF1F7);
  background: linear-gradient(180deg, #FBF9FE, #fff);
}
.wr-ai__head-title { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15px; color: var(--wr-ink, #1E1B2E); }
.wr-ai__dot { width: 9px; height: 9px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.wr-ai__close { border: none; background: none; cursor: pointer; color: #9CA3AF; padding: 4px; border-radius: 8px; }
.wr-ai__close:hover { background: #F3F4F6; color: #4B5563; }
.wr-ai__close svg { width: 19px; height: 19px; display: block; }

.wr-ai__body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

.wr-ai-msg { display: flex; }
.wr-ai-msg--user { justify-content: flex-end; }
.wr-ai-msg__bubble {
  max-width: 82%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word;
}
.wr-ai-msg--assistant .wr-ai-msg__bubble { background: #F4F1FA; color: #2C2640; border-bottom-left-radius: 5px; }
.wr-ai-msg--user .wr-ai-msg__bubble { background: var(--wr-violet, #8A63C1); color: #fff; border-bottom-right-radius: 5px; }

/* Points animés « en train d'écrire » */
.wr-ai-dots { display: inline-flex; gap: 4px; padding: 2px 0; }
.wr-ai-dots span { width: 7px; height: 7px; border-radius: 50%; background: #B9A8D6; animation: wr-ai-bounce 1.2s infinite ease-in-out; }
.wr-ai-dots span:nth-child(2) { animation-delay: .18s; }
.wr-ai-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes wr-ai-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.wr-ai__form { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--wr-line, #EEF1F7); }
.wr-ai__input {
  flex: 1; resize: none; border: 1px solid var(--wr-line, #EEF1F7); border-radius: 12px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; line-height: 1.4; max-height: 120px;
  outline: none; transition: border-color .15s ease;
}
.wr-ai__input:focus { border-color: var(--wr-violet, #8A63C1); }
.wr-ai__send {
  flex-shrink: 0; width: 40px; height: 40px; border: none; border-radius: 11px; cursor: pointer;
  background: var(--wr-violet, #8A63C1); color: #fff; display: grid; place-items: center;
  transition: opacity .15s ease;
}
.wr-ai__send:disabled { opacity: .5; cursor: default; }
.wr-ai__send svg { width: 18px; height: 18px; }

@media (max-width: 560px) {
  .wr-ai { right: 14px; bottom: 14px; }
  .wr-ai__fab-label { display: none; }
  .wr-ai__fab { padding: 14px; }
  .wr-ai__panel { width: calc(100vw - 28px); height: calc(100vh - 100px); }
}
