/* ============================================================
   Groupe IDRA - Widget chatbot (Lia, le concierge)
   Classes prefixees .idra-bot-* pour eviter conflits.
   ============================================================ */

/* --- Bouton flottant ---------------------------------------- */
.idra-bot-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(140deg, #7ce0ff, #2a6dd9);
  color: #001026;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid rgba(124, 224, 255, 0.4);
  box-shadow:
    0 14px 30px -10px rgba(95, 168, 255, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  z-index: 9998;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.25s;
}
.idra-bot-fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 20px 40px -10px rgba(95,168,255,0.75); }
.idra-bot-fab:focus-visible { outline: 2px solid #7ce0ff; outline-offset: 4px; }
.idra-bot-fab svg { width: 26px; height: 26px; }

.idra-bot-fab .idra-bot-fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(124, 224, 255, 0.5);
  animation: idra-bot-pulse 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes idra-bot-pulse {
  0%   { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0;   transform: scale(1.5); }
}

.idra-bot-fab.is-open .idra-bot-fab-pulse { display: none; }
.idra-bot-fab .idra-bot-icon-chat { display: block; }
.idra-bot-fab .idra-bot-icon-close { display: none; }
.idra-bot-fab.is-open .idra-bot-icon-chat { display: none; }
.idra-bot-fab.is-open .idra-bot-icon-close { display: block; }

/* --- Panneau ouvert ------------------------------------------ */
.idra-bot-panel {
  position: fixed;
  bottom: 96px;
  right: 22px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 130px);
  background: linear-gradient(180deg, rgba(15, 25, 45, 0.96), rgba(8, 15, 30, 0.96));
  border: 1px solid rgba(120, 170, 230, 0.22);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
  pointer-events: none;
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  color: #e8eef9;
}
.idra-bot-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* --- Header -------------------------------------------------- */
.idra-bot-head {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(120, 170, 230, 0.12);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(95, 168, 255, 0.06), transparent);
}
.idra-bot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(140deg, #7ce0ff, #2a6dd9);
  display: grid;
  place-items: center;
  font-family: 'Instrument Serif', serif;
  color: #001026;
  font-size: 19px;
  font-style: italic;
  position: relative;
  flex-shrink: 0;
}
.idra-bot-avatar::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7cf0a8;
  border: 2px solid rgba(15, 25, 45, 1);
}
.idra-bot-head-info { flex: 1; line-height: 1.2; min-width: 0; }
.idra-bot-head-info strong { font-weight: 500; font-size: 15px; }
.idra-bot-head-info small {
  display: block;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: #8a9bb4;
  margin-top: 2px;
  letter-spacing: 0.04em;
}
.idra-bot-head-close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(120, 170, 230, 0.18);
  color: #8a9bb4;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}
.idra-bot-head-close:hover { background: rgba(255, 255, 255, 0.06); color: #e8eef9; }

/* --- Zone messages ------------------------------------------- */
.idra-bot-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.idra-bot-msgs::-webkit-scrollbar { width: 6px; }
.idra-bot-msgs::-webkit-scrollbar-thumb { background: rgba(120, 170, 230, 0.18); border-radius: 4px; }

.idra-bot-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: idra-bot-msg-in 0.35s ease-out;
}
@keyframes idra-bot-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.idra-bot-msg.bot {
  align-self: flex-start;
  background: rgba(15, 25, 45, 0.7);
  border: 1px solid rgba(120, 170, 230, 0.15);
  border-top-left-radius: 6px;
}
.idra-bot-msg.user {
  align-self: flex-end;
  background: linear-gradient(140deg, rgba(124, 224, 255, 0.18), rgba(42, 109, 217, 0.18));
  border: 1px solid rgba(124, 224, 255, 0.3);
  color: #f0f7ff;
  border-top-right-radius: 6px;
}
.idra-bot-typing {
  align-self: flex-start;
  padding: 12px 16px;
  background: rgba(15, 25, 45, 0.7);
  border: 1px solid rgba(120, 170, 230, 0.15);
  border-radius: 16px;
  border-top-left-radius: 6px;
  display: inline-flex;
  gap: 4px;
}
.idra-bot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7ce0ff;
  opacity: 0.5;
  animation: idra-bot-bounce 1.2s infinite;
}
.idra-bot-typing span:nth-child(2) { animation-delay: 0.15s; }
.idra-bot-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes idra-bot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-4px); opacity: 1; }
}

/* --- Zone choix (boutons) ------------------------------------ */
.idra-bot-choices {
  padding: 8px 16px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.idra-bot-choice {
  background: rgba(8, 15, 30, 0.7);
  border: 1px solid rgba(120, 170, 230, 0.25);
  color: #e8eef9;
  font-family: inherit;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.idra-bot-choice:hover {
  background: rgba(124, 224, 255, 0.08);
  border-color: rgba(124, 224, 255, 0.5);
}
.idra-bot-choice:active { transform: scale(0.97); }
.idra-bot-choice:focus-visible { outline: 2px solid #7ce0ff; outline-offset: 2px; }

/* --- Zone champ libre ---------------------------------------- */
.idra-bot-input-zone {
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(120, 170, 230, 0.12);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: rgba(8, 15, 30, 0.4);
}
.idra-bot-input {
  flex: 1;
  background: rgba(8, 15, 30, 0.7);
  border: 1px solid rgba(120, 170, 230, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  color: #e8eef9;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.idra-bot-input::placeholder { color: rgba(138, 155, 180, 0.55); }
.idra-bot-input:focus {
  outline: none;
  border-color: #7ce0ff;
  box-shadow: 0 0 0 3px rgba(124, 224, 255, 0.15);
}
.idra-bot-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(140deg, #6db4ff, #2a6dd9);
  color: #001026;
  cursor: pointer;
  border: none;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.2s, opacity 0.2s;
}
.idra-bot-send:hover { transform: translateY(-1px); }
.idra-bot-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.idra-bot-skip {
  background: transparent;
  border: 1px solid rgba(120, 170, 230, 0.25);
  color: #8a9bb4;
  font-family: inherit;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  height: 40px;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s;
}
.idra-bot-skip:hover { color: #e8eef9; border-color: rgba(120, 170, 230, 0.45); }

/* --- Footer mini-info --------------------------------------- */
.idra-bot-footer-note {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: #8a9bb4;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 6px 14px 10px;
  border-top: 1px solid rgba(120, 170, 230, 0.08);
  background: rgba(8, 15, 30, 0.3);
}

/* --- Erreur inline ------------------------------------------ */
.idra-bot-error {
  align-self: stretch;
  margin: 4px 16px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  background: rgba(255, 107, 136, 0.1);
  border: 1px solid rgba(255, 107, 136, 0.3);
  color: #ffc6d1;
}

/* --- Responsive : mobile / petit ecran ---------------------- */
@media (max-width: 640px) {
  .idra-bot-fab { bottom: 16px; right: 16px; width: 52px; height: 52px; }
  .idra-bot-fab svg { width: 22px; height: 22px; }
  .idra-bot-panel {
    bottom: 80px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 110px);
  }
}

/* --- Reduce motion ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .idra-bot-panel { transition: opacity 0.01ms, transform 0.01ms; }
  .idra-bot-fab-pulse { animation: none; }
  .idra-bot-msg { animation: none; }
  .idra-bot-typing span { animation: none; opacity: 0.7; }
}

/* --- Cacher honeypot anti-spam ------------------------------ */
.idra-bot-trap {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* --- Bloc recap (S5) — confirmation visuelle des reponses ---- */
.idra-bot-recap {
  align-self: stretch;
  margin: 4px 12px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(124,224,255,0.06), rgba(42,109,217,0.04));
  border: 1px solid rgba(124,224,255,0.22);
  font-size: 13px;
  line-height: 1.5;
  animation: idra-bot-msg-in 0.4s ease-out;
}
.idra-bot-recap-row {
  display: flex; gap: 10px; align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(120, 170, 230, 0.12);
}
.idra-bot-recap-row:last-child { border-bottom: none; }
.idra-bot-recap-label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a9bb4;
  flex: 0 0 70px;
}
.idra-bot-recap-val {
  color: #e8eef9;
  font-weight: 500;
  flex: 1;
}

/* --- Timeline (S9) — vision de la suite apres envoi ---------- */
.idra-bot-timeline {
  align-self: stretch;
  margin: 4px 12px 0;
  padding: 14px 16px 6px;
  border-radius: 14px;
  background: rgba(8, 15, 30, 0.55);
  border: 1px solid rgba(124,224,255,0.18);
  animation: idra-bot-msg-in 0.4s ease-out;
}
.idra-bot-timeline-step {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 6px 0;
  position: relative;
}
.idra-bot-timeline-step::before {
  content: ""; position: absolute;
  left: 7px; top: 22px; bottom: -10px;
  width: 1px;
  background: linear-gradient(180deg, rgba(124,224,255,0.4), transparent);
}
.idra-bot-timeline-step:last-child::before { display: none; }
.idra-bot-timeline-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(140deg, #7ce0ff, #2a6dd9);
  flex-shrink: 0;
  margin-top: 1px;
  display: grid; place-items: center;
  color: #001026;
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  font-weight: 700;
}
.idra-bot-timeline-content {
  flex: 1;
  font-size: 13px;
  line-height: 1.45;
  padding-bottom: 6px;
}
.idra-bot-timeline-when {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #7ce0ff;
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}
