.chat-launch-btn {
  background: #05a730 !important;
  border-color: #05a730 !important;
  right: 20px;
  bottom: 20px;
  z-index: 1055;
}

/* =========================
   CHAT WIDGET (single source)
   ========================= */
.chat-widget {
  right: 24px;
  bottom: 80px;

  /* ✅ smaller width (not too wide) */
  width: 760px;
  min-width: 420px;
  max-width: calc(100vw - 48px);

  /* ✅ fixed height like screenshot, but still fits screen */
  height: 560px;
  max-height: calc(100vh - 140px);

  z-index: 1055;
}

.chat-arrow {
  right: 55px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
}

.chat-sidebar {
  width: 300px;
  flex: 0 0 300px; /* ✅ don't shrink */
  background: #3c3c3c;
}

.chat-content {
  flex: 1;
  min-width: 0; /* ✅ important for flex overflow */
  background: #f8f9fa;
}

.chat-contact-list {
  flex: 1;
  overflow-y: auto;
}

.chat-contact-list button {
  transition: 0.2s;
}

.chat-contact-list button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.active-contact {
  background: #495057 !important;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f5f5;
}

/* online dot */
.chat-online {
  position: absolute;
  right: -4px;
  bottom: 2px;
  width: 10px;
  height: 10px;
  background: #28a745;
  border: 2px solid #3c3c3c;
  border-radius: 50%;
}

/* scrollbars */
.chat-contact-list::-webkit-scrollbar,
.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-contact-list::-webkit-scrollbar-thumb,
.chat-body::-webkit-scrollbar-thumb {
  background: #bcbcbc;
  border-radius: 10px;
}

/* =========================
   MESSAGE BUBBLES
   ========================= */
.msg-bubble {
  position: relative;
  max-width: 75%;
  display: inline-block;
  padding: 12px 14px;
  padding-right: 28px; /* space for actions */
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.msg-received {
  background: #bcd6ff;
  border: 1px solid #aac8ff;
}

.msg-sent {
  background: #c9f3d0;
  border: 1px solid #b2e9bc;
}

.msg-text {
  white-space: pre-wrap; /* keep new lines */
  overflow-wrap: anywhere; /* break long text */
  word-break: break-word; /* fallback */
}

.msg-time {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.55);
  white-space: nowrap; /* ✅ stop wrapping */
}

/* =========================
   MESSAGE ACTIONS + MENU
   ========================= */
.msg-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0;
  transition: opacity 0.12s ease-in-out;
}

.msg-bubble:hover .msg-actions,
.msg-actions.open {
  opacity: 1;
}

.msg-actions-btn {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.msg-menu {
  position: absolute;
  top: 26px;
  right: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  min-width: 120px;
  overflow: hidden;
  z-index: 20;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.msg-menu-item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 13px;
  color: black;
}

.msg-menu-item:hover {
  background: rgba(0, 0, 0, 0.06);
}

.msg-menu-item.danger {
  color: black;
}

.msg-edit-input {
  font-size: 14px;
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 992px) {
  .chat-widget {
    width: 520px;
    min-width: 360px;
    height: calc(100vh - 140px);
  }
  .chat-sidebar {
    width: 260px;
    flex: 0 0 260px;
  }
}

@media (max-width: 768px) {
  .chat-widget {
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .chat-sidebar {
    width: 40%;
    flex: 0 0 40%;
  }

  .chat-arrow {
    display: none;
  }
}
