/* Chatbot Container */
.chatbot-container {
  position: fixed;
  bottom: 25px;
  right: 48px;
  z-index: 1000;
  font-family: "Open Sans", sans-serif;
}

/* Chatbot Button */
.chatbot-button {
  min-width: 200px;
  height: 50px;
  border-radius: 15px;
  background: linear-gradient(97deg, #004439 -58.61%, #59B224 103.65%);
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.05);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  padding: 9 18px;
}

.chatbot-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(89, 178, 36, 0.4);
}

/* Style quand le chatbot est ouvert (bouton compact) */
.chatbot-button.compact {
  min-width: 50px;
  width: 50px;
  padding: 0;
  justify-content: center;
}

.chatbot-button:active {
  transform: translateY(0);
}

.chatbot-button .chat-icon {
  flex-shrink: 0;
}

.chatbot-button .button-label {
  font-family: 'Open Sans', sans-serif;
  color: white;
  font-size: 14px;
  font-weight: 700;
}

.chatbot-button .close-icon {
  width: 20px;
  height: 20px;
  fill: white;
  display: none;
  flex-shrink: 0;
}

/* Chatbot Window */
.chatbot-window {
  position: fixed;
  bottom: 25px;
  right: 108px;
  width: 480px;
  height: 500px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #DDE9E7;
  transition: all 0.3s ease;
}

.chatbot-window.expanded {
  width: 600px;
  height: calc(100vh - 200px);
  max-height: 600px;
  right: 108px;
}

.chatbot-window.active {
  display: flex;
}

/* Chatbot Header */
.chatbot-header {
  border-radius: 20px 20px 0 0;
  background: linear-gradient(99deg, #004439 -103.18%, #59B224 103.33%);
  color: white;
  padding: 0 20px;
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chatbot-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: white;
}

.chatbot-header .header-actions {
  display: flex;
  gap: 10px;
}

.chatbot-header button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-header .expand-icon,
.chatbot-header .minimize-icon,
.chatbot-header .reset-icon,
.chatbot-header .close-icon {
  width: 31px;
  height: 31px;
  flex-shrink: 0;
}

/* Chatbot Messages */
.chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #F8F9FA;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #DDE9E7;
  border-radius: 2px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #6BBE46;
}

/* Message Bubbles */
.message {
  display: flex;
  max-width: 85%;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.bot {
  align-self: flex-start;
}

.message-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-content {
  background: white;
  padding: 12px 16px;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #DDE9E7;
  line-height: 1.4;
  font-size: 14px;
  color: #004439;
}

.message.user .message-content {
  background: #E6EFE0;
  color: #004439;
  font-weight: 500;
  border: none;
}

.message.user .audio-player {
  background: rgba(89, 178, 36, 0.1);
  border: 1px solid rgba(89, 178, 36, 0.2);
}

.message.user .play-pause-btn {
  background: #59B224;
  border: 1px solid #59B224;
}

.message.user .play-pause-btn:hover {
  background: #4A9A1E;
}

.message.user .progress-bar {
  background: rgba(89, 178, 36, 0.2);
}

.message.user .progress-fill {
  background: #59B224;
}

.message.user .time-display {
  color: #59B224;
}

.message.user .wave-bar {
  background: #59B224;
}

.message.bot .audio-player {
  background: #F8F9FA;
  border: 1px solid #E5ECEB;
}

.message.bot .play-pause-btn {
  background: #59B224;
  border: 1px solid #59B224;
}

.message.bot .play-pause-btn:hover {
  background: #4A9A1E;
}

.message.bot .progress-bar {
  background: #E5ECEB;
}

.message.bot .progress-fill {
  background: #59B224;
}

.message.bot .time-display {
  color: #6B7280;
}

.message.bot .wave-bar {
  background: #59B224;
}

.message.bot .message-content {
  background: white;
  color: #004439;
  position: relative;
  line-height: 1.6;
}

/* Styles pour les listes et la mise en forme */
.list-number {
  font-weight: 600;
  color: #59B224;
  margin-right: 4px;
}

.list-bullet {
  font-weight: 600;
  color: #59B224;
  margin-right: 4px;
}

.list-dash {
  font-weight: 600;
  color: #59B224;
  margin-right: 4px;
}

/* Styles pour le texte en gras */
.message-content strong {
  font-weight: 700;
  color: #004439;
}

/* Espacement pour les paragraphes */
.message-content br {
  margin-bottom: 4px;
}

/* Amélioration de la lisibilité */
.message-content {
  line-height: 1.5;
  word-wrap: break-word;
}

/* Styles pour les listes */
.message-content {
  text-align: left;
}

.audio-content {
  background: transparent;
  padding: 0;
  border: none;
  box-shadow: none;
  position: relative;
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

.audio-player {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #F8F9FA;
  border: 1px solid #E5ECEB;
  border-radius: 15px;
  padding: 8px 12px;
  min-width: 200px;
  max-width: 300px;
}

.play-pause-btn {
  background: #59B224;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.play-pause-btn:hover {
  background: #4A9A1E;
  transform: scale(1.05);
}

.play-pause-btn:disabled {
  background: #E5ECEB;
  cursor: not-allowed;
  transform: none;
}

.play-icon {
  font-size: 14px;
  color: white;
  font-weight: bold;
  line-height: 1;
}

.audio-progress {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: #E5ECEB;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #59B224;
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s ease;
}

.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #6B7280;
  font-family: "Open Sans", sans-serif;
}

.audio-waveform {
  display: none;
  align-items: center;
  gap: 2px;
  height: 20px;
}

.wave-bar {
  width: 3px;
  height: 8px;
  background: #59B224;
  border-radius: 1px;
  transition: height 0.1s ease;
}

@keyframes waveform {
  0%, 100% {
    height: 8px;
  }
  50% {
    height: 20px;
  }
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: white;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid #DDE9E7;
  align-self: flex-start;
  max-width: 85%;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6BBE46;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Chatbot Input */
.chatbot-input-container {
  padding: 20px;
  background: white;
  border-top: 1px solid #DDE9E7;
  border-radius: 0 0 20px 20px;
}

.chatbot-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chatbot-input {
  flex: 1;
  border: 1px solid #DDE9E7;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-family: "Open Sans", sans-serif;
  resize: none;
  max-height: 100px;
  min-height: 44px;
  height: 44px;
  line-height: 1.4;
  color: #004439;
  background: #F8F9FA;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.chatbot-input:focus {
  outline: none;
  border-color: #59B224;
  background: white;
  box-shadow: 0 0 0 3px rgba(89, 178, 36, 0.1);
}

.chatbot-input::placeholder {
  color: #9DADAB;
}

.chatbot-send-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(97deg, #004439 -58.61%, #59B224 103.65%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.chatbot-send-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(89, 178, 36, 0.3);
}

.chatbot-send-button:disabled {
  background: #9DADAB;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.chatbot-micro-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #F1F4F4;
  border: 1px solid #DDE9E7;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.chatbot-micro-button:hover {
  background: #E5ECEB;
  border-color: #59B224;
}

.chatbot-micro-button.recording {
  background: #6B7280;
  border-color: #6B7280;
  animation: pulse 1.5s infinite;
}

.chatbot-micro-button .micro-icon {
  width: 18px;
  height: 18px;
  filter: brightness(0) saturate(100%) invert(40%) sepia(20%) saturate(1000%) hue-rotate(120deg) brightness(0.8);
}

.chatbot-micro-button.recording .micro-icon {
  filter: brightness(0) invert(1);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(107, 114, 128, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(107, 114, 128, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(107, 114, 128, 0);
  }
}

.chatbot-send-button .send-icon {
  width: 18px;
  height: 18px;
  fill: white;
}

/* Welcome Message */
.welcome-message {
  text-align: center;
  padding: 20px;
  color: #7E9894;
  font-size: 14px;
  line-height: 1.5;
}

.welcome-message h4 {
  color: #004439;
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 600;
}

.welcome-message p {
  margin: 0 0 15px 0;
}

/* Error Message */
.error-message {
  background: #FFF5F5;
  border: 1px solid #FEB2B2;
  color: #C53030;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin: 10px 0;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
  .chatbot-window {
    width: calc(100vw - 40px);
    height: calc(100vh - 140px);
    bottom: 165px;
    right: 20px;
    left: 20px;
    border-radius: 15px;
  }
  
  .chatbot-window.expanded {
    width: calc(100vw - 40px);
    height: calc(100vh - 200px);
    max-height: calc(100vh - 200px);
  }
  
  .chatbot-button {
    min-width: 180px;
    height: 45px;
  }
  
  .chatbot-button .chat-icon {
    width: 18px;
    height: 18px;
  }
  
  .chatbot-button .button-label {
    font-size: 13px;
  }
  
  .chatbot-header {
    padding: 15px;
  }
  
  .chatbot-messages {
    padding: 15px;
  }
  
  .chatbot-input-container {
    padding: 15px;
  }
}

/* Very small screens */
@media screen and (max-height: 600px) {
  .chatbot-window {
    bottom: 105px;
    right: 108px;
    max-height: calc(100vh - 80px);
  }
  
  .chatbot-window.expanded {
    max-height: calc(100vh - 140px);
  }
  
  .chatbot-header {
    padding: 12px 15px;
  }
  
  .chatbot-messages {
    padding: 12px 15px;
  }
  
  .chatbot-input-container {
    padding: 12px 15px;
  }
}

/* Animation for opening/closing */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

.chatbot-window.slide-in {
  animation: slideInUp 0.3s ease-out;
}

.chatbot-window.slide-out {
  animation: slideOutDown 0.3s ease-in;
}

/* Loading state for send button */
.chatbot-send-button.loading {
  pointer-events: none;
}

.chatbot-send-button.loading .send-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Notifications */
.chatbot-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  z-index: 1001;
  animation: slideInRight 0.3s ease-out;
}

.chatbot-notification.success {
  background: linear-gradient(97deg, #004439 -58.61%, #59B224 103.65%);
}

.chatbot-notification.error {
  background: #FF6B6B;
}

.chatbot-notification.info {
  background: #3182CE;
}

/* Voice Indicator */
.voice-indicator {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #6B7280;
  border-radius: 20px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  box-sizing: border-box;
  position: relative;
}

/* Bouton d'annulation de l'enregistrement */
.voice-cancel-btn {
  background: #FF6B6B;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
  margin-left: auto;
}

.voice-cancel-btn:hover {
  background: #FF5252;
}

.voice-cancel-btn:active {
  background: #E53935;
}

.voice-animation {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
}

.voice-bar {
  width: 3px;
  background: white;
  border-radius: 2px;
  animation: voiceWave 1.2s ease-in-out infinite;
}

.voice-bar:nth-child(1) { animation-delay: -0.4s; }
.voice-bar:nth-child(2) { animation-delay: -0.3s; }
.voice-bar:nth-child(3) { animation-delay: -0.2s; }
.voice-bar:nth-child(4) { animation-delay: -0.1s; }
.voice-bar:nth-child(5) { animation-delay: 0s; }

@keyframes voiceWave {
  0%, 40%, 100% {
    height: 8px;
  }
  20% {
    height: 20px;
  }
}

.voice-text {
  font-family: "Open Sans", sans-serif;
}

/* Processing Loader */
.processing-loader {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 12px;
}

.loader-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #E5ECEB;
  border-top: 2px solid #59B224;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader-text {
  color: #3B605A;
  font-size: 13px;
  font-weight: 500;
  font-family: "Open Sans", sans-serif;
  font-style: italic;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.processing-message .message-content {
  background: #F8F9FA;
  border: 1px solid #E5ECEB;
}

.message.user.processing-message .message-content {
  background: linear-gradient(97deg, #004439 -58.61%, #59B224 103.65%);
  color: white;
  border: none;
}

.message.user.processing-message .loader-text {
  color: white;
}

/* Audio Response Indicator */
.audio-response-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(97deg, #004439 -58.61%, #59B224 103.65%);
  color: white;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 500;
  margin: 10px 0;
  animation: pulse 2s infinite;
}

.audio-response-indicator .audio-icon {
  width: 16px;
  height: 16px;
  animation: audioWave 1.5s ease-in-out infinite;
}

@keyframes audioWave {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
