/* ============================================
   ChatVC Design System
   ============================================ */

/* --- Design Tokens --- */
:root {
  /* Brand */
  --brand: #DCFCE7;
  --brand-hover: #BBF7D0;
  --brand-light: #F0FDF4;
  --text-on-brand: #166534;

  /* Background */
  --bg: #FFFFFF;
  --bg-secondary: #FAFAFA;
  --surface: #F4F4F4;

  /* Text */
  --text-primary: #0D0D0D;
  --text-secondary: #6E6E6E;
  --text-faint: #ABABAB;

  /* Border */
  --border: #E5E5E5;
  --border-light: #F0F0F0;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Typography */
  --font-display: "Instrument Sans", sans-serif;
  --font-body: "Source Sans 3", sans-serif;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);

  /* Status */
  --success: #22C55E;
  --error: #EF4444;
}

/* --- 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;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Layout --- */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
}

/* --- Logo --- */
.logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.3px;
}

.logo .vc {
  color: var(--text-on-brand);
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: var(--space-2xl) 0 var(--space-lg);
}

.hero-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto var(--space-lg);
  line-height: 1.6;
}

/* --- Social Proof --- */
.social-proof {
  text-align: center;
  padding-bottom: var(--space-xl);
}

.social-proof-label {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: var(--space-sm);
}

.social-proof-firms {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-faint);
  letter-spacing: 0.5px;
}

.social-proof-firms span {
  margin: 0 var(--space-sm);
}

.social-proof-firms span::after {
  content: "\00b7";
  margin-left: var(--space-md);
  color: var(--border);
}

.social-proof-firms span:last-child::after {
  content: "";
}

/* --- Chat Container --- */
.chat-container {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  overflow: hidden;
  margin-bottom: var(--space-2xl);
  box-shadow: var(--shadow-md);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--brand);
  color: var(--text-on-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.chat-header-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-header-status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 12px;
  color: var(--text-faint);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--success);
}

/* --- Messages Area --- */
.messages-area {
  padding: var(--space-lg);
  min-height: 320px;
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* --- Chat Bubbles --- */
.message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: fadeIn 150ms ease-out;
}

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

.message.ai {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
}

.message-bubble {
  padding: var(--space-sm) var(--space-md);
  font-size: 15px;
  line-height: 1.55;
  word-wrap: break-word;
}

.message.ai .message-bubble {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
}

.message.user .message-bubble {
  background: var(--text-primary);
  color: #FFFFFF;
  border-radius: var(--radius-md) 4px var(--radius-md) var(--radius-md);
}

/* --- Chips --- */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-on-brand);
  background: var(--brand-light);
  border: 1px solid var(--brand);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}

.chip:hover {
  background: var(--brand);
  border-color: var(--brand-hover);
}

.chip.selected {
  background: var(--brand);
  border-color: var(--text-on-brand);
  font-weight: 600;
}

/* --- Chat Input --- */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-light);
  background: var(--bg);
}

.chat-input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  outline: none;
  transition: border-color 0.15s;
}

.chat-input::placeholder {
  color: var(--text-faint);
}

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

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--text-on-brand);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  font-size: 16px;
}

.chat-send-btn:hover {
  background: #14532d;
  transform: translateY(-1px);
}

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

/* --- File Upload Button --- */
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.upload-btn:hover {
  border-color: var(--brand-hover);
  background: var(--brand-light);
}

/* --- Typing Indicator --- */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--space-sm) var(--space-md);
  align-self: flex-start;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--text-faint);
  animation: typingBounce 1.2s infinite;
}

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

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

/* --- Loading State --- */
.loading-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
}

.loading-state h3 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.loading-state p {
  font-size: 15px;
  color: var(--text-secondary);
}

.loading-dots::after {
  content: "";
  animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
  0% { content: ""; }
  33% { content: "."; }
  66% { content: ".."; }
  100% { content: "..."; }
}

/* --- Results Section --- */
.results-section {
  display: none;
  padding-bottom: var(--space-2xl);
}

.results-section.visible {
  display: block;
}

.results-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.results-header h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.results-header p {
  font-size: 16px;
  color: var(--text-secondary);
}

/* --- Intro Banner --- */
.intro-banner {
  background: var(--brand-light);
  border: 1px solid var(--brand);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  text-align: center;
}

.intro-banner h3 {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-on-brand);
  margin-bottom: var(--space-sm);
}

.intro-banner p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

/* --- Match Cards --- */
.match-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.match-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.match-card:hover {
  border-color: var(--brand-hover);
  box-shadow: var(--shadow-md);
}

.match-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
}

.match-investor-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.match-firm {
  font-size: 14px;
  color: var(--text-secondary);
}

.match-location {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: var(--space-sm);
}

.match-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-sm);
  font-size: 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.tag-brand {
  background: var(--brand-light);
  color: var(--text-on-brand);
  border: 1px solid var(--brand);
}

.tag-neutral {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.match-reason {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--brand);
  color: var(--text-on-brand);
}

.btn-primary:hover {
  background: var(--brand-hover);
}

.btn-dark {
  background: var(--text-primary);
  color: #FFFFFF;
}

.btn-dark:hover {
  background: #1a1a1a;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border-light);
}

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

.btn-ghost:hover {
  background: var(--surface);
  color: var(--text-primary);
}

/* --- Zero Matches --- */
.zero-matches {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.zero-matches h3 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.zero-matches p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.email-signup {
  display: flex;
  gap: var(--space-sm);
  max-width: 400px;
  margin: 0 auto;
}

.email-signup input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}

.email-signup input:focus {
  border-color: var(--brand-hover);
}

/* --- Coming Soon Gate --- */
.gate-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: var(--space-lg);
}

.gate-page .logo {
  font-size: 28px;
  margin-bottom: var(--space-2xl);
}

.gate-page h1 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.gate-page p {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 420px;
  margin-bottom: var(--space-xl);
  line-height: 1.6;
}

.gate-email-form {
  display: flex;
  gap: var(--space-sm);
  width: 100%;
  max-width: 420px;
}

.gate-email-form input {
  flex: 1;
  padding: 12px var(--space-md);
  font-family: var(--font-body);
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--bg);
}

.gate-email-form input:focus {
  border-color: var(--brand-hover);
}

.gate-email-form button {
  padding: 12px var(--space-lg);
}

.gate-success {
  color: var(--text-on-brand);
  font-size: 15px;
  margin-top: var(--space-md);
  display: none;
}

/* --- Main App (hidden when gated) --- */
.main-app {
  display: none;
}

.main-app.visible {
  display: block;
}

/* --- Header --- */
.top-header {
  padding: var(--space-lg) 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Scrollbar --- */
.messages-area::-webkit-scrollbar {
  width: 4px;
}

.messages-area::-webkit-scrollbar-track {
  background: transparent;
}

.messages-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-md);
  }

  .hero-title {
    font-size: 32px;
  }

  .hero-subtitle {
    font-size: 16px;
  }

  .social-proof-firms {
    font-size: 12px;
  }

  .social-proof-firms span {
    margin: 0 var(--space-xs);
  }

  .messages-area {
    min-height: 280px;
    max-height: 400px;
    padding: var(--space-md);
  }

  .message {
    max-width: 92%;
  }

  .chat-input-bar {
    padding: var(--space-sm) var(--space-md);
  }

  .match-card {
    padding: var(--space-md);
  }

  .gate-page h1 {
    font-size: 28px;
  }

  .gate-email-form {
    flex-direction: column;
  }

  .gate-email-form button {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .hero-title {
    font-size: 28px;
  }

  .chips-container {
    gap: var(--space-xs);
  }

  .chip {
    font-size: 13px;
    padding: 6px var(--space-sm);
  }
}
