body {
  background: #0f172a;
  color: #f8fafc;
  font-family: 'Segoe UI', 'Roboto', sans-serif;
  margin: 0;
  overflow: hidden;  /* ← fixe la page */
  height: 100vh;      /* ← hauteur fixe */
  display: block;
}


h1, h2, h3 {
  font-family: 'Orbitron', sans-serif;
  color: #38bdf8;
  text-align: center;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

#appSection {
  display: flex;
  height: 100vh;
  overflow: hidden;  /* empêche tout débordement */
}


.sidebar {
  width: 250px;
  background: #1e293b;
  padding: 1rem;
  border-right: 1px solid #334155;
  overflow-y: auto;
}

.sidebar h2 {
  font-size: 1.3rem;
  color: #38bdf8;
  margin-bottom: 1rem;
  text-align: center;
}

#conversationList {
  list-style: none;
  padding: 0;
}

#conversationList li {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: #334155;
  color: #f8fafc;
  border-radius: 6px;
  cursor: pointer;
}

#conversationList li:hover {
  background: #475569;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: 0;     /* ❌ plus de décalage à gauche */
  padding: 0;         /* ❌ plus de padding */
  overflow: hidden;
}




/* === Auth Section === */
#authSection {
  max-width: 540px;
  margin: 0 auto;
  padding: 3rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  text-align: center;
}

#authSection input {
  display: block;
  width: 100%;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 1.05rem;
  box-sizing: border-box;
}

#authSection button {
  width: 100%;
  padding: 1rem;
  margin-top: 0.5rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(to right, #3b82f6, #06b6d4);
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

#authSection button:hover {
  transform: scale(1.03);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.6);
}

#authSection a {
  display: block;
  text-align: center;
  margin-top: 0.5rem;
  color: #60a5fa;
  text-decoration: none;
}

#authSection a:hover {
  text-decoration: underline;
}

#authSection p {
  text-align: center;
  margin-top: 1rem;
}

/* === Auth Status Message === */
#authStatus {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: #facc15;
}

/* === Chat === */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: transparent;     /* ❌ pas de fond */
  border: none;                /* ❌ aucune bordure */
  border-radius: 0;            /* ❌ pas d'arrondi */
  padding: 1rem;                  /* ❌ pas d’espace intérieur */
  overflow-y: auto;
  margin: 0 auto; 
  scrollbar-color: #3b82f6 #0f172a; /* Firefox */
  scrollbar-width: thin;
}

.chat-container::-webkit-scrollbar {
  width: 12px;
}

.chat-container::-webkit-scrollbar-track {
  background-color: #0f172a; /* même que le fond */
}

.chat-container::-webkit-scrollbar-thumb {
  background-color: #3b82f6; /* bleu plus clair que le fond */
  border-radius: 10px;
}


.chat-container .chat-actions {
  margin-bottom: 0.5rem;      /* facultatif, petit espace bas global */
}

.chat-message {
  margin: 0.5rem auto;              /* Centrage horizontal */
  padding: 0.75rem 1rem;
  border-radius: 10px;
  max-width: 700px;                 /* Largeur lisible */
  word-wrap: break-word;
  white-space: pre-wrap;
  text-align: left;                 /* Texte aligné à gauche */
}


.chat-message.user {
  background: #3b82f6;
  color: white;
  align-self: flex-end;
  text-align: left;
  margin-left: auto;
  margin-right: 0;
}

.chat-message.bot {
  background: #1f2937; /* gris sombre */
  color: #f8fafc;
  align-self: flex-start;
  width: 100%; 
  max-width: 700px;
  word-wrap: break-word;
  white-space: pre-wrap;
  text-align: left;
  margin-left: auto;
  margin-right: 0;
  margin-bottom: auto;           /* ✅ colle le message à ce qui suit */
  padding-bottom: 0.6rem; 
  box-shadow: none;
  border-radius: 10px;
  position: relative;
}



.chat-input-wrapper {
  display: flex;
  justify-content: center;
  margin: 1rem auto;
  max-width: 700px; /* même largeur que les messages */
  width: 100%;
  gap: 0;
  border: 1px solid #334155;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
}

#chatInput {
  flex: 1;
  border: none;
  padding: 1rem;
  background: transparent;
  color: #f8fafc;
  font-size: 1rem;
  border-radius: 0;
}

.chat-input-wrapper button {
  border: none;
  background: #3b82f6;
  color: white;
  padding: 0 1rem;
  font-weight: bold;
  cursor: pointer;
  border-left: 1px solid #334155;
  transition: background 0.3s;
  border-radius: 0;
}

.chat-input-wrapper button:hover {
  background: #2563eb;
}


.chat-actions {
  font-size: 0.85rem;
  color: #94a3b8;
  margin: 0;                /* 🔧 Supprime espace vertical */
  padding: 0 1rem;          /* 🔧 Garde un peu de padding horizontal */
  margin-top: 0;
  padding-top: 0.3rem;        /* colle au message précédent */
  text-align: left;
}

.chat-message.bot .chat-actions a {
  margin: 0;
  padding: 0;
  line-height: 1.2;
}

.chat-message.bot .copy-button {
  display: flex;
  justify-content: flex-end;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  color: #94a3b8;
  cursor: pointer;
}

.chat-message.bot .copy-button:hover {
  color: #60a5fa;
}

.chat-actions a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
}

.chat-actions a:hover {
  text-decoration: underline;
}

/* === Password Toggle Eye === */
.password-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
}

.password-wrapper input {
  padding-right: 2.5rem;
  width: 100%;
  box-sizing: border-box;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  cursor: pointer;
  color: #cbd5e1;
  font-size: 1.2rem;
  z-index: 10;
}

.wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}



/* === Common Content (Prompt/Response) === */
#aiResponse, #optimizedPrompt {
  color: #f8fafc;
}

#aiResponse h1, #aiResponse h2, #aiResponse h3,
#optimizedPrompt h1, #optimizedPrompt h2, #optimizedPrompt h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-family: 'Orbitron', sans-serif;
  color: #38bdf8;
}

#aiResponse p, #optimizedPrompt p {
  margin: 0.5rem 0;
  line-height: 1.6;
}

#aiResponse ul, #aiResponse ol,
#optimizedPrompt ul, #optimizedPrompt ol {
  margin: 0.5rem 0 1rem 1.5rem;
}

#aiResponse li, #optimizedPrompt li {
  margin-bottom: 0.3rem;
}

#aiResponse li::marker, #optimizedPrompt li::marker {
  color: #22d3ee;
}

#aiResponse code, #optimizedPrompt code {
  background-color: #0f172a;
  padding: 0.2rem 0.4rem;
  border-radius: 5px;
  font-family: 'Courier New', monospace;
  color: #38bdf8;
}

#aiResponse pre, #optimizedPrompt pre {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 1rem;
  border-radius: 10px;
  overflow-x: auto;
  margin-top: 1rem;
}
#sidebar {
  width: 250px;
  background-color: #1f2937;
  color: white;
  padding: 10px;
  overflow-y: auto;
  height: 100vh;
  display: block; /* visible par défaut */
  float: left;
}
#headerBar {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 1rem;
  align-items: center;
  z-index: 1000;
}

#historyToggleIcon {
  font-size: 1.5rem;
  cursor: pointer;
  color: #f1f5f9;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.close-history {
  cursor: pointer;
  font-size: 1.2rem;
  color: #f8fafc;
  padding: 0.25rem;
  transition: color 0.2s;
}

.close-history:hover {
  color: #f87171;
}

.reopen-history {
  position: absolute;
  top: 15px;
  left: 15px;
  background-color: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  font-size: 1.2rem;
  z-index: 1000;
  box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

.reopen-history:hover {
  background-color: #334155;
}

.main-content {
  transition: margin-left 0.3s ease;
}
#accountIcon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  font-weight: bold;
  display: none;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.account-menu {
  position: absolute;
  top: 60px;
  right: 10px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px;
  width: 200px;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  z-index: 1000;
}

.account-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.account-menu li {
  padding: 0.75rem;
  border-radius: 5px;
  color: #f8fafc;
}

.account-menu li:hover {
  background-color: #334155;
}
#accountWrapper {
  position: absolute;
  top: 10px;
  right: 60px;
  z-index: 999;
}

#accountIcon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #3b82f6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0,0,0,0.2);
  font-size: 1rem;
}

.account-menu {
  position: absolute;
  top: 45px;
  right: 0;
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.5rem;
  width: 180px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.account-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.account-menu li {
  padding: 0.6rem 1rem;
  cursor: pointer;
  color: #f1f5f9;
  border-radius: 5px;
}

.account-menu li:hover {
  background-color: #334155;
}

.account-menu hr {
  border: 0;
  border-top: 1px solid #475569;
  margin: 0.5rem 0;
}

#logoutBtn {
  color: #f87171;
  font-weight: bold;
}
.markdown h1, .markdown h2, .markdown h3 {
  font-family: 'Orbitron', sans-serif;
  color: #38bdf8;
  margin: 1rem 0 0.5rem;
}

.markdown p {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.markdown ul, .markdown ol {
  margin: 0.5rem 0 1rem 1.5rem;
}

.markdown li::marker {
  color: #22d3ee;
}

.markdown code {
  background-color: #0f172a;
  padding: 0.2rem 0.4rem;
  border-radius: 5px;
  font-family: 'Courier New', monospace;
  color: #38bdf8;
}

.markdown pre {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 1rem;
  border-radius: 10px;
  overflow-x: auto;
  margin-top: 1rem;
}
.chat-message.bot .markdown {
  text-align: left;
  margin: 0;
  padding: 0;
}

/* Réduit l'espacement vertical à l’intérieur du contenu Markdown */
.chat-message.bot .markdown p,
.chat-message.bot .markdown ul,
.chat-message.bot .markdown ol,
.chat-message.bot .markdown pre,
.chat-message.bot .markdown h1,
.chat-message.bot .markdown h2,
.chat-message.bot .markdown h3 {
  margin: 0;
  padding: 0;
}
.dropdown-container {
  position: relative;
  display: inline-block;
  float: right;
  margin-left: 1rem;
}

.options-icon {
  cursor: pointer;
  color: #f8fafc;
}



/* Chat input position centrale quand vide */
.chat-wrapper-empty {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

/* Barre d’écriture fixe en bas quand messages présents */
.chat-wrapper-active {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
}


.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: #38bdf8;
  color: white;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
}

.copy-btn:hover {
  background: #2563eb;
}

.sidebar-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.right-icons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.sidebar-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.new-chat-button {
  flex-grow: 1;
  background: #334155;
  color: #f8fafc;
  border: none;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: background 0.3s;
}

.new-chat-button:hover {
  background: #475569;
}

.sidebar-icons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#accountIcon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: #3b82f6;
  color: white;
  font-weight: bold;
  font-size: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

#historyToggleIcon {
  font-size: 1.3rem;
  cursor: pointer;
  color: #f1f5f9;
  transition: color 0.2s ease;
}

#historyToggleIcon:hover {
  color: #38bdf8;
}
.sidebar button {
  width: 100%;
  margin-top: 0.5rem;
  background: #334155;
  color: #f8fafc;
  border: none;
  padding: 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.sidebar button:hover {
  background: #475569;
}

.options-icon {
  cursor: pointer;
  color: #f8fafc;
}
#accountIcon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #3b82f6;
  color: white;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.account-menu {
  position: absolute;
  top: 45px;
  right: 0;
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.5rem;
  width: 180px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.account-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.account-menu li {
  padding: 0.6rem 1rem;
  cursor: pointer;
  color: #f1f5f9;
  border-radius: 5px;
}

.account-menu li:hover {
  background-color: #334155;
}

.account-menu hr {
  border: 0;
  border-top: 1px solid #475569;
  margin: 0.5rem 0;
}

/* Responsive Styles */

/* For small devices (Phones) */
@media screen and (max-width: 600px) {
  .sidebar {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 999;
    height: 100vh;
    display: none; /* Initially hidden */
  }

  .main-content {
    margin-left: 0; /* No left margin when sidebar is hidden */
    padding: 1rem;
  }

  #chatContainer {
    padding: 0.5rem; /* Smaller padding for better use of space */
  }

  .chat-input-wrapper {
    flex-direction: column;
    width: 100%;
    gap: 0;
  }

  .chat-input-wrapper button {
    width: 100%; /* Full width button */
  }

  .sidebar-button {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
  }

  #accountWrapper {
    position: absolute;
    top: 10px;
    right: 10px;
  }

  /* Adjust button sizes for mobile */
  #historyToggleIcon, .new-chat-button {
    font-size: 1.2rem;
  }

  /* Adjust form fields */
  #authSection input, #authSection button {
    width: 100%;
  }

  /* Mobile specific styling for bottom bar */
  .chat-wrapper-empty {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
  }

  .chat-wrapper-active {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }
}

/* For medium devices (Tablets) */
@media screen and (max-width: 1024px) {
  .sidebar {
    width: 200px;
  }

  .main-content {
    margin-left: 200px; /* Provide space for sidebar */
  }

  .chat-input-wrapper {
    flex-direction: row;
    width: 100%;
    gap: 0;
  }

  .chat-input-wrapper button {
    padding: 0.5rem;
  }
}
/* plein écran */
.modal.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #f9fafb; /* fond clair, change selon ton thème */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

/* centrer le contenu */
.modal.fullscreen .modal-content {
  background: white;
  width: 90%;
  max-width: 600px;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  text-align: center;
}

/* bouton fermer */
.modal.fullscreen .close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
}
.mode-selector {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 0.5rem auto;
  font-size: 1rem;
  font-weight: normal;
  color: #94a3b8;
  cursor: pointer;
}

.mode-selector span {
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.mode-selector span:hover {
  color: #38bdf8;
}

.mode-selector .active {
  font-weight: bold;
  color: #38bdf8;
  text-decoration: underline;
}
.checkbox-terms {
  margin: 1rem 0;
  font-size: 0.9rem;
  text-align: left;
  color: #cbd5e1;
}

.checkbox-terms a {
  color: #38bdf8;
  text-decoration: underline;
}

.legal-content {
  max-height: 70vh;
  overflow-y: auto;
  text-align: left;
  padding: 1rem;
  color: #0f172a;
}
.checkbox-terms {
  white-space: nowrap;
}
.checkbox-terms label {
  display: inline;
}
/* Style du conteneur du menu déroulant */
.dropdown-container {
  position: relative;
  display: inline-block;
  margin-left: 1rem; /* Espace entre l'icône et le texte de la conversation */
}

/* Icône des trois points (options) */
.options-icon {
  cursor: pointer;
  color: #f8fafc;
}

/* Style du menu déroulant */
.dropdown-menu {
  display: none; /* Par défaut, caché */
  position: absolute;
  right: 0;
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 0.3rem 0;
  min-width: 120px;
  z-index: 100;
}

/* Chaque option dans le menu déroulant */
.dropdown-menu div {
  padding: 0.5rem 1rem;
  cursor: pointer;
  color: #f8fafc;
}

/* Hover sur une option du menu déroulant */
.dropdown-menu div:hover {
  background-color: #334155;
}


/* === Popup Paramètres (version large et centrée) === */
.modal.fullscreen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.9);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content.settings-layout {
  display: flex;
  flex-direction: row;
  width: 85%;
  max-width: 1200px;
  height: 85%;
  background: #1e293b;
  border-radius: 14px;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: relative;
  animation: fadeIn 0.3s ease-out;
}

/* Animation d’apparition douce */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Croix de fermeture */
.modal-content .close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 1.8rem;
  color: #f8fafc;
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s ease;
}

.modal-content .close:hover {
  color: #38bdf8;
}

/* === Barre latérale === */
.settings-sidebar {
  width: 280px;
  background: #0f172a;
  border-right: 1px solid #334155;
  padding-top: 4rem;
}

.settings-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.settings-sidebar li {
  padding: 1rem 1.5rem;
  color: #f8fafc;
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: background 0.3s, border-left 0.3s;
  font-size: 1rem;
}

.settings-sidebar li:hover {
  background: #334155;
}

.settings-sidebar li.active {
  background: #334155;
  border-left: 4px solid #3b82f6;
  font-weight: bold;
}

/* === Zone principale === */
.settings-main {
  flex: 1;
  padding: 2rem 3rem;
  overflow-y: auto;
  color: #f8fafc;
}

.settings-main h2 {
  color: #38bdf8;
  margin-bottom: 1rem;
}

.scrollable-content {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 1rem;
  line-height: 1.6;
}

.scrollable-content::-webkit-scrollbar {
  width: 8px;
}
.scrollable-content::-webkit-scrollbar-thumb {
  background: #3b82f6;
  border-radius: 6px;
}

/* === Boutons de danger === */
.account-actions {
  margin-top: 2rem;
}

.danger-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.9rem 1.4rem;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  margin-bottom: 1rem;
  width: fit-content;
  font-weight: 600;
  transition: background 0.25s ease;
}

.danger-btn:hover {
  background: #dc2626;
}
/* Centre le modal settings au milieu de l'écran */
.modal.fullscreen {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2,6,23,0.6); /* léger overlay */
  z-index: 2000;
}

.modal.fullscreen .modal-content {
  position: relative;
  width: min(900px, 95%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 12px;
  background: #0f172a;
  box-shadow: 0 10px 30px rgba(2,6,23,0.6);
  padding: 0; /* la structure interne gère les paddings */
}
