/* Styles pour le chatbot - Design moderne 2025 */
.chatbot-container {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 1050;
  font-family: 'Inter', sans-serif;
  --primary-color: #2066a1;
  --primary-dark: #134b7c;
  --primary-light: #4c8dca;
  --accent-color: #ff9800;
  --text-dark: #333333;
  --text-light: #ffffff;
  --background-light: #f8f9fa;
  --shadow-soft: 0 10px 30px rgba(0,0,0,0.08);
  --shadow-strong: 0 15px 35px rgba(0,0,0,0.12);
  --border-radius: 16px;
  --transition-fast: 0.2s ease;
  --transition-standard: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Bouton de toggle avec design moderne */
.chatbot-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--text-light);
  border-radius: 60px;
  padding: 12px 20px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition-standard), box-shadow var(--transition-standard);
  border: none;
  font-weight: 500;
}

.chatbot-toggle:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-strong);
}

.chatbot-toggle i {
  margin-right: 10px;
  font-size: 18px;
  transition: transform 0.5s ease;
}

.chatbot-toggle:hover i {
  transform: rotate(15deg);
}

/* Panel principal avec animation fluide */
.chatbot-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 360px;
  height: 0;
  opacity: 0;
  overflow: hidden;
  border-radius: var(--border-radius);
  background: white;
  box-shadow: var(--shadow-strong);
  transition: height 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              opacity 0.3s ease,
              transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  pointer-events: none;
  transform: translateY(20px);
  border: 1px solid rgba(0,0,0,0.05);
}

.chatbot-panel.expanded {
  height: 550px;
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

/* En-tête du chatbot élégant */
.chatbot-header {
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--text-light);
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  box-shadow: 0 3px 5px rgba(0,0,0,0.05);
}

.chatbot-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.chatbot-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: var(--accent-color);
  border-radius: 10px;
}

.chatbot-subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  opacity: 0.9;
  font-weight: 300;
}

/* Zone des messages avec style amélioré */
.chatbot-messages {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: var(--background-light);
  scroll-behavior: smooth;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.1);
  border-radius: 20px;
}

/* Conteneurs de messages avec animations */
.message-container {
  margin-bottom: 18px;
  animation: messageAppear 0.3s ease-out;
  transform-origin: bottom;
}

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

.message {
  max-width: 85%;
  border-radius: var(--border-radius);
  padding: 12px 16px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform var(--transition-fast);
}

.message:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.user-message {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  color: var(--primary-dark);
  margin-left: auto;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.user-message::before {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 12px;
  width: 12px;
  height: 12px;
  background: #bbdefb;
  transform: rotate(45deg);
  z-index: -1;
}

.bot-message {
  background-color: white;
  color: var(--text-dark);
  margin-right: auto;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-left: 3px solid var(--primary-color);
}

.bot-message::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 12px;
  width: 12px;
  height: 12px;
  background: white;
  transform: rotate(45deg);
  z-index: -1;
}

.error-message {
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
  color: #c62828;
  border-left: 3px solid #c62828;
}

.message-content {
  word-break: break-word;
  line-height: 1.5;
}

.message-time {
  font-size: 11px;
  color: rgba(0,0,0,0.5);
  text-align: right;
  margin-top: 6px;
  font-weight: 300;
}

/* Données supplémentaires dans les messages */
.message-data {
  margin-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.05);
  padding-top: 10px;
}

.chart-container {
  background-color: white;
  padding: 10px;
  border-radius: 8px;
  margin-top: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.table-container {
  margin-top: 10px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.08);
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.table-container th {
  background-color: rgba(32, 102, 161, 0.08);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

.table-container th, .table-container td {
  padding: 8px 10px;
  border: 1px solid rgba(0,0,0,0.08);
}

/* Références avec style moderne */
.message-references {
  margin-top: 12px;
  font-size: 12px;
  color: var(--primary-dark);
  background-color: rgba(32, 102, 161, 0.05);
  border-radius: 8px;
  padding: 8px 12px;
}

.references-title {
  margin: 0;
  font-style: italic;
  font-weight: 500;
  display: flex;
  align-items: center;
}

.references-title:before {
  content: '📚';
  margin-right: 6px;
  font-style: normal;
}

.references-list {
  margin: 6px 0 0;
  padding-left: 18px;
  list-style-type: none;
}

.references-list li {
  position: relative;
  padding: 3px 0;
}

.references-list li:before {
  content: '•';
  position: absolute;
  left: -12px;
  color: var(--primary-color);
}

.references-list a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 1px dotted var(--primary-light);
  transition: all var(--transition-fast);
}

.references-list a:hover {
  color: var(--primary-dark);
  border-bottom: 1px solid var(--primary-color);
}

/* Indicateur de chargement moderne */
.loading-indicator {
  padding: 15px 0;
  display: flex;
  align-items: center;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  background: white;
  padding: 10px 15px;
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.typing-indicator span {
  height: 10px;
  width: 10px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  border-radius: 50%;
  display: inline-block;
  margin: 0 3px;
  opacity: 0.6;
  animation: typing-bubble 1.2s infinite cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

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

@keyframes typing-bubble {
  0% { transform: translateY(0) scale(1); opacity: 0.6; }
  50% { transform: translateY(-6px) scale(1.1); opacity: 0.9; }
  100% { transform: translateY(0) scale(1); opacity: 0.6; }
}

/* Zone de suggestions avec design moderne */
.chatbot-suggestions {
  padding: 12px 15px;
  background-color: var(--background-light);
  border-top: 1px solid rgba(0,0,0,0.05);
  position: relative;
}

.chatbot-suggestions:before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(32, 102, 161, 0.2), transparent);
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.suggestion-chip {
  background: white;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 8px 15px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  outline: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.suggestion-chip:hover {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

/* Zone de saisie moderne */
.chatbot-input {
  padding: 15px;
  border-top: 1px solid rgba(0,0,0,0.05);
  background-color: white;
  border-bottom-left-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
}

.chatbot-input .input-group {
  box-shadow: var(--shadow-soft);
  border-radius: 50px;
  overflow: hidden;
}

.chatbot-input .form-control {
  border-radius: 30px;
  border: 1px solid rgba(0,0,0,0.08);
  padding: 12px 20px;
  font-size: 14px;
  transition: all var(--transition-fast);
  height: auto;
}

.chatbot-input .form-control:focus {
  box-shadow: 0 0 0 2px rgba(32, 102, 161, 0.2);
  border-color: var(--primary-color);
}

.chatbot-input .input-group-append {
  position: relative;
}

.chatbot-input .btn {
  border-radius: 50%;
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 0;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  border: none;
  box-shadow: none;
  transition: all var(--transition-fast);
}

.chatbot-input .btn:hover {
  transform: rotate(15deg) scale(1.05);
}

.chatbot-input .btn i {
  font-size: 16px;
}

/* Styles pour les avatars des messages */
.message-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  position: absolute;
  left: -16px;
  top: 10px;
}

.user-avatar {
  background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
  right: -16px;
  left: auto;
}

/* Styles pour les titres des suggestions */
.suggestions-title {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
}

.suggestions-title i {
  margin-right: 6px;
  color: var(--accent-color);
}

/* Styles pour les titres des tableaux et graphiques */
.chart-title, .table-title {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--primary-dark);
  text-align: center;
}

/* Animation pour les nouveaux messages */
.new-message {
  animation: highlightNew 1s ease-in-out;
}

@keyframes highlightNew {
  0% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Style pour le pied de page du chatbot */
.chatbot-footer {
  text-align: center;
  padding: 8px 0 0;
  font-size: 12px;
  color: rgba(0,0,0,0.5);
  border-top: 1px solid rgba(0,0,0,0.05);
  margin-top: 10px;
}

.chatbot-footer p {
  margin: 0;
}

.chatbot-footer strong {
  color: var(--primary-dark);
}

/* Responsive pour les mobiles et tablettes */
@media (max-width: 767px) {
  .chatbot-panel {
    width: 320px;
    bottom: 70px;
    right: 5px;
  }
  
  .chatbot-panel.expanded {
    height: 500px;
  }
}

@media (max-width: 576px) {
  .chatbot-container {
    bottom: 15px;
    right: 15px;
  }
  
  .chatbot-panel {
    width: calc(100vw - 30px);
    bottom: 60px;
    right: 0;
    max-width: 350px;
  }
  
  .chatbot-panel.expanded {
    height: 450px;
  }
  
  .chatbot-header h3 {
    font-size: 18px;
  }
  
  .message {
    max-width: 90%;
  }
}
