/*
 * Web Agents API Demo - Design System
 * A clean, modern design inspired by open web aesthetics
 */

/* ============================================
   FONTS
   ============================================ */
/* 
 * To use these fonts, add to your HTML <head>:
 * <link rel="preconnect" href="https://fonts.googleapis.com">
 * <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 * <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
 */

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */
:root {
  /* ---- Color Palette ---- */
  /* Background layers (darkest to lighter) */
  --demo-bg-base: #15141a;
  --demo-bg-subtle: #1c1b22;
  --demo-bg-elevated: #23222b;
  --demo-bg-surface: #2b2a33;
  --demo-bg-overlay: #32313c;
  
  /* Text colors */
  --demo-text-primary: #fbfbfe;
  --demo-text-secondary: #b1b1b3;
  --demo-text-muted: #7c7c7e;
  --demo-text-faint: #52525e;
  
  /* Border colors */
  --demo-border-subtle: rgba(255, 255, 255, 0.06);
  --demo-border-default: rgba(255, 255, 255, 0.10);
  --demo-border-strong: rgba(255, 255, 255, 0.18);
  
  /* Accent colors - Firefox orange gradient */
  --demo-accent-primary: #ff9400;
  --demo-accent-secondary: #ff7139;
  --demo-accent-tertiary: #e64040;
  --demo-accent-glow: rgba(255, 148, 0, 0.15);
  
  /* Semantic colors */
  --demo-success: #30e60b;
  --demo-success-dim: rgba(48, 230, 11, 0.12);
  --demo-warning: #ffbd4f;
  --demo-warning-dim: rgba(255, 189, 79, 0.12);
  --demo-error: #ff6b6b;
  --demo-error-dim: rgba(255, 107, 107, 0.12);
  --demo-info: #00ddff;
  --demo-info-dim: rgba(0, 221, 255, 0.12);
  
  /* ---- Typography ---- */
  --demo-font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --demo-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
  
  --demo-text-xs: 0.75rem;    /* 12px */
  --demo-text-sm: 0.875rem;   /* 14px */
  --demo-text-base: 1rem;     /* 16px */
  --demo-text-lg: 1.125rem;   /* 18px */
  --demo-text-xl: 1.25rem;    /* 20px */
  --demo-text-2xl: 1.5rem;    /* 24px */
  --demo-text-3xl: 2rem;      /* 32px */
  --demo-text-4xl: 2.5rem;    /* 40px */
  
  --demo-weight-normal: 400;
  --demo-weight-medium: 500;
  --demo-weight-semibold: 600;
  --demo-weight-bold: 700;
  
  --demo-leading-tight: 1.2;
  --demo-leading-normal: 1.5;
  --demo-leading-relaxed: 1.7;
  
  /* ---- Spacing ---- */
  --demo-space-1: 0.25rem;    /* 4px */
  --demo-space-2: 0.5rem;     /* 8px */
  --demo-space-3: 0.75rem;    /* 12px */
  --demo-space-4: 1rem;       /* 16px */
  --demo-space-5: 1.25rem;    /* 20px */
  --demo-space-6: 1.5rem;     /* 24px */
  --demo-space-8: 2rem;       /* 32px */
  --demo-space-10: 2.5rem;    /* 40px */
  --demo-space-12: 3rem;      /* 48px */
  --demo-space-16: 4rem;      /* 64px */
  
  /* ---- Border Radius ---- */
  --demo-radius-sm: 4px;
  --demo-radius-md: 8px;
  --demo-radius-lg: 12px;
  --demo-radius-xl: 16px;
  --demo-radius-2xl: 24px;
  --demo-radius-full: 9999px;
  
  /* ---- Shadows ---- */
  --demo-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --demo-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --demo-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
  --demo-shadow-glow: 0 0 30px var(--demo-accent-glow);
  
  /* ---- Transitions ---- */
  --demo-transition-fast: 150ms ease;
  --demo-transition-normal: 200ms ease;
  --demo-transition-slow: 300ms ease;
}

/* Light theme overrides */
[data-theme="light"] {
  --demo-bg-base: #ffffff;
  --demo-bg-subtle: #f9f9fb;
  --demo-bg-elevated: #f0f0f4;
  --demo-bg-surface: #ffffff;
  --demo-bg-overlay: #e0e0e6;
  
  --demo-text-primary: #15141a;
  --demo-text-secondary: #5b5b66;
  --demo-text-muted: #8f8f9d;
  --demo-text-faint: #c0c0c7;
  
  --demo-border-subtle: rgba(0, 0, 0, 0.05);
  --demo-border-default: rgba(0, 0, 0, 0.10);
  --demo-border-strong: rgba(0, 0, 0, 0.15);
  
  --demo-accent-primary: #e66000;
  --demo-accent-secondary: #d45a00;
  
  --demo-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --demo-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
  --demo-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--demo-font-sans);
  font-size: var(--demo-text-base);
  line-height: var(--demo-leading-normal);
  color: var(--demo-text-primary);
  background: var(--demo-bg-base);
}

/* ============================================
   BACKGROUND PATTERNS
   ============================================ */
/* Subtle dot pattern */
.demo-bg-grid::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: -1;
}

/* Gradient glow effect */
.demo-bg-glow::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(255, 148, 0, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(255, 113, 57, 0.05), transparent);
  pointer-events: none;
  z-index: -1;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--demo-weight-bold);
  line-height: var(--demo-leading-tight);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--demo-text-3xl); }
h2 { font-size: var(--demo-text-2xl); }
h3 { font-size: var(--demo-text-xl); }
h4 { font-size: var(--demo-text-lg); }

p {
  color: var(--demo-text-secondary);
}

a {
  color: var(--demo-accent-primary);
  text-decoration: none;
  transition: color var(--demo-transition-fast);
}

a:hover {
  color: var(--demo-accent-secondary);
}

code {
  font-family: var(--demo-font-mono);
  font-size: 0.9em;
  background: var(--demo-bg-elevated);
  padding: 0.15em 0.4em;
  border-radius: var(--demo-radius-sm);
}

/* Gradient text effect */
.demo-text-gradient {
  background: linear-gradient(90deg, var(--demo-accent-primary), var(--demo-accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   LAYOUT COMPONENTS
   ============================================ */
.demo-container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--demo-space-6);
}

.demo-container-wide {
  max-width: 1000px;
}

.demo-container-narrow {
  max-width: 560px;
}

/* ============================================
   CARDS
   ============================================ */
.demo-card {
  background: var(--demo-bg-surface);
  border: 1px solid var(--demo-border-default);
  border-radius: var(--demo-radius-lg);
  padding: var(--demo-space-6);
  transition: all var(--demo-transition-normal);
}

.demo-card:hover {
  border-color: var(--demo-border-strong);
}

.demo-card-interactive:hover {
  border-color: var(--demo-accent-primary);
  box-shadow: 0 0 0 1px var(--demo-accent-primary), var(--demo-shadow-glow);
  transform: translateY(-2px);
}

.demo-card-header {
  display: flex;
  align-items: center;
  gap: var(--demo-space-3);
  margin-bottom: var(--demo-space-4);
  padding-bottom: var(--demo-space-4);
  border-bottom: 1px solid var(--demo-border-subtle);
}

.demo-card-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--demo-accent-primary), var(--demo-accent-secondary));
  border-radius: var(--demo-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.demo-card-title {
  font-size: var(--demo-text-lg);
  font-weight: var(--demo-weight-semibold);
  color: var(--demo-text-primary);
}

/* ============================================
   BUTTONS
   ============================================ */
.demo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--demo-space-2);
  padding: var(--demo-space-3) var(--demo-space-5);
  border: none;
  border-radius: var(--demo-radius-md);
  font-family: var(--demo-font-sans);
  font-size: var(--demo-text-sm);
  font-weight: var(--demo-weight-semibold);
  cursor: pointer;
  transition: all var(--demo-transition-fast);
}

.demo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.demo-btn-primary {
  background: linear-gradient(90deg, var(--demo-accent-primary), var(--demo-accent-secondary));
  color: white;
  box-shadow: var(--demo-shadow-sm);
}

.demo-btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: var(--demo-shadow-glow);
  transform: translateY(-1px);
}

.demo-btn-secondary {
  background: var(--demo-bg-elevated);
  border: 1px solid var(--demo-border-default);
  color: var(--demo-text-secondary);
}

.demo-btn-secondary:hover:not(:disabled) {
  background: var(--demo-bg-overlay);
  border-color: var(--demo-border-strong);
  color: var(--demo-text-primary);
}

.demo-btn-ghost {
  background: transparent;
  color: var(--demo-text-secondary);
}

.demo-btn-ghost:hover:not(:disabled) {
  background: var(--demo-bg-elevated);
  color: var(--demo-text-primary);
}

/* Icon button */
.demo-btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--demo-bg-elevated);
  border: 1px solid var(--demo-border-default);
  border-radius: var(--demo-radius-md);
  color: var(--demo-text-secondary);
}

.demo-btn-icon:hover {
  background: var(--demo-bg-overlay);
  color: var(--demo-text-primary);
}

/* ============================================
   BADGES & TAGS
   ============================================ */
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--demo-space-1);
  padding: var(--demo-space-1) var(--demo-space-2);
  background: var(--demo-accent-glow);
  border-radius: var(--demo-radius-sm);
  font-size: var(--demo-text-xs);
  font-weight: var(--demo-weight-semibold);
  color: var(--demo-accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.demo-badge-success {
  background: var(--demo-success-dim);
  color: var(--demo-success);
}

.demo-badge-warning {
  background: var(--demo-warning-dim);
  color: var(--demo-warning);
}

.demo-badge-error {
  background: var(--demo-error-dim);
  color: var(--demo-error);
}

.demo-badge-info {
  background: var(--demo-info-dim);
  color: var(--demo-info);
}

/* Status dot */
.demo-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--demo-text-muted);
}

.demo-status-dot.success { background: var(--demo-success); }
.demo-status-dot.warning { background: var(--demo-warning); }
.demo-status-dot.error { background: var(--demo-error); }
.demo-status-dot.info { background: var(--demo-info); }

/* ============================================
   CODE BLOCKS
   ============================================ */
.demo-code {
  background: var(--demo-bg-base);
  border: 1px solid var(--demo-border-subtle);
  border-radius: var(--demo-radius-md);
  padding: var(--demo-space-4);
  font-family: var(--demo-font-mono);
  font-size: var(--demo-text-xs);
  line-height: var(--demo-leading-relaxed);
  color: var(--demo-text-secondary);
  overflow-x: auto;
  white-space: pre;
}

/* Syntax highlighting */
.demo-code .keyword { color: #ff7eb6; }
.demo-code .string { color: #42be65; }
.demo-code .comment { color: var(--demo-text-muted); }
.demo-code .property { color: #ffab70; }
.demo-code .method { color: #82cfff; }
.demo-code .number { color: #ff9500; }

/* ============================================
   INPUTS
   ============================================ */
.demo-input {
  width: 100%;
  padding: var(--demo-space-3) var(--demo-space-4);
  background: var(--demo-bg-elevated);
  border: 1px solid var(--demo-border-default);
  border-radius: var(--demo-radius-md);
  font-family: var(--demo-font-sans);
  font-size: var(--demo-text-sm);
  color: var(--demo-text-primary);
  transition: all var(--demo-transition-fast);
}

.demo-input:focus {
  outline: none;
  border-color: var(--demo-accent-primary);
  box-shadow: 0 0 0 3px var(--demo-accent-glow);
}

.demo-input::placeholder {
  color: var(--demo-text-muted);
}

textarea.demo-input {
  resize: vertical;
  min-height: 100px;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
/* Flex utilities */
.demo-flex { display: flex; }
.demo-flex-col { flex-direction: column; }
.demo-items-center { align-items: center; }
.demo-justify-center { justify-content: center; }
.demo-justify-between { justify-content: space-between; }
.demo-gap-2 { gap: var(--demo-space-2); }
.demo-gap-3 { gap: var(--demo-space-3); }
.demo-gap-4 { gap: var(--demo-space-4); }

/* Text utilities */
.demo-text-center { text-align: center; }
.demo-text-sm { font-size: var(--demo-text-sm); }
.demo-text-muted { color: var(--demo-text-muted); }

/* Spacing utilities */
.demo-mt-4 { margin-top: var(--demo-space-4); }
.demo-mt-6 { margin-top: var(--demo-space-6); }
.demo-mt-8 { margin-top: var(--demo-space-8); }
.demo-mb-4 { margin-bottom: var(--demo-space-4); }
.demo-mb-6 { margin-bottom: var(--demo-space-6); }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes demo-fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes demo-spin {
  to { transform: rotate(360deg); }
}

@keyframes demo-slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.demo-animate-fadeIn {
  animation: demo-fadeIn 0.3s ease forwards;
}

.demo-animate-pulse {
  animation: demo-pulse 2s ease-in-out infinite;
}

/* Spinner */
.demo-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--demo-border-default);
  border-top-color: var(--demo-accent-primary);
  border-radius: 50%;
  animation: demo-spin 0.8s linear infinite;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--demo-border-default);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--demo-border-strong);
}

/* ============================================
   DEMO-SPECIFIC: HEADER
   ============================================ */
.demo-header {
  text-align: center;
  margin-bottom: var(--demo-space-12);
}

.demo-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--demo-accent-primary), var(--demo-accent-secondary));
  border-radius: var(--demo-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--demo-space-5);
  font-size: 28px;
  box-shadow: var(--demo-shadow-glow);
}

.demo-title {
  font-size: var(--demo-text-3xl);
  margin-bottom: var(--demo-space-3);
}

.demo-subtitle {
  font-size: var(--demo-text-lg);
  color: var(--demo-text-secondary);
  max-width: 520px;
  margin: 0 auto;
}

/* ============================================
   DEMO-SPECIFIC: FOOTER
   ============================================ */
.demo-footer {
  margin-top: auto;
  padding-top: var(--demo-space-12);
  text-align: center;
  font-size: var(--demo-text-sm);
  color: var(--demo-text-muted);
}

.demo-footer a {
  color: var(--demo-text-secondary);
}

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

/* ============================================
   WALKTHROUGH / STEP COMPONENTS
   ============================================ */
/* Layout */
.page-container {
  width: 100%;
  max-width: 680px;
}

/* Header badge */
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--demo-space-2);
  padding: var(--demo-space-2) var(--demo-space-4);
  background: var(--demo-bg-surface);
  border: 1px solid var(--demo-border-default);
  border-radius: var(--demo-radius-full);
  font-size: var(--demo-text-xs);
  font-weight: var(--demo-weight-medium);
  color: var(--demo-text-secondary);
  margin-bottom: var(--demo-space-5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-badge .dot {
  width: 6px;
  height: 6px;
  background: var(--demo-success);
  border-radius: 50%;
  animation: demo-pulse 2s infinite;
}

/* Progress bar */
.progress-bar {
  height: 3px;
  background: var(--demo-border-default);
  border-radius: 2px;
  margin-bottom: var(--demo-space-6);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--demo-accent-primary), var(--demo-accent-secondary));
  transition: width 0.4s ease;
  border-radius: 2px;
}

/* Checklist */
.checklist {
  background: var(--demo-bg-surface);
  border: 1px solid var(--demo-border-default);
  border-radius: var(--demo-radius-lg);
  overflow: hidden;
  margin-bottom: var(--demo-space-4);
}

.step {
  display: flex;
  gap: var(--demo-space-4);
  padding: var(--demo-space-5) var(--demo-space-6);
  border-bottom: 1px solid var(--demo-border-default);
  transition: background 0.2s;
}

.step:last-child {
  border-bottom: none;
}

.step.active {
  background: var(--demo-bg-overlay);
}

.step.completed {
  background: var(--demo-success-dim);
}

.step.error {
  background: var(--demo-error-dim);
}

.step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--demo-text-sm);
  font-weight: var(--demo-weight-semibold);
  transition: all 0.3s;
}

.step.waiting .step-icon {
  background: var(--demo-border-default);
  color: var(--demo-text-faint);
}

.step.active .step-icon {
  background: var(--demo-accent-primary);
  color: white;
  box-shadow: var(--demo-shadow-glow);
}

.step.completed .step-icon {
  background: var(--demo-success);
  color: white;
}

.step.error .step-icon {
  background: var(--demo-error);
  color: white;
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-title {
  font-size: var(--demo-text-sm);
  font-weight: var(--demo-weight-semibold);
  margin-bottom: var(--demo-space-1);
  color: var(--demo-text-primary);
}

.step.waiting .step-title {
  color: var(--demo-text-faint);
}

.step-description {
  font-size: var(--demo-text-sm);
  color: var(--demo-text-secondary);
  line-height: var(--demo-leading-normal);
  margin-bottom: var(--demo-space-3);
}

.step.waiting .step-description {
  color: var(--demo-text-faint);
}

.step-code {
  background: var(--demo-bg-base);
  border: 1px solid var(--demo-border-subtle);
  border-radius: var(--demo-radius-md);
  padding: var(--demo-space-3) var(--demo-space-4);
  font-family: var(--demo-font-mono);
  font-size: 11px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  color: var(--demo-text-secondary);
}

.step.waiting .step-code {
  opacity: 0.5;
}

/* Code syntax highlighting */
.step-code .keyword { color: #ff7eb6; }
.step-code .string { color: #42be65; }
.step-code .comment { color: var(--demo-text-muted); }
.step-code .property { color: #ffab70; }
.step-code .method { color: #82cfff; }
.step-code .number { color: #ff9500; }

.step-output {
  margin-top: var(--demo-space-3);
  padding: var(--demo-space-3);
  background: var(--demo-bg-base);
  border-radius: var(--demo-radius-md);
  font-family: var(--demo-font-mono);
  font-size: var(--demo-text-xs);
  color: var(--demo-text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow-y: auto;
}

.step-output.success {
  border-left: 3px solid var(--demo-success);
}

.step-output.error {
  border-left: 3px solid var(--demo-error);
  color: var(--demo-error);
}

.output-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--demo-text-faint);
  margin-top: var(--demo-space-3);
  margin-bottom: var(--demo-space-2);
}

/* Spinner for steps */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: demo-spin 0.8s linear infinite;
}

/* Walkthrough controls */
.walkthrough-controls {
  display: flex;
  gap: var(--demo-space-3);
  flex-wrap: wrap;
  margin-top: var(--demo-space-4);
}

/* Walkthrough card */
.walkthrough-card {
  margin-bottom: var(--demo-space-6);
}

/* ============================================
   CHAT COMPONENTS
   ============================================ */
/* Messages */
.message {
  margin-bottom: var(--demo-space-4);
  animation: demo-fadeIn 0.2s ease;
}

.message-header {
  display: flex;
  align-items: center;
  gap: var(--demo-space-2);
  margin-bottom: var(--demo-space-2);
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--demo-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: var(--demo-weight-bold);
}

.message.user .message-avatar {
  background: linear-gradient(135deg, var(--demo-accent-primary), var(--demo-accent-secondary));
  color: white;
}

.message.assistant .message-avatar {
  background: var(--demo-bg-subtle);
  color: var(--demo-text-secondary);
  border: 1px solid var(--demo-border-default);
}

.message-role {
  font-size: var(--demo-text-sm);
  font-weight: var(--demo-weight-semibold);
  color: var(--demo-text-primary);
}

.message-time {
  font-size: var(--demo-text-xs);
  color: var(--demo-text-muted);
}

.message-body {
  margin-left: 36px;
  font-size: var(--demo-text-sm);
  line-height: var(--demo-leading-relaxed);
  color: var(--demo-text-secondary);
}

.message-body p {
  margin-bottom: var(--demo-space-2);
}

.message-body p:last-child {
  margin-bottom: 0;
}

/* Tool calls */
.tool-call {
  margin: var(--demo-space-3) 0;
  margin-left: 36px;
  background: var(--demo-bg-elevated);
  border: 1px solid var(--demo-border-default);
  border-radius: var(--demo-radius-md);
  overflow: hidden;
}

.tool-call-header {
  display: flex;
  align-items: center;
  gap: var(--demo-space-2);
  padding: var(--demo-space-2) var(--demo-space-3);
  background: var(--demo-bg-surface);
  border-bottom: 1px solid var(--demo-border-default);
  font-size: var(--demo-text-xs);
  color: var(--demo-text-secondary);
  cursor: pointer;
}

.tool-call-header:hover {
  background: var(--demo-bg-overlay);
}

.tool-call-name {
  font-family: var(--demo-font-mono);
  color: var(--demo-accent-primary);
}

.tool-call-status {
  margin-left: auto;
}

.tool-call-status.pending { color: var(--demo-warning); }
.tool-call-status.success { color: var(--demo-success); }
.tool-call-status.error { color: var(--demo-error); }

.tool-call-content {
  padding: var(--demo-space-3);
  font-family: var(--demo-font-mono);
  font-size: 11px;
  color: var(--demo-text-secondary);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.tool-call-content.collapsed {
  display: none;
}

/* Thinking indicator */
.thinking {
  display: flex;
  align-items: center;
  gap: var(--demo-space-2);
  color: var(--demo-text-muted);
  font-size: var(--demo-text-sm);
}

.thinking-dots {
  display: flex;
  gap: 4px;
}

.thinking-dots span {
  width: 6px;
  height: 6px;
  background: var(--demo-accent-primary);
  border-radius: 50%;
  animation: thinking-pulse 1.2s infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinking-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

/* Chat input area */
.chat-input-area {
  margin-top: var(--demo-space-4);
}

.input-wrapper {
  display: flex;
  gap: var(--demo-space-3);
  background: var(--demo-bg-surface);
  border: 1px solid var(--demo-border-default);
  border-radius: var(--demo-radius-md);
  padding: var(--demo-space-3);
  transition: border-color var(--demo-transition-fast);
}

.input-wrapper:focus-within {
  border-color: var(--demo-accent-primary);
  box-shadow: 0 0 0 3px var(--demo-accent-glow);
}

.input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--demo-text-primary);
  font-family: var(--demo-font-sans);
  font-size: var(--demo-text-sm);
  line-height: 1.5;
  resize: none;
  min-height: 24px;
  max-height: 150px;
}

.input-wrapper textarea:focus {
  outline: none;
}

.input-wrapper textarea::placeholder {
  color: var(--demo-text-muted);
}

.send-btn {
  width: 36px;
  height: 36px;
  background: linear-gradient(90deg, var(--demo-accent-primary), var(--demo-accent-secondary));
  border: none;
  border-radius: var(--demo-radius-md);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: filter var(--demo-transition-fast);
}

.send-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Icon button */
.icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--demo-bg-elevated);
  border: 1px solid var(--demo-border-default);
  border-radius: var(--demo-radius-md);
  color: var(--demo-text-secondary);
  cursor: pointer;
  transition: all var(--demo-transition-fast);
}

.icon-btn:hover {
  background: var(--demo-bg-overlay);
  color: var(--demo-text-primary);
}

/* Back link */
.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--demo-bg-elevated);
  border: 1px solid var(--demo-border-default);
  border-radius: var(--demo-radius-md);
  color: var(--demo-text-secondary);
  text-decoration: none;
  transition: all var(--demo-transition-fast);
}

.back-link:hover {
  background: var(--demo-bg-overlay);
  border-color: var(--demo-border-strong);
  color: var(--demo-text-primary);
}