/* Chat widget styles */
#chat-widget-body, #chat-widget-body-desktop {
  max-height: calc(100vh - 250px);
  overflow-y: auto;
}

.chat-widget-time {
  color: #666;
  text-align: right;
  margin-top: 0.25rem;
  font-size: xx-small;
  position: relative;
  bottom: -6px;
}

.sent.chat-widget-time {
  text-align: right;
}

.received.chat-widget-time {
  text-align: left;
}

.chat-widget-message {
  line-height: 1.16em;
  font-size: 0.85rem;
  word-wrap: break-word;
  padding: 0.5rem 0.75rem;
  white-space: pre-line;
  width: calc(100% - 3rem);
}

.chat-widget-message.sent {
    align-self: flex-end;
    background-color: var(--bs-success-bg-subtle);
    text-align: right;
    border-radius: 16px 16px 0 16px;
    margin: 0.5rem 0.5rem 0.5rem 2.5rem;

}

.chat-widget-message.received {
    align-self: flex-start;
    background-color: var(--bs-light);
    border-radius: 16px 16px 16px 0;
    margin: 0.5rem 2.5rem 0.5rem 0.5rem;
}

#chat-widget-input, #chat-widget-input-desktop {
  resize: none;
  overflow-y: auto;
}

.chat-widget-typing-indicator {
  display: flex;
  gap: 0.3em;
  align-items: center;
  justify-content: center;
  height: 1em;
}

.chat-widget-typing-indicator span {
  width: 0.6em;
  height: 0.6em;
  background: #999;
  border-radius: 50%;
  display: inline-block;
  animation: chat-widget-bounce 1.4s infinite ease-in-out both;
}

.chat-widget-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.chat-widget-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.chat-widget-typing-indicator span:nth-child(3) { animation-delay: 0s; }

@keyframes chat-widget-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
  40% { transform: scale(1.4); opacity: 1; }
}

.chat-date-divider {
  display: flex;
  align-items: center;
  text-align: center;
  font-size: x-small;
  color: #999;
  width: calc(100% - 8rem);
  margin: 1rem 4rem;
}

.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  flex: 1;
  border-top: 1px dotted #ccc;
}

.chat-date-divider:not(:empty)::before {
  margin-right: 0.75em;
}

.chat-date-divider:not(:empty)::after {
  margin-left: 0.75em;
}

#chat-widget {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-right: 1rem;
}

.chat-widget-desktop {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

#chat-widget-body,
#chat-widget-body-desktop {
  overflow-y: auto;
  flex-grow: 1;
}