/* Style général pour la fenêtre de chat */
#chat-window {
  position: fixed;
  bottom: 10px;
  margin-right: 0px;
  margin-left: 20px;
  right: 0;
  width: 95%;
  max-width: 0px;
  height: 0px;
  background-color: #f9f9f9;
  border: 1px solid #ccc;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  font-family: "Open Sans", Verdana, sans-serif;
  transition: 500ms ease all;
  opacity: 0;
  pointer-events: none;
}
#chat-window.chat-window-visible {
  opacity: 1;
  transition: 500ms ease all;
  width: 95%;
  max-width: 420px;
  height: 720px;
  pointer-events: auto;
}

/* Style pour la zone d'affichage des messages */
#chat-response {
  padding: 15px;
  min-height: 255px;
  overflow-y: auto;
  border-bottom: 1px solid #eee;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  scrollbar-width: thin;
  scroll-behavior: smooth;
}

.poweredby {
  text-align: center;
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin:5px 0;
}
.poweredby a {
  color: #444444;
  text-decoration: none;
  font-weight: bold;
}
/* Style général pour les messages (utilisateur et assistant) */
.user-message,
.assistant-message {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 20px;
  margin: 0 0 8px 0;
  display: inline-block;
  word-wrap: break-word;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.assistant-message-container,
.user-message-container {
  display: flex;
  gap: 5px;
  margin: 5px 0;
}
.user-message-container {
  flex-direction: row-reverse;
}
.assistant-message-container img,
.user-message-container img {
  width: 40px;
  height: auto;
  border-radius: 50%;
  align-self: flex-start;
  margin-top: 4px;
}

.assistant-message-container.typing .assistant-typing {
  display: flex;
  align-self: center;
}
/* Style pour les messages de l'utilisateur */
.user-message {
  background-color: #e2f7ff;
  color: #202020;
  margin-left: auto;
  text-align: right;
}

/* Style pour les messages de l'assistant */
.assistant-message {
  padding: 15px;
  border-radius: 10px;
  background-color: var(--assistant-message-bg);
  color: var(--assistant-message-text);
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
  transition: height 0.3s ease-out, opacity 0.2s ease-in-out;
}

.assistant-message-container {
  position: relative;
  transition: height 0.3s ease-out;
}

/* Styles pour l'animation de frappe */
.assistant-message.typing-animation::after {
  content: '|';
  display: inline-block;
  animation: blink 1s infinite;
  margin-left: 2px;
  font-weight: bold;
}

/* Animation du curseur clignotant */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Styles pour le texte caché pendant l'animation de frappe */
.hidden-text {
  position: absolute;
  visibility: hidden;
  height: 0;
  width: 0;
  overflow: hidden;
  display: none;
}

/* Styles spécifiques pour les listes pendant l'animation */
.typing-animation ul, 
.typing-animation ol {
  height: auto;
  overflow: hidden;
  transition: height 0.3s ease-out, opacity 0.2s ease-in-out;
}

.typing-animation li {
  height: auto;
  overflow: hidden;
  transition: height 0.3s ease-out, opacity 0.2s ease-in-out;
}

/* Styles spécifiques pour les paragraphes pendant l'animation */
.typing-animation p {
  height: auto;
  overflow: hidden;
  transition: height 0.3s ease-out, opacity 0.2s ease-in-out;
  margin-top: 0;
  margin-bottom: 0;
}

/* Styles pour les éléments vides (qui n'ont pas encore été remplis) */
.typing-animation ul:empty,
.typing-animation ol:empty,
.typing-animation li:empty,
.typing-animation p:empty {
  height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
}

/* Animation de fondu pour les éléments qui apparaissent */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Animation pour les paragraphes */
@keyframes fadeInParagraph {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 1;
  }
}

/* Animation pour les éléments de formatage */
.assistant-message strong, 
.assistant-message em, 
.assistant-message code, 
.assistant-message pre {
  animation: emphasize 0.5s ease-out;
}

@keyframes emphasize {
  from {
    background-color: rgba(255, 255, 100, 0.3);
  }
  to {
    background-color: transparent;
  }
}

/* Style pour l'indicateur de chargement des questions de suivi */
.followup-loading {
  padding: 10px;
  text-align: center;
  color: #666;
  font-size: 14px;
  font-style: italic;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

/* Indicateur de frappe (typing) */
#typing-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 20px;
}

#typing-indicator span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 3px;
  background-color: #969696;
  border-radius: 50%;
  animation: typing 600ms infinite;
}

#typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

#typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

#typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0% {
    transform: translateY(0);
    animation-timing-function: ease-in-out;
  }
  50% {
    transform: translateY(-5px);
    animation-timing-function: ease-in-out;
  }
  100% {
    transform: translateY(0);
    animation-timing-function: ease-in-out;
  }
}

/* Style pour le formulaire de chat */
#chat-form {
  display: flex;
  padding: 15px;
  align-items: center;
  height: 60px;
  background-color: #fff;
  border-top: 1px solid #eee;
}

/* Style pour le champ de saisie */
#chat-message {
  flex-grow: 1;
  min-width: 50px;
  margin-right: 10px;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 24px;
  font-size: 16px;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Style pour le bouton d'envoi */
#chat-form button {
  padding: 10px 20px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s ease-in-out;
}
#chat-form button#submitchat svg {
  width: 15px;
  height: auto;
}

/* Style pour le bouton d'ouverture/fermeture du chat */
#chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  border-radius: 50px;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  background-color: #007bff;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#chat-toggle svg {
  width: 24px;
  height: auto;
}

/* Style pour le bouton d'ouverture du chat */
.chat-toggle-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--primary-color, #4caf50);
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

/* Style pour le conteneur des boutons de conversation starter */
#conversation-starters-container {
  width: 100%;
  box-sizing: border-box;
  background-color: #f5f5f5;
  border-bottom: 1px solid #eee;
}

/* Style pour les boutons de conversation starter */
#conversation-starters {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  gap: 10px;
  padding: 15px;
  width: 100%;
  box-sizing: border-box;
  z-index: 10;
}

.starter-button {
  background-color: var(--primary-color, #0047b3);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 15px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 100px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.starter-button:hover {
  background-color: var(--primary-color, #4caf50);
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Style pour le conteneur des questions de suivi */
#followup-questions-container {
  width: 100%;
  box-sizing: border-box;
  background-color: #f8f8f8;
  border-bottom: 1px solid #eee;
}


#conversation-starters .startwith {
  font-size:15px;
}
/* Style pour les questions de suivi */
#followup-questions {
  display: flex;
  flex-direction: column;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
  z-index: 10;
}

#followup-questions h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: #666;
  font-weight: 600;
}

.followup-button {
  background-color: var(--primary-color, #4caf50);
  color: white;
  opacity:0.8;
  border: 1px solid #ddd;
  border-radius: 9px;
  padding: 6px 12px;
  margin-bottom: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre-wrap;
}

.followup-button:hover {
  opacity:1;
  background-color: var(--primary-color, #4caf50);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Style pour le formulaire de chat */
#chat-form {
  display: flex;
  padding: 15px;
  align-items: center;
  height: 60px;
  background-color: #fff;
  border-top: 1px solid #eee;
}

/* Style pour le bouton d'envoi (au survol) */
#chat-form button:hover {
  background-color: #0056b3;
}

/* Style pour l'indicateur "en train d'écrire" */
.typing {
  font-style: italic;
  color: #888;
}

/* Style pour les emojis (WordPress default style) */
.emoji {
  display: inline !important;
  border: none !important;
  box-shadow: none !important;
  height: 1em !important;
  width: 1em !important;
  margin: 0 0.07em !important;
  vertical-align: -0.1em !important;
  background: none !important;
  padding: 0 !important;
}

.aaia-xp-header {
  background: rgb(214, 34, 70);
  color: white;
  border-top-left-radius: 12px; /* Use the same value as #chat-window */
  border-top-right-radius: 12px; /* Use the same value as #chat-window */
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
}

.aaia-xp-header-inner {
  display: flex;
  align-items: center;
}

.aaia-xp-header-buttons #aaia-xp-reset-chat svg {
  width: 20px;
  height: auto;
}
.aaia-xp-header-buttons #aaia-xp-close-chat svg {
  width: 20px;
  height: auto;
}
.aaia-xp-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
  object-fit: cover;
}

.aaia-xp-header-title {
  font-weight: bold;
  font-size: 16px;
}

.aaia-xp-header-buttons {
  display: flex;
  align-items: center;
}

.aaia-xp-header-buttons button {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 5px;
  margin-left: 5px;
}

.aaia-xp-header-buttons button:hover {
  opacity: 0.6;
}

/* Style de la barre de défilement (Webkit/Chrome/Safari) */
#chat-response::-webkit-scrollbar {
  width: 4px; /* Largeur de la barre de défilement */
}

#chat-response::-webkit-scrollbar-track {
  background: #f1f1f1; /* Couleur de fond de la zone de la barre de défilement */
  border-radius: 10px;
}

#chat-response::-webkit-scrollbar-thumb {
  background: #888; /* Couleur du "pouce" de la barre de défilement */
  border-radius: 10px;
}

#chat-response::-webkit-scrollbar-thumb:hover {
  background: #555; /* Couleur du "pouce" au survol */
}

.aaia_send_confirmation {
  color: green;
  font-weight: bold;
}

/* Styles pour l'indicateur de chargement des questions de suivi */
.followup-loading {
  padding: 10px;
  text-align: center;
  color: #666;
  font-style: italic;
  background-color: #f9f9f9;
  border-radius: 8px;
  margin: 10px 0;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

@media screen and (max-width:768px) {
  #chat-window.chat-window-visible {
    width: 90%;
    max-width: 90%;
    height: 95vh;
  } 
}