/* --- Structure générale --- */
body {
  background-color: #F7FAF8;
  color: #2F5D50;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 760px;
  margin: 40px auto;
  padding: 0 12px;
}

h1 {
  font-size: 1.6rem;
  color: #2F5D50;
  text-align: center;
  margin-bottom: 20px;
}

/* --- Zone de chat --- */
#chat {
  border: 1px solid #C7D9CF;
  border-radius: 10px;
  padding: 14px;
  min-height: 340px;
  margin-bottom: 14px;
  background: #FFFFFF;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* --- Messages --- */
.msg {
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: 8px;
  line-height: 1.4;
}

.msg.user {
  background: #E6F2ED; /* vert clair mandragore */
  color: #1E3D33;
  align-self: flex-end;
}

.msg.assistant {
  background: #F1F8F5;
  color: #2F5D50;
}

.msg .meta {
  font-size: 0.8rem;
  color: #6B8C7E;
  margin-bottom: 4px;
}

/* --- Formulaire --- */
form {
  display: flex;
  gap: 8px;
}

input {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #C7D9CF;
  font-size: 1rem;
  background: #FFFFFF;
  color: #2F5D50;
}

button {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #6BAF92; /* vert mandragorite */
  color: #FFFFFF;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
}

button:hover {
  background: #5AA783;
  transform: translateY(-1px);
}

/* --- Bouton "Voir les sources" --- */
.toggle-sources {
  margin-top: 8px;
  background: #E6F2ED;
  border: none;
  border-radius: 6px;
  color: #2F5D50;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 500;
  transition: background 0.2s;
}
.toggle-sources:hover {
  background: #CFE8DA;
}

/* --- Bloc sources --- */
.sources-container {
  border-left: 3px solid #6BAF92;
  padding-left: 10px;
  margin-top: 8px;
  background: #FAFCFB;
}

.source {
  font-size: 0.85rem;
  color: #2F5D50;
  padding-left: 8px;
  border-left: 2px solid #C7D9CF;
  margin: 5px 0;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  h1 { font-size: 1.3rem; }
  input, button { font-size: 0.95rem; }
}

/* --- Panneau coulissant Admin (API Key + Contexte) --- */
#context-panel {
  position: fixed;
  left: 0;
  width: 100%;
  background: #F9FAF8;
  border-top: 1px solid #C7D9CF;
  box-shadow: 0 -3px 10px rgba(0,0,0,0.08);
  padding: 15px 20px 20px;
  z-index: 1000;
  transition: bottom 0.35s ease;

  /* 💡 totalement caché quand fermé */
  bottom: -200vh;
}

/* Quand ouvert */
#context-panel.open {
  bottom: 0;
}

/* Titre du panneau */
#context-panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #2F5D50;
}

/* Zone de texte */
#context-panel textarea {
  width: 100%;
  height: 150px;
  border-radius: 6px;
  border: 1px solid #C7D9CF;
  padding: 8px;
  resize: vertical;
  font-family: monospace;
  background: #FFFFFF;
  color: #2F5D50;
}

/* Petit texte d’aide */
#context-panel small {
  color: #54786B;
  display: block;
  margin-bottom: 6px;
}

/* --- Bouton toggle du panneau --- */
#toggle-panel {
  position: fixed;
  bottom: 0;
  right: 16px;
  background: #6BAF92;
  color: #FFFFFF;
  padding: 7px 12px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  z-index: 1001;
  font-size: 18px;
  user-select: none;
  transition: background 0.2s, transform 0.2s;
}

#toggle-panel:hover {
  background: #5AA783;
  transform: translateY(-2px);
}
