/* Demo page — chatbot widget preview and embed section */

.demo-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 64px 24px 96px;
}

.demo-header {
  text-align: center;
  margin-bottom: 56px;
}

.demo-header h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 800;
  letter-spacing: -1.2px;
  line-height: 1.1;
  color: var(--fg);
  margin-bottom: 16px;
}

.demo-header h1 em {
  font-style: normal;
  color: var(--accent);
}

.demo-sub {
  font-size: 16px;
  color: var(--fg-muted);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Widget preview container */
.widget-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 64px;
}

/* The floating widget shell */
.widget-shell {
  width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(240,78,26,0.08) inset;
  display: flex;
  flex-direction: column;
  height: 520px;
}

.widget-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
}

.wt-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wt-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wt-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--fg);
}

.wt-status {
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.status-dot-green {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #28CA41;
  box-shadow: 0 0 5px #28CA41;
}

.wt-badge {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 8px;
  border-radius: 100px;
}

/* Message area */
.widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.msg {
  display: flex;
  flex-direction: column;
}

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

.msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  font-family: var(--font-body);
}

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

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

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-muted);
  animation: typing-bounce 1.4s 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); }
  30% { transform: translateY(-4px); }
}

/* Lead capture form */
.widget-lead-form {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-3);
}

.lf-title {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 12px;
  font-family: var(--font-display);
}

.lf-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.widget-lead-form input,
.widget-lead-form select,
.widget-lead-form textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
}

.widget-lead-form input:focus,
.widget-lead-form select:focus,
.widget-lead-form textarea:focus {
  border-color: var(--accent);
}

.widget-lead-form textarea {
  resize: none;
  height: 56px;
  margin-bottom: 8px;
}

.lf-btn {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.lf-btn:hover { opacity: 0.88; }

/* Input bar */
.widget-input {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-3);
}

.widget-input input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 16px;
  outline: none;
}

.widget-input input:focus { border-color: rgba(240,78,26,0.4); }

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

#sendBtn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s;
  flex-shrink: 0;
}

#sendBtn:hover { transform: scale(1.08); }

/* Embed section */
.embed-section {
  text-align: center;
  padding: 48px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.embed-section h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 12px;
}

.embed-section > p {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

.embed-section pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  margin-bottom: 16px;
  overflow-x: auto;
}

.embed-section code {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--fg-muted);
}

.copy-btn {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 8px 20px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.copy-btn:hover { background: rgba(240,78,26,0.2); }

@media (max-width: 480px) {
  .widget-shell { width: 100%; }
  .embed-section { padding: 24px; }
}