/* root wrapper removed;
styles apply to icon and panel separately */
/* Icon button fixed in bottom-right */
#live-chat-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99;
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  width: 50px;
  height: 50px;
  max-width: 50px;
  max-height: 50px;
  cursor: pointer;
}

#live-chat-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 50%;
  background: #f0f0f0; /* offline background */
  transition: background-color 200ms ease, transform 150ms ease;
  box-sizing: border-box;
}

/* Indicator dot inside the icon (top-right) */
#live-chat-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor; /* match icon color when not unread */
  border: 2px solid #fff; /* white border for visibility */
  box-sizing: border-box;
  display: block;
  z-index: 2;
}

/* When there's unread activity, force red */
#live-chat-indicator.unread {
  background: #e53935 !important;
}

#live-chat-toggle .live-chat-label {
  display:none 
}

/* Small inline status component (shortcode output) */
.live-chat-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: bold;
  user-select: none;
  color: #333;
}
.live-chat-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  background: #e53935; /* offline red */
  border: 2px solid #fff;
  box-sizing: border-box;
}
.live-chat-status.online .live-chat-status-dot {
  background: #18a558; /* online green */
  position: relative; /* establish containing block for pulse pseudo-element */
  z-index: 1;
}

/* Pulse effect: subtle expanding ring when online */
.live-chat-status.online .live-chat-status-dot::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(24,165,88,0.35);
  pointer-events: none;
  z-index: 0;
  animation: lc-pulse 1.6s ease-out infinite;
}

@keyframes lc-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(24,165,88,0.35);
  }
  60% {
    box-shadow: 0 0 0 12px rgba(24,165,88,0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(24,165,88,0);
  }
}

.live-chat-status-text {
  font-size: inherit;
  color: inherit;
  margin-top: -1px;
}

/* Make shortcode triggers obviously interactive */
.live-chat-open-shortcode,
.live-chat-status {
  cursor: pointer;
}

/* Icon color states (applied to the wrapper span) */
/* Icon color states (applied to the wrapper span) */
#live-chat-icon.offline {
  color: #333;
  background: #f0f0f0;
}

#live-chat-icon.online {
  color: #18a558;
  background: #e6f6ea; /* light green background when online */
}

#live-chat-icon.online svg {
  filter: drop-shadow(0 0 6px rgba(24,165,88,0.6));
}

/* Ensure any fills/strokes inside the SVG follow currentColor and make the SVG scale to the icon container */
#live-chat-icon svg, #live-chat-icon svg * {
  fill: currentColor !important;
  stroke: currentColor !important;
}

/* Make sure the inlined SVG uses the wrapper size and is visible */
/* Scale the inline SVG down a bit so it sits nicely within the circular background */
#live-chat-icon svg {
  display: block !important;
  width: 75% !important; /* increased by ~25% */
  height: 75% !important; /* increased by ~25% */
  vertical-align: middle !important;
}

#live-chat-panel {
  width: 320px;
  max-width: 90vw;
  max-height: 90vh;
  background: #fff;
  background: rgba(255, 255, 255, 0.98);
  border:1px solid #ddd;
  border-radius:6px;
  box-shadow:0 8px 30px rgba(0,0,0,0.12);
  overflow: hidden;
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

.hidden {
  display:none 
}

#live-chat-header {
  font-size: 16px;
  font-weight: bold;
  padding: 10px;
  color: #555;
  background: #f0f0f0;
  background: rgba(240, 240, 240, 0.90);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative; /* make loader :before absolute positioning relative to this container */
}

/* Ensure close button SVG is visible and centered */
#live-chat-close-button {
  background: transparent;
  border: none;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: opacity 150ms ease;
  box-sizing: border-box;
  cursor: pointer;
}

#live-chat-close-button svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 20px;
  fill: currentColor;
  stroke: currentColor;
}

#live-chat-close-button:active svg,
#live-chat-close-button svg:active {
  
}

#live-chat-body {
  padding: 10px;
  box-sizing: border-box;
  flex: 1 1 auto; /* fill remaining panel height */
  min-height: 0; /* allow children to scroll inside */
  display: flex;
  flex-direction: column;
}

#live-chat-body button:disabled,
#live-chat-body button[disabled] {
  opacity: .25 !important;
  cursor: not-allowed !important;
}

#live-chat-messages {
  /* allow messages area to expand and scroll inside the body */
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin-bottom: 8px;
  position: relative; /* allow loader pseudo-element to center inside this container */
}

/* Loading spinner overlay for messages and admin list */
#live-chat-messages.loading:before,
#live-chat-admin-list.loading:before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.08);
  border-top-color: rgba(0,0,0,0.6);
  animation: lc-spin 0.9s linear infinite;
  pointer-events: none; /* don't block clicks when showing loader */
  z-index: 9998;
}

@keyframes lc-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.live-chat-message {
  font-size: 14px;
  line-height: 20px;
  color: #333;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 6px;
}

.live-chat-message a {
  color:  #007bff;
  font-size: inherit;
  text-decoration: none;
}

.live-chat-message a:hover {
  text-decoration: underline;
}

.from-user {
  background: #eef6ff;
  text-align: right;
}

/* Empty-state placeholder for chat areas */
.live-chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #9aa0a6; /* soft grey */
}
.live-chat-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  fill: currentColor;
  opacity: 0.9;
}

.live-chat-empty-text {
  font-size: 14px;
  color: currentColor;
  opacity: 0.9;
  margin-top: 0;
}

/* Smooth transitions for programmatic panel repositioning */
#live-chat-panel {
  transition: top 500ms ease, 
              left 500ms ease, 
              right 500ms ease, 
              bottom 500ms ease, 
              width 500ms ease, 
              height 500ms ease,
              transform 50ms ease-out,
              opacity 50ms ease-out;
  will-change: top, left, right, bottom, width, height;
}

#live-chat-panel.hidden {
  transition: none;
  visibility: hidden;
}

/* Helper to temporarily disable transition when user is actively dragging/resizing */
.no-transition {
  transition: none !important;
}

/* Fast fade-out + move-right animation for hiding the panel */
.fade-out-right {
  transform: translateX(18px) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Pre-position state: render the panel off-screen (invisible) so we can compute sizes/position before showing */
#live-chat-panel.pre-position {
  opacity: 0 !important;
  visibility: visible !important;
  pointer-events: none !important;
  transition: none !important;
}

.from-admin {
  background: #f1f1f1;
  text-align: left;
}

.msg-text {
  display: block;
}

.msg-time {
  display: block;
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

#live-chat-body textarea,
#live-chat-form textarea {
  font-size: 14px;
  line-height: 20px;
  width: 100%;
  height: 100px;
  min-height: 100px;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: vertical;
}

#live-chat-form input[type="text"], 
#live-chat-form input[type="email"] {
  font-size: 14px;
  line-height: 20px;
  width: 100%;
  box-sizing: border-box;
  padding: 6px;
  margin-bottom: 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#live-chat-consent {
  font-size: 60%;
  color: #555;
  margin-top: 6px;
}

#live-chat-consent input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 18px;
  height: 18px;
  visibility: hidden;
  z-index: -1;
}

#live-chat-send {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 14px;
  font-weight: normal;
  margin-top: 8px;
  background: #007bff;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  transition: opacity 150ms ease;
  cursor: pointer;
}

#live-chat-send:active {
  opacity: .75;
}

/* Admin list styles */
#live-chat-admin-wrap {
  display: flex;
  gap: 10px;
  height: 100%;
}

#live-chat-admin-list {
  position: relative;
  font-size: 12px;
  line-height: 16px;
  width: 200px;
  min-width: 200px;
  max-height: none;
  overflow: auto;
  border-right: 1px solid #eee;
  padding-right: 8px;
  align-self: stretch;
}

.live-chat-list-item {
  position: relative;
  padding: 8px;
  margin-bottom: 8px;
  background: #fafafa;
  color: #999;
  border-radius: 5px;
  cursor: pointer;
}

/* Highlight currently selected admin chat item */
.live-chat-list-item.active {
  background: #f1f1f1;
  color: #555;
}

.live-chat-list-item strong {
  display: block;
  font-size: 12px;
}

.live-chat-list-indicator {
  position: absolute;
  top: 0;
  right: 0;
  float: right;
  background: #e53935;
  border-top-right-radius: 5px;
  color: #fff;
  padding: 2px 6px;
  /* border-radius: 12px; */
  font-size: 12px;
  font-weight: bold;
}

/* Per-item coloring: red when there are unread messages, green when none */
.live-chat-list-item.has-unread .live-chat-list-indicator {
  background: #e53935;
}
.live-chat-list-item.no-unread .live-chat-list-indicator {
  background: #18a558;
}

#live-chat-admin-chat {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Resizer handle */
#live-chat-resizer {
  position: absolute;
  width: 14px;
  height: 14px;
  right: 6px;
  bottom: 6px;
  background: transparent;
  border-right: 2px solid rgba(0,0,0,0.2);
  border-bottom: 2px solid rgba(0,0,0,0.2);
  box-sizing: border-box;
  z-index: 9999;
}

#live-chat-header {
  cursor: move;
}
