@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 300; font-display: swap; src: url('fonts/SpaceGrotesk-Light.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/SpaceGrotesk-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/SpaceGrotesk-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/SpaceGrotesk-Bold.woff2') format('woff2'); }

:root {
  --ivory: #F7F4EF; --ivory-deep: #F0EBE3; --surface: #FCFAF7;
  --charcoal: #1E1E1C; --gray: #6F6A63; --gray-light: #9A938A;
  --border: #E3DED6; --border-strong: #C9C0B2; --bronze: #7C7A5A;
  --shadow: 0 1px 2px rgba(30,30,28,0.04), 0 12px 48px rgba(30,30,28,0.08);
}

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

html, body {
  height: 100%; font-family: 'Space Grotesk', sans-serif; background: var(--ivory);
  color: var(--charcoal); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}

body {
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(circle at 20% 0%, rgba(166,124,82,0.04), transparent 50%),
              radial-gradient(circle at 80% 100%, rgba(124,122,90,0.05), transparent 50%), var(--ivory);
}

/* FENÊTRE AGRANDIE */
.chat-window {
  width: 100%; max-width: 900px; /* Augmenté de 480px à 900px */
  height: 90vh; max-height: 900px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}

/* HEADER */
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.header-left { display: flex; align-items: center; gap: 12px; }
.avatar-img { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; }
.assistant-name { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; }
.separator { color: var(--border-strong); font-size: 14px; }
.status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-light); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bronze); }
.icon-btn { width: 32px; height: 32px; border: none; background: transparent; color: var(--gray); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.icon-btn:hover { background: var(--ivory-deep); color: var(--charcoal); }

/* MESSAGES */
.messages { flex: 1; overflow-y: auto; padding: 32px 24px; display: flex; flex-direction: column; gap: 24px; scroll-behavior: smooth; }
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb { background: rgba(111, 106, 99, 0.2); border-radius: 10px; }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 12px; gap: 12px; margin: auto 0; }
.empty-title { font-size: 28px; font-weight: 400; letter-spacing: -0.02em; }
.empty-sub { font-size: 15px; color: var(--gray); max-width: 400px; line-height: 1.5; margin-bottom: 12px; }
.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; max-width: 600px; margin-top: 12px; }
.suggestion { padding: 10px 16px; background: transparent; border: 1px solid var(--border); border-radius: 8px; color: var(--charcoal); font-family: inherit; font-size: 13.5px; cursor: pointer; transition: all 0.15s ease; }
.suggestion:hover { background: var(--ivory-deep); border-color: var(--border-strong); }

.message { display: flex; flex-direction: column; max-width: 85%; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.message.user { align-self: flex-end; align-items: flex-end; }
.message.assistant { align-self: flex-start; align-items: flex-start; }
.bubble { padding: 14px 20px; border-radius: 12px; font-size: 15px; line-height: 1.6; word-wrap: break-word; }
.message.user .bubble { background: var(--charcoal); color: var(--ivory); border-bottom-right-radius: 4px; }
.message.assistant .bubble { background: var(--ivory-deep); color: var(--charcoal); border-bottom-left-radius: 4px; }

/* Style pour le code Markdown */
.bubble pre { background: #1E1E1C; color: #F7F4EF; padding: 16px; border-radius: 8px; overflow-x: auto; font-family: monospace; font-size: 13.5px; margin-top: 12px; }
.bubble code { font-family: monospace; background: rgba(30,30,28,0.08); padding: 2px 6px; border-radius: 4px; font-size: 13.5px; }
.bubble pre code { background: transparent; padding: 0; }

/* TYPING INDICATOR */
.typing { display: flex; align-items: center; gap: 5px; padding: 14px 20px; background: var(--ivory-deep); border-radius: 12px; border-bottom-left-radius: 4px; }
.typing span { width: 6px; height: 6px; background: var(--gray); border-radius: 50%; opacity: 0.4; animation: blink 1.4s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.3; } 30% { opacity: 1; } }

/* ZONE DE SAISIE (avec trombone) */
.composer { padding: 16px 24px 20px; border-top: 1px solid var(--border); background: var(--surface); }
.input-wrapper { display: flex; align-items: flex-end; gap: 8px; background: var(--ivory); border: 1px solid var(--border); border-radius: 12px; padding: 8px 8px 8px 12px; transition: border-color 0.2s; }
.input-wrapper:focus-within { border-color: var(--border-strong); }

.attach-btn { background: transparent; border: none; color: var(--gray); cursor: pointer; padding: 8px; border-radius: 8px; display: flex; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s; }
.attach-btn:hover { background: var(--ivory-deep); color: var(--charcoal); }

#input { flex: 1; border: none; background: transparent; outline: none; resize: none; font-family: inherit; font-size: 15px; color: var(--charcoal); line-height: 1.5; padding: 8px 0; max-height: 150px; min-height: 24px; }
#input::placeholder { color: var(--gray-light); }

.send-btn { width: 36px; height: 36px; border: none; background: var(--charcoal); color: var(--ivory); border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: opacity 0.15s, transform 0.1s; flex-shrink: 0; }
.send-btn:hover { opacity: 0.9; }
.send-btn:active { transform: scale(0.96); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.disclaimer { text-align: center; font-size: 11.5px; color: var(--gray-light); margin-top: 12px; }

@media (max-width: 768px) {
  body { padding: 0; }
  .chat-window { max-width: 100%; height: 100vh; max-height: 100vh; border-radius: 0; border: none; }
}

/* --- Bouton Copier --- */
.message.assistant {
  position: relative;
}
.copy-btn {
  position: absolute;
  bottom: -24px;
  left: 0;
  background: transparent;
  border: none;
  color: var(--gray-light);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  padding: 4px;
  border-radius: 4px;
}
.message.assistant:hover .copy-btn {
  opacity: 1;
}
.copy-btn:hover {
  color: var(--charcoal);
}
.copy-btn.copied {
  color: var(--bronze);
}

/* --- Animation de réflexion (Réseau de neurones) --- */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--ivory-deep);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  color: var(--gray);
  font-size: 13.5px;
  font-style: italic;
}
.neural-net {
  width: 24px;
  height: 24px;
}
.neural-net circle {
  animation: pulse-node 1.5s infinite ease-in-out;
}
.neural-net circle:nth-child(1) { animation-delay: 0s; }
.neural-net circle:nth-child(2) { animation-delay: 0.3s; }
.neural-net circle:nth-child(3) { animation-delay: 0.6s; }
.neural-net circle:nth-child(4) { animation-delay: 0.9s; }

@keyframes pulse-node {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}
