/**
 * Client Chat Widget - Modern Design
 * CRM Chat & AI Chatbot Module
 *
 * A clean, modern floating chat widget for client-staff communication
 */

/* ==========================================================================
   CSS Variables - Easy theming
   ========================================================================== */
:root {
  --chat-primary: #4f46e5;
  --chat-primary-hover: #4338ca;
  --chat-primary-light: #eef2ff;
  --chat-secondary: #64748b;
  --chat-success: #22c55e;
  --chat-danger: #ef4444;
  --chat-bg: #ffffff;
  --chat-bg-secondary: #f8fafc;
  --chat-border: #e2e8f0;
  --chat-text: #1e293b;
  --chat-text-muted: #64748b;
  --chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  --chat-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --chat-radius: 16px;
  --chat-radius-sm: 8px;
  --chat-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Floating Chat Button
   ========================================================================== */
.ch_pointer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999990;
}

.ch_pointer .ch_pointer-main {
  position: relative;
  width: 49px;
  height: 49px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary) 0%, #7c3aed 100%);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--chat-shadow), 0 0 0 0 rgba(79, 70, 229, 0.4);
  transition: var(--chat-transition);
  /* No animation by default - only pulse when there are unread messages */
}

/* Pulse animation only when there are unread notifications */
.ch_pointer.has-unread .ch_pointer-main {
  animation: chat-pulse 2s infinite;
}

.ch_pointer .ch_pointer-main:hover {
  transform: scale(1.05);
  box-shadow: var(--chat-shadow), 0 0 0 8px rgba(79, 70, 229, 0.15);
}

@keyframes chat-pulse {

  0%,
  100% {
    box-shadow: var(--chat-shadow), 0 0 0 0 rgba(79, 70, 229, 0.4);
  }

  50% {
    box-shadow: var(--chat-shadow), 0 0 0 12px rgba(79, 70, 229, 0);
  }
}

.ch_pointer .ch_pointer-main svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
  transition: var(--chat-transition);
}

.ch_pointer .ch_pointer-main-first,
.ch_pointer .ch_pointer-main-under {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ch_pointer .ch_pointer-main-under {
  display: none;
}

.ch_pointer .ch_pointer-main-under svg {
  width: 20px;
  height: 20px;
}

/* Notification Badge */
.chatNewNotification {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  background: #ef4444;
  border-radius: 11px;
  border: 2px solid #ffffff;
  display: none;
  animation: bounce-in 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  padding: 0 5px;
  box-shadow: none;
}

.chatNewNotification::after {
  content: attr(data-count);
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  line-height: 18px;
  text-align: center;
  white-space: nowrap;
}

.chatNewNotification.show-count {
  display: block;
}

@keyframes bounce-in {
  0% {
    transform: scale(0);
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

/* ==========================================================================
   Chat Window Container
   ========================================================================== */
#clientChat .firstDiv {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-height: 600px;
  background: var(--chat-bg);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  overflow: hidden;
  /* Smooth open/close animation instead of display:none toggle */
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#clientChat .firstDiv.chat-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  z-index: 999999;
  animation: slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================================================
   Header Section
   ========================================================================== */
.company_top_info {
  background: linear-gradient(135deg, var(--chat-primary) 0%, #7c3aed 100%);
  padding: 16px;
  position: relative;
  color: #ffffff;
  margin-bottom: 44px;
  border-bottom: none;
}

.company_top_info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.top_close_icon {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transition: var(--chat-transition);
  z-index: 10;
}

.top_close_icon:hover {
  background: rgba(255, 255, 255, 0.2);
}

.top_close_icon svg {
  width: 12px;
  height: 12px;
}

.company_top_info_parent {
  position: relative;
  z-index: 1;
}

.company_logo_placeholder {
  display: flex;
  align-items: center;
}

.company_logo_placeholder img {
  max-height: 40px;
  width: auto;
  filter: brightness(0) invert(1);
}

.company_logo_placeholder a {
  pointer-events: none;
}

/* ==========================================================================
   Staff Selection Panel - Clean Compact Design
   ========================================================================== */
.customer_admins_wrapper {
  position: relative;
  top: -44px;
  z-index: 2;
  margin-bottom: -44px;
}

.customer_first_co_wrapper {
  background: var(--chat-bg);
  border-bottom: 1px solid var(--chat-border);
}

/* Ensure nested divs don't block overflow */
.customer_first_co_wrapper>div,
.customer_first_co_wrapper>div>div {
  overflow: visible;
}

.customer_main_placeholder_top {
  padding: 8px 12px;
  overflow: visible;
}

.staff_online_text {
  display: none;
}

.staff_muted_text_info {
  display: none;
}

.staff_info_wrapper_div {
  display: none;
}

/* Staff Avatars - Single row, left aligned, scrollable */
.staff_image_parent {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

/* Show thin scrollbar for usability */
.staff_image_parent::-webkit-scrollbar {
  height: 4px;
}

.staff_image_parent::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
}

.staff_image_parent::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}

.staff_image_parent::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

.staff_image_wrapper {
  display: inline-flex;
  gap: 0;
  white-space: nowrap;
}

.staff_container {
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 4px 5px;
  display: inline-block;
}

.staff_container:hover .staff_children_parent_child_div {
  transform: scale(1.1);
}

.staff_image_second_children_div {
  position: relative;
}

.staff_children_parent_child_div {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  transition: all 0.2s ease;
  background: #fff;
  border: none !important;
  box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.4);
}

.staff_children_parent_child_div img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Online, not selected — green ring */
.staff_children_parent_child_div.onlineStaff {
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.5);
}

/* Selected (active) — indigo ring, regardless of online status */
.staff_children_parent_child_div.active_staff {
  box-shadow:0 0 0 2px rgba(28, 84, 196, 0.64);
  transform: scale(1.1);
}

/* Selected + online — keep indigo ring (selection takes priority) */
.staff_children_parent_child_div.active_staff.onlineStaff {
  box-shadow: 0 0 0 2px rgba(28, 84, 196, 0.64);
}

/* Staff notification badge */
.staff_notification {
  display: none;
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 11px;
  padding: 0 5px;
  text-align: center;
  line-height: 18px;
  z-index: 10;
  border: 2px solid #fff;
  box-shadow: none;
}

.staff_notification[data-notification]:not([data-notification="0"]) {
  display: block;
}

.staff_notification::after {
  content: attr(data-notification);
  white-space: nowrap;
}

/* ==========================================================================
   Messages Area
   ========================================================================== */
.clientwrapper {
  display: flex;
  flex-direction: column;
  height: 380px;
  background: var(--chat-bg-secondary);
  margin-top: 0;
  position: relative;
}

.m-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.m-area::-webkit-scrollbar {
  width: 6px;
}

.m-area::-webkit-scrollbar-track {
  background: transparent;
}

.m-area::-webkit-scrollbar-thumb {
  background: var(--chat-border);
  border-radius: 3px;
}

.m-area::-webkit-scrollbar-thumb:hover {
  background: var(--chat-secondary);
}

/* Chat Messages List */
ol.chat {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

ol.chat li {
  display: flex;
  animation: message-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Message row: avatar + bubble */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 85%;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Incoming Messages (Staff) */
ol.chat li.customer_admin {
  justify-content: flex-start;
}

ol.chat li.customer_admin .msg-row {
  flex-direction: row;
}

ol.chat li.customer_admin .msg {
  background: var(--chat-bg);
  color: var(--chat-text);
  border-radius: 16px 16px 16px 4px;
  box-shadow: var(--chat-shadow-sm);
}

/* Outgoing Messages (Client) */
ol.chat li.client {
  justify-content: flex-end;
}

ol.chat li.client .msg-row {
  flex-direction: row-reverse;
}

ol.chat li.client .msg {
  background: linear-gradient(135deg, var(--chat-primary) 0%, #7c3aed 100%);
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
}

/* Message Bubble */
.msg {
  max-width: 80%;
  padding: 12px 16px;
  word-wrap: break-word;
  position: relative;
}

.msg .admin_name,
.msg .client_name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.8;
}

.msg .admin_role {
  display: block;
  font-size: 10px;
  font-weight: 400;
  margin-bottom: 4px;
  opacity: 0.6;
}

.msg p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

ol.chat li.client .msg p {
  color: #ffffff;
}

.msg .time {
  display: block;
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.7;
}

/* Message Time */
.msg-time {
  display: block;
  font-size: 10px;
  color: var(--chat-text-muted);
  margin-top: 4px;
  opacity: 0.8;
  text-align: right;
}

ol.chat li.client .msg-time {
  color: rgba(255, 255, 255, 0.7);
}

/* Message Status Indicators */
.msg-status {
  display: inline-block;
  align-items: center;
  margin-left: 6px;
  font-size: 12px;
  vertical-align: middle;
  float: right;
  margin-top: 4px;
}

.msg-status.sending {
  color: rgba(255, 255, 255, 0.5);
}

.msg-status.sending i {
  animation: pulse 1s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }
}

.msg-status.delivered {
  color: rgba(255, 255, 255, 0.7);
}

.msg-status.read {
  color: #60a5fa;
}

ol.chat li.client .msg-status.read {
  color: #93c5fd;
}

.msg-status.failed {
  color: var(--chat-danger);
}

ol.chat li.has-status .msg {
  padding-right: 16px;
}

/* Images in messages */
img.prchat_convertedImage {
  max-width: 100%;
  border-radius: var(--chat-radius-sm);
  margin-top: 8px;
}

/* Typing Indicator - Same style as staff side */
.typing-indicator {
  display: none;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 16px;
  position: relative;
  left: -24px;
  bottom: -24px;
  width: fit-content;
}

.typing-indicator.show {
  display: flex;
}

.typing-bubble {
  background: #f1f3f5;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.typing-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0s;
}

.typing-text {
  font-size: 12px;
  color: #666;
  font-style: italic;
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ==========================================================================
   Input Area
   ========================================================================== */
.placeholder-messages {
  padding: 10px 12px;
  background: transparent;
  border-top: 1px solid rgba(226, 232, 240, 0.85);
}

#staffMessagesForm {
  display: block;
  position: relative;
}

.prchat-client-composer-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  row-gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.prchat-client-composer-row > .prchat-edit-indicator {
  flex: 1 1 100%;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-bottom: 0;
}

.prchat-client-composer-row.prchat-voice-recording-active {
  min-height: 56px;
  align-items: center;
}

.prchat-client-composer-row .input-actions-left {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 2px 0 0;
}

.prchat-client-composer-row .input-textarea-wrap-client {
  flex: 1 1 0%;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: none;
}

.clients_textarea {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  padding: 8px 42px 8px 12px;
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 38px;
  max-height: 80px;
  line-height: 1.45;
  transition: var(--chat-transition);
  font-family: inherit;
  background: transparent;
  box-shadow: none;
}

.prchat-client-composer-row .input-actions-left .client-file-trigger,
.prchat-client-composer-row .input-actions-left .client-emoji-trigger,
.prchat-client-composer-row .input-actions-left .chat-action-voice-clientside {
  width: 26px;
  height: 26px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--chat-secondary);
  transition: var(--chat-transition);
}

/* .clients_textarea:focus {
  border-color: #4f46e5;
} */

.clients_textarea::placeholder {
  color: var(--chat-text-muted);
}

.send_client_message {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #017bff;
  color: #ffffff;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--chat-transition);
  border: none;
  outline: none;
}

.send_client_message svg {
  fill: #ffffff;
}

.send_client_message:hover {
  background: #0068d9;
  transform: translateY(-50%) scale(1.05);
}

.send_client_message:active {
  transform: translateY(-50%) scale(0.95);
}

.client-file-trigger,
.client-emoji-trigger,
.chat-action-voice-clientside {
  position: static;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--chat-secondary);
  cursor: pointer;
  border-radius: 50%;
  transition: var(--chat-transition);
  font-size: 16px;
}

.client-file-trigger:hover,
.client-emoji-trigger:hover,
.chat-action-voice-clientside:hover {
  color: var(--chat-primary);
  background: var(--chat-primary-light);
}

/* File upload loader */
.chat-module-loader {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999999;
  align-items: center;
  justify-content: center;
}

.chat-module-loader::before {
  content: "Uploading...";
  color: #ffffff;
  font-size: 14px;
}

/* ==========================================================================
   Emoji Display
   ========================================================================== */
img.emoji {
  width: 20px !important;
  height: 20px !important;
  vertical-align: middle;
  margin: 0 2px;
}

/* ==========================================================================
   Tooltips
   ========================================================================== */
.tooltip {
  z-index: 99999999 !important;
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */
@media screen and (max-width: 480px) {
  .ch_pointer {
    bottom: 16px;
    right: 16px;
  }

  .ch_pointer .ch_pointer-main {
    width: 56px;
    height: 56px;
  }

  #clientChat .firstDiv {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    transform: translateY(100%);
  }

  #clientChat .firstDiv.chat-open {
    transform: translateY(0);
  }

  @keyframes slide-up-mobile {
    from {
      opacity: 0;
      transform: translateY(100%);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .company_top_info {
    padding: 16px;
    padding-top: 20px;
  }

  .customer_admins_wrapper {
    margin-top: -30px;
    padding: 0;
    margin-bottom: -30px;
  }

  .customer_main_placeholder_top {
    padding: 6px 12px;
  }

  .staff_children_parent_child_div {
    width: 30px;
    height: 30px;
  }

  .clientwrapper {
    height: calc(100vh - 220px);
    min-height: 320px;
  }

  .msg {
    max-width: 85%;
    padding: 10px 14px;
  }

  .msg p {
    font-size: 14px;
  }

  .placeholder-messages {
    padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .clients_textarea {
    padding: 8px 42px 8px 10px;
    min-height: 40px;
    font-size: 14px;
  }

  .prchat-client-composer-row {
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
  }

  .prchat-client-composer-row .input-actions-left {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 0 4px 0 0;
  }

  .prchat-client-composer-row .input-textarea-wrap-client {
    border-radius: 20px;
  }

  .client-file-trigger,
  .client-emoji-trigger,
  .chat-action-voice-clientside {
    width: 30px;
    height: 30px;
    font-size: 15px;
    flex-shrink: 0;
  }

  .send_client_message {
    width: 34px;
    height: 34px;
    right: 3px;
  }
}

/* ==========================================================================
   Dark Mode Support (optional - follows system preference)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  /* Uncomment to enable automatic dark mode
  :root {
    --chat-bg: #1e1e2e;
    --chat-bg-secondary: #181825;
    --chat-border: #313244;
    --chat-text: #cdd6f4;
    --chat-text-muted: #a6adc8;
    --chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --chat-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  }

  ol.chat li.customer_admin .msg {
    background: #313244;
  }
  */
}

/* ==========================================================================
   Drag and Drop
   ========================================================================== */
.drag-drop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(79, 70, 229, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  border-radius: var(--chat-radius-sm);
  pointer-events: none;
}

.drag-drop-overlay.active {
  opacity: 1;
  visibility: visible;
}

.drag-drop-content {
  text-align: center;
  color: #ffffff;
}

.drag-drop-content i {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
  animation: bounce-slow 1s ease infinite;
}

@keyframes bounce-slow {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.drag-drop-content p {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}

.clientwrapper.dragover {
  border: 2px dashed var(--chat-primary);
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus states for keyboard navigation */
.ch_pointer .ch_pointer-main:focus-visible,
.send_client_message:focus-visible,
.client-file-trigger:focus-visible,
.client-emoji-trigger:focus-visible {
  outline: 2px solid var(--chat-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Compact Staff Header
   ========================================================================== */
.compact_staff_header {
  padding: 12px 16px;
  background: var(--chat-bg);
  border-bottom: 1px solid var(--chat-border);
}

.compact_staff_selector {
  position: relative;
}

.compact_staff_active {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--chat-bg-secondary);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--chat-transition);
}

.compact_staff_active:hover {
  background: var(--chat-border);
}

.compact_staff_avatar {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.compact_staff_avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.compact_online_dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #9ca3af;
  border: 2px solid var(--chat-bg);
  border-radius: 50%;
}

.compact_online_dot.online {
  background: var(--chat-success);
}

.compact_staff_info {
  flex: 1;
  min-width: 0;
}

.compact_staff_name {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--chat-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact_staff_status {
  display: block;
  font-size: 12px;
  color: var(--chat-text-muted);
}

.compact_dropdown_icon {
  color: var(--chat-text-muted);
  font-size: 12px;
  transition: transform 0.2s ease;
}

.compact_staff_active.open .compact_dropdown_icon {
  transform: rotate(180deg);
}

/* Dropdown */
.compact_staff_dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--chat-bg);
  border-radius: 10px;
  box-shadow: var(--chat-shadow);
  border: 1px solid var(--chat-border);
  z-index: 100;
  display: none;
  max-height: 200px;
  overflow-y: auto;
}

.compact_staff_dropdown.show {
  display: block;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.compact_dropdown_header {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--chat-text-muted);
  border-bottom: 1px solid var(--chat-border);
}

.compact_staff_list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compact_staff_list .staff_container {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--chat-transition);
}

.compact_staff_list .staff_container:hover {
  background: var(--chat-bg-secondary);
}

.compact_staff_list .staff_container.active {
  background: var(--chat-primary-light);
}

.compact_staff_list .staff_container .staff_image_second_children_div {
  position: relative;
  width: 32px;
  height: 32px;
}

.compact_staff_list .staff_container .staff_image_second_children_div img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.compact_staff_list .staff_container .staff_compact_name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--chat-text);
}

.compact_staff_list .staff_container .staff_notification {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  font-size: 11px;
  line-height: 18px;
}

/* Hide full header elements when in compact mode */
#clientChat[data-header-style="compact"] .customer_admins_wrapper {
  display: none;
}

/* Links in chat messages */
#clientChat ol.chat li .msg p a {
  color: #fff !important;
  text-decoration: underline !important;
  word-break: break-all;
}

#clientChat ol.chat li .msg p a:hover {
  text-decoration: none !important;
  opacity: 0.9;
}

/* Links in incoming messages (from staff) - darker color */
#clientChat ol.chat li.customer_admin .msg p a {
  color: var(--chat-primary) !important;
}

#clientChat ol.chat li.customer_admin .msg p a:hover {
  color: var(--chat-primary-hover) !important;
}

/* Voice Recorder UI */
.prchat-voice-recorder {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  animation: pvr-fadein 0.2s ease;
}

@keyframes pvr-fadein {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.pvr-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: pvr-blink 1s ease infinite;
  flex-shrink: 0;
}

@keyframes pvr-blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.pvr-timer {
  font-family: monospace;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  flex: 1 1 auto;
  min-width: 46px;
}

.pvr-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.pvr-cancel,
.pvr-send {
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s ease, transform 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pvr-cancel {
  border-radius: 50%;
  width: 34px;
  height: 34px;
  background: #f1f5f9;
  color: #64748b;
}

.pvr-cancel:hover {
  background: #e2e8f0;
  transform: scale(1.05);
}

.pvr-send {
  border-radius: 8px;
  min-width: 34px;
  height: 34px;
  padding: 0 12px;
  gap: 6px;
  background: var(--chat-primary, #6e6cf0);
  color: #fff;
}

.pvr-send i,
.pvr-send .pvr-send-label {
  color: #fff;
}

.pvr-send .pvr-send-label {
  font-size: 12px;
  font-weight: 600;
}

.pvr-send:hover {
  background: var(--chat-primary-hover, #5b59d6);
  transform: scale(1.02);
}

#clientChat .prchat-voice-recorder .pvr-send {
  background: #017bff;
}

#clientChat .prchat-voice-recorder .pvr-send:hover {
  background: #0068d9;
}

#clientChat .prchat-voice-recorder .pvr-send i,
#clientChat .prchat-voice-recorder .pvr-send .pvr-send-label {
  color: #fff;
}

.chat-action-voice {
  cursor: pointer;
  transition: color 0.15s ease;
}

.chat-action-voice:hover {
  color: var(--chat-primary, #6e6cf0) !important;
}

.prchat-edit-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #eff6ff;
  border-left: 3px solid var(--chat-primary, #6e6cf0);
  border-radius: 4px;
  font-size: 12px;
  color: #4338ca;
  margin-bottom: 4px;
  width: 100%;
}

.prchat-edit-cancel {
  margin-left: auto;
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 2px;
  font-size: 12px;
}

.prchat-edit-cancel:hover {
  color: #ef4444;
}

.prchat-edited-tag {
  font-size: 10px;
  color: #9ca3af;
  font-style: italic;
  margin-left: 4px;
}

#no_messages {
  border-radius: 9px;
  background: #f2f2f2;
  line-height: 3;
  width: max-content;
  margin: 0 auto;
    margin-bottom: 0px;
  padding: 0px 19px;
  margin-bottom: 12px;
}
