/* src/components/ChatInterface/ChatInterface.css */

/* ── Chat Interface ──────────────────────────────────────────────────────── */
.chat-interface {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: transparent;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  position: relative;
}

/* ── Messages wrapper (collapsible) ─────────────────────────────────────── */
.chat-messages-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease;
  opacity: 1;
}

.chat-messages-collapsed {
  max-height: 0 !important;
  opacity: 0;
  pointer-events: none;
}

/* ── Messages area ───────────────────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto !important;
  overflow-anchor: auto;
  padding: 1rem 1rem 1.25rem;
  scroll-padding-bottom: 1.25rem;
  display: block;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.2) transparent;
  background: var(--bg-main); /* Conversation area is pink */
}

.chat-messages::-webkit-scrollbar {
  width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.25);
  border-radius: 10px;
}

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.empty-state p::before {
  content: '✨ ';
}

/* ── Transcript ──────────────────────────────────────────────────────────── */
.transcript {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  overflow-x: hidden;
}

.message {
  display: flex;
  margin-bottom: 0.8rem;
  width: 100%;
  max-width: 100%;
  gap: 0.75rem;
  animation: messageAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@keyframes messageAppear {
  from { opacity: 0; transform: translateY(15px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.message-user {
  justify-content: flex-end;
}

.message-avatar {
  min-width: 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-pimsy {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
  padding: 0;
  overflow: hidden;
  width: 36px;
  height: 36px;
  min-width: 36px;
}

.pimsy-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-user {
  background: #475569;
  color: white;
  width: 32px;
  height: 32px;
  min-width: 32px;
}

.msg-avatar-svg {
  width: 18px;
  height: 18px;
}

.message-content {
  max-width: 80%;
  border-radius: 20px;
  word-wrap: break-word;
}

.message-user .message-content {
  background: #475569; /* Softer Slate Gray to match image */
  color: white;
  border-radius: 18px 18px 4px 18px;
  padding: 10px 16px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
  font-weight: 500;
}

.message-assistant .message-content,
.message-pimsy .message-content {
  color: #1e293b;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 0;
  gap: 8px;
}

.message-content p {
  margin: 0;
  width: 100%;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ── Individual Pimsy chat bubbles (Simple Style) ───────────────────────── */
.pimsy-bubble {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px 18px 18px 4px;
  padding: 12px 16px;
  margin: 0;
  width: auto !important;
  max-width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  color: var(--text-main);
}

.pimsy-bubble:first-child {
  border-radius: 18px 18px 18px 4px;
}

@media (max-width: 640px) {
  .pimsy-bubble {
    font-size: 15px;
    padding: 8px 12px;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

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

/* ── Thinking dots ───────────────────────────────────────────────────────── */
.thinking-bubble .message-content {
  padding: 8px 12px;
  display: flex;
  gap: 4px;
  justify-content: center;
}

.thinking-dot {
  width: 5px;
  height: 5px;
  background: #94a3b8;
  border-radius: 50%;
  animation: thinking 1.4s ease-in-out infinite;
}

.thinking-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot-bounce {

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

  40% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* ── Typing cursor ───────────────────────────────────────────────────────── */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: currentColor;
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .chat-interface {
    padding-bottom: 0; 
  }

  .chat-messages {
    /* Let the parent .app-chat control the height */
  }

  .message-content {
    max-width: 85%;
    min-width: 0;
  }

  .message {
    margin-bottom: 0.35rem;
  }

  .prompts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .prompt-button {
    padding: 0.6rem 0.5rem;
    border-radius: 12px;
  }

  .prompt-icon {
    font-size: 1.2rem;
  }

  .prompt-text {
    font-size: 0.72rem;
  }

  .message-content p {
    font-size: 17px;
    line-height: 21px;
  }

  .message-avatar {
    min-width: 32px;
    width: 32px;
    height: 32px;
  }

  .icon-tooltip {
    left: auto;
    right: -10px;
    transform: translateX(0) translateY(4px);
  }

  .icon-btn-wrapper:hover .icon-tooltip {
    transform: translateX(0) translateY(0);
  }

  .icon-tooltip::after {
    left: auto;
    right: 25px;
  }
}
