/* Variables de couleur inspirées de style.css */
:root {
  --chat-primary-color: #7066e0;
  /* Nouvelle couleur primaire */
  --chat-light-color: #E3F2FD;
  /* Couleur claire - alignée sur back-office azpro */
  --chat-text-light: #f2f1f3;
  /* $white */
  --chat-text-dark: #333;
  /* Couleur texte - alignée sur back-office */
  --chat-yellow-color: #edb71f;
  /* $yellow */
}

#chat-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: 'Poppins', sans-serif;
}

.chat-widget-button {
  background-color: var(--chat-primary-color);
  color: var(--chat-text-light);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: rgba(0, 0, 0, 0.12) 0px 12px 48px 4px;
  /* Correspond à l'image */
  transition: all 0.3s ease;
  /* Transition plus générale */
  position: relative;
  /* Nécessaire pour le positionnement des ondes */
}

/* Effet de pulsation/ripple pour le bouton de chat */
.chat-widget-button::before,
.chat-widget-button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--chat-primary-color);
  opacity: 0;
  transform: translate(-50%, -50%) scale(1);
  animation: pulse-ripple 2s ease-out infinite;
}

.chat-widget-button::after {
  animation-delay: 1s;
}

@keyframes pulse-ripple {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }

  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

.chat-widget-button:hover {
  transform: scale(1.1);
  animation: none;
  /* Désactive l'animation au survol */
}

#chat-window {
  position: fixed;
  /* Assure que la fenêtre reste en place */
  bottom: 24px;
  right: 24px;
  width: 375px;
  height: 90%;
  max-height: 500px;
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: rgba(0, 0, 0, 0.12) 0px 12px 48px 4px;
  /* Correspond à l'image */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Poppins', sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

#chat-window.hidden {
  display: none;
}

#chat-header {
  background-color: var(--chat-primary-color);
  color: var(--chat-text-light);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 16px;
  /* Pour correspondre au border-radius de la fenêtre */
  border-top-right-radius: 16px;
}

.chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.chat-header-logo {
  background-color: white;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-header-logo img {
  width: 20px;
  height: 20px;
}

#chat-close-button {
  background: none;
  border: none;
  color: var(--chat-text-light);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

#chat-close-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

#chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 16px;
  /* Espacement entre les messages */
}

.message-container {
  display: flex;
  flex-direction: column;
}

.message-bubble {
  max-width: 80%;
  padding: 8px 16px;
  border-radius: 16px;
  /* Aligné sur back-office (rounded-2xl) */
  font-size: 14px;
  line-height: 1.4;
  font-weight: 400;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message-container.user {
  align-items: flex-end;
}

.message-container.bot {
  align-items: flex-start;
}

.message-bubble.user {
  background-color: var(--chat-light-color);
  /* Couleur claire pour l'utilisateur */
  color: var(--chat-text-dark);
  border: 2px solid var(--chat-light-color);
}

.message-bubble.bot {
  background-color: #ffffff;
  /* Blanc pour le bot */
  color: var(--chat-text-dark);
  border: 2px solid var(--chat-light-color);
  /* Bordure claire pour le bot */
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 8px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--chat-primary-color);
  animation: bounce 1s infinite;
}

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

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

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

/* Quick Replies */
.quick-replies-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.quick-reply-button {
  background-color: white;
  border: 2px solid var(--chat-primary-color);
  color: var(--chat-primary-color);
  border-radius: 9999px;
  /* Full rounded */
  padding: 8px 16px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.quick-reply-button:hover {
  background-color: var(--chat-light-color);
}

/* Feedback Buttons */
.feedback-buttons-container {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  /* 0.5rem */
  padding-left: 8px;
  /* 0.5rem */
  margin-top: 8px;
}

.feedback-button {
  padding: 4px;
  /* p-1 */
  color: #9ca3af;
  /* text-gray-400 */
  background-color: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease-in-out;
  /* transition-colors */
  border-radius: 4px;
}

.feedback-button:hover.feedback-button-like {
  color: #22c55e;
  /* hover:text-green-500 */
}

.hidden {
  display: none !important;
}

.feedback-button:hover.feedback-button-dislike {
  color: #ef4444;
  /* hover:text-red-500 */
}

.feedback-button svg {
  width: 16px;
  /* h-4 w-4 */
  height: 16px;
  /* h-4 w-4 */
}

/* Sources */
.sources-container {
  margin-top: 10px;
  padding: 10px;
  background-color: #f0f0f0;
  border-radius: 8px;
  font-size: 12px;
  color: #555;
}

.sources-container p {
  font-weight: bold;
  margin-bottom: 5px;
}

.sources-container ul {
  list-style-type: disc;
  margin-left: 20px;
  padding-left: 0;
}

.sources-container li {
  margin-bottom: 3px;
}

#chat-input-container {
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background-color: #f9fafb;
  border-bottom-left-radius: 16px;
  /* Pour correspondre au border-radius de la fenêtre */
  border-bottom-right-radius: 16px;
}

#chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

#chat-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  /* Full rounded */
  padding: 8px 16px;
  font-size: 14px;
}

#chat-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--chat-primary-color);
  /* Anneau de focus */
  border-color: var(--chat-primary-color);
}

#chat-input:disabled {
  background-color: #f3f4f6;
}

#chat-send-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: var(--chat-primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

#chat-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}



/* System Warning Message */
.system-warning-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background-color: #fefce8;
  /* bg-yellow-50 */
  color: #854d0e;
  /* text-yellow-800 */
  border: 1px solid #fef08a;
  /* border-yellow-200 */
  padding: 12px;
  border-radius: 8px;
  margin: 8px 0;
  /* my-2 aligné sur back-office */
  font-size: 14px;
  text-align: center;
  animation: fadeIn 0.3s ease-in-out;
}

.system-warning-message p {
  margin: 0;
  font-weight: 500;
  line-height: 1.4;
  /* leading-[1.4] aligné sur back-office */
}

.continue-session-button {
  background-color: #fef9c3;
  /* bg-yellow-100 */
  color: #854d0e;
  /* text-yellow-800 */
  border: none;
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.continue-session-button:hover {
  background-color: #fef08a;
  /* hover:bg-yellow-200 */
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}