/* ====== CONTENEUR ====== */
.chatbot-container {
  display: flex;
  flex-direction: column;
  height: calc(100% - 3.5rem);
  max-width: 700px;
  margin: var(--sp-xl) auto;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* ====== HEADER ====== */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md) var(--sp-xl);
  background: var(--primary);
  color: white;
  flex-shrink: 0;
  /* border-bottom: 4px solid var(--secondary); */
}

.chatbot-title {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  font-weight: 700;
  font-size: var(--fs-md);
  color: white;
}

.chatbot-title .icon {
  filter: brightness(0) invert(1);
  width: 25px;
  height: 25px;
}

.chatbot-actions {
  display: flex;
  gap: var(--sp-sm);
}

.chatbot-actions .btn {
  color: white;
  border-color: rgba(255,255,255,0.3);
}

.chatbot-actions .btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.5);
}

.chatbot-actions .icon {
  filter: brightness(0) invert(1);
}

/* ====== AUTO-REFRESH TOGGLE ====== */
.btn-auto-refresh {
  background: transparent;
  width: 25px;
  height: 25px;
  cursor: pointer;
  border: 1px solid white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}
.btn-auto-refresh .icon {
  filter: brightness(0) invert(1);
  width: 15px;
  height: 15px;
  transition: filter var(--transition);
}
/* .btn-auto-refresh.auto-off {
  border-color: var(--secondary);
} */
.btn-auto-refresh.auto-off .icon {
  filter: brightness(0) saturate(100%) invert(76%) sepia(53%) saturate(567%) hue-rotate(28deg) brightness(97%) contrast(87%);
}
.btn-auto-refresh:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ====== MESSAGES ====== */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-xxl) var(--sp-xxl) 17rem;
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  background: var(--bg-card);
}

.chatbot-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: var(--sp-lg);
  color: var(--text-light);
  text-align: center;
}

.chatbot-welcome .icon {
  opacity: 0.2;
}

.icone-inline {
  vertical-align: -0.25em;
  border-radius: var(--radius-lg);
  padding: 3px;
}

/* ====== BULLES ====== */
.chat-bulle {
  display: flex;
  gap: var(--sp-md);
  max-width: 90%;
  animation: bulleIn 0.3s ease;
}

@keyframes bulleIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bot {
  align-self: flex-start;
}

.chat-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-avatar .icon {
  filter: brightness(0) invert(1);
}

.chat-user .chat-avatar {
  background: var(--secondary);
}

.chat-user .chat-avatar .icon {
  filter: brightness(0) saturate(100%) invert(25%) sepia(10%) saturate(600%) hue-rotate(160deg);
}

.chat-contenu {
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--radius-lg);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.chat-bot .chat-contenu {
  background: var(--bg);
  border: 1px solid var(--border);
  border-top-left-radius: var(--sp-xs);
  color: var(--text);
}

.chat-user .chat-contenu {
  background: var(--secondary);
  color: var(--primary-dark);
  border-top-right-radius: var(--sp-xs);
  font-weight: 600;
}

.chat-contenu a {
  color: var(--secondary-dark);
  text-decoration: underline;
}

.chat-contenu .carte-img {
  max-width: 200px;
  max-height: 120px;
  border-radius: var(--radius-sm);
  margin: var(--sp-sm) 0;
}

/* ====== CARTES DE RÉSULTATS ====== */
.chat-carte {
  margin-left: 44px;
  padding: var(--sp-md) var(--sp-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--secondary);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  line-height: 2;
  box-shadow: var(--shadow-sm);
  animation: bulleIn 0.3s ease;
}

.chat-carte strong {
  color: var(--primary);
  font-size: var(--fs-base);
}

.chat-carte a {
  color: var(--secondary-dark);
  text-decoration: underline;
  font-weight: 600;
}

.chat-carte .carte-img {
  max-width: 100%;
  max-height: 100px;
  border-radius: var(--radius-sm);
  margin: var(--sp-sm) 0;
}

/* ====== CHOIX ====== */
.chat-choix {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-left: 44px;
  animation: bulleIn 0.3s ease;
}

.chat-choix-btn {
  padding: var(--sp-sm) var(--sp-lg);
  background: var(--bg-card);
  border: 2px solid var(--secondary);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition);
}

.chat-choix-btn:hover:not(:disabled) {
  background: var(--secondary);
  color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.chat-choix-btn:disabled {
  cursor: default;
  opacity: 0.5;
}

.chat-choix-btn.choix-clique {
  border-color: var(--border);
  color: var(--text-light);
}

.chat-choix-btn.choix-actif {
  background: var(--secondary);
  color: var(--primary-dark);
  border-color: var(--secondary);
  opacity: 1;
}

.carte-img {
  max-width: 200px;
  height: auto;
  border-radius: var(--radius-sm);
}
.preview-img {
  max-width: 200px;
  height: auto;
  border-radius: var(--radius-sm);
}