/* =============================================
   Chatbot Demo — Dental AI Chat Interface
   ============================================= */

.chat-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5rem 1rem 2rem;
  position: relative;
}

.chat-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 80% 30%, rgba(245, 158, 11, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 20% 70%, rgba(99, 102, 241, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ---- HEADER ---- */
.chat-header {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-bottom: 2rem;
}

.chat-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.375rem 0.875rem;
  margin-bottom: 1rem;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-header h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.chat-header p {
  font-size: 0.9375rem;
  color: var(--fg-muted);
  font-weight: 300;
  max-width: 480px;
  margin: 0 auto;
}

/* ---- CHAT PLATFORM ---- */
.chat-platform {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.08), 0 32px 64px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  height: 70vh;
  max-height: 640px;
}

.chat-platform-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.platform-dots {
  display: flex;
  gap: 5px;
}

.platform-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.platform-dots span:first-child { background: #ff5f57; }
.platform-dots span:nth-child(2) { background: #febc2e; }
.platform-dots span:nth-child(3) { background: #28c840; }

.platform-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-weight: 500;
}

/* ---- MESSAGE FEED ---- */
.conv-feed {
  flex: 1;
  overflow-y: auto;
  padding: 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  scroll-behavior: smooth;
}

.conv-feed::-webkit-scrollbar {
  width: 4px;
}

.conv-feed::-webkit-scrollbar-track {
  background: transparent;
}

.conv-feed::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
}

.conv-msg {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: msg-in 0.35s ease-out both;
}

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

.msg-patient {
  align-items: flex-end;
}

.msg-patient .msg-text {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 12px 12px 4px 12px;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  max-width: 80%;
  line-height: 1.5;
}

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

.msg-bot .msg-text {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.15);
  color: var(--fg);
  border-radius: 12px 12px 12px 4px;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  max-width: 80%;
  line-height: 1.5;
  white-space: pre-wrap;
}

.msg-agent-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.agent-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-family: 'Sora', sans-serif;
  font-size: 0.5625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.agent-name {
  font-size: 0.6875rem;
  color: var(--accent);
  font-weight: 600;
}

.msg-time {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.25);
}

/* ---- TYPING INDICATOR ---- */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.625rem 0.875rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 12px 12px 12px 4px;
  width: fit-content;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.5);
  animation: typing-bounce 1.2s ease-in-out infinite;
}

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

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ---- BOOKED PILL ---- */
.msg-booked {
  padding-top: 0.125rem;
}

.booked-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--green-dim);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 100px;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  color: var(--green);
  font-weight: 500;
}

/* ---- INPUT BAR ---- */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.125rem;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}

.chat-input-bar input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.625rem 1rem;
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-bar input::placeholder {
  color: var(--fg-muted);
}

.chat-input-bar input:focus {
  border-color: rgba(245, 158, 11, 0.4);
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.15s;
}

.send-btn:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.95);
}

.send-btn svg {
  width: 16px;
  height: 16px;
  color: var(--bg);
}

/* ---- ACTION CHECKLIST ---- */
.action-checklist {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.125rem;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.01);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.action-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.3125rem 0.625rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-muted);
  transition: all 0.3s ease;
}

.action-chip svg {
  flex-shrink: 0;
}

.action-chip.action-done {
  color: var(--green);
  border-color: rgba(16, 185, 129, 0.25);
  background: var(--green-dim);
}

.action-chip.action-active {
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.3);
  background: var(--accent-dim);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 580px) {
  .chat-platform {
    max-width: 100%;
    border-radius: 12px;
    height: 80vh;
  }

  .chat-page {
    padding-top: 4rem;
  }
}
