* {
  box-sizing: border-box;
}


body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f5f7;
  color: #242424;
}


.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px;
}


.main-header {
  text-align: center;
  margin-bottom: 50px;
}


h1 {
  font-size: 42px;
  margin: 0 0 8px 0;
}


.subtitle {
  color: #666;
  font-size: 18px;
}


.intro {
  text-align: center;
  margin-bottom: 30px;
}


.intro h2 {
  margin-bottom: 10px;
}


.intro p {
  color: #666;
}


.profiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}


.card {
  background: white;
  padding: 30px;
  border-radius: 18px;

  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.06);

  cursor: pointer;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}


.card:hover {
  transform: translateY(-4px);

  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.10);
}


.avatar {
  width: 64px;
  height: 64px;

  border-radius: 50%;

  background: #ececf3;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 26px;
  font-weight: bold;

  margin-bottom: 20px;
}


.card h3 {
  margin-bottom: 4px;
}


.role {
  color: #666;
  margin-top: 0;
}


.notice {
  display: block;

  color: #888;

  font-size: 13px;

  margin: 18px 0;
}


button {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 15px;
}


button:disabled {
  cursor: default;
  opacity: 0.6;
}


.card button,
#chat-form button {
  background: #222;
  color: white;
}


.hidden {
  display: none !important;
}



/* CHAT */

.chat {
  background: white;

  border-radius: 18px;

  padding: 24px;

  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.06);
}


.chat-header {
  display: flex;

  align-items: center;

  gap: 18px;

  padding-bottom: 20px;

  border-bottom: 1px solid #eee;
}


.chat-identity {
  flex: 1;
}


#chat-role {
  color: #777;
  font-size: 13px;
  margin-top: 3px;
}


.chat-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}


.back {
  background: #eee;
  color: #333;
}


.secondary-button {
  background: #eeeeF2;
  color: #333;
}


.delete-button {
  background: #f6eaea;
  color: #8b2424;
}


.messages {
  height: 420px;
  overflow-y: auto;
  padding: 20px 0;
}


.message {
  max-width: 78%;

  padding: 12px 16px;

  border-radius: 14px;

  margin-bottom: 12px;

  line-height: 1.5;

  white-space: pre-wrap;
}


.message.user {
  margin-left: auto;
  background: #222;
  color: white;
}


.message.ai {
  background: #f0f0f2;
}


.message.loading {
  color: #777;
  font-style: italic;
}



/* SOURCES FREUD */

.freud-sources {
  max-width: 78%;

  margin-top: -5px;
  margin-bottom: 18px;

  padding: 12px 15px;

  background: #fafafa;

  border-left: 3px solid #aaa;

  border-radius: 8px;

  font-size: 13px;

  line-height: 1.45;

  color: #555;
}


.sources-title {
  font-weight: bold;

  color: #333;

  margin-bottom: 7px;
}


.source-item {
  margin-top: 4px;
}


.source-item::before {
  content: "• ";
}



/* FORMULAIRE */

#chat-form {
  display: flex;

  gap: 12px;

  align-items: flex-end;
}


textarea {
  width: 100%;

  resize: none;

  padding: 12px;

  border-radius: 10px;

  border: 1px solid #ccc;

  font-family: inherit;

  font-size: 15px;

  line-height: 1.4;
}


textarea:focus {
  outline: none;
  border-color: #777;
}


.disclaimer {
  color: #888;

  font-size: 12px;

  margin-top: 16px;

  line-height: 1.4;
}



/* RÉSUMÉ */

.summary-panel {
  margin: 0 0 20px 0;

  padding: 20px;

  border-radius: 14px;

  background: #f6f6f8;

  border: 1px solid #e6e6ea;
}


.summary-header {
  display: flex;

  align-items: center;

  justify-content: space-between;

  margin-bottom: 14px;
}


.close-summary {
  background: transparent;

  color: #555;

  font-size: 22px;

  padding: 2px 8px;
}


#summary-content {
  line-height: 1.55;

  white-space: pre-wrap;

  color: #333;
}



@media (max-width: 700px) {

  .container {
    padding: 24px 16px;
  }


  .profiles {
    grid-template-columns: 1fr;
  }


  .chat-header {
    flex-wrap: wrap;
  }


  .chat-actions {
    width: 100%;

    margin-left: 0;

    margin-top: 5px;
  }


  .chat-actions button {
    flex: 1;
  }


  .messages {
    height: 390px;
  }


  .message,
  .freud-sources {
    max-width: 88%;
  }


  #chat-form {
    flex-direction: column;
  }


  #chat-form button {
    width: 100%;
  }

}