/* Agent d'orientation EHESP-MALI : couleurs du logo (bleus du globe, rouge du slogan).
   Tous les styles sont limités à .ea-root pour ne pas toucher au thème du site. */
.ea-root {
  --ea-blue: #203363;
  --ea-blue-2: #255B95;
  --ea-sky: #3285B7;
  --ea-red: #C81B25;
  --ea-ink: #17233F;
  --ea-muted: #5A6785;
  --ea-line: #D5DEE9;
  --ea-surface: #FFFFFF;
  --ea-surface-2: #EEF3F8;
  --ea-log: #F4F7FB;
  --ea-ok: #1B6B4A;
  --ea-ok-bg: #DDF0E6;
  --ea-warn: #8A5200;
  --ea-warn-bg: #FBEDCF;
  --ea-danger: #A3271F;
  --ea-danger-bg: #FBE3E0;
  --ea-wa: #25D366;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ea-ink);
}
.ea-root *, .ea-root *::before, .ea-root *::after { box-sizing: border-box; }
.ea-root :where(button, input, textarea) { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; }
.ea-root :where(p, ul, ol, h2) { margin: 0; }
.ea-root a { color: var(--ea-blue-2); }
.ea-root :focus-visible { outline: 2px solid var(--ea-sky); outline-offset: 2px; }
.ea-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Bulle flottante */
.ea-floating { position: fixed; right: 18px; bottom: 18px; z-index: 99990; }
.ea-launcher {
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 16px 7px 7px;
  border: 0; border-radius: 999px; background: var(--ea-blue); color: #FFFFFF; cursor: pointer;
  box-shadow: 0 10px 28px -8px rgba(23, 35, 63, 0.55); font-weight: 600; font-size: 15px;
}
.ea-launcher:hover { background: var(--ea-blue-2); }
.ea-launcher img { width: 40px; height: 40px; border-radius: 50%; background: #FFFFFF; padding: 3px; object-fit: contain; }
.ea-floating.ea-open .ea-launcher { display: none; }

/* Fenêtre */
.ea-window {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  width: 100%; background: var(--ea-surface); border-radius: 18px;
  box-shadow: 0 22px 44px -20px rgba(23, 35, 63, 0.45), 0 2px 6px rgba(23, 35, 63, 0.1);
}
.ea-floating .ea-window { width: 390px; height: min(640px, calc(100vh - 36px)); }
.ea-floating:not(.ea-open) .ea-window { display: none; }
.ea-inline .ea-window { max-width: 560px; height: 640px; margin: 0 auto; border: 1px solid var(--ea-line); }
.ea-head { display: flex; align-items: center; gap: 11px; padding: 13px 14px; background: linear-gradient(120deg, var(--ea-blue), var(--ea-blue-2)); color: #FFFFFF; }
.ea-avatar { flex: none; width: 46px; height: 46px; border-radius: 50%; background: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: 0 0 0 2px #5670A6; }
.ea-avatar img { width: 90%; height: 90%; object-fit: contain; }
.ea-id { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ea-id strong { font-size: 17px; }
.ea-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #CBD8EC; }
.ea-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; }
.ea-hbtn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 1px solid #5670A6; background: transparent; color: #FFFFFF; cursor: pointer; }
.ea-hbtn:hover:not(:disabled) { background: #5670A6; }
.ea-hbtn:disabled { opacity: 0.5; cursor: not-allowed; }
.ea-hbtn svg { width: 16px; height: 16px; }
.ea-head :focus-visible { outline-color: #FFFFFF; }
.ea-band { background: var(--ea-red); color: #FFFFFF; font-size: 10.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; text-align: center; padding: 4px 12px; }

.ea-log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 12px 10px; background: var(--ea-log); display: flex; flex-direction: column; gap: 10px; }
.ea-msg { display: flex; gap: 8px; max-width: 90%; min-width: 0; }
.ea-msg.ea-user { align-self: flex-end; }
.ea-msg.ea-agent { align-self: flex-start; }
.ea-msg .ea-avatar { width: 30px; height: 30px; box-shadow: none; border: 1px solid var(--ea-line); align-self: flex-start; margin-top: 2px; }
.ea-bubble { padding: 9px 13px; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ea-user .ea-bubble { background: var(--ea-blue); color: #FFFFFF; border-radius: 18px 18px 5px 18px; white-space: pre-wrap; }
.ea-agent .ea-bubble { background: var(--ea-surface); border: 1px solid var(--ea-line); border-radius: 18px 18px 18px 5px; }
.ea-bubble ul, .ea-bubble ol { padding-left: 20px; display: flex; flex-direction: column; gap: 3px; margin: 0; }
.ea-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-left: 38px; }
.ea-chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--ea-line); background: var(--ea-surface); color: var(--ea-blue-2); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.ea-chip:hover:not(:disabled) { border-color: var(--ea-sky); background: var(--ea-surface-2); }
.ea-line { align-self: center; max-width: 92%; text-align: center; font-size: 12.5px; line-height: 1.4; padding: 6px 12px; border-radius: 10px; }
.ea-line.ea-ok { background: var(--ea-ok-bg); color: var(--ea-ok); }
.ea-line.ea-warn { background: var(--ea-warn-bg); color: var(--ea-warn); }
.ea-typing { display: inline-flex; align-items: center; gap: 4px; height: 21px; }
.ea-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ea-muted); }
@media (prefers-reduced-motion: no-preference) {
  .ea-typing i { animation: ea-hop 1.1s ease-in-out infinite; }
  .ea-typing i:nth-child(2) { animation-delay: 0.15s; }
  .ea-typing i:nth-child(3) { animation-delay: 0.3s; }
  @keyframes ea-hop { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-4px); opacity: 1; } }
}

.ea-notice { margin: 8px 12px 0; padding: 8px 11px; border-radius: 10px; background: var(--ea-danger-bg); color: var(--ea-danger); font-size: 13.5px; }
.ea-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--ea-line); background: var(--ea-surface); }
.ea-composer textarea { flex: 1; min-width: 0; resize: none; max-height: 120px; margin: 0; padding: 9px 14px; border: 1px solid var(--ea-line); border-radius: 21px; background: var(--ea-surface-2); line-height: 1.4; box-shadow: none; }
.ea-composer textarea:focus-visible { outline-offset: 0; border-color: var(--ea-sky); }
.ea-send { flex: none; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 0; background: var(--ea-blue); color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ea-send svg { width: 19px; height: 19px; }
.ea-send:disabled { opacity: 0.45; cursor: not-allowed; }
.ea-actions { display: flex; gap: 8px; padding: 0 12px 6px; background: var(--ea-surface); }
.ea-pill { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--ea-line); background: var(--ea-surface); color: var(--ea-ink); font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; text-align: center; line-height: 1.25; }
.ea-pill:hover { border-color: var(--ea-sky); }
.ea-pill-ico { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--ea-blue); color: #FFFFFF; }
.ea-pill-ico.ea-wa { background: var(--ea-wa); color: #0B2B20; }
.ea-pill-ico svg { width: 13px; height: 13px; }
.ea-legal { padding: 2px 14px 10px; font-size: 11.5px; color: var(--ea-muted); text-align: center; background: var(--ea-surface); }

/* Carte de localisation */
.ea-loc { display: block; width: 100%; max-width: 280px; border-radius: 14px; overflow: hidden; border: 1px solid var(--ea-line); background: var(--ea-surface); color: inherit; text-decoration: none; }
.ea-root a.ea-loc { color: inherit; text-decoration: none; }
.ea-loc-map { position: relative; display: block; aspect-ratio: 290 / 150; background: #E6EEF7; }
.ea-loc-map svg { display: block; width: 100%; height: 100%; }
.ea-loc-map .blk { fill: #D5E1EE; }
.ea-loc-map .rd { stroke: #FFFFFF; fill: none; stroke-linecap: round; }
.ea-loc-map .rd-main { stroke: #8FB6DA; fill: none; stroke-linecap: round; }
.ea-loc-map .lbl { fill: var(--ea-muted); font-size: 8px; font-weight: 700; letter-spacing: 0.05em; }
.ea-loc-map .halo { fill: var(--ea-sky); opacity: 0.22; }
.ea-loc-map .pin { fill: #E1212B; stroke: #FFFFFF; stroke-width: 1.5; }
.ea-loc-map .pin-dot, .ea-loc-map .lm { fill: var(--ea-blue); }
.ea-loc-note { position: absolute; right: 6px; bottom: 5px; padding: 1px 6px; border-radius: 6px; font-size: 9.5px; background: #FFFFFF; color: var(--ea-muted); }
.ea-loc-info { display: flex; gap: 10px; align-items: center; padding: 9px 12px; background: var(--ea-blue); color: #FFFFFF; border-top: 3px solid #E1212B; }
.ea-loc-ico { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #E1212B; color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; }
.ea-loc-ico svg { width: 15px; height: 15px; }
.ea-loc-text { display: grid; gap: 1px; min-width: 0; }
.ea-loc-text strong { font-size: 14px; }
.ea-loc-text span { font-size: 12px; color: #CBD8EC; }
.ea-loc-open { display: block; padding: 8px 12px; text-align: center; font-size: 13.5px; font-weight: 600; color: var(--ea-blue-2); border-top: 1px solid var(--ea-line); }

/* Fiche d'inscription */
.ea-fiche { position: absolute; inset: 0; z-index: 5; background: var(--ea-surface); display: flex; flex-direction: column; }
.ea-fiche[hidden], .ea-fiche-body[hidden], .ea-pieces[hidden], .ea-notice[hidden], .ea-fiche-error[hidden] { display: none; }
.ea-fiche-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: var(--ea-blue); color: #FFFFFF; }
.ea-fiche-head h2 { font-size: 16px; color: #FFFFFF; font-weight: 600; }
.ea-fiche-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.ea-fiche fieldset { border: 1px solid var(--ea-line); border-radius: 12px; padding: 10px 12px 12px; margin: 0; display: grid; gap: 10px; min-width: 0; }
.ea-fiche legend { padding: 0 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ea-muted); }
.ea-f { display: grid; gap: 4px; font-size: 13.5px; min-width: 0; }
.ea-fiche input[type="text"], .ea-fiche input[type="tel"], .ea-fiche input[type="email"], .ea-fiche textarea {
  width: 100%; min-width: 0; margin: 0; padding: 8px 10px; border: 1px solid var(--ea-line); border-radius: 8px; background: var(--ea-surface-2); box-shadow: none; height: auto;
}
.ea-fiche [aria-invalid="true"] { border-color: var(--ea-danger); }
.ea-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ea-choices { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ea-choices label, .ea-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; }
.ea-check input, .ea-choices input { margin: 3px 0 0; }
.ea-pieces { display: grid; gap: 8px; }
.ea-consent { padding: 10px 12px; border-radius: 10px; background: var(--ea-surface-2); }
.ea-note { font-size: 12.5px; color: var(--ea-muted); }
.ea-fiche-error { padding: 8px 10px; border-radius: 8px; background: var(--ea-danger-bg); color: var(--ea-danger); font-size: 13.5px; }
.ea-fiche-ok { padding: 10px 12px; border-radius: 10px; background: var(--ea-ok-bg); color: var(--ea-ok); font-weight: 500; }
.ea-fiche-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ea-btn { border: 1px solid transparent; border-radius: 8px; padding: 8px 15px; background: var(--ea-blue); color: #FFFFFF; font-weight: 600; cursor: pointer; }
.ea-btn.ea-quiet { background: transparent; color: var(--ea-ink); border-color: var(--ea-line); font-weight: 500; }
.ea-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 520px) {
  .ea-floating { right: 12px; bottom: 12px; }
  .ea-floating.ea-open { inset: 0; }
  .ea-floating.ea-open .ea-window { width: 100%; height: 100%; border-radius: 0; }
  .ea-row2 { grid-template-columns: 1fr; }
  .ea-launcher span { display: none; }
  .ea-launcher { padding: 6px; }
}

/* ---------- Protection contre les styles du thème ----------
   Les thèmes (Elementor, etc.) appliquent leurs couleurs à tous les champs et boutons.
   Ces règles, plus fortes, gardent l'apparence de l'agent quel que soit le thème. */
#ehesp-agent textarea, #ehesp-agent textarea:hover, #ehesp-agent textarea:focus, #ehesp-agent textarea:active {
  background: #EEF3F8 !important; background-image: none !important; color: #17233F !important;
  border: 1px solid #D5DEE9 !important; border-radius: 21px !important; box-shadow: none !important;
  font-family: inherit !important; font-size: 15px !important; font-weight: 400 !important; line-height: 1.4 !important;
  padding: 9px 14px !important; margin: 0 !important; min-height: 40px !important; height: auto; max-height: 120px !important;
  text-transform: none !important; letter-spacing: normal !important; -webkit-text-fill-color: #17233F !important; opacity: 1 !important;
}
#ehesp-agent textarea:focus { border-color: #3285B7 !important; outline: 2px solid rgba(50, 133, 183, 0.25) !important; outline-offset: 0 !important; }
#ehesp-agent textarea::placeholder { color: #5A6785 !important; opacity: 1 !important; -webkit-text-fill-color: #5A6785 !important; }

#ehesp-agent .ea-send, #ehesp-agent .ea-send:hover, #ehesp-agent .ea-send:focus, #ehesp-agent .ea-send:active {
  flex: none !important; width: 40px !important; height: 40px !important; min-width: 40px !important; min-height: 0 !important;
  padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 50% !important;
  background: #203363 !important; background-image: none !important; color: #FFFFFF !important;
  box-shadow: none !important; opacity: 1 !important; display: inline-flex !important; align-items: center !important; justify-content: center !important;
}
#ehesp-agent .ea-send:hover:not(:disabled) { background: #255B95 !important; }
#ehesp-agent .ea-send:disabled { background: #B9C4D6 !important; color: #FFFFFF !important; cursor: not-allowed !important; }
#ehesp-agent .ea-send svg { width: 19px !important; height: 19px !important; stroke: currentColor !important; fill: none !important; }

#ehesp-agent .ea-pill, #ehesp-agent .ea-pill:hover, #ehesp-agent .ea-pill:focus, #ehesp-agent .ea-pill:active {
  flex: 1 1 0 !important; min-width: 0 !important; height: auto !important; min-height: 40px !important; margin: 0 !important;
  padding: 6px 12px !important; border: 1px solid #D5DEE9 !important; border-radius: 999px !important;
  background: #FFFFFF !important; background-image: none !important; color: #17233F !important; box-shadow: none !important;
  font-family: inherit !important; font-size: 13px !important; font-weight: 500 !important; line-height: 1.25 !important;
  white-space: normal !important; text-align: center !important; text-transform: none !important; letter-spacing: normal !important;
  text-decoration: none !important; overflow: hidden !important; display: flex !important; align-items: center !important; justify-content: center !important; gap: 7px !important;
}
#ehesp-agent .ea-pill:hover { border-color: #3285B7 !important; }
#ehesp-agent .ea-pill span:not(.ea-pill-ico) { min-width: 0 !important; overflow-wrap: anywhere; color: #17233F !important; }
#ehesp-agent .ea-actions { padding: 0 12px 6px !important; gap: 8px !important; }

#ehesp-agent .ea-chip, #ehesp-agent .ea-chip:hover, #ehesp-agent .ea-chip:focus {
  background: #FFFFFF !important; background-image: none !important; color: #255B95 !important; border: 1px solid #D5DEE9 !important;
  border-radius: 999px !important; padding: 6px 12px !important; margin: 0 !important; box-shadow: none !important; height: auto !important;
  font-size: 13.5px !important; font-weight: 500 !important; line-height: 1.3 !important; white-space: normal !important; text-align: left !important;
  text-transform: none !important; letter-spacing: normal !important;
}
#ehesp-agent .ea-chip:hover { border-color: #3285B7 !important; background: #EEF3F8 !important; }

#ehesp-agent .ea-hbtn, #ehesp-agent .ea-hbtn:hover, #ehesp-agent .ea-hbtn:focus {
  width: 34px !important; height: 34px !important; min-width: 34px !important; padding: 0 !important; margin: 0 !important;
  border: 1px solid #5670A6 !important; border-radius: 50% !important; background: transparent !important; background-image: none !important;
  color: #FFFFFF !important; box-shadow: none !important; display: inline-flex !important; align-items: center !important; justify-content: center !important;
}
#ehesp-agent .ea-hbtn:hover:not(:disabled) { background: #5670A6 !important; }

#ehesp-agent .ea-launcher, #ehesp-agent .ea-launcher:hover, #ehesp-agent .ea-launcher:focus {
  border: 0 !important; border-radius: 999px !important; background: #203363 !important; background-image: none !important; color: #FFFFFF !important;
  padding: 7px 16px 7px 7px !important; margin: 0 !important; height: auto !important; font-size: 15px !important; font-weight: 600 !important;
  line-height: 1.3 !important; text-transform: none !important; letter-spacing: normal !important;
}
#ehesp-agent .ea-launcher:hover { background: #255B95 !important; }

#ehesp-agent .ea-btn, #ehesp-agent .ea-btn:hover, #ehesp-agent .ea-btn:focus {
  background: #203363 !important; background-image: none !important; color: #FFFFFF !important; border: 1px solid transparent !important;
  border-radius: 8px !important; padding: 8px 15px !important; height: auto !important; box-shadow: none !important;
  font-size: 14px !important; font-weight: 600 !important; line-height: 1.3 !important; text-transform: none !important; letter-spacing: normal !important;
}
#ehesp-agent .ea-btn.ea-quiet, #ehesp-agent .ea-btn.ea-quiet:hover { background: transparent !important; color: #17233F !important; border-color: #D5DEE9 !important; font-weight: 500 !important; }

#ehesp-agent .ea-fiche input[type="text"], #ehesp-agent .ea-fiche input[type="tel"], #ehesp-agent .ea-fiche input[type="email"],
#ehesp-agent .ea-fiche input[type="text"]:focus, #ehesp-agent .ea-fiche input[type="tel"]:focus, #ehesp-agent .ea-fiche input[type="email"]:focus {
  background: #EEF3F8 !important; background-image: none !important; color: #17233F !important; -webkit-text-fill-color: #17233F !important;
  border: 1px solid #D5DEE9 !important; border-radius: 8px !important; box-shadow: none !important; padding: 8px 10px !important;
  margin: 0 !important; height: auto !important; font-size: 14px !important; line-height: 1.4 !important;
}
#ehesp-agent .ea-fiche textarea { border-radius: 8px !important; }
#ehesp-agent .ea-fiche input:focus, #ehesp-agent .ea-fiche textarea:focus { border-color: #3285B7 !important; }
#ehesp-agent .ea-fiche [aria-invalid="true"] { border-color: #A3271F !important; }
#ehesp-agent .ea-fiche input[type="radio"], #ehesp-agent .ea-fiche input[type="checkbox"] { width: auto !important; height: auto !important; margin: 3px 0 0 !important; accent-color: #203363; }
#ehesp-agent .ea-composer { background: #FFFFFF !important; }
#ehesp-agent .ea-pill, #ehesp-agent .ea-chip, #ehesp-agent .ea-hbtn, #ehesp-agent .ea-launcher, #ehesp-agent .ea-btn { opacity: 1 !important; }
#ehesp-agent .ea-chip:disabled, #ehesp-agent .ea-hbtn:disabled, #ehesp-agent .ea-btn:disabled { opacity: 0.5 !important; }
#ehesp-agent .ea-pill-ico, #ehesp-agent .ea-pill-ico svg { opacity: 1 !important; }
