/* ============================
   AI Chat Widget — AutomateHQ Demo
   Matches landing page design tokens
   ============================ */

:root {
  --chat-bg: #0F0F12;
  --chat-bg-2: #16161B;
  --chat-bg-3: #1E1E25;
  --chat-fg: #F2F2F4;
  --chat-fg-muted: #8E8E9A;
  --chat-accent: #FF6B2B;
  --chat-accent-2: #FF9A6B;
  --chat-accent-glow: rgba(255, 107, 43, 0.15);
  --chat-border: rgba(255, 255, 255, 0.06);
  --chat-radius: 16px;
  --chat-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

/* ============================
   DEMO PAGE WRAPPER
   ============================ */
.demo-page {
  min-height: 100vh;
  background: var(--chat-bg);
  display: flex;
  flex-direction: column;
}

/* ============================
   DEMO HEADER
   ============================ */
.demo-header {
  padding: 28px 40px;
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.demo-header-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--chat-fg);
}

.demo-badge {
  background: var(--chat-accent-glow);
  border: 1px solid var(--chat-accent);
  color: var(--chat-accent-2);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

/* ============================
   DEMO LAYOUT (sidebar + chat)
   ============================ */
.demo-layout {
  flex: 1;
  display: flex;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 0 40px;
  gap: 40px;
}

/* ============================
   DEMO SIDEBAR (info panel)
   ============================ */
.demo-sidebar {
  width: 280px;
  flex-shrink: 0;
  padding: 60px 0;
}

.demo-sidebar h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--chat-fg);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.demo-sidebar p {
  font-size: 14px;
  color: var(--chat-fg-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.demo-stats {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.demo-stat {
  background: var(--chat-bg-2);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  padding: 16px 20px;
}

.demo-stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--chat-accent);
  letter-spacing: -0.03em;
}

.demo-stat-label {
  font-size: 12px;
  color: var(--chat-fg-muted);
  margin-top: 2px;
}

/* ============================
   CHAT CONTAINER
   ============================ */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 40px 0;
  min-height: 0;
}

.chat-window {
  background: var(--chat-bg-2);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius);
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  height: 560px;
  overflow: hidden;
}

/* ============================
   CHAT HEADER
   ============================ */
.chat-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-accent), #FF9A6B);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.chat-header-info {
  flex: 1;
}

.chat-header-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--chat-fg);
}

.chat-header-status {
  font-size: 12px;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.chat-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
}

/* ============================
   CHAT MESSAGES
   ============================ */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--chat-bg-3);
  border-radius: 3px;
}

.chat-message {
  display: flex;
  gap: 10px;
  animation: msgIn 0.25s ease-out;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
}

.chat-message.bot .chat-msg-avatar {
  background: linear-gradient(135deg, var(--chat-accent), #FF9A6B);
  color: white;
}

.chat-message.user .chat-msg-avatar {
  background: var(--chat-bg-3);
  color: var(--chat-fg-muted);
}

.chat-bubble-wrap {
  max-width: 75%;
}

.chat-message.user .chat-bubble-wrap {
  align-items: flex-end;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--chat-fg);
}

.chat-message.bot .chat-bubble {
  background: var(--chat-bg-3);
  border: 1px solid var(--chat-border);
  border-bottom-left-radius: 4px;
}

.chat-message.user .chat-bubble {
  background: var(--chat-accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-timestamp {
  font-size: 11px;
  color: var(--chat-fg-muted);
  margin-top: 4px;
  padding: 0 4px;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.chat-typing .chat-msg-avatar {
  background: linear-gradient(135deg, var(--chat-accent), #FF9A6B);
  color: white;
}

.typing-dots {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  background: var(--chat-bg-3);
  border: 1px solid var(--chat-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--chat-fg-muted);
  border-radius: 50%;
  animation: dotPulse 1.4s infinite;
}

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

@keyframes dotPulse {
  0%, 60%, 100% { transform: scale(1); opacity: 0.4; }
  30% { transform: scale(1.3); opacity: 1; }
}

/* ============================
   CHAT INPUT AREA
   ============================ */
.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--chat-border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--chat-bg-3);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  padding: 12px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--chat-fg);
  resize: none;
  min-height: 46px;
  max-height: 100px;
  outline: none;
  transition: border-color 0.2s;
}

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

.chat-input:focus {
  border-color: var(--chat-accent);
}

.chat-send-btn {
  width: 46px;
  height: 46px;
  background: var(--chat-accent);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #ff7d3a;
  transform: scale(1.04);
}

.chat-send-btn:disabled {
  background: var(--chat-bg-3);
  cursor: not-allowed;
  transform: none;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: white;
}

/* ============================
   COMPLETION STATE
   ============================ */
.chat-complete {
  padding: 32px 24px;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.chat-complete-icon {
  width: 64px;
  height: 64px;
  background: var(--chat-accent-glow);
  border: 2px solid var(--chat-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.chat-complete h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--chat-fg);
}

.chat-complete p {
  font-size: 14px;
  color: var(--chat-fg-muted);
  max-width: 300px;
}

.book-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--chat-accent);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 14px 28px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  margin-top: 8px;
  transition: background 0.2s, transform 0.1s;
}

.book-cta-btn:hover {
  background: #ff7d3a;
  transform: translateY(-1px);
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 768px) {
  .demo-layout {
    flex-direction: column;
    padding: 0 20px;
  }

  .demo-sidebar {
    width: 100%;
    padding: 32px 0 0;
  }

  .demo-sidebar h2 { font-size: 18px; }
  .demo-stats { flex-direction: row; flex-wrap: wrap; }
  .demo-stat { flex: 1; min-width: 140px; }
  .demo-stat-value { font-size: 22px; }

  .chat-container {
    padding: 20px 0 40px;
  }

  .chat-window {
    height: 480px;
  }

  .demo-header {
    padding: 20px;
  }
}

/* ============================
   LEAD FORM (inline in chat completion)
   ============================ */
.lead-form-inline {
  background: var(--chat-bg-3);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  padding: 24px;
  margin-top: 8px;
  width: 100%;
  max-width: 360px;
}

.lead-form-inline h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--chat-fg);
  margin-bottom: 16px;
}

.lead-form-inline .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.lead-form-inline input {
  width: 100%;
  background: var(--chat-bg-2);
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--chat-fg);
  outline: none;
  transition: border-color 0.2s;
}

.lead-form-inline input::placeholder {
  color: var(--chat-fg-muted);
}

.lead-form-inline input:focus {
  border-color: var(--chat-accent);
}

.lead-form-inline button {
  width: 100%;
  background: var(--chat-accent);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}

.lead-form-inline button:hover {
  background: #ff7d3a;
}

.lead-form-success {
  text-align: center;
  padding: 24px 0;
}

.lead-form-success .check-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.lead-form-success h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--chat-fg);
}

.lead-form-success p {
  font-size: 13px;
  color: var(--chat-fg-muted);
  margin-top: 6px;
}