/* -----------------------------------------------------------------
   Lead Stampede Demo Assistant — Stylesheet
   Editorial-dark meets terminal-tool. Shared palette with viewer pages.
   ----------------------------------------------------------------- */

:root {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --bg-elevated-2: #1a1a1a;
  --bg-elevated-3: #1f1f1f;
  --border: #2a2a2a;
  --border-strong: #383838;
  --text: #f5f5f5;
  --text-muted: #9a9a9a;
  --text-dim: #6a6a6a;
  --accent: #d4af37;
  --accent-hover: #e4bf47;
  --accent-dim: #8a7425;
  --success: #4ade80;
  --danger: #ff6b6b;
  --info: #60a5fa;
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.hidden { display: none !important; }

/* -----------------------------------------------------------------
   Intro overlay
   ----------------------------------------------------------------- */

.intro {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 48px 24px;
  transition: opacity 700ms ease;
}

.intro.fading {
  opacity: 0;
  pointer-events: none;
}

.intro-content {
  max-width: 720px;
  text-align: center;
}

.intro-line {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.01em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 900ms ease, transform 900ms ease;
  margin-bottom: 28px;
}

.intro-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.intro-line[data-step="1"] {
  color: var(--text-muted);
  font-style: italic;
}

.intro-line[data-step="3"] #intro-client-name {
  color: var(--accent);
  font-weight: 500;
}

.skip-intro {
  position: absolute;
  bottom: 32px;
  right: 32px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

.skip-intro:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 640px) {
  .intro-line { font-size: 22px; margin-bottom: 20px; }
  .skip-intro { bottom: 20px; right: 20px; }
}

/* -----------------------------------------------------------------
   App shell
   ----------------------------------------------------------------- */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  gap: 20px;
  flex-wrap: wrap;
}

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
  animation: pulse 2s ease-in-out infinite;
}

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

.client-name {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-top: 4px;
}

.persona-tag {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

.stack-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.stack-label { opacity: 0.7; }
.stack-name { color: var(--text-muted); font-weight: 500; }
.stack-divider { color: var(--text-dim); }

/* -----------------------------------------------------------------
   Workspace layout
   ----------------------------------------------------------------- */

.workspace {
  display: grid;
  grid-template-columns: 1fr 420px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
}

/* -----------------------------------------------------------------
   Chat pane
   ----------------------------------------------------------------- */

.chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 28px 20px;
  scroll-behavior: smooth;
}

.message {
  max-width: 760px;
  margin: 0 auto 28px;
  display: flex;
  gap: 14px;
  animation: slide-in 400ms ease both;
}

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

.message-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.message.assistant .message-avatar {
  background: linear-gradient(135deg, #d4af37, #a0782a);
  color: #0a0a0a;
  border-color: transparent;
}

.message.user .message-avatar {
  background: var(--bg-elevated-2);
  color: var(--text-muted);
}

.message-content {
  flex: 1;
  min-width: 0;
  line-height: 1.65;
}

.message-role {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.message-body {
  color: var(--text);
  font-size: 15px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-body p { margin-bottom: 12px; }
.message-body p:last-child { margin-bottom: 0; }
.message-body strong { color: var(--text); font-weight: 600; }
.message-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-elevated-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent);
}

.message-body ul {
  margin: 8px 0;
  padding-left: 20px;
}
.message-body li { margin-bottom: 6px; }

/* Markdown elements rendered inside .message-body */
.message-body .md-h {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  margin: 16px 0 6px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.message-body .md-h:first-child { margin-top: 0; }
.message-body .md-ul {
  list-style: none;
  padding-left: 0;
  margin: 8px 0 12px;
}
.message-body .md-ul li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 4px;
}
.message-body .md-ul li::before {
  content: "·";
  position: absolute;
  left: 6px;
  color: var(--accent);
  font-weight: 600;
}
.message-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* Assistant "thinking" indicator */
.message.thinking .message-body {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: var(--text-dim);
  font-size: 13px;
}

.thinking-dot {
  width: 6px;
  height: 6px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: dot-bounce 1.4s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.thinking-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* -----------------------------------------------------------------
   Suggestion buttons
   ----------------------------------------------------------------- */

.suggestions {
  padding: 8px 28px 0;
  max-width: calc(760px + 56px);
  margin: 0 auto;
  width: 100%;
}

.suggestions.hidden { display: none; }

.suggestions-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.suggestion-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.suggestion-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 150ms ease;
}

.suggestion-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--bg-elevated-2);
}

/* -----------------------------------------------------------------
   Composer
   ----------------------------------------------------------------- */

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 16px 28px 24px;
  max-width: calc(760px + 56px);
  margin: 0 auto;
  width: 100%;
}

.composer-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 14px 16px;
  border-radius: 12px;
  resize: none;
  max-height: 180px;
  line-height: 1.5;
  outline: none;
  transition: border-color 150ms ease;
}

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

.composer-input::placeholder {
  color: var(--text-dim);
}

.composer-send {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease, transform 150ms ease;
}

.composer-send:hover { background: var(--accent-hover); }
.composer-send:disabled { opacity: 0.5; cursor: not-allowed; }
.composer-send:active { transform: scale(0.96); }

/* -----------------------------------------------------------------
   Tool-call panel
   ----------------------------------------------------------------- */

.tools-pane {
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 960px) {
  .tools-pane {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 40vh;
  }
}

.tools-header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.tools-title {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.tools-subtitle {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}

.tool-calls {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.tools-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: var(--text-dim);
  padding: 40px 20px;
}

.tools-empty-icon {
  font-size: 40px;
  color: var(--border-strong);
  line-height: 1;
}

.tools-empty-text {
  font-size: 13px;
  max-width: 240px;
  line-height: 1.5;
}

.tool-call {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  animation: slide-in 350ms ease both;
}

.tool-call-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.tool-call-name {
  color: var(--accent);
  font-weight: 500;
}

.tool-call-status {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--info);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-call-status.done { color: var(--success); }
.tool-call-status.error { color: var(--danger); }

.tool-call-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}

.tool-call-status.done::before,
.tool-call-status.error::before { animation: none; }

.tool-call-args {
  color: var(--text-dim);
  font-size: 11px;
  margin-bottom: 6px;
  word-break: break-word;
}

.tool-call-args strong { color: var(--text-muted); font-weight: 500; }

.tool-call-result {
  background: var(--bg-elevated-3);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.tool-call-result-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.tools-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.mcp-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mcp-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-dim);
}

.mcp-endpoint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.3;
}

/* -----------------------------------------------------------------
   Footer
   ----------------------------------------------------------------- */

.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.app-footer a { color: var(--text-muted); }

/* -----------------------------------------------------------------
   No-client fallback
   ----------------------------------------------------------------- */

.no-client {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 24px;
}

.no-client-content {
  max-width: 520px;
  text-align: center;
}

.no-client h1 {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 500;
  margin-bottom: 16px;
}

.no-client p {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 28px;
}

.no-client code {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--bg-elevated);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
}

.no-client-examples {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.no-client-examples a {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  width: 100%;
  max-width: 360px;
  text-align: left;
  font-size: 14px;
  transition: border-color 150ms ease;
}

.no-client-examples a:hover {
  border-color: var(--accent);
  text-decoration: none;
}
