/* ==========================================================================
   Todd & Robinson Family Tree - Interactive Genealogy Web Application
   High-performance, standalone, responsive stylesheet
   ========================================================================== */

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Palette - Dark Obsidian & Slate */
  --bg-app: #090d16;
  --bg-surface: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --bg-input: #1f293d;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.12);
  --border-card-hover: rgba(56, 189, 248, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Accent Colors */
  --accent-primary: #38bdf8;
  --accent-primary-hover: #0284c7;
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.25);
  --accent-emerald: #10b981;
  --accent-purple: #a855f7;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;

  /* Branch Specific Border Colors */
  --branch-todd: #3b82f6;
  --branch-roche: #f59e0b;
  --branch-lais: #14b8a6;
  --branch-robinson: #8b5cf6;
  --branch-gassett: #f43f5e;
  --branch-mcfarland: #0ea5e9;
  --branch-evans: #10b981;
  --branch-asher: #d97706;
  --branch-dearduff: #06b6d4;
  --branch-bonham: #4f46e5;
  --branch-wallace: #ef4444;
  --branch-floyd: #f97316;
  --branch-central: #fbbf24;

  --card-width: 250px;
  --card-height: 104px;

  --header-height: 64px;
  --drawer-width: 480px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px -1px rgba(0, 0, 0, 0.4), 0 2px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5), 0 4px 10px -4px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 8px 20px rgba(0, 0, 0, 0.35);
  --shadow-gold: 0 0 15px rgba(245, 158, 11, 0.35);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-drawer: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */

.app-header {
  position: relative;
  z-index: 100;
  height: var(--header-height);
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-crest {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  white-space: nowrap;
}

.brand-subtitle {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Navigation Tabs */
.view-tabs {
  display: flex;
  align-items: center;
  background: rgba(30, 41, 59, 0.7);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn:hover {
  color: #ffffff;
}

.tab-btn.active {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Header Right: Search, Filter, Actions */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: flex-end;
}

/* Search Box */
.search-box {
  position: relative;
  width: 320px;
  max-width: 360px;
}

.search-box input {
  width: 100%;
  height: 34px;
  padding: 0 34px 0 32px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-shortcut {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 12px;
}

.search-clear-btn:hover {
  color: #fff;
}

/* Search Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: 380px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  padding: 6px;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.search-result-item:hover, .search-result-item.highlighted {
  background: var(--bg-card-hover);
}

.search-result-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.search-result-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.search-result-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  white-space: nowrap;
}

.search-result-badge.patriot {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Filter Controls */
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-group select {
  height: 34px;
  padding: 0 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.filter-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: #ffffff;
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

.canvas-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   Main App Container & View Panels
   ========================================================================== */

.main-container {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

.view-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  overflow: hidden;
}

.view-panel.active {
  display: block;
}

/* ==========================================================================
   VIEW 1: Interactive Tree Canvas
   ========================================================================== */

#tree-view {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--bg-app);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 28px 28px;
  user-select: none;
  -webkit-user-select: none;
}

/* Canvas HUD */
.tree-hud {
  position: absolute;
  top: 14px;
  left: 18px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.hud-item {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
}

.hud-branches {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-branch-select {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 4px;
  color: #38bdf8;
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.hud-branch-select:hover,
.hud-branch-select:focus {
  outline: none;
  border-color: var(--gold);
  color: #ffffff;
  background: rgba(15, 23, 42, 0.95);
}

.hud-focus {
  font-size: 12px;
}

.hud-label {
  color: var(--text-dim);
  font-weight: 500;
}

.hud-val {
  font-weight: 700;
  color: #ffffff;
}

.hud-btn {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hud-btn:hover {
  background: rgba(239, 68, 68, 0.4);
  color: #fff;
}

.hud-legend {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-pill.proven .dot { background: var(--accent-emerald); }
.legend-pill.memory .dot { background: var(--accent-purple); }
.legend-pill.lead .dot { background: var(--accent-gold); }
.legend-pill.patriot .dot.gold {
  background: #fbbf24;
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.8);
}

.hud-instructions {
  font-size: 11px;
  color: var(--text-dim);
}

/* Tree Viewport & Canvas */
.tree-viewport {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  cursor: grab;
}

.tree-viewport.panning {
  cursor: grabbing;
}

.tree-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* Generation Column Guides */
.tree-generation-guides {
  position: absolute;
  top: -4000px;
  bottom: -4000px;
  left: -8000px;
  right: -8000px;
  pointer-events: none;
}

.gen-column-header {
  position: absolute;
  top: -80px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
  white-space: nowrap;
}

.gen-column-line {
  position: absolute;
  top: -4000px;
  height: 8000px;
  width: 1px;
  border-left: 1px dashed rgba(255, 255, 255, 0.04);
}

/* SVG Links Layer - Perfectly aligned with tree-canvas origin (0, 0) */
.tree-svg-links {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
}

.tree-link {
  fill: none;
  stroke: #64748b;
  stroke-width: 2.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease, stroke-width 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

/* Left wing lines (Travis's lineage: Luminous Cyan / Sky Blue) */
.tree-link.left-wing {
  stroke: #38bdf8;
  stroke-opacity: 0.85;
  filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.45));
}

/* Right wing lines (Sonya's lineage: Luminous Purple / Violet) */
.tree-link.right-wing {
  stroke: #c084fc;
  stroke-opacity: 0.85;
  filter: drop-shadow(0 0 2px rgba(192, 132, 252, 0.45));
}

/* Marriage link between Travis & Sonya (Bright Gold Glow) */
.tree-link.marriage-link {
  stroke: #fbbf24;
  stroke-width: 3.5px;
  stroke-opacity: 1;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.7));
}

/* Children connecting lines (Bright Cyan) */
.tree-link.child-link {
  stroke: #38bdf8;
  stroke-width: 2.5px;
  stroke-opacity: 0.9;
  filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.4));
}

/* Hover & Selected Line Highlight (Glowing Amber Gold) */
.tree-link.highlighted {
  stroke: #f59e0b !important;
  stroke-width: 4.5px !important;
  stroke-opacity: 1 !important;
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.9)) !important;
  z-index: 15;
}

/* Connection Junction Dots */
.tree-dot {
  fill: #38bdf8;
  stroke: #090d16;
  stroke-width: 1.5px;
  filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.6));
}

.tree-dot.right-wing {
  fill: #c084fc;
  filter: drop-shadow(0 0 2px rgba(192, 132, 252, 0.6));
}

.tree-dot.gold {
  fill: #fbbf24;
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.8));
}

/* Tree Nodes Container */
.tree-nodes-container {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 10;
}

/* Individual Person Card */
.person-card {
  position: absolute;
  width: var(--card-width);
  height: var(--card-height);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 10px 12px;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s ease,
              border-color 0.2s ease,
              opacity 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  user-select: none;
  border-left: 4px solid var(--accent-primary);
}

.person-card:hover {
  transform: translateY(-3px) scale(1.02);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-lg), 0 0 15px rgba(56, 189, 248, 0.15);
  border-color: var(--border-card-hover);
  z-index: 20;
}

.person-card.active-selected {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35), var(--shadow-lg);
  z-index: 30;
}

.person-card.dimmed {
  opacity: 0.25;
}

/* Branch Specific Stripe Colors */
.person-card.branch-Todd { border-left-color: var(--branch-todd); }
.person-card.branch-Roche { border-left-color: var(--branch-roche); }
.person-card.branch-Lais { border-left-color: var(--branch-lais); }
.person-card.branch-Robinson { border-left-color: var(--branch-robinson); }
.person-card.branch-Gassett { border-left-color: var(--branch-gassett); }
.person-card.branch-McFarland { border-left-color: var(--branch-mcfarland); }
.person-card.branch-Evans { border-left-color: var(--branch-evans); }
.person-card.branch-Asher { border-left-color: var(--branch-asher); }
.person-card.branch-Dearduff { border-left-color: var(--branch-dearduff); }
.person-card.branch-Bonham { border-left-color: var(--branch-bonham); }
.person-card.branch-Wallace { border-left-color: var(--branch-wallace); }
.person-card.branch-Floyd { border-left-color: var(--branch-floyd); }
.person-card.branch-Central {
  border-left-color: var(--branch-central);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.2), var(--shadow-card);
}

/* Card Header */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.card-title-group {
  overflow: hidden;
}

.card-name {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-lifespan {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

.card-location {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Card Badges Row */
.card-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge.proven {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.memory {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge.lead {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.patriot,
.badge.veteran {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.3));
  color: #fde047;
  border: 1px solid rgba(251, 191, 36, 0.5);
  font-weight: 700;
}

.badge.dar-eligible {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-weight: 600;
}

.search-result-badge.dar-eligible {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.tag-pill.dar {
  color: #93c5fd !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
}

.badge.story {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Branch Expand/Collapse Toggle Button */
.branch-toggle-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--accent-primary);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  z-index: 25;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.branch-toggle-btn:hover {
  background: var(--accent-primary);
  color: #ffffff;
  transform: translateY(-50%) scale(1.15);
}

.branch-toggle-btn.left {
  left: -13px;
}

.branch-toggle-btn.right {
  right: -13px;
}

.branch-toggle-btn.collapsed {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  font-size: 9px;
  width: auto;
  min-width: 24px;
  padding: 0 5px;
  border-radius: var(--radius-full);
}

/* Central Marriage Ring Hub */
.marriage-hub {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid var(--accent-gold);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #fbbf24;
  box-shadow: var(--shadow-gold);
  z-index: 15;
  white-space: nowrap;
  pointer-events: auto;
  cursor: default;
}

/* Daughters Section Hub */
.daughters-hub {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 3px 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
  z-index: 15;
  white-space: nowrap;
  pointer-events: none;
}

/* ==========================================================================
   VIEW 2: Directory Table
   ========================================================================== */

#directory-view {
  overflow-y: auto;
  background: var(--bg-app);
  padding: 24px 32px;
}

.directory-container {
  max-width: 1400px;
  margin: 0 auto;
}

.directory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.directory-title h2 {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
}

.directory-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.directory-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-pill {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

.stat-pill strong {
  color: #ffffff;
  font-weight: 700;
}

.directory-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-input {
  flex: 1;
  min-width: 240px;
  height: 38px;
  padding: 0 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 13px;
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.filter-select {
  height: 38px;
  padding: 0 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12px;
  cursor: pointer;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.directory-table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.directory-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.directory-table th {
  background: #1e293b;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}

.directory-table th.sortable {
  cursor: pointer;
}

.directory-table th.sortable:hover {
  color: #ffffff;
}

.directory-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.directory-table tbody tr {
  transition: background var(--transition-fast);
  cursor: pointer;
}

.directory-table tbody tr:hover {
  background: var(--bg-card);
}

.table-person-name {
  font-weight: 600;
  color: #ffffff;
}

.table-person-dates {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.table-actions {
  display: flex;
  gap: 6px;
}

/* ==========================================================================
   VIEW 3: Patriots & Veterans Roll of Honor
   ========================================================================== */

#patriots-view {
  overflow-y: auto;
  background: var(--bg-app);
  padding: 28px 36px;
}

.patriots-container {
  max-width: 1400px;
  margin: 0 auto;
}

.patriots-header {
  margin-bottom: 24px;
}

.patriots-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.patriots-crest {
  font-size: 36px;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-gold);
}

.patriots-title h2 {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
}

.patriots-title p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.patriots-filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pill-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.pill-btn.active {
  background: #f59e0b;
  color: #000000;
  border-color: #f59e0b;
  font-weight: 700;
}

.patriots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.patriot-card {
  background: var(--bg-surface);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.patriot-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.patriot-card:hover {
  transform: translateY(-4px);
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: var(--shadow-gold), var(--shadow-lg);
}

.patriot-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.patriot-name {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.patriot-lifespan {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.patriot-service-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 12px;
}

.patriot-service-text {
  font-size: 13px;
  font-weight: 600;
  color: #fbbf24;
  line-height: 1.4;
}

.patriot-snippet {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.patriot-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}

/* ==========================================================================
   VIEW 4: Family Research Discoveries & Heritage Chronicles
   ========================================================================== */

#discoveries-view {
  overflow-y: auto;
  background: var(--bg-app);
  padding: 28px 36px;
}

.discoveries-container {
  max-width: 1400px;
  margin: 0 auto;
}

.discoveries-header {
  margin-bottom: 28px;
}

.discoveries-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.discoveries-crest {
  font-size: 34px;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(168, 85, 247, 0.25));
  border: 1.5px solid rgba(56, 189, 248, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.2);
}

.discoveries-title h2 {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
}

.discoveries-title p {
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 4px;
}

.discoveries-filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.discoveries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: 24px;
}

.discovery-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.discovery-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: var(--shadow-lg), 0 0 24px rgba(56, 189, 248, 0.15);
}

.discovery-card-top {
  margin-bottom: 16px;
}

.discovery-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.discovery-badge.mancuso {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.discovery-badge.pinero {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.discovery-badge.manson {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.35);
}

.discovery-badge.nola {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border-color: rgba(236, 72, 153, 0.35);
}

.discovery-badge.military {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.35);
}

.discovery-badge.mills {
  background: rgba(20, 184, 166, 0.15);
  color: #2dd4bf;
  border-color: rgba(20, 184, 166, 0.35);
}

.discovery-badge.mayflower {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border-color: rgba(234, 179, 8, 0.4);
}

.discovery-badge.lothrop {
  background: rgba(147, 51, 234, 0.15);
  color: #c084fc;
  border-color: rgba(147, 51, 234, 0.4);
}

.discovery-badge.lawmen {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
}

.discovery-badge.sheriff {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.discovery-badge.brethren {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.discovery-badge.wallace {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  border-color: rgba(249, 115, 22, 0.4);
}

.discovery-badge.edgley {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.4);
}

.discovery-title {
  font-size: 19px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
  margin-bottom: 6px;
}

.discovery-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 14px;
  line-height: 1.45;
}

.discovery-story {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-main);
  margin-bottom: 16px;
}

.discovery-lineage-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.discovery-lineage-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.discovery-chain {
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.6;
}

.discovery-relatives {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.discovery-relative-pill {
  background: rgba(51, 65, 85, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.discovery-relative-pill:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #ffffff;
}

.discovery-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: auto;
}

.discovery-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}

.discovery-actions .btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
  text-align: center;
  justify-content: center;
}

/* Discovery Community Contributions & Additions */
.discovery-contributions-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(148, 163, 184, 0.2);
}

.discovery-contrib-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #38bdf8;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.discovery-contrib-item {
  background: rgba(15, 23, 42, 0.7);
  border-left: 3px solid #10b981;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 12px;
}

.discovery-contrib-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 11px;
}

.discovery-contrib-author {
  font-weight: 600;
  color: #93c5fd;
}

.discovery-contrib-date {
  color: var(--text-dim);
}

.discovery-contrib-text {
  color: #e2e8f0;
  line-height: 1.5;
}

.discovery-contrib-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 1px 6px;
  border-radius: 8px;
}

.discovery-add-container {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px dashed rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Detail Drawer Callout for Special Discoveries */
.discovery-drawer-callout {
  margin: 14px 0;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.75), rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.discovery-drawer-callout.mancuso {
  border-color: rgba(16, 185, 129, 0.45);
}

.discovery-drawer-callout.cuban {
  border-color: rgba(245, 158, 11, 0.45);
}

.discovery-drawer-callout.manson {
  border-color: rgba(168, 85, 247, 0.45);
}

.discovery-drawer-callout.mayflower {
  border-color: rgba(234, 179, 8, 0.5);
}

.discovery-drawer-callout.lothrop {
  border-color: rgba(147, 51, 234, 0.5);
}

.discovery-drawer-callout.lawmen {
  border-color: rgba(59, 130, 246, 0.5);
}

.discovery-drawer-callout.sheriff {
  border-color: rgba(239, 68, 68, 0.5);
}

.discovery-drawer-callout.brethren {
  border-color: rgba(16, 185, 129, 0.5);
}

.discovery-drawer-callout.wallace {
  border-color: rgba(249, 115, 22, 0.5);
}

.discovery-drawer-callout.edgley {
  border-color: rgba(244, 63, 94, 0.5);
}

.callout-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.callout-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.callout-header strong {
  font-size: 14px;
  color: #ffffff;
}

.discovery-drawer-callout p {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-main);
  margin-bottom: 10px;
}

.callout-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   VIEW 5: Biographical Lore & Stories
   ========================================================================== */

#stories-view {
  overflow-y: auto;
  background: var(--bg-app);
  padding: 28px 36px;
}

.stories-container {
  max-width: 1400px;
  margin: 0 auto;
}

.stories-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.stories-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
}

.stories-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stories-search-box input {
  width: 320px;
  height: 38px;
  padding: 0 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: 13px;
}

.stories-search-box input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 22px;
}

.story-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.story-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(56, 189, 248, 0.15);
}

.story-card-top {
  margin-bottom: 14px;
}

.story-card-name {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.story-card-branch {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.story-card-excerpt {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 16px;
}

.story-card-highlights {
  list-style: none;
  margin-bottom: 16px;
}

.story-card-highlights li {
  font-size: 12px;
  color: var(--text-muted);
  padding-left: 14px;
  position: relative;
  margin-bottom: 4px;
}

.story-card-highlights li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent-primary);
}

.story-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  font-size: 12px;
  color: var(--accent-primary);
  font-weight: 600;
}

/* ==========================================================================
   Detail Drawer (Sliding Panel)
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-drawer);
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--drawer-width);
  max-width: 100vw;
  height: 100vh;
  background: #0f172a;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.7);
  z-index: 300;
  transform: translateX(100%);
  transition: transform var(--transition-drawer);
  display: flex;
  flex-direction: column;
}

.detail-drawer.open {
  transform: translateX(0);
}

/* Drawer Header */
.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(15, 23, 42, 0.95);
}

.drawer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.drawer-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.drawer-badges-top {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Drawer Body */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Person Hero Section */
.drawer-hero {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.drawer-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1e293b, #334155);
  border: 2px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

.drawer-hero-info {
  flex: 1;
}

.drawer-name {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.drawer-lifespan {
  font-size: 13px;
  color: var(--accent-primary);
  font-weight: 600;
  margin-top: 4px;
}

.drawer-meta-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Drawer Sections */
.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

/* Vitals Card */
.vitals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.vital-item dt {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.vital-item dd {
  font-size: 12px;
  color: #ffffff;
  font-weight: 500;
  margin-top: 2px;
  line-height: 1.35;
}

/* Military / Patriot Box */
.patriot-callout {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(217, 119, 6, 0.18));
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  gap: 12px;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
}

.patriot-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.patriot-title {
  font-size: 12px;
  font-weight: 700;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.patriot-text {
  font-size: 13px;
  color: #fde047;
  line-height: 1.45;
  font-weight: 500;
}

/* Relationships */
.relation-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.rel-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  width: 70px;
  flex-shrink: 0;
  padding-top: 5px;
}

.rel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.rel-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: #ffffff;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.rel-chip:hover {
  background: var(--bg-card);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.rel-chip-sub {
  font-size: 10px;
  color: var(--text-dim);
}

/* Highlights List */
.highlights-list {
  list-style: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.highlights-list li {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.5;
  padding-left: 18px;
  position: relative;
  margin-bottom: 8px;
}

.highlights-list li:last-child {
  margin-bottom: 0;
}

.highlights-list li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--accent-primary);
  font-size: 11px;
  top: 2px;
}

/* Story Narrative */
.story-content {
  font-size: 14px;
  line-height: 1.7;
  color: #e2e8f0;
}

.story-content p {
  margin-bottom: 12px;
}

.story-content p:last-child {
  margin-bottom: 0;
}

.story-empty {
  font-style: italic;
  color: var(--text-dim);
  font-size: 13px;
}

/* Sources List */
.sources-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sources-list li {
  font-size: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  line-height: 1.4;
}

.sources-list a {
  color: var(--accent-primary);
  text-decoration: none;
  word-break: break-all;
}

.sources-list a:hover {
  text-decoration: underline;
}

/* Tags Cloud */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 1200px) {
  .search-box {
    width: 220px;
  }
  .filter-group select {
    max-width: 130px;
  }
}

@media (max-width: 900px) {
  .app-header {
    height: auto;
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .header-left, .header-right {
    justify-content: space-between;
    width: 100%;
  }

  .main-container {
    height: calc(100vh - 120px);
  }

  .detail-drawer {
    width: 100vw;
  }

  .tree-hud {
    top: 8px;
    left: 8px;
  }

  .hud-legend, .hud-instructions {
    display: none;
  }
}

/* ==========================================================================
   Firebase Authentication & User State
   ========================================================================== */

.auth-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--border-color);
}

.btn-auth {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(2, 132, 199, 0.25));
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-weight: 600;
}

.btn-auth:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(2, 132, 199, 0.4));
  color: #fff;
  border-color: #38bdf8;
}

.auth-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 11px;
  font-weight: 600;
  color: #34d399;
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  flex-shrink: 0;
}

/* ==========================================================================
   Authentication Modal Dialog
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-modal {
  width: 100%;
  max-width: 420px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
}

.modal-title-group h3 {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.4);
}

.auth-tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab-btn:hover {
  color: #fff;
}

.auth-tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
  background: rgba(56, 189, 248, 0.05);
}

.auth-alert {
  margin: 16px 20px 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
}

.auth-alert.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.auth-alert.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.auth-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.btn-block {
  width: 100%;
  height: 38px;
  margin-top: 4px;
  font-size: 13px;
}

/* ==========================================================================
   Drawer Memories Section (Firestore Live)
   ========================================================================== */

.section-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.section-header-flex .section-title {
  border-bottom: none;
  padding-bottom: 0;
}

.memories-login-prompt {
  background: rgba(30, 41, 59, 0.5);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.memories-login-prompt a {
  color: var(--accent-primary);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

.add-memory-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-card-hover);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.memory-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.ancestor-memories-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.memory-item {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.memory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.memory-author {
  font-weight: 600;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.memory-author::before {
  content: '👤';
  font-size: 10px;
}

.memory-date {
  color: var(--text-dim);
}

.memory-text {
  font-size: 13px;
  line-height: 1.55;
  color: #e2e8f0;
  white-space: pre-line;
}

.memory-item.verified-memory {
  border-left-color: #10b981;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
}

.memory-verified-bar {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.memory-verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  width: fit-content;
  transition: all var(--transition-fast);
}

.memory-verified-badge:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: #10b981;
  color: #ffffff;
  transform: translateY(-1px);
}

.memory-verified-note {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  margin-left: 2px;
}

/* Distinct Verified Family Addition in Narrative Area */
.verified-narrative-line {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 78, 59, 0.18));
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-left: 4px solid #10b981;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 14px 0;
  transition: all 0.3s ease;
}

.verified-line-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #34d399;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.verified-line-text {
  font-size: 13px;
  line-height: 1.6;
  color: #f8fafc;
  margin: 0 !important;
}

@keyframes highlightPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    border-color: #10b981;
  }
  70% {
    box-shadow: 0 0 0 12px rgba(16, 185, 129, 0);
    border-color: #34d399;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.highlight-pulse {
  animation: highlightPulse 2s ease-out;
}

/* ==========================================================================
   Print Stylesheet
   ========================================================================== */

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    overflow: visible !important;
  }

  .app-header, .tree-hud, .canvas-actions, .drawer-backdrop, .drawer-actions {
    display: none !important;
  }

  .detail-drawer {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
    color: #000000 !important;
  }

  .story-content, .vitals-grid, .highlights-list {
    color: #000000 !important;
  }
}
