.chat-container {
  display: flex;
  width: 100%;
  height: 70vh;
  background-color: white;
  border-radius: 5px;
}

.chat-sidebar {
  width: 23%;
  padding: 20px 10px;
  overflow-y: auto;
  border-right: 2px solid #e0e0e0;
}

.chat-sidebar h5 {
  margin-top: 0;
}

#group-list {
  list-style: none;
  padding: 0;
  margin-top: 15px;
}

#group-list li {
  padding: 10px;
  cursor: pointer;
  /* border-bottom: 1px solid #ced4da; */
  display: flex;
  align-items: center;
  border-radius: 4px;
}

#group-list li.selected-group {
  background-color: #f0f2f5;
}

#group-list li img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
  border: 1px solid #e0e0e0;
  object-fit: cover;
  flex-shrink: 0;
}

/* #group-list li:hover {
  background-color: #f1f1f1;
} */

.chat-main {
  display: flex;
  flex: 1;
}

#chat-area {
  flex: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.selected-group-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 2px dotted #e0e0e0;
}

.group-info {
  display: flex;
  align-items: center;
}

.group-picture img {
  width: 50px;
  height: 50px;
  border-radius: 100%;
  object-fit: cover;
  border: 1px solid #e0e0e0;
}

.group-name {
  padding-left: 10px;
}

.group-name p {
  margin: 0;
  font-weight: 600;
}

#message-list {
  flex: 1;
  overflow-y: auto;
  /* border-radius: 5px; */
  margin-bottom: 10px;
  background-image: url("/assets/images/chat/bg_w3.jpg");
  background-repeat: repeat;
  background-size: contain; /* or 'contain' or 'auto' based on your need */
}

.message {
  display: flex;
  align-items: flex-start;
  margin: 10px;
  padding: 10px;
  border-radius: 10px;
}

.message img {
  width: 40px;
  height: 40px;
  border-radius: 100%;
  object-fit: cover;
  border: 1px solid #e0e0e0;
}

.current-user-message {
  justify-content: flex-end;
  padding-left: 30%;
}

.other-user-message {
  justify-content: flex-start;
  padding-right: 15%;
}

.message img {
  border-radius: 50%;
  margin-right: 10px;
  border: 1px solid #e0e0e0;
}

.current-user-message span {
  color: #133356;
  font-weight: 700;
  margin-bottom: 8px;
}

.current-user-message p {
  color: #6b738f;
  margin: 0px;
}

.current-user-message .created-at {
  color: #f2f2f2;
  margin: 0;
  font-size: 10px;
  margin-top: 10px;
  text-align: right;
}

.current-user-message .message-wrapper {
  background-color: rgb(140 145 171 / 50%);
  margin: 0;
  word-break: break-word;
  padding: 10px 25px;
  border-radius: 18px 18px 0 10px;
  max-width: 75%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.other-user-message span {
  color: rgb(34, 34, 34);
  font-weight: 700;
  margin-bottom: 8px;
}

.other-user-message p {
  color: #3d3d3d;
  margin: 0px;
}

.other-user-message .created-at {
  color: white;
  margin: 0;
  font-size: 10px;
  margin-top: 10px;
  text-align: right;
}

.other-user-message .message-wrapper {
  background-color: rgb(219 219 219 / 50%);
  margin: 0;
  word-break: break-word;
  padding: 10px 25px;
  border-radius: 18px 18px 10px 0px;
  max-width: 75%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-input-wrapper {
  padding: 0px 10px;
  margin-bottom: 10px;
}

#message-input {
  display: flex;
  margin: 15px 30px;
}

#message-input input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ced4da;
  border-radius: 5px 0 0 5px;
  outline: none;
}

#message-input textarea {
  flex: 1;
  padding: 10px;
  border: 1px solid #ced4da;
  border-radius: 5px 0 0 5px;
  outline: none;
  height: 42px;
  resize: none;
}

#message-input button {
  padding: 10px 10px 5px 10px;
  border: 1px solid #133356;
  border-left: 0;
  border-radius: 0 5px 5px 0;
  background-color: #133356;
  color: white;
  cursor: pointer;
  outline: none;
}

#message-input button:hover {
  background-color: #a36624;
  border-color: #a36624;
}

#user-list-container {
  width: 25%;
  padding: 10px;
  overflow-y: auto;
  border-left: 2px solid #e0e0e0;
}

.user-title,
.group-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#user-list-container h5 {
  margin-top: 0;
}

#user-list {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-top: 15px;
}

#user-list li.user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  position: relative;
}

#user-list li img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 10px;
  border: 1px solid #e0e0e0;
}

/*
 Group section
*/
.create-group-form {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 20px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1001;
}

#create-group-form h5 {
  margin-top: 0;
}

#create-group-form form {
  display: flex;
  flex-direction: column;
}

#create-group-form form input,
#create-group-form form textarea,
#create-group-form form button {
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid #ced4da;
  border-radius: 5px;
}

#create-group-form form button {
  background-color: #d38c3e;
  color: white;
  cursor: pointer;
  border: 1px solid #d38c3e;
}

#create-group-form form button:hover {
  background-color: #a36624;
  border-color: #a36624;
}

#create-group-form form button[type="button"] {
  background-color: #6c757d;
  border-color: #6c757d;
}

#create-group-form form button[type="button"]:hover {
  background-color: #5a6268;
  border-color: #5a6268;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
}

#create-group-form #category-id,
#school-id,
#class-id,
#section-id {
  width: 100%;
  padding: 10px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  outline: none;
  background-color: white;
  font-size: 14px;
  color: #495057;
  appearance: none; /* Remove default dropdown arrow */
  -webkit-appearance: none; /* Remove default dropdown arrow for Safari */
  -moz-appearance: none; /* Remove default dropdown arrow for Firefox */
  background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="gray" class="bi bi-chevron-down" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}

#create-group-form #category-id:focus {
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/*
  Assign users to the group
*/
/* Add User Form */
.add-user-form {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 20px;
  border: 1px solid #ced4da;
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1001;
  max-height: 70vh;
}

.add-user-form h5 {
  margin-top: 0;
}

.add-user-form ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.add-user-form li {
  padding: 10px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ced4da;
}

.add-user-form li input[type="checkbox"] {
  margin-right: 10px;
}

.add-user-form button {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #d38c3e;
  border-radius: 5px;
  background-color: #d38c3e;
  color: white;
  cursor: pointer;
  outline: none;
}

.add-user-form button:hover {
  background-color: #a36624;
  border-color: #a36624;
}

.add-user-form button[type="button"] {
  background-color: #6c757d;
  border-color: #6c757d;
}

.add-user-form button[type="button"]:hover {
  background-color: #5a6268;
  border-color: #5a6268;
}

.error-messages {
  margin-bottom: 15px;
  color: #711a1a;
  background: #f87f7f;
  padding: 10px;
  border-radius: 6px;
}

.error-message {
  margin-bottom: 5px;
}

#add-user-btn,
#add-group-btn {
  background-color: #f0f2f5;
  border: none;
  outline: none;
  color: #707070;
  padding: 6px 10px;
  border-radius: 5px;
}

ul#add-user-list {
  list-style: none;
  padding: 12px 0px;
  margin: 0;
  max-width: 600px;
  margin: auto;
  max-height: 56vh;
  overflow-y: auto;
}

li.user-item {
  background-color: #ffffff;
  border: 1px solid #ddd;
  border-radius: 5px;
  margin-bottom: 10px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  transition: background-color 0.3s, box-shadow 0.3s;
}

li.user-item:hover {
  background-color: #f9f9f9;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-checkbox {
  margin-right: 10px;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

label {
  cursor: pointer;
  font-size: 16px;
  color: #333;
  transition: color 0.3s;
  margin-bottom: 0;
}

li.user-item:hover label {
  color: #000;
}

/* mzzm desing change for chat */
.more-options {
  position: relative;
  margin-left: auto; /* Push to the right */
}
.more-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 10px;
  color: #333;
}
.more-btn:hover {
  color: #007bff;
}
/* Remove Bootstrap's down arrow (caret) */
.more-btn.dropdown-toggle::after {
  display: none !important;
}
.dropdown-menu {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  z-index: 10000; /* High z-index to ensure visibility */
  min-width: 150px;
}
.dropdown-item {
  padding: 8px 12px;
  color: #333;
  font-size: 0.9rem;
}
.dropdown-item:hover {
  background: #f5f5f5;
}

.whatsapp-modal {
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.whatsapp-header {
  background: #4a506e; /* WhatsApp green */
  color: #fff;
  padding: 15px 20px !important;
  border-bottom: none;
}
h5#viewParticipantsModalLabel {
  color: white !important;
}
.whatsapp-header .modal-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.whatsapp-header .btn-close-white {
  filter: invert(1); /* White close icon */
  opacity: 0.8;
}

.whatsapp-body {
  padding: 15px 20px;
  max-height: 400px;
  overflow-y: auto;
}

.user-list-container {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 10px;
}

.user-title {
  margin-bottom: 10px;
  padding: 0 10px;
}

.user-title h5 {
  font-size: 1.1rem;
  color: rgb(19, 19, 19) !important;
  margin: 0;
}

.btn-whatsapp-add {
  background: #4a506e;
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-whatsapp-add:hover {
  background: #4a506e;
}

.whatsapp-user-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.user-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #e0e0e0;
  transition: background 0.2s;
}

.user-item:last-child {
  border-bottom: none;
}

.user-item:hover {
  background: #ececec;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
}

.user-name {
  font-size: 1rem;
  color: #333;
  font-weight: 500;
}

.whatsapp-footer {
  padding: 10px 20px;
  border-top: none;
  background: #fff;
}

.btn-whatsapp-close {
  background: #4a506e;
  border: none;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.btn-whatsapp-close:hover {
  background: #d38c3e !important;
}

/* Ensure modal is centered and responsive */
.modal-dialog-centered {
  max-width: 400px;
}
#add-user-btn {
  background-color: #4a506e;
  border: none;
  outline: none;
  color: #ffffff;
  padding: 10px 12px;
  border-radius: 25px;
}
#add-user-btn:hover {
  background-color: #d38c3e;
}

/* inside modal show user list */
#user-list li.user-item .admin {
  background-color: #4a506e;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-left: auto;
}

.three-dots {
  margin-left: 10px;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  position: relative;
  margin-left: auto;
}

.custom-toggle-menu {
  position: absolute;
  right: 0;
  top: 70%;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: none;
  flex-direction: column;
  z-index: 100;
  min-width: 140px;
}

.custom-toggle-menu.show {
  display: flex;
}

.custom-toggle-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}

.custom-toggle-item:hover {
  background-color: #f0f0f0;
}

@media (max-width: 576px) {
  .modal-dialog-centered {
    margin: 0.5rem;
  }

  .whatsapp-modal {
    border-radius: 8px;
  }

  .whatsapp-body {
    max-height: 300px;
  }
}
