/* ACTION EMPLOI – Chatbot (scénarisé, sans IA) */
.ae-chatbot{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2147483647; /* au-dessus de tout */
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* BOUTON FLOTTANT */
.ae-fab{
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  background: #0B5FA5;
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
  display: grid;
  place-items: center;

  position: relative;
  transform-origin: center;
  transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
  animation: ae-nudge 6s ease-in-out infinite;
}

.ae-fab svg{ width: 34px; height: 34px; }

.ae-fab:hover{
  animation: none;
  transform: scale(1.06);
  box-shadow: 0 18px 42px rgba(0,0,0,0.22);
  filter: brightness(1.05);
}

.ae-fab:active{
  transform: scale(.98);
}

.ae-fab{
  border-radius: 999px !important;
}

@keyframes ae-nudge{
  0%   { transform: translateY(0) rotate(0); }
  20%  { transform: translateY(-3px) rotate(-6deg); }
  40%  { transform: translateY(0) rotate(0); }
  100% { transform: translateY(0) rotate(0); }
}

.ae-fab::after{
  content:"";
  position:absolute;
  inset: -6px;
  border-radius: 999px;
  border: 2px solid rgba(11,95,165,.35);
  animation: ae-pulse 3.5s ease-out infinite;
  pointer-events: none;
}

@keyframes ae-pulse{
  0%   { transform: scale(.85); opacity: 0; }
  30%  { opacity: .6; }
  60%  { transform: scale(1.15); opacity: 0; }
  100% { opacity: 0; }
}

/* PANNEAU */
.ae-panel{
  width: 360px;
  max-width: calc(100vw - 36px);
  height: 520px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 55px rgba(0,0,0,.20);
  overflow: hidden;
  margin-bottom: 12px;

  /* ✅ animé (NE PAS mettre display:none) */
  display: block;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(.98);
  transform-origin: bottom right;
  pointer-events: none;

  transition:
    opacity .22s ease,
    transform .28s cubic-bezier(.16,1,.3,1),
    visibility 0s linear .28s;
}

.ae-panel.is-open{
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;

  transition:
    opacity .22s ease,
    transform .28s cubic-bezier(.16,1,.3,1),
    visibility 0s;
}

/* petite bounce */
.ae-panel.is-open{
  animation: aePop .26s cubic-bezier(.2,.9,.2,1);
}

@keyframes aePop{
  0%   { transform: translateY(18px) scale(.98); }
  60%  { transform: translateY(-2px) scale(1.01); }
  100% { transform: translateY(0) scale(1); }
}

/* HEADER */
.ae-header{
  background: #0B5FA5;
  color: #fff;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ae-header-left{
  display: flex;
  align-items: center;
  gap: 10px;
}

.ae-botmark{
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  display: grid;
  place-items: center;
}

.ae-title{
  font-weight: 700;
  font-size: 14px;
  line-height: 1.1;
}

.ae-subtitle{
  font-size: 12px;
  opacity: .9;
}

.ae-demo{
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  font-size: 11px;
  line-height: 1.6;
}

.ae-header-actions button{
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  opacity: .95;
}

/* CORPS (MESSAGES) */
.ae-body{
  padding: 14px 14px 22px; /* air en bas */
  height: calc(520px - 54px); /* header */
  overflow-y: auto;
  background: #f6f7f9;
}

/* LIGNES */
.ae-row{
  margin: 10px 0;
  display: flex;
}

.ae-row.bot{ justify-content: flex-start; }
.ae-row.user{ justify-content: flex-end; }

/* BULLES */
.ae-bubble{
  max-width: 82%;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.35;
}

.ae-row.bot .ae-bubble{
  background: #fff;
  border: 1px solid #e6e8ee;
}

.ae-row.user .ae-bubble{
  background: #0B5FA5;
  color: #fff;
  border: 1px solid rgba(255,255,255,.2);
}

/* Message d’accueil en pleine largeur */
.ae-row.bot:first-child .ae-bubble{
  max-width: 100%;
}

/* CHOIX / BOUTONS */
.ae-choices{
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.ae-btn{
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 13px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  background: #0B5FA5;
  color: #fff;
  box-shadow: 0 8px 18px rgba(11,95,165,.18);
}

.ae-btn.secondary{
  background: #fff;
  color: #0B5FA5;
  border: 1px solid #d8e3f0;
  box-shadow: none;
}

/* MOBILE */
@media (max-width: 768px){
  .ae-chatbot{
    right: 14px;
    bottom: 90px; /* au-dessus des barres sticky */
  }
}

@media (max-width: 420px){
  .ae-panel{
    width: calc(100vw - 36px);
  }
}

/* FIX position bulle (toujours en bas à droite) */
.ae-chatbot{
  right: 18px !important;
  left: auto !important;
  bottom: 18px !important;
  transform: none !important;
}

.ae-chatbot .ae-fab{
  margin-left: auto !important;
  margin-right: 0 !important;
}

/* le panneau doit aussi s’ancrer à droite */
.ae-chatbot .ae-panel{
  margin-right: 0 !important;
  margin-left: auto !important;
  transform-origin: bottom right !important;
}

/* Espace visuel constant sous les boutons (tous les flows) */
.ae-choices {
  padding-bottom: 22px;
}

/* évite la barre horizontale dans le chat */
#ae-chatbot .ae-body,
#ae-chatbot .ae-panel,
#ae-chatbot .ae-choices {
  overflow-x: hidden;
}

/* boutons : autoriser le retour à la ligne */
#ae-chatbot .ae-btn {
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.3;
  min-height: 54px;
  height: auto;
  padding: 14px 16px;
}

/* le conteneur global du chatbot ne bloque pas les clics */
#ae-chatbot {
  pointer-events: none;
}

/* seules les vraies zones interactives du chat restent cliquables */
#ae-chatbot .ae-fab,
#ae-chatbot .ae-panel,
#ae-chatbot .ae-panel * {
  pointer-events: auto;
}