.chat-section {
  display: flex;
  justify-content: center;
  margin: 20px auto;
  padding: 0 15px;
  box-sizing: border-box;
}

/* Chat container */
.chat-container {
  width: 100%;
  max-width: 700px;
  height: 500px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 400px;
}

/* En-tête du chat */
.chat-header {
  background-color: var(--primary-color);
  color: white;
  padding: 15px;
  text-align: center;
  flex-shrink: 0;
}

.chat-header h2 {
  font-weight: 600;
  font-size: 18px;
  margin: 0;
}

/* Zone des messages */
.chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background-color: white;
  min-height: 0; /* Important for flex child to shrink */
}

/* Styles pour les messages */
.message {
  margin-bottom: 12px;
  max-width: 85%;
  width: fit-content;
  padding: 10px 15px;
  border-radius: 18px;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.user-message {
  background-color: var(--primary-color);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 5px;
}

.admin-message,
.response-message {
  background-color: #e9e9eb;
  color: #333;
  margin-right: auto;
  border-bottom-left-radius: 5px;
}

/* Zone de saisie du message */
.chat-input-area {
  display: flex;
  padding: 15px;
  background-color: white;
  border-top: 1px solid #e0e0e0;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

#message-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #e0e0e0;
  border-radius: 15px;
  outline: none;
  font-size: 14px;
  transition: border 0.3s ease;
  resize: none;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  min-height: 45px;
  max-height: 120px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) #ffffff;
  box-sizing: border-box;
}

#message-input:focus {
  border-color: var(--primary-color);
}

#send-button {
  background-color: var(--primary-color);
  height: 45px;
  min-width: 80px;
  color: white;
  border: none;
  border-radius: 25px;
  padding: 0 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

#send-button:hover {
  background-color: var(--secondary-color);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

#send-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Droit à l'oubli section */
.droit-oubli {
  text-align: center;
  padding: 20px 15px;
  background: #f8f9fa;
  border-top: 1px solid #ddd;
}

.info-text {
  font-size: 16px;
  color: #333;
  margin-bottom: 15px;
  line-height: 1.5;
}

.btn-delete {
  display: inline-block;
  padding: 12px 20px;
  background: #d6332d;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.btn-delete:hover {
  background: #c9302c;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

/* Responsive breakpoints */

/* Large tablets and small desktops */
@media (max-width: 992px) {
  .chat-container {
    max-width: 90%;
    height: 480px;
  }
}

/* Tablets */
@media (max-width: 768px) {
  .chat-section {
    margin: 15px auto;
    padding: 0 10px;
  }

  .chat-container {
    height: 450px;
    border-radius: 8px;
    max-width: 95%;
  }

  .chat-header {
    padding: 12px;
  }

  .chat-header h2 {
    font-size: 16px;
  }

  .chat-messages {
    padding: 12px;
  }

  .message {
    max-width: 90%;
    padding: 8px 12px;
    font-size: 14px;
  }

  .chat-input-area {
    padding: 12px;
    gap: 8px;
  }

  #message-input {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 40px;
    max-height: 100px;
  }

  #send-button {
    height: 40px;
    min-width: 70px;
    padding: 0 15px;
    font-size: 13px;
  }

  .droit-oubli {
    padding: 15px 10px;
  }

  .info-text {
    font-size: 14px;
  }

  .btn-delete {
    padding: 10px 16px;
    font-size: 14px;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .chat-section {
    margin: 10px auto;
    padding: 0 5px;
  }

  .chat-container {
    height: 400px;
    border-radius: 8px;
    max-width: 100%;
    margin: 0;
  }

  .chat-header {
    padding: 10px;
  }

  .chat-header h2 {
    font-size: 15px;
  }

  .chat-messages {
    padding: 10px;
  }

  .message {
    max-width: 95%;
    padding: 8px 10px;
    font-size: 13px;
    margin-bottom: 10px;
  }

  .chat-input-area {
    padding: 10px;
    gap: 6px;
  }

  #message-input {
    padding: 10px 12px;
    min-height: 38px;
    max-height: 80px;
    border-radius: 12px;
  }

  #send-button {
    height: 38px;
    min-width: 60px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 20px;
  }

  #send-button span {
    display: none;
  }

  #send-button::after {
    content: "→";
    font-size: 16px;
    font-weight: bold;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  .chat-container {
    height: 350px;
  }

  .chat-messages {
    padding: 8px;
  }

  .message {
    padding: 6px 8px;
    font-size: 12px;
  }

  .chat-input-area {
    padding: 8px;
  }

  #message-input {
    padding: 8px 10px;
    min-height: 35px;
  }

  #send-button {
    height: 35px;
    min-width: 50px;
    padding: 0 8px;
  }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .chat-container {
    height: 300px;
  }

  .chat-messages {
    padding: 8px;
  }

  .message {
    margin-bottom: 8px;
  }

  .chat-input-area {
    padding: 8px;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .chat-container {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  }

  #send-button {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  }
}

/* Scrollbar styling for webkit browsers */
.chat-messages::-webkit-scrollbar,
#message-input::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
#message-input::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb,
#message-input::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
#message-input::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

#char-count {
  font-size: 0.9em;
  color: #888;
  text-align: center;
  margin-bottom: 10px;
}

.message-date {
  font-size: 0.75em;
  color: white;
  display: block;
  margin-top: 4px;
  font-style: italic;
  text-align: right;
}

.message-date-response {
  font-size: 0.75em;
  color: #333;
  display: block;
  margin-top: 4px;
  font-style: italic;
  text-align: left;
}

.chat-section-header {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-light) 100%
  );
  color: white;
  padding: 2rem 0;
  margin-bottom: 2rem;
}

.chat-container-header {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  padding: 0 1rem;
}

.chat-hours {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0;
}

.chat-hours ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
}

.chat-hours li {
  margin: 0.25rem 0;
}
