/* ===================== CHATBOT SENTINELLE ===================== */

#chatbot-toggle {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #001a4d, #0066ff);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 8px 30px rgba(0,102,255,0.4);
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), box-shadow 0.25s ease;
  user-select: none;
  animation: chatbot-float 3s ease-in-out infinite;
}

/* Ondulation autour du bouton */
#chatbot-toggle::before,
#chatbot-toggle::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(0, 102, 255, 0.25);
  animation: chatbot-ripple 2.5s ease-out infinite;
  pointer-events: none;
}

#chatbot-toggle::after {
  animation-delay: 1.2s;
  background: rgba(0, 102, 255, 0.15);
}

@keyframes chatbot-ripple {
  0%   { transform: scale(1);   opacity: 1; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* Légère lévitation */
@keyframes chatbot-float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-5px); }
}

#chatbot-toggle:hover {
  transform: scale(1.12) translateY(-2px);
  box-shadow: 0 16px 45px rgba(0,102,255,0.6);
  animation: none;
}

#chatbot-toggle.active {
  background: linear-gradient(135deg, #003d99, #001a4d);
  animation: none;
}

#chatbot-toggle.active::before,
#chatbot-toggle.active::after {
  display: none;
}

#chatbot-notif {
  display: none;
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: #ff3b3b;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  animation: chatbot-pulse 2s infinite;
}

@keyframes chatbot-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.18); }
}

#chatbot-window {
  position: fixed;
  bottom: 108px;
  right: 32px;
  width: 370px;
  max-height: 580px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,26,77,0.2), 0 4px 20px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(.34,1.56,.64,1);
}

#chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

#chatbot-header {
  background: linear-gradient(135deg, #001a4d 0%, #003d99 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#chatbot-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.25);
}

#chatbot-name {
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: 'Montserrat', sans-serif;
}

#chatbot-status {
  color: rgba(255,255,255,0.75);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

#chatbot-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  animation: chatbot-blink 2s infinite;
}

@keyframes chatbot-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

#chatbot-close-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

#chatbot-close-btn:hover {
  background: rgba(255,255,255,0.22);
}

#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#chatbot-messages::-webkit-scrollbar { width: 4px; }
#chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#chatbot-messages::-webkit-scrollbar-thumb { background: #d0d8e8; border-radius: 4px; }

.chatbot-msg {
  display: flex;
  animation: chatbot-fadein 0.25s ease;
}

@keyframes chatbot-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chatbot-msg-user { justify-content: flex-end; }
.chatbot-msg-bot  { justify-content: flex-start; }

.chatbot-bubble {
  max-width: 85%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.65;
}

.chatbot-msg-user .chatbot-bubble {
  background: linear-gradient(135deg, #003d99, #0066ff);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chatbot-msg-bot .chatbot-bubble {
  background: #f0f4ff;
  color: #1a1a2e;
  border-bottom-left-radius: 4px;
  border: 1px solid #e0e8ff;
}

.chatbot-typing-bubble {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 14px 18px;
}

.chatbot-typing-bubble span {
  width: 7px;
  height: 7px;
  background: #0066ff;
  border-radius: 50%;
  opacity: 0.4;
  animation: chatbot-dot-bounce 1.2s infinite;
}

.chatbot-typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatbot-dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

#chatbot-choices {
  padding: 8px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
  max-height: 200px;
  overflow-y: auto;
}

.chatbot-choice-btn {
  background: #f0f4ff;
  border: 1.5px solid #c5d3f5;
  color: #003d99;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
  font-family: 'Montserrat', sans-serif;
  line-height: 1.3;
}

.chatbot-choice-btn:hover {
  background: #003d99;
  border-color: #003d99;
  color: #fff;
  transform: translateX(4px);
}

@media (max-width: 480px) {
  #chatbot-window {
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
  }
  #chatbot-toggle {
    bottom: 20px;
    right: 20px;
  }
}
