.chat-preview {
  background: hsl(200, 20%, 8%);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-xl), var(--shadow-inset-top);
  overflow: hidden;
  width: 100%;
  max-width: 360px;
  font-family: "DM Sans", system-ui, sans-serif;
}

.chat-preview__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: hsl(200, 20%, 10%);
  border-bottom: 1px solid var(--border-subtle);
}

.chat-preview__avatar {
  width: 36px;
  height: 36px;
  background: var(--gradient-brand);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-preview__avatar img {
  width: 20px;
  height: 20px;
  filter: brightness(10);
  object-fit: contain;
}

.chat-preview__name {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.chat-preview__status {
  font-size: var(--font-xs);
  color: var(--color-success);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.chat-preview__status::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--color-success);
  border-radius: var(--radius-full);
}

.chat-preview__body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 280px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms var(--ease-out-expo), transform 300ms var(--ease-out-expo);
}

.chat-msg.visible {
  opacity: 1;
  transform: translateY(0);
}

.chat-msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg--bot {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-msg__bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: 16px;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.chat-msg--user .chat-msg__bubble {
  background: var(--brand-600);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg--bot .chat-msg__bubble {
  background: hsl(200, 18%, 16%);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.chat-msg__time {
  font-size: 0.6875rem;
  color: var(--text-disabled);
  margin-top: var(--space-1);
  padding: 0 var(--space-1);
}

.chat-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: var(--space-3) var(--space-4);
  background: hsl(200, 18%, 16%);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-subtle);
  opacity: 0;
  transition: opacity 200ms;
}

.chat-typing.visible {
  opacity: 1;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: var(--radius-full);
  animation: typingDot 1.4s ease-in-out infinite;
}

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

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

@keyframes typingDot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }

  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}
