/* MODAL CONTAINER */
#negotiation-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 420px;
  max-height: 80vh;
  background: #f9f9f9;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  z-index: 9999;
}

#negotiation-modal.hidden {
  display: none;
}

/* MODAL HEADER */
#negotiation-modal .modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px 16px 8px 16px;
  box-sizing: border-box;
}

#negotiation-modal h3#negotiation-product-name {
  margin: 0 0 12px 0;
  font-weight: 600;
  font-size: 1.25rem;
  color: #222;
  text-align: center;
}

/* CLOSE BUTTON */
#negotiation-modal .close-modal {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 24px;
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  transition: color 0.2s ease-in-out;
}
#negotiation-modal .close-modal:hover {
  color: #000;
}

/* CHAT WINDOW */
#chat-window {
  flex-grow: 1;
  overflow-y: auto;
  background: #e5ddd5; /* couleur fond chat WhatsApp */
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: inset 0 0 5px #ccc;
  margin-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: #aaa #e5ddd5;
  font-size: 0.95rem;
  line-height: 1.3;
}

/* Scrollbar Chrome */
#chat-window::-webkit-scrollbar {
  width: 6px;
}
#chat-window::-webkit-scrollbar-track {
  background: #e5ddd5;
  border-radius: 3px;
}
#chat-window::-webkit-scrollbar-thumb {
  background-color: #aaa;
  border-radius: 3px;
}

/* MESSAGE BUBBLES */
.chat-message {
  max-width: 70%;
  margin: 6px 0;
  padding: 10px 14px;
  border-radius: 20px;
  position: relative;
  clear: both;
  word-wrap: break-word;
  white-space: pre-line; /* support des retours à la ligne */
  box-shadow: 0 1px 1.5px rgba(0,0,0,0.1);
  font-weight: 500;
}

/* Vendeur - à gauche */
.vendeur-msg {
  background: #dcf8c6; /* vert clair WhatsApp */
  color: #222;
  float: left;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 20px;
  border-top-right-radius: 20px;
  border-top-left-radius: 20px;
}

/* Client - à droite */
.client-msg {
  background: #fff;
  color: #222;
  float: right;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 20px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 1px 1.5px rgba(0,0,0,0.15);
}

/* INPUT AREA */
.input-area {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid #ccc;
}

#price-proposal {
  flex-grow: 1;
  padding: 10px 14px;
  font-size: 1rem;
  border: 1.5px solid #ccc;
  border-radius: 24px;
  outline-offset: 2px;
  transition: border-color 0.3s ease;
}

#price-proposal:focus {
  border-color: #25d366; /* vert WhatsApp */
  box-shadow: 0 0 8px #25d366aa;
}

#send-proposal {
  background-color: #25d366;
  border: none;
  color: white;
  font-weight: 600;
  padding: 10px 18px;
  font-size: 1rem;
  border-radius: 24px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  user-select: none;
}

#send-proposal:disabled {
  background-color: #9bd9a3;
  cursor: default;
}

#send-proposal:not(:disabled):hover {
  background-color: #128c3e;
}

/* Responsive - petits écrans */
@media (max-width: 400px) {
  #negotiation-modal {
    width: 95%;
    max-width: none;
  }
  .chat-message {
    max-width: 80%;
  }
}
