/* Palette inspirée du design médical */
:root {
  /* Palette alignée au site Santélien */
  --main-blue: #13223b;            /* Navy (fond d’en-tête) */
  --light-blue: #f5f7fb;           /* Arrière-plan page/pistes très claires */
  --accent-blue: #ff8c00;          /* Conservé pour titres si souhaité */
  --accent-orange: #ff8c00;        /* Accent orange (liens, labels) */
  --accent-link: #7e57c2;          /* Violet lisible pour liens */
  --accent-link-dark: #6b46b3;     /* Survol */
  --accent-strong: #3d7edb;        /* Bleu pour liens (après inversion) */
  --accent-strong-dark: #2f6bc6;   /* Survol des liens bleus */
  --accent-email: #1ba8b5;         /* Teal pour emails */
  --accent-email-dark: #118894;    /* Survol */
  --card-bg: #fff;                 /* Cartes/blocs */
  --border-color: #e6e8ef;         /* Bordures subtiles */
  --shadow: 0 12px 30px rgba(16, 33, 58, 0.12);
  --button-blue: #ffffff;          /* Boutons blancs comme sur le site */
  --button-hover: #f3f5fa;         /* Survol discret */
  --text-main: #1f2937;            /* Texte principal foncé */
  --text-muted: #6b7280;           /* Texte secondaire */
  --success: #4bb543;
  --warning: #ffcc00;
  --danger: #ff5c5c;
}

body {
  background: var(--light-blue);
  font-family: 'Inter', Arial, sans-serif;
  color: var(--text-main);
}

.chatbot-window {
  max-width: 420px;
  margin: 40px auto;
  background: var(--card-bg);
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  overflow: hidden;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  bottom: 90px;
  right: 32px;
  z-index: 1001;
  opacity: 0;
  transform: translateY(40px);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(.4,0,.2,1), transform 0.35s cubic-bezier(.4,0,.2,1);
}
#chatbot-window.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#chatbot-window.close {
  opacity: 0;
  transform: translateY(40px);
  pointer-events: none;
}

.chatbot-header {
  background: var(--main-blue);
  color: #ffffff;
  padding: 1.2rem 1.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.chatbot-header .icon {
  width: 28px;
  height: 28px;
  background: var(--accent-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
}

#chat {
  padding: 2rem 1.5rem 1.5rem 1.5rem;
  flex: 1;
  min-height: 180px;
  overflow-y: auto;
}

.chat-message {
  margin-bottom: 1.3rem;
  font-size: 1.05rem;
  opacity: 0;
  transform: translateY(20px);
  animation: chat-fade-in 0.35s cubic-bezier(.4,0,.2,1) forwards;
  line-height: 1.5;
}

/* Label "Santébot :" et questions par défaut en orange */
.chat-label-bot {
  display: inline-block;
  font-weight: 700;
  color: var(--accent-orange);
  margin: 0 0 0.5rem 0;
}

.chat-message.chat-final {
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.chat-message.chat-question {
  font-weight: 700;
  color: var(--accent-orange);
  font-size: 1.22rem;
}

/* Styles pour le HTML formaté dans les messages */
.chat-message h1, .chat-message h2, .chat-message h3, 
.chat-message h4, .chat-message h5, .chat-message h6 {
  margin: 0.8rem 0 0.5rem 0;
  color: var(--accent-blue);
  font-weight: 600;
}

.chat-message h1 { font-size: 1.5rem; }
.chat-message h2 { font-size: 1.4rem; }
.chat-message h3 { font-size: 1.3rem; }
.chat-message h4 { font-size: 1.2rem; }
.chat-message h5 { font-size: 1.1rem; }
.chat-message h6 { font-size: 1.05rem; }

.chat-message p {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.chat-message ul, .chat-message ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.chat-message li {
  margin: 0.3rem 0;
  line-height: 1.5;
}

.chat-message strong, .chat-message b {
  font-weight: 600;
  color: var(--accent-link);
}

.chat-message em, .chat-message i {
  font-style: italic;
  color: var(--text-muted);
}

.chat-message u {
  text-decoration: underline;
  text-decoration-color: var(--accent-blue);
}

.chat-message a, .chat-options button a, .chat-options-scrollable button a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s, opacity 0.2s;
  padding: 0 2px;
}

.chat-message a:hover {
  color: var(--accent-strong-dark);
}

.chat-options button a, .chat-options-scrollable button a {
  color: var(--accent-strong);
  opacity: 0.95;
}

.chat-options button a:hover, .chat-options-scrollable button a:hover {
  opacity: 1;
  color: var(--accent-strong-dark);
}

/* Emails distincts (mailto:) */
.chat-message a[href^="mailto:"],
.chat-options button a[href^="mailto:"],
.chat-options-scrollable button a[href^="mailto:"] {
  color: var(--accent-email);
  font-weight: 700;
}
.chat-message a[href^="mailto:"]:hover {
  color: var(--accent-email-dark);
}
.chat-options button a[href^="mailto:"]:hover,
.chat-options-scrollable button a[href^="mailto:"]:hover {
  color: var(--accent-email-dark);
}

/* Style spécial pour les liens */
.chat-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chat-link::after {
  content: '↗';
  font-size: 0.8em;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.chat-link:hover::after {
  opacity: 1;
}

.chat-message br {
  margin: 0.3rem 0;
}

@keyframes chat-fade-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-options {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  opacity: 0;
  transform: translateY(20px);
  animation: chat-fade-in 0.35s 0.08s cubic-bezier(.4,0,.2,1) forwards;
}

.chat-options button {
  background: var(--button-blue);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 2px rgba(16,33,58,0.04);
  text-align: left;
  line-height: 1.4;
}

.chat-options button:hover {
  background: var(--button-hover);
  border-color: #d7dae3;
  box-shadow: 0 4px 10px rgba(16,33,58,0.08);
}

/* Styles pour le HTML formaté dans les boutons */
.chat-options button strong, .chat-options button b {
  font-weight: 600;
  color: inherit;
}

.chat-options button em, .chat-options button i {
  font-style: italic;
  opacity: 0.8;
}

.chat-options button u {
  text-decoration: underline;
}

.chat-options button br {
  margin: 0.2rem 0;
}

/* Styles pour le slider d'options (quand plus de 4 choix) */
.chat-options-scrollable {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0;
  scroll-behavior: smooth;
  opacity: 0;
  transform: translateY(20px);
  animation: chat-fade-in 0.35s 0.08s cubic-bezier(.4,0,.2,1) forwards;
  max-height: 200px;
}

.chat-options-scrollable::-webkit-scrollbar {
  width: 6px;
}

.chat-options-scrollable::-webkit-scrollbar-track {
  background: var(--light-blue);
  border-radius: 3px;
}

.chat-options-scrollable::-webkit-scrollbar-thumb {
  background: var(--main-blue);
  border-radius: 3px;
  transition: background 0.2s;
}

.chat-options-scrollable::-webkit-scrollbar-thumb:hover {
  background: #0e1a2e;
}

/* Scrollbar couleur pour Firefox */
.chat-options-scrollable {
  scrollbar-color: var(--main-blue) var(--light-blue);
}

/* Harmoniser aussi la scrollbar du panneau principal */
#chat::-webkit-scrollbar {
  width: 8px;
}
#chat::-webkit-scrollbar-track {
  background: var(--light-blue);
}
#chat::-webkit-scrollbar-thumb {
  background: var(--main-blue);
  border-radius: 4px;
}
#chat::-webkit-scrollbar-thumb:hover {
  background: #0e1a2e;
}
#chat {
  scrollbar-color: var(--main-blue) var(--light-blue);
}

.chat-options-scrollable button {
  background: var(--button-blue);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 2px rgba(16,33,58,0.04);
  width: 100%;
  text-align: left;
  line-height: 1.4;
}

.chat-options-scrollable button:hover {
  background: var(--button-hover);
  border-color: #d7dae3;
  box-shadow: 0 4px 10px rgba(16,33,58,0.08);
}

/* Styles pour le HTML formaté dans les boutons scrollables */
.chat-options-scrollable button strong, .chat-options-scrollable button b {
  font-weight: 600;
  color: inherit;
}

.chat-options-scrollable button em, .chat-options-scrollable button i {
  font-style: italic;
  opacity: 0.8;
}

.chat-options-scrollable button u {
  text-decoration: underline;
}

.chat-options-scrollable button br {
  margin: 0.2rem 0;
}

/* Indicateurs de scroll */
.chat-options-container {
  position: relative;
}

.scroll-indicator {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  background: var(--main-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16,33,58,0.15);
  transition: all 0.2s;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
}

.scroll-indicator:hover {
  background: var(--accent-blue);
  transform: translateX(-50%) scale(1.1);
}

.scroll-indicator.top {
  top: -12px;
}

.scroll-indicator.bottom {
  bottom: -12px;
}

.scroll-indicator.visible {
  opacity: 1;
  pointer-events: auto;
}

.scroll-indicator svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Responsive */
@media (max-width: 600px) {
  .chatbot-window {
    max-width: 98vw;
    margin: 10px;
  }
  #chat {
    padding: 1rem;
  }
}

.chatbot-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  margin-right: 0.8rem;
  box-shadow: 0 2px 8px rgba(0,159,227,0.10);
  background: #fff;
  object-fit: cover;
}

#chatbot-launcher {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 1000;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0,159,227,0.13);
  padding: 8px;
  cursor: pointer;
  transition: box-shadow 0.2s, background 0.2s;
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}
#chatbot-launcher:hover {
  background: var(--main-blue);
  box-shadow: 0 8px 24px rgba(0,159,227,0.18);
}
#chatbot-launcher .chatbot-logo {
  margin-right: 0;
}

@media (max-width: 600px) {
  #chatbot-launcher {
    bottom: 12px;
    right: 12px;
    padding: 4px;
  }
  #chatbot-window {
    bottom: 60px;
    right: 4px;
    max-width: 98vw;
  }
}

.chatbot-footer {
  width: 100%;
  padding: 12px 12px 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border-top: 1px solid var(--border-color);
  min-height: 48px;
  box-sizing: border-box;
}

.chatbot-action-btn, .chatbot-reset-btn {
  appearance: none;
  background: #fff;
  color: var(--main-blue);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(16,33,58,0.06);
  cursor: pointer;
  transition: background .2s, border-color .2s, box-shadow .2s, color .2s;
}
.chatbot-action-btn:hover, .chatbot-reset-btn:hover {
  background: var(--button-hover);
  border-color: #d7dae3;
  box-shadow: 0 4px 10px rgba(16,33,58,0.08);
}
.chatbot-action-btn svg, .chatbot-reset-btn svg {
  width: 22px;
  height: 22px;
}

/* Forcer l'icône Home en noir pour plus de lisibilité */
.chatbot-reset-btn { color: #111; }