:root {
  --bordeaux: #401201;
  --beige: #f2d7b6;
  --orange: #f97300;
  --marron-clair: #a6785d;
  --white: #fff;
}

/* =======================
   MESSAGERIE STYLED
======================= */
.messagerie-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 90%;
  max-width: 900px;
  height: 600px;
  display: flex;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
  border-radius: 20px;
  overflow: hidden;
  font-family: 'Segoe UI', sans-serif;
  z-index: 9999;
  background: var(--beige);
  border: 2px solid var(--bordeaux);
  animation: fadeInUp 0.4s ease;
}

.hidden {
  display: none !important;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--bordeaux);
  transition: transform 0.2s ease;
  z-index: 2;
}
.close-btn:hover {
  transform: scale(1.2);
}

/* = Sidebar gauche = */
.sidebar {
  background: var(--bordeaux);
  color: var(--white);
  width: 35%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.sidebar-header {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--orange);
}

.search-input {
  padding: 10px 14px;
  border: none;
  border-radius: 30px;
  outline: none;
  background: var(--marron-clair);
  color: var(--white);
  font-size: 14px;
}

.search-input::placeholder {
  color: #f6e5d5;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.conversation-item {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}
.conversation-item:hover {
  background: var(--orange);
  transform: translateX(4px);
}
.conversation-item strong {
  display: block;
  font-weight: 600;
  color: #fff;
}
.conversation-item p {
  font-size: 13px;
  color: #eee;
}

/* = Fenêtre de chat = */
.chat-window {
  background: var(--beige);
  width: 65%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border-left: 2px solid var(--bordeaux);
}

.chat-header {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--bordeaux);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--marron-clair);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background-color: var(--marron-clair);
  border-radius: 6px;
}

/* = Messages = */
.message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  animation: pop 0.3s ease;
  word-break: break-word;
}

.message.sent {
  background: var(--orange);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 0;
}
.message:not(.sent) {
  background: var(--white);
  color: var(--bordeaux);
  align-self: flex-start;
  border-bottom-left-radius: 0;
}

/* = Input zone = */
.chat-input {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.chat-input input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 30px;
  border: 2px solid var(--bordeaux);
  font-size: 14px;
  outline: none;
}

.chat-input button {
  background: var(--orange);
  color: white;
  border: none;
  border-radius: 30px;
  padding: 12px 20px;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chat-input button:hover {
  background: #d15e00;
}

/* Animations */
@keyframes fadeInUp {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes pop {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .messagerie-container {
    flex-direction: column;
    width: 95vw;
    height: 65vh;
    bottom: 10px;
    right: 10px;
    border-radius: 14px;
    border: 1px solid var(--bordeaux);
  }

  .sidebar,
  .chat-window {
    width: 100%;
    height: 50%;
    padding: 12px;
  }

  .sidebar {
    border-bottom: 1px solid var(--orange);
    gap: 10px;
  }

  .sidebar-header {
    font-size: 1.2rem;
    margin-bottom: 6px;
  }

  .conversation-item {
    padding: 10px 12px;
    font-size: 14px;
  }

  .chat-window {
    border-left: none;
    border-top: 1px solid var(--bordeaux);
    padding-top: 6px;
  }

  .chat-header {
    font-size: 1rem;
    padding-bottom: 6px;
  }

  .chat-messages {
    padding: 10px 0;
    gap: 8px;
  }

  .chat-input {
    flex-direction: row;
    gap: 6px;
  }

  .chat-input input {
    font-size: 14px;
    padding: 10px 12px;
  }

  .chat-input button {
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 20px;
  }

  .close-btn {
    font-size: 20px;
    top: 8px;
    right: 10px;
  }
}