/* Styles pour le composant de chat Stella */
.stella-chat-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
  font-family: 'Open Sans', sans-serif;
}

/* Styles pour la bulle de notification */
.stella-notification-bubble {
  position: absolute;
  bottom: 65px; /* Ajuster pour être au-dessus de l'icône */
  left: 30px; /* Décaler la bulle vers la droite par rapport à l'icône */
  background-color: #cb0c9f;
  color: white;
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 14px;
  width: 300px; /* Définir une largeur fixe pour la bulle sur desktop */
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 10001; /* S'assurer qu'elle est au-dessus de l'icône */
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  visibility: hidden;
  pointer-events: none; /* Empêche les clics quand c'est transparent */
}

.stella-notification-bubble.visible {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.stella-notification-bubble::after {
  content: '';
  position: absolute;
  bottom: -5px; /* Position de la flèche */
  left: 15px; /* Positionner la flèche vers la gauche de la bulle */
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #cb0c9f; /* Couleur de la flèche */
}

/* Styles pour l'icône de logo */
.stella-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #fff;
  box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.09), 0 2px 3px -1px rgba(0, 0, 0, 0.07);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.15s ease-in;
  position: relative;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: solid #cb0c9f;
}

.stella-icon img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.stella-icon:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.09), 0 2px 3px -1px rgba(0, 0, 0, 0.07);
}

/* Styles pour la bulle de chat */
.chat-bubble {
  display: none;
  position: absolute;
  bottom: 70px;
  left: 0;
  width: 320px;
  height: 400px;
  max-height: calc(100vh - 90px); /* 70px bottom + 20px top margin */
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  flex-direction: column;
  transition: all 0.3s ease, width 0.4s ease, height 0.4s ease;
  transform: translateY(20px);
  opacity: 0;
}

.chat-bubble.large {
  width: 500px;
  height: 600px;
  max-height: calc(100vh - 90px); /* 70px bottom + 20px top margin */
}

.chat-bubble.active {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}

/* Styles pour l'en-tête de chat */
.chat-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background-color: #cb0c9f;
  color: white;
}

.chat-header .chat-title {
  flex-grow: 1;
  font-weight: 600;
  font-size: 16px;
}

.chat-header .resize-btn,
.chat-header .close-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}

.chat-header .close-btn {
  font-size: 24px;
}

.chat-header .resize-btn svg {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* Styles pour les messages */
.chat-messages {
  flex-grow: 1;
  padding: 12px;
  overflow-y: auto;
  background-color: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 18px;
  margin-bottom: 5px;
  word-wrap: break-word;
}

.chat-bubble .message.user {
  align-self: flex-end;
  background-color: #cb0c9f;
  color: white;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background-color: #e9ecef;
  color: #344767;
  border-bottom-left-radius: 4px;
}

.message .message-content {
  font-size: 14px;
  line-height: 1.4;
}

/* Styles pour le formulaire de saisie */
.chat-form {
  display: flex;
  border-top: 1px solid #e9ecef;
  padding: 12px;
  background-color: white;
}

.chat-input {
  flex-grow: 1;
  border: 1px solid #d2d6da;
  border-radius: 0.5rem;
  padding: 8px 12px;
  margin-right: 8px;
  font-size: 14px;
  color: #495057;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
  max-height: 90px; /* Environ 4 lignes */
  box-sizing: border-box;
}

.chat-input:focus {
  outline: none;
  border-color: #e293d3;
  box-shadow: 0 0 0 2px #e9aede;
}

.send-btn {
  border: none;
  background-color: #cb0c9f;
  color: white;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease-in;
}

.send-btn:hover {
  background-color: #ad0a87;
  transform: scale(1.05);
  box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.09), 0 2px 3px -1px rgba(0, 0, 0, 0.07);
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

/* Styles pour les appareils mobiles */
@media (max-width: 576px) {
  .chat-bubble {
    width: calc(100vw - 40px);
    bottom: 70px;
  }

  .chat-bubble.large {
    width: calc(100vw - 40px);
    height: 85vh;
  }

  .stella-icon {
    width: 50px;
    height: 50px;
  }
}

/* Dans stella-chat.css */
.loading-indicator .message-content .dots span {
    opacity: 0;
    animation: blink 1s infinite;
}
.loading-indicator .message-content .dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.loading-indicator .message-content .dots span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes blink {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.message.assistant-error {
    background-color: #f8d7da; /* Rouge clair Bootstrap pour danger */
    color: #721c24; /* Texte rouge foncé */
    border-color: #f5c6cb;
    border-bottom-left-radius: 4px;
}

