/* ═══════════════════════════════════════════════════════════
   Global Reset & Base Styles
   Applied to: every page (body, all elements)
   ═══════════════════════════════════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #f5f5f5;
  color: #333;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   Landing Page
   ═══════════════════════════════════════════════════════════ */

.landing-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Hero Wrapper ───
   Shared background image + overlay for header, hero banner, and value strip */
.hero-wrapper {
  background-image: url("/hero-bg.jpg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  position: relative;
}
.hero-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 0;
}
.hero-wrapper > * {
  position: relative;
  z-index: 1;
}

/* ─── Hero Banner ───
   Used in: ExampleList.tsx — top of landing page
   Tagline "When AI says 'because'...", subtitle, CTA buttons */
.hero {
  padding: 4.5rem 2rem 3.5rem;
  text-align: center;
}
.hero-content {
  max-width: 750px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-tagline {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}
.hero-tagline em {
  font-style: italic;
  color: #e99211;
}
.hero-subtitle {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.01em;
  line-height: 1.6;
  max-width: 600px;
}
.hero-subtitle strong {
  color: #fff;
}
.hero-cta {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}
.cta-primary {
  display: inline-block;
  padding: 0.7rem 1.75rem;
  background: #2c5f7c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.cta-primary:hover { background: #1e4f6a; transform: translateY(-1px); }
.cta-secondary {
  display: inline-block;
  padding: 0.7rem 1.75rem;
  background: transparent;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cta-secondary:hover { background: #fff; color: #1a365d; }

/* ─── Value Proposition Strip ───
   Used in: ExampleList.tsx — navy bar below hero
   Three value items: Transparent Logic, Institutional Memory, Domain-Native */
.value-strip {
  background: transparent;
  padding: 1.5rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.value-strip-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 3rem;
}
.value-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #e0e7ee;
}
.value-icon {
  color: #e99211;
  flex-shrink: 0;
}
.value-item div {
  display: flex;
  flex-direction: column;
}
.value-item strong {
  font-size: 0.95rem;
  color: #e99211;
  font-weight: 700;
}
.value-item span:last-child {
  font-size: 0.8rem;
  color: #b0bec5;
}

/* ─── Section Headings ───
   Used in: ExampleList.tsx — shared heading styles for
   "How It Works", "Choose a Dataset", "Built For" sections */
.section-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a365d;
  text-align: center;
  margin-bottom: 0.5rem;
}
.section-subheading {
  text-align: center;
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── How It Works ───
   Used in: ExampleList.tsx — 3-step cards with arrows
   Step 1: Load Your Data, Step 2: Explore Diagnostics, Step 3: Get Explanations */
.how-section {
  padding: 3rem 2rem;
  background: #fff;
}
.how-inner {
  max-width: 900px;
  margin: 0 auto;
}
.how-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.how-step {
  flex: 1;
  max-width: 260px;
  min-height: 180px;
  text-align: center;
  padding: 1.5rem 1.25rem;
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.how-step:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #2c5f7c;
  color: #fff;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.how-step h3 {
  font-size: 1.05rem;
  color: #1a365d;
  margin-bottom: 0.5rem;
}
.how-step p {
  font-size: 0.88rem;
  color: #555;
  line-height: 1.6;
}
.how-step-arrow {
  font-size: 1.5rem;
  color: #ccc;
  font-weight: 300;
}

/* ─── Stats Banner ───
   Used in: ExampleList.tsx — light blue bar with counters
   Shows: 8 Datasets, 5 Domains, 485 Rules, 100% Pass Rate */
.stats-banner {
  background: #f0f4f8;
  padding: 2rem 2rem;
  border-top: 1px solid #e0e7ee;
  border-bottom: 1px solid #e0e7ee;
}
.stats-inner {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
}
.stat {
  text-align: center;
  display: flex;
  flex-direction: column;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: #2c5f7c;
  line-height: 1.2;
}
.stat-label {
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* ─── Main Content ───
   Used in: ExampleList.tsx — wraps the dataset selector area */
.landing-main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 2rem;
}

/* ─── Master / Detail Selector ───
   Used in: ExampleList.tsx — dataset picker
   Left nav: list of datasets grouped by domain
   Right panel: dataset detail with title, tags, description, sample question, start button */
.example-selector {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  min-height: 380px;
}

/* Left nav */
.example-nav {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 1rem 0;
  overflow: hidden;
}
.nav-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  padding: 0 1.25rem 0.75rem;
  border-bottom: 1px solid #eee;
  margin-bottom: 0.25rem;
}
/* Group sections inside the nav */
.nav-group {
  margin-top: 0.15rem;
}
.nav-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #999;
  padding: 0.6rem 1.25rem 0.2rem;
}
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  padding: 0.35rem 1.25rem; 
  font-size: 0.95rem;
  font-family: inherit;
  color: #333;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.nav-item:hover { background: #f8f9fa; color: #2c5f7c; }
.nav-item.active {
  background: #e8f0fe;
  border-left-color: #2c5f7c;
  color: #2c5f7c;
  font-weight: 600;
}

/* Right detail panel */
.detail-panel {
  flex: 1 1 auto;
  min-width: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 2rem 2.25rem;
  display: flex;
  flex-direction: column;
}
.detail-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a365d;
  margin-bottom: 0.75rem;
}
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}
.tag {
  display: inline-block;
  background: #e8eef4;
  color: #336;
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
}
.detail-description {
  font-size: 1rem;
  line-height: 1.7;
  color: #444;
  margin-bottom: 1.25rem;
  flex: 1;
}
.detail-sample {
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.sample-label {
  color: #888;
  font-weight: 500;
  margin-right: 0.5rem;
}
.sample-question {
  color: #2c5f7c;
  font-style: italic;
}
.start-btn {
  align-self: flex-end;
  padding: 0.65rem 1.75rem;
  background: #2c5f7c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.start-btn:hover { background: #1e4f6a; transform: translateY(-1px); }

/* ─── Audience Section ───
   Used in: ExampleList.tsx — "Built For" cards
   Three cards: Risk & Compliance, Clinical Ops, Operations & Supply Chain */
.audience-section {
  padding: 3rem 2rem;
  background: #fff;
  border-top: 1px solid #e8e8e8;
}
.audience-inner {
  max-width: 960px;
  margin: 0 auto;
}
.audience-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.audience-card {
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
}
.audience-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.audience-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  display: block;
}
.audience-card h3 {
  font-size: 1.05rem;
  color: #1a365d;
  margin-bottom: 0.5rem;
}
.audience-card p {
  font-size: 0.88rem;
  color: #555;
  line-height: 1.6;
}

/* ─── Site Header ───
   Used in: ExampleList.tsx — top navigation bar
   Logo text left, login/greeting right */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 2rem;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.header-brand {
  font-size: 1.3rem;
  font-weight: 800;
  color: #e99211;
  letter-spacing: -0.02em;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.login-link {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0;
  transition: color 0.15s;
}
.login-link:hover { color: #fff; text-decoration: underline; }
.login-link:disabled { color: rgba(255, 255, 255, 0.4); cursor: not-allowed; text-decoration: none; }
.user-greeting {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}
.identify-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.identify-form input {
  padding: 0.3rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  width: 160px;
}
.identify-form input:focus { border-color: #2c5f7c; }

/* ─── Footer ───
   Used in: ExampleList.tsx, About.tsx, Contact.tsx — site-wide footer
   Brand name, nav links (About, Contact, GitHub), tagline */
.site-footer {
  background: #1a365d;
  color: #b0bec5;
  padding: 1.25rem 2rem;
}
.footer-content {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.footer-brand {
  font-weight: 700;
  color: #e99211;
  font-size: 0.95rem;
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a {
  color: #b0bec5;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}
.footer-links a:hover { color: #e99211; }
.footer-tagline {
  font-size: 0.8rem;
  color: #78909c;
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════
   Static Pages (About, Contact)
   ═══════════════════════════════════════════════════════════ */

.static-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.static-header {
  background: #1a365d;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
}
.header-logo-link { display: flex; }
.header-logo { height: 36px; }

.static-content {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}
.static-content h1 {
  font-size: 1.75rem;
  color: #1a365d;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e8eef4;
}
.static-content h2 {
  font-size: 1.25rem;
  color: #333;
  margin-bottom: 0.75rem;
  margin-top: 0.5rem;
}

/* ─── About Page ───
   Used in: About.tsx — about sections, feature checklist, 3-pillar grid
   Pillars: Diagnostic (Why?), Reporting (What?), Prescriptive (What should?) */
.about-section {
  margin-bottom: 2rem;
}
.about-section p { margin-bottom: 0.75rem; line-height: 1.7; }
.about-features {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}
.about-features li {
  padding: 0.4rem 0 0.4rem 1.5rem;
  position: relative;
  line-height: 1.6;
}
.about-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #2c5f7c;
  font-weight: 700;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 0.75rem;
}
.pillar {
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 1.25rem;
}
.pillar h3 {
  font-size: 1rem;
  color: #1a365d;
  margin-bottom: 0.25rem;
}
.pillar-question {
  font-style: italic;
  color: #2c5f7c;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.pillar p:last-child { font-size: 0.9rem; color: #555; line-height: 1.5; }

/* ─── Contact Page ───
   Used in: Contact.tsx — contact card with email, LinkedIn, GitHub links */
.contact-section {
  margin-bottom: 2rem;
}
.contact-section p { margin-bottom: 0.75rem; line-height: 1.7; }
.contact-card {
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.contact-item { display: flex; align-items: center; gap: 1rem; }
.contact-label {
  font-weight: 600;
  color: #555;
  min-width: 70px;
  font-size: 0.9rem;
}
.contact-item a {
  color: #2c5f7c;
  text-decoration: none;
  font-size: 0.95rem;
}
.contact-item a:hover { text-decoration: underline; }

/* ─── Contact Form (Feedback & Inquiry tabs) ───
   Used in: Contact.tsx — tabbed form with feedback (email optional) and inquiry (email required) */
.contact-form-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0;
}
.contact-tab {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1px solid #e0e7ee;
  background: #f0f4f8;
  color: #555;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.contact-tab:first-child { border-radius: 8px 0 0 0; }
.contact-tab:last-child { border-radius: 0 8px 0 0; }
.contact-tab.active {
  background: #fff;
  color: #1a365d;
  border-bottom-color: #fff;
}
.contact-tab:not(.active):hover { background: #e8eef4; }
.contact-form-card {
  background: #fff;
  border: 1px solid #e0e7ee;
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 1.5rem;
}
.contact-form-hint {
  font-size: 0.88rem;
  color: #666;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.contact-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.35rem;
}
.optional-label {
  font-weight: 400;
  color: #888;
  font-size: 0.8rem;
}
.required-label {
  color: #c0392b;
  font-weight: 600;
}
.contact-field input,
.contact-field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.contact-field input:focus,
.contact-field textarea:focus {
  border-color: #2c5f7c;
}
.contact-field textarea {
  resize: vertical;
  min-height: 100px;
}
.contact-submit-btn {
  align-self: flex-start;
  padding: 0.6rem 1.5rem;
  background: #2c5f7c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.contact-submit-btn:hover { background: #1e4f6a; transform: translateY(-1px); }
.contact-submit-btn:disabled { background: #999; cursor: not-allowed; transform: none; }
.contact-error {
  color: #c0392b;
  font-size: 0.85rem;
  margin: 0;
}
.contact-success {
  text-align: center;
  padding: 1.5rem 0;
}
.contact-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #27ae60;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.contact-success p {
  font-size: 1rem;
  color: #333;
  margin-bottom: 1rem;
}
.contact-again-btn {
  padding: 0.4rem 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #555;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}
.contact-again-btn:hover { background: #f0f0f0; }

/* ─── Responsive Landing Page ───
   Breakpoint 768px: stacks hero CTA, value strip, how-steps, audience cards vertically */
@media (max-width: 768px) {
  .hero { padding: 3rem 1rem 2rem; }
  .hero-tagline { font-size: 1.4rem; }
  .hero-subtitle { font-size: 0.9rem; }
  .hero-cta { flex-direction: column; gap: 0.75rem; }
  .value-strip-inner { flex-direction: column; gap: 1rem; align-items: flex-start; padding: 0 1rem; }
  .how-steps { flex-direction: column; align-items: center; }
  .how-step-arrow { transform: rotate(90deg); padding: 0; }
  .how-step { max-width: 100%; }
  .stats-inner { flex-wrap: wrap; gap: 1.5rem; justify-content: center; }
  .example-selector { flex-direction: column; }
  .example-nav { width: 100%; min-width: 0; max-width: 100%; }
  .audience-cards { grid-template-columns: 1fr; }
  .pillars { grid-template-columns: 1fr; }
  .footer-content { flex-direction: column; text-align: center; }
  .detail-panel { padding: 1.5rem; }
  .section-heading { font-size: 1.25rem; }
}

/* ═══════════════════════════════════════════════════════════
   Chat Page (Chat.tsx)
   Full-height layout: header → scrollable messages → input bar
   ═══════════════════════════════════════════════════════════ */

/* ─── Chat Header ───
   Used in: Chat.tsx — top bar with back button, dataset title, user badge */
.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.chat-header {
  padding: 0.85rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chat-header h2 { margin: 0; color: #1a365d; font-weight: 600; font-size: 1.1rem; flex: 1; }

.chat-user-badge {
  font-size: 0.78rem;
  color: #666;
  background: #f0f4f8;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  white-space: nowrap;
}

/* ─── Back Button ───
   Used in: Chat.tsx — navigates back to landing page */
.back-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: #555;
  transition: background 0.15s, border-color 0.15s;
}
.back-btn:hover { background: #f0f0f0; border-color: #999; }

/* ─── Mode Badge ───
   Shown in Chat header when internal mode is active */
.mode-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}
.mode-badge.internal {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}
.mode-badge.developer {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #3b82f6;
}

/* ─── Messages Container ───
   Used in: Chat.tsx — scrollable area holding all chat messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  scroll-behavior: smooth;
}

/* ─── Message Bubble (shared) ───
   Used in: Chat.tsx — base style for all message types
   Width 90% with fade-in animation */
.message {
  max-width: 90%;
  width: 90%;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: fadeInUp 0.2s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── User Message ───
   Used in: Chat.tsx — user's typed questions, faint blue background */
.message.user {
  background: #dce8f5;
  color: #1a365d;
  border-bottom-right-radius: 4px;
}

/* ─── Agent Message ───
   Used in: Chat.tsx — AI responses rendered as Markdown
   White background with border */
.message.agent {
  background: #fff;
  border: 1px solid #ddd;
  border-bottom-left-radius: 4px;
}

/* ─── Agent Message Typography ───
   All headings (h1-h4): uniform 0.88rem semi-bold
   Body text (p, li): uniform 0.82rem normal weight
   Code blocks: 0.85rem monospace on gray background
   Tables: 0.82rem with light header background */
.message.agent h1,
.message.agent h2,
.message.agent h3,
.message.agent h4 { font-size: 0.88rem; font-weight: 600; margin: 0.6rem 0 0.2rem; color: #1a365d; }
.message.agent p { margin: 0.2rem 0; font-size: 0.82rem; }
.message.agent ul, .message.agent ol { margin: 0.1rem 0 0.1rem 1.25rem; padding: 0; }
.message.agent li { margin: 0; padding: 0; line-height: 1.35; font-size: 0.82rem; }
.message.agent li > p { margin: 0; padding: 0; font-size: 0.82rem; }
.message.agent li > ul, .message.agent li > ol { margin: 0 0 0 1rem; }
.message.agent pre {
  background: #f4f4f4;
  border-radius: 4px;
  padding: 0.5rem;
  overflow-x: auto;
  margin: 0.5rem 0;
  font-size: 0.85rem;
}
.message.agent code {
  background: #f0f0f0;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.9em;
}
.message.agent pre code { background: none; padding: 0; }

/* ─── Message Action Icons ───
   Used in: Chat.tsx — row of 👍 👎 💾 icons below each agent response
   Left-aligned, subtle gray icons that darken on hover */
.message-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.5rem;
  justify-content: flex-start;
}
.action-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  color: #aaa;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}
.action-icon:hover { color: #555; background: #f0f0f0; }
.action-icon.voted { color: #2c5f7c; }

/* ─── Agent Message Tables ───
   Used in: Chat.tsx — markdown tables inside agent responses
   e.g. "Overall Dataset Statistics" in dataset summaries */
.message.agent table { border-collapse: collapse; margin: 0.5rem 0; width: 100%; font-size: 0.82rem; }
.message.agent th, .message.agent td { border: 1px solid #ddd; padding: 0.3rem 0.5rem; text-align: left; font-weight: normal; }
.message.agent th { background: #f8f8f8; font-weight: 600; }

.input-bar {
  display: flex;
  padding: 1rem 1.5rem;
  background: #fff;
  border-top: 1px solid #ddd;
  box-shadow: 0 -1px 3px rgba(0,0,0,0.04);
  justify-content: flex-start;
}

.input-bar .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 90%;
  max-width: 90%;
}

.input-bar input {
  flex: 1;
  padding: 0.65rem 2.5rem 0.65rem 0.85rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-bar input:focus { border-color: #2c5f7c; box-shadow: 0 0 0 2px rgba(44,95,124,0.15); }

/* ─── Send Icon (inside input) ───
   Used in: Chat.tsx — ➤ arrow icon positioned inside the input field
   Styled like VS Code Copilot chat send button */
.input-bar .send-icon {
  position: absolute;
  right: 0.4rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  color: #2c5f7c;
  padding: 0.25rem;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.input-bar .send-icon:hover { background: rgba(44,95,124,0.08); }
.input-bar .send-icon:disabled { color: #ccc; cursor: not-allowed; background: none; }

/* ─── Loading & Spinner ───
   Used in: Chat.tsx — shown while session initializes or agent is thinking
   .loading = full-area centered spinner
   .spinner = 18px rotating circle (session init)
   .spinner-sm = 12px rotating circle (inline "Thinking…" indicator) */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #888;
  font-size: 1.1rem;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #ccc;
  border-top-color: #2c5f7c;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 0.5rem;
}

.spinner-sm {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid #ccc;
  border-top-color: #2c5f7c;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 0.4rem;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Error Display ───
   Used in: Chat.tsx — shown when session creation or streaming fails */
.error { color: #c33; padding: 1rem; text-align: center; }

/* ─── Streaming Status ───
   Used in: Chat.tsx — shows streaming phase ("Thinking", "Retrieving data", etc.)
   .message.streaming adds a left blue border to the active response */
.stream-status {
  display: flex;
  align-items: center;
  color: #666;
  font-size: 0.9rem;
  padding: 0.4rem 0;
  margin-top: 0.3rem;
}
.message.streaming {
  border-left: 3px solid #2c5f7c;
}

/* ─── System Messages ───
   Used in: Chat.tsx — centered info messages (e.g. session start) */
.system-message {
  text-align: center;
  color: #666;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  margin-bottom: 0.75rem;
  background: #e8eef4;
  border-radius: 8px;
}

/* ─── Sample Question Chips ───
   Used in: Chat.tsx — "Try asking:" pills shown before first message
   Clicking a chip populates the input and focuses it */
.question-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.chips-label {
  color: #888;
  font-size: 0.85rem;
  font-weight: 500;
  margin-right: 0.25rem;
}
.question-chip {
  display: inline-block;
  background: #f0f4f8;
  color: #2c5f7c;
  border: 1px solid #d0dce8;
  border-radius: 16px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.question-chip:hover {
  background: #dce6f0;
  border-color: #2c5f7c;
}

/* ─── Dataset Overview ───
   Used in: Chat.tsx — Summary.md rendered as first agent message
   Contains tables, pre blocks with dataset statistics
   .overview-loading shown while summary loads */
.dataset-overview {
  transition: opacity 0.4s ease-in;
}
.dataset-overview pre {
  font-size: 0.78rem;
  line-height: 1.3;
  padding: 0.4rem 0.5rem;
  margin: 0.3rem 0;
}
.dataset-overview.overview-loading {
  opacity: 0.7;
  border-left: 3px solid #2c5f7c;
}

/* ─── Responsive Chat Page ───
   Breakpoint 768px: smaller header, messages, input adjustments
   iOS zoom prevention: font-size 16px on input */
@media (max-width: 768px) {
  .chat-header { padding: 0.65rem 1rem; }
  .chat-header h2 { font-size: 0.95rem; }
  .messages { padding: 1rem; }
  .message { max-width: 92%; padding: 0.6rem 0.85rem; font-size: 0.9rem; }
  .input-bar { padding: 0.75rem 1rem; }
  .input-bar input { font-size: 16px; /* prevent iOS zoom */ padding-right: 2.5rem; }
  .question-chips { padding: 0.5rem; }
  .question-chip { font-size: 0.8rem; padding: 0.3rem 0.7rem; }
}
