* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #ffffff;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-layout {
  width: 100%;
  max-width: 850px;
  display: flex;
  flex-direction: column;
  padding: 0 20px;
}

/* Landing state: center everything */
body.landing .main-layout {
  height: 100vh;
  justify-content: center;
  align-items: center;
}

.landing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
  text-align: center;
  max-width: 850px;
}

.landing-text {
  font-size: 16px;
  color: #666;
  margin-top: 10px;
}

.central-logo {
  width: 150px;
  height: auto;
}

/* Chat state */
.chat-container {
  flex: 1;
  padding: 40px 0 300px 0; /* Plus d'espace pour ne pas être collé à la barre */
  display: none;
  flex-direction: column;
  gap: 4px; /* Réduit de 8px à 4px pour coller les bulles */
  width: 100%;
}

/* Ajustement pour les petits écrans */
@media (max-width: 600px) {
  .chat-container { 
    padding: 20px 15px 250px 15px; 
  }
  .input-box {
    padding: 12px 18px;
  }
  #messageInput {
    font-size: 16px;
  }
  .left-tools {
    gap: 8px;
  }
  .tool-btn span {
    display: none; /* Cache les textes Recherche/Réflexion sur mobile */
  }
  .central-logo {
    width: 100px;
  }
}

.message {
  max-width: 100%;
  line-height: 1.4; /* Réduit de 1.5 */
  font-size: 16px;
  padding: 8px 14px; /* Réduit de 10px */
  border-radius: 12px;
  position: relative;
}

.message.user {
  align-self: flex-end;
  background: #dcf8c6;
  color: #1a1a1a;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
  padding: 8px 12px;
  border-radius: 12px;
  border-top-right-radius: 2px;
  max-width: 85%;
  font-size: 16px;
}

.message.user::before {
  content: "Vous";
  display: block;
  font-size: 10px; /* Réduit de 11px */
  color: #588c3e;
  font-weight: 600;
  margin-bottom: 1px; /* Réduit */
  text-align: right;
}

.message.assistant {
  align-self: flex-start;
  background: transparent;
  color: #333;
  border: none;
  box-shadow: none;
  padding: 0;
  width: 100%;
  line-height: 1.35; /* Encore plus compact pour l'IA */
}

.message.assistant strong {
  font-weight: 700;
  color: #000;
}

.message.assistant blockquote {
  font-size: 1.05em;
  color: #444;
  margin: 5px 0; /* Réduit */
  padding-left: 12px;
  border-left: 3px solid #eee;
  font-style: italic;
}

/* Style spécifique pour les guillemets courbes */
.message.assistant {
  quotes: "“" "”";
}

.custom-quote {
  font-weight: 900;
  font-size: 1.2em;
  color: #000;
  font-family: serif;
}

.message.assistant .table-container {
  width: 100%;
  overflow-x: auto;
  margin: 8px 0; /* Réduit de 15px */
  border: 1px solid #e5e5e5;
  border-radius: 8px;
}

.message.assistant table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.message.assistant th, .message.assistant td {
  padding: 8px 12px; /* Réduit de 12px 15px */
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

.message.assistant th {
  background-color: #f9f9f9;
  font-weight: 600;
  color: #666;
}

.message.assistant tr:last-child td {
  border-bottom: none;
}

.message.assistant h3, .message.assistant h2 {
  margin: 4px 0 1px 0; /* Encore plus réduit */
  font-size: 17px; /* Un poil plus petit */
  color: #111;
}

.message.assistant li {
  margin-left: 18px;
  margin-bottom: 1px; /* Réduit */
}

.message.assistant hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 6px 0; /* Réduit */
}

.assistant-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px; /* Réduit de 6px */
}

.assistant-logo-small {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
}

.assistant-name {
  font-size: 11px;
  color: #666;
  font-weight: 600;
}

.message.thinking {
  background: #f9f9f9;
  color: #666;
  border-left: 2px solid #ddd;
  padding: 10px 20px;
  font-style: italic;
  font-size: 14px;
  margin: 10px 0;
  width: 100%;
}

/* Input area - Fixed only in chat */
.input-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 20px 0 40px 0;
}

body:not(.landing) .input-wrapper {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 850px;
  padding: 20px 20px 40px 20px;
  background: linear-gradient(to top, white 80%, transparent);
  z-index: 100;
}

.input-box {
  width: 100%;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 34px;
  padding: 18px 28px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-box:focus-within {
  border-color: #d1d1d1;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}

#messageInput {
  width: 100%;
  padding: 12px 4px;
  border: none;
  background: transparent;
  color: #1a1a1a;
  font-size: 20px;
  outline: none;
  resize: none;
  min-height: 54px;
}

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  padding-bottom: 4px;
}

.left-tools {
  display: flex;
  gap: 12px;
  align-items: center;
}

.tool-btn {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 15px;
  color: #4b4b4b;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-btn.logo-btn {
  background: #ff5e1a;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.tool-btn.logo-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.tool-btn.plus-btn {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  justify-content: center;
  color: #1a1a1a;
}

.tool-btn i {
  width: 18px;
  height: 18px;
}

#sendButton {
  width: 36px;
  height: 36px;
  background: #111111;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

#sendButton i {
  width: 20px;
  height: 20px;
}

#sendButton.recording {
  background: #ff4444;
}

#sendButton:hover {
  opacity: 0.8;
}

#sendButton:disabled {
  background: #e5e5e5;
  cursor: not-allowed;
}

.loading {
  align-self: flex-start;
  margin-top: 10px;
}

.loading img {
  width: 120px;
  height: auto;
  border-radius: 12px;
}
