/* ═══════════════════════════════════════════
   APEX SYSTEMATIC — Chatbot Demo
   demos.apexsystematic.com/chatbot/
   ═══════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --bg:            #0E1117;
  --surface:       #131820;
  --surface-2:     #182030;
  --border:        #1E2838;
  --border-light:  #263040;

  --text:          #D8DCE4;
  --text-muted:    #7A8299;
  --text-dim:      #4F5B6E;
  --white:         #FFFFFF;

  --gold:          #C9A84C;
  --gold-light:    #DDB95A;

  --font-display:  'Playfair Display', Georgia, serif;
  --font-body:     'DM Sans', 'Helvetica Neue', sans-serif;

  --radius:        2px;
  --ease:          0.2s ease;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, textarea { font-family: inherit; font-size: inherit; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 13px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
}

.btn-primary:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
}

.btn-ghost {
  background: transparent;
  color: var(--white);
  border-color: var(--border-light);
}

.btn-ghost:hover {
  border-color: var(--text-muted);
}

/* ── Header ── */
.demo-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.demo-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.demo-header-logo svg {
  display: block;
}

/* ── Main ── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Hero ── */
.demo-hero {
  padding: 72px 28px 48px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.demo-hero-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 20px;
}

.demo-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  color: var(--white);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  animation: fadeInUp 0.6s ease 0.1s both;
}

.demo-hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.75;
  animation: fadeInUp 0.6s ease 0.22s both;
}

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

/* ── Demo Section ── */
.demo-section {
  flex: 1;
  padding: 48px 28px 72px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ── Industry Selector ── */
.industry-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
  animation: fadeInUp 0.6s ease 0.32s both;
}

.industry-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  padding: 10px 22px;
  border-radius: var(--radius);
  transition: all var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.industry-btn:hover {
  border-color: var(--text-muted);
  color: var(--white);
}

.industry-btn.active {
  background: rgba(201, 168, 76, 0.1);
  border-color: var(--gold);
  color: var(--gold);
}

.industry-descriptor {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  letter-spacing: 0.03em;
  margin-bottom: 32px;
  min-height: 20px;
  transition: opacity 0.25s ease;
  animation: fadeInUp 0.6s ease 0.4s both;
}

/* ── Chat Window ── */
.chat-wrap {
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 560px;
  background: var(--surface);
  position: relative;
  animation: fadeInUp 0.6s ease 0.48s both;
}

/* Gold top line */
.chat-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ── Chat Header ── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 34px;
  height: 34px;
  background: rgba(201, 168, 76, 0.15);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-avatar svg {
  width: 16px;
  height: 16px;
  color: var(--gold);
}

.chat-header-info strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--white);
  line-height: 1.2;
}

.chat-header-info span {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.chat-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2ECC71;
  box-shadow: 0 0 6px #2ECC71;
  animation: pulse 2s infinite;
  margin-left: auto;
  flex-shrink: 0;
}

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

.chat-clear-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: all var(--ease);
}

.chat-clear-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-muted);
}

/* ── Messages ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

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

.chat-msg {
  display: flex;
  gap: 10px;
  animation: msgIn 0.22s ease forwards;
  opacity: 0;
}

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

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

.chat-bubble {
  max-width: 82%;
  padding: 11px 15px;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text);
  border-radius: var(--radius);
}

.chat-msg.bot .chat-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.chat-msg.user .chat-bubble {
  background: #1B2540;
  border: 1px solid rgba(201, 168, 76, 0.15);
  color: var(--white);
}

/* Book a call CTA in chat */
.chat-booking-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 18px;
  background: var(--gold);
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: background var(--ease);
  text-decoration: none;
}

.chat-booking-cta:hover {
  background: var(--gold-light);
}

.chat-booking-cta svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 4px;
  padding: 13px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
  animation: msgIn 0.22s ease forwards;
  opacity: 0;
}

.chat-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: bounce 1.2s infinite;
}

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

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

/* ── Input Area ── */
.chat-input-area {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
  background: var(--surface);
}

.chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--white);
  padding: 10px 14px;
  border-radius: var(--radius);
  resize: none;
  outline: none;
  font-size: 0.875rem;
  line-height: 1.5;
  min-height: 42px;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color var(--ease);
}

.chat-input::placeholder { color: var(--text-dim); }
.chat-input:focus { border-color: rgba(201, 168, 76, 0.4); }

.chat-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-char-count {
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  align-self: center;
  flex-shrink: 0;
  min-width: 36px;
  text-align: right;
  transition: color var(--ease);
}

.chat-char-count.warn { color: var(--gold); }

.chat-send-btn {
  width: 42px;
  height: 42px;
  background: var(--gold);
  border: none;
  border-radius: var(--radius);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--ease), opacity var(--ease);
}

.chat-send-btn:hover:not(:disabled) { background: var(--gold-light); }
.chat-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.chat-send-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Footer ── */
.demo-footer {
  border-top: 1px solid var(--border);
  padding: 24px 28px;
  text-align: center;
}

.demo-footer p {
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.demo-footer a {
  color: var(--gold);
  transition: color var(--ease);
}

.demo-footer a:hover { color: var(--white); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .demo-hero {
    padding: 48px 20px 36px;
  }

  .demo-section {
    padding: 36px 16px 56px;
  }

  .industry-btn {
    font-size: 0.72rem;
    padding: 9px 16px;
  }

  .chat-wrap {
    height: calc(100dvh - 340px);
    min-height: 400px;
  }

  .chat-bubble {
    max-width: 92%;
  }

  .demo-header-inner {
    padding: 0 16px;
  }
}
