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

.chat-sidebar {
  width: 23%;
  padding: 0;
  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;
  padding-top: 20px;
}

.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: #3d3d3d;
  margin: 0px;
}

.current-user-message .created-at {
  color: #7e7e7e;
  margin: 0;
  font-size: 10px;
  position: absolute;
  right: 10px;
  bottom: 1px;
  cursor: pointer;
}

.current-user-message .message-wrapper {
  background-color: rgb(140 145 171 / 50%);
  margin: 0;
  word-break: break-word;
  padding: 15px 30px 15px 15px;
  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: #7e7e7e;
  margin: 0;
  font-size: 10px;
  position: absolute;
  right: 10px;
  bottom: 1px;
  cursor: pointer;
}

.other-user-message .message-wrapper {
  background-color: rgba(255, 255, 255, 0.5);
  margin: 0;
  word-break: break-word;
  padding: 15px 30px 15px 15px;
  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: var(--primary-color);
}

/* 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: var(--primary-color);
  /* 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: var(--primary-color);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.btn-whatsapp-add:hover {
  background: var(--primary-color);
}

.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: var(--primary-color);
  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: var(--primary-color);
  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: var(--primary-color);
  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;
  }
}


.msg-wrapper-relative {
  position: relative;
}

.msg-menu-btn {
  position: absolute;
  top: 5px;
  right: 10px;
  cursor: pointer;
  font-size: 16px;
  color: var(--primary-color);
}

.msg-menu-dropdown {
  position: absolute;
  top: 25px;
  right: 10px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  min-width: 80px;
  display: none;
  z-index: 100;
}

.msg-menu-item {
  padding: 8px;
  cursor: pointer;
}

.msg-menu-item:hover {
  background: #f1f1f1;
}

.chat-input-container {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 25px;
  padding: 0px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  gap: 10px;
}

.chat-input-container textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  max-height: 80px;
  font-size: 14px;
  padding: 8px;
  align-content: center;
}

.chat-input-container button {
  background: var(--primary-color);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-attach {
  position: relative;
  cursor: pointer;
  font-size: 18px;
  color: var(--primary-color);
}

.attach-menu {
  position: absolute;
  bottom: 45px;
  left: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  display: none;
  min-width: 150px;
  z-index: 100;
}

.attach-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  cursor: pointer;
  font-size: 14px;
}

.attach-item:hover {
  background: #f5f5f5;
}

.attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 5px;
  margin-left: 10px;
}



/* preview container */
.attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}

/* image box */
.preview-item {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 10px;
  overflow: hidden;
  background: #eee;
}

/* image */
.preview-image-chat {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* remove button (top right circle) */
.remove-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  text-align: center;
  line-height: 18px;
  cursor: pointer;
}

/* document style (whatsapp-like pill) */
.doc-preview-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f0f2f5;
  border-radius: 15px;
  padding: 5px 10px;
  font-size: 12px;
  position: relative;
}

.doc-preview-item .remove-btn {
  position: relative;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  text-align: center;
  line-height: 18px;
  cursor: pointer;
  margin-bottom: 3px;

}

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

.selected-group-title {
  background: var(--primary-color);
}

.group-name {
  color: white;
}

button.more-btn.dropdown-toggle {
  color: white;
}

.disabled-btn {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}



.group-image-wrapper {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 0 auto;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.group-image-wrapper img#group_image_preview {
  width: 110px;
  height: 110px;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  transition: filter 0.3s ease;
}

.group-image-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.group-image-overlay span {
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Hover triggers the reveal */
.group-image-wrapper:hover .group-image-overlay {
  opacity: 1;
}

.group-image-wrapper:hover img#group_image_preview {
  filter: brightness(0.65);
}

#group-list li {
  transition: all 0.3s ease;
}

#group-list li.selected-group {
  background-color: var(--primary-color);
  color: white;
}

li.group-item {
  margin-bottom: 3px;
}

li.group-item:hover {
  background: rgb(6 20 126);
  color: white;
}

ul#group-list {
  padding: 10px;
}

.group-title {
  padding: 10px 20px;
  background: var(--primary-color);
  color: white;
}

.group-title h5 {
  color: white;
  margin-bottom: 0;
}

button#add-group-btn {
  color: var(--primary-color);
}

.user-info-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: inherit;
}

.user-role {
  font-size: 11px;
  color: #9aa3af;
  /* subtle gray, not fully visible */
  margin-top: 1px;
  opacity: 0.85;
}

input#group-user-search {
  border-radius: 20px;
  margin: 10px 0 25px 0 !important;
}

.wa-toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.wa-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.wa-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  transition: background 0.2s;
}

.wa-toggle-slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.wa-toggle input:checked+.wa-toggle-slider {
  background: var(--primary-color);
}

.wa-toggle input:checked+.wa-toggle-slider::before {
  transform: translateX(20px);
}

#message-list {
  direction: ltr;
}

#empty-alert {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  text-align: center;
  flex-direction: column;
  width: 100%;
}