@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;700;800&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  --bg-dark: #0a0b0e;
  --bg-sidebar: #0f1115;
  --bg-card: #14161d;
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-active: rgba(255, 255, 255, 0.15);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-dimmed: #6b7280;
  
  /* High contrast minimal accents (solid, no glow) */
  --accent-arrest: #ef4444; /* Crisp red */
  --accent-lawsuit: #f59e0b; /* Amber */
  --accent-milestone: #3b82f6; /* Blue */
  --accent-win: #10b981; /* Emerald */
  --accent-link: #7dd3fc; /* Accessible link blue on dark */
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --transition-fast: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-medium: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variable Overrides */
body.light-theme {
  --bg-dark: #f8f9fa;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --border-subtle: #e9ecef;
  --border-active: #dee2e6;
  
  --text-primary: #12141c;
  --text-secondary: #495057;
  --text-dimmed: #868e96;
  --accent-link: #075985;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  display: flex;
}

/* 1. Split Screen Layout */

/* Left Sidebar (Fixed) */
.sidebar {
  width: 360px;
  min-width: 360px;
  height: 100vh;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 10;
}

.brand-section {
  margin-bottom: 30px;
}

.brand-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--accent-arrest);
  padding: 4px 12px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-arrest);
  border-radius: 50%;
  animation: dot-pulse 1.8s infinite ease-in-out;
}

@keyframes dot-pulse {
  0% { transform: scale(0.85); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.5; }
  100% { transform: scale(0.85); opacity: 1; }
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}
.theme-toggle-btn:hover {
  border-color: var(--border-active);
  color: var(--text-primary);
}
.theme-toggle-btn svg {
  fill: currentColor;
  width: 16px;
  height: 16px;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 15px;
}

.tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 400;
  margin-bottom: 25px;
}

.donation-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 9999px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  width: 100%;
  justify-content: center;
  transition: var(--transition-fast);
}

.donation-btn:hover {
  background: var(--text-primary);
  color: var(--bg-dark);
  transform: translateY(-1px);
}

.donation-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

body.light-theme .donation-btn {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.15);
}

body.light-theme .donation-btn:hover {
  background: var(--text-primary);
  color: var(--bg-sidebar);
}

.campaign-card {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(255, 255, 255, 0.02));
}

.campaign-card-header,
.campaign-amount {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.campaign-card-header {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.campaign-live {
  color: var(--accent-win);
  font-size: 0.6rem;
}

.campaign-amount {
  margin-top: 8px;
}

.campaign-amount strong {
  color: var(--text-primary);
  font-size: 1.35rem;
}

.campaign-amount span {
  color: var(--text-dimmed);
  font-size: 0.72rem;
}

.campaign-progress {
  height: 5px;
  margin: 9px 0 10px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
}

.campaign-progress span {
  display: block;
  width: 6.37%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-lawsuit);
}

.campaign-card p {
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.45;
}

.campaign-card > a {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent-lawsuit);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}

.campaign-card > a:hover {
  text-decoration: underline;
}

/* Audio Player Wrapper */
.audio-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 30px;
}

.audio-header {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dimmed);
  text-transform: uppercase;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
}

.audio-player-container {
  background-color: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

audio {
  display: none; /* We hide the native audio bar to style it cleanly */
}

/* Custom Mini Audio UI controls */
.audio-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.play-main-btn {
  background: var(--text-primary);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}
.play-main-btn:hover {
  transform: scale(1.05);
}

.play-main-btn svg {
  fill: var(--bg-dark);
  width: 14px;
  height: 14px;
}

.audio-info {
  flex-grow: 1;
}

.track-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.time-display {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Progress bar */
.progress-bar-container {
  height: 4px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}
body.light-theme .progress-bar-container {
  background: rgba(0, 0, 0, 0.05);
}
.progress-bar-fill {
  height: 100%;
  background: var(--text-primary);
  width: 0%;
  border-radius: 2px;
  pointer-events: none;
}

/* Filters in Sidebar */
.filter-section {
  margin: 30px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  text-align: left;
  padding: 10px 16px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}
.filter-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}
body.light-theme .filter-btn:hover {
  background: rgba(0, 0, 0, 0.03);
}
.filter-btn.active {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  font-weight: 700;
}
body.light-theme .filter-btn.active {
  background: rgba(0, 0, 0, 0.04);
}

.sidebar-footer {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dimmed);
  line-height: 1.4;
}

.sidebar-footer a {
  color: var(--accent-link);
  text-decoration: none;
  border-bottom: 1px solid var(--text-dimmed);
}
.sidebar-footer a:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.disclaimer-panel {
  margin-top: 12px;
  color: var(--text-dimmed);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  line-height: 1.45;
}

/* 2. Right Timeline Panel (Horizontal scrolling) */
.timeline-container {
  flex-grow: 1;
  height: 100vh;
  overflow-x: auto;
  overflow-y: auto;
  white-space: nowrap;
  position: relative;
}

/* Custom Scrollbar for timeline container */
.timeline-container::-webkit-scrollbar {
  height: 8px;
}
.timeline-container::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
.timeline-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}
body.light-theme .timeline-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}
.timeline-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
body.light-theme .timeline-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.timeline-track {
  display: inline-flex;
  align-items: flex-start;
  min-height: 100%;
  height: auto;
  padding: 100px 100px 80px;
  position: relative;
}

/* Timeline Horizontal Axis Line */
.timeline-track::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 72px;
  height: 1px;
  background-color: var(--border-subtle);
  z-index: 1;
}

/* Timeline Node / Card Container */
.timeline-node {
  display: inline-flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  width: 420px;
  margin: 0 50px;
  z-index: 2;
  white-space: normal; /* Restore normal wrap inside cards */
}

/* Date marker on the timeline line */
.node-marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--bg-dark);
  border: 2px solid var(--text-dimmed);
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  transition: var(--transition-fast);
  z-index: 5;
}

.timeline-node.active .node-marker {
  background-color: var(--text-primary);
  border-color: var(--text-primary);
  transform: translateY(-50%) scale(1.4);
}

/* Keep every card on the same top-aligned reading row. */
.timeline-node .node-marker {
  top: -32px;
  transform: translateX(0);
}

.timeline-node.active .node-marker {
  transform: translateX(0) scale(1.4);
}

/* Alternate connection lines from dot to card */
.timeline-node::after {
  content: '';
  position: absolute;
  left: 34px;
  width: 1px;
  background-color: var(--border-subtle);
  height: 24px;
  z-index: 1;
}
.timeline-node::after {
  top: -24px;
}

.timeline-node.active::after {
  background-color: rgba(255,255,255,0.2);
}
body.light-theme .timeline-node.active::after {
  background-color: rgba(0,0,0,0.1);
}

/* Card Styling (Editorial, flat, crisp) */
.timeline-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  transition: var(--transition-medium);
  position: relative;
  overflow: hidden;
}

.timeline-node.active .timeline-card {
  border-color: var(--border-active);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
body.light-theme .timeline-node.active .timeline-card {
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

/* Card Illustration Image style */
.card-illustration {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.date-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dimmed);
}

.category-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid transparent;
}

/* Minimal Category Borders */
.timeline-node[data-category="Arrests"] .category-tag {
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--accent-arrest);
}
.timeline-node[data-category="Lawsuits"] .category-tag {
  border-color: rgba(245, 158, 11, 0.2);
  color: var(--accent-lawsuit);
}
.timeline-node[data-category="Milestones"] .category-tag {
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--accent-milestone);
}
.timeline-node[data-category="Wins"] .category-tag {
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--accent-win);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 15px;
}

/* Play Audio Button inside Card */
.play-node-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.play-node-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-active);
}
body.light-theme .play-node-btn:hover {
  background: rgba(0, 0, 0, 0.02);
}

.play-node-btn svg {
  fill: currentColor;
  width: 8px;
  height: 8px;
}

/* Expandable content area */
.card-details {
  display: none;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0;
}

.timeline-card.expanded .card-details {
  display: block;
  max-height: none;
  overflow: visible;
  margin-top: 15px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}

.card-source {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.card-source span {
  color: var(--text-dimmed);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-source a {
  color: var(--accent-link);
  text-decoration: none;
}

.card-source a:hover {
  text-decoration: underline;
}

.detail-section {
  margin-bottom: 10px;
}
.detail-section:last-child {
  margin-bottom: 0;
}
.detail-section strong {
  color: var(--text-primary);
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  margin-bottom: 2px;
}

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

/* Actions footer */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
}

.expand-btn {
  background: transparent;
  border: none;
  color: var(--text-dimmed);
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 500;
}
.expand-btn:hover {
  color: var(--text-primary);
}

/* 3. Global Info overlay for scrolling */
.scroll-indicator {
  position: absolute;
  bottom: 178px;
  right: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dimmed);
  background: var(--bg-sidebar);
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  z-index: 5;
  pointer-events: none;
}

.scroll-indicator svg {
  fill: currentColor;
  width: 12px;
  height: 12px;
}

/* 4. Gamified HUD Panel - 3x2 Compact Layout */
.hud-panel {
  position: fixed;
  top: auto;
  bottom: 24px;
  right: 40px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 24px;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  pointer-events: none; /* Let clicks pass through */
}
body.light-theme .hud-panel {
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
}

/* Borders between items */
.hud-item:not(:nth-child(3n)) {
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  padding-right: 12px;
}
body.light-theme .hud-item:not(:nth-child(3n)) {
  border-right-color: rgba(0, 0, 0, 0.04);
}

.hud-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-dimmed);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  white-space: nowrap;
}

.hud-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  transition: var(--transition-fast);
}

/* Specific color highlight based on metrics */
.hud-item.filed-active .hud-value { color: var(--text-primary); }
.hud-item.dropped-active .hud-value { color: var(--accent-win); }
.hud-item.charges-active .hud-value { color: var(--accent-arrest); }
.hud-item.jail-active .hud-value { color: var(--accent-lawsuit); }
.hud-item.felonies-active .hud-value { color: var(--accent-arrest); }
.hud-item.probation-active .hud-value { color: var(--accent-milestone); }

/* Pulse animation for HUD when numbers tick */
@keyframes hud-tick {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); filter: brightness(1.3); }
  100% { transform: scale(1); }
}

.hud-value.tick {
  animation: hud-tick 0.25s ease-out;
}

/* Timeline Year Markers */
.timeline-year-marker {
  position: absolute;
  top: 30px;
  height: calc(100% - 60px);
  border-left: 1px dashed var(--border-active);
  padding-left: 15px;
  z-index: 1;
  pointer-events: none;
}

.timeline-year-marker span {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-primary);
  opacity: 0.15;
  letter-spacing: 0.05em;
  position: sticky;
  top: 30px;
  display: block;
}

body.light-theme .timeline-year-marker span {
  opacity: 0.1;
}

/* Media Query for small viewports */
@media (max-width: 900px) {
  body {
    flex-direction: column;
    overflow-y: auto;
    height: auto;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 30px 20px;
  }
  
  .timeline-container {
    height: 600px;
    overflow-y: auto;
  }
  
  .timeline-track {
    padding: 100px 40px 60px;
  }
  
  .timeline-node {
    width: 320px;
    margin: 0 20px;
  }

  .hud-panel {
    position: relative;
    top: 0;
    bottom: auto;
    right: 0;
    box-shadow: none;
    width: 100%;
    border: none;
    border-top: 1px solid var(--border-subtle);
    border-radius: 0;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 20px 10px;
  }

  .hud-item:not(:nth-child(3n)) {
    border-right: none;
    padding-right: 0;
  }
}

/* ==========================================
   CASE DETAILS MODAL STYLING
   ========================================== */

/* Clickable trigger links inside timeline text */
.case-trigger {
  color: var(--accent-link);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 700;
  transition: var(--transition-fast);
}

.case-records {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.case-records-label {
  margin-bottom: 8px;
  color: var(--text-dimmed);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.case-record-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.case-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: 4px;
  padding: 5px 7px;
  background: rgba(125, 211, 252, 0.06);
  color: var(--accent-link);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-decoration: none;
}

.case-link:hover {
  background: rgba(125, 211, 252, 0.14);
  border-color: var(--accent-link);
}

.case-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.case-disposition {
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.68rem;
}
.case-trigger:hover {
  color: var(--text-primary);
  opacity: 0.85;
}

/* Modal dialog container */
.case-modal {
  width: 90%;
  max-width: 850px;
  max-height: 85vh;
  border-radius: 12px;
  border: 1px solid var(--border-active);
  background-color: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  padding: 0;
  overflow: hidden;
  margin: auto;
  z-index: 1000;
}

.modal-disclaimer {
  margin-top: 18px;
  color: var(--text-dimmed);
  font-size: 0.72rem;
  line-height: 1.45;
}

/* Backdrop overlay */
.case-modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Header style */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-sidebar);
}

.modal-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  padding: 0 4px;
}
.close-modal-btn:hover {
  color: var(--accent-arrest);
}

/* Modal Body */
.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(85vh - 80px);
}

/* Loading and Error States */
.loading-state, .error-state {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 40px 0;
}
.error-state {
  color: var(--accent-arrest);
}

/* Court metadata layout */
.case-info-block {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 25px;
  background-color: var(--bg-dark);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.case-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.case-info-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dimmed);
  text-transform: uppercase;
}
.case-info-value {
  font-size: 0.92rem;
  font-weight: 600;
}
.case-caption {
  grid-column: span 2;
}

/* Sections inside modal */
.modal-section {
  margin-bottom: 30px;
}
.modal-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

/* Table layouts in modal */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-dark);
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}
.modal-table th, .modal-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.modal-table th {
  background-color: var(--bg-sidebar);
  font-weight: 700;
  color: var(--text-primary);
}
.modal-table tr:last-child td {
  border-bottom: none;
}

/* Highlight the guilty/conviction row */
.modal-table tr.guilty-row {
  background-color: rgba(16, 185, 129, 0.08); /* Soft win green highlight */
}
.modal-table tr.guilty-row td {
  color: var(--text-primary);
  font-weight: 600;
}
.badge-guilty {
  background-color: var(--accent-win);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-dismissed {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}
body.light-theme .badge-dismissed {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Document List styling */
.doc-list {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background-color: var(--bg-dark);
}
.doc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}
.doc-item:last-child {
  border-bottom: none;
}
.doc-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
  padding-right: 15px;
}
.doc-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.doc-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}
body.light-theme .doc-badge {
  background-color: rgba(0, 0, 0, 0.05);
}
.doc-caption {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.doc-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dimmed);
}

/* Custom Scrollbars inside modal elements */
.modal-body::-webkit-scrollbar,
.doc-list::-webkit-scrollbar,
.table-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.modal-body::-webkit-scrollbar-track,
.doc-list::-webkit-scrollbar-track,
.table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb,
.doc-list::-webkit-scrollbar-thumb,
.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-active);
  border-radius: 3px;
}

/* Responsive modal formatting */
@media (max-width: 600px) {
  .case-info-block {
    grid-template-columns: 1fr;
  }
  .case-caption {
    grid-column: span 1;
  }
  .modal-body {
    padding: 16px;
  }
}

/* ==========================================
   🖨️ PRINT RULES (Resolves cutoff dockets)
   ========================================== */
@media print {
  /* Hide the rest of the application completely */
  body > * {
    display: none !important;
  }

  /* Force display only the modal, taking up the full page size */
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
    overflow: visible !important;
  }

  .case-modal, dialog[open] {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    overflow: visible !important;
  }

  .modal-content, .modal-body {
    overflow: visible !important;
    max-height: none !important;
    padding: 0 !important;
  }

  .modal-header {
    border-bottom: 2px solid #000000 !important;
    padding: 10px 0 !important;
    background: transparent !important;
  }
  .close-modal-btn {
    display: none !important; /* Hide close button in printout */
  }

  .case-info-block {
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    color: #000000 !important;
  }

  .table-wrapper, .doc-list {
    overflow: visible !important;
    max-height: none !important;
    border: none !important;
    background: transparent !important;
  }

  .modal-table {
    page-break-inside: avoid !important;
  }
  .modal-table th {
    background-color: #f1f3f5 !important;
    color: #000000 !important;
    border-bottom: 2px solid #dee2e6 !important;
  }
  .modal-table td {
    border-bottom: 1px solid #dee2e6 !important;
    color: #000000 !important;
  }

  .doc-item {
    page-break-inside: avoid !important;
    border-bottom: 1px solid #dee2e6 !important;
  }
  
  .badge-guilty {
    border: 1px solid #000000 !important;
    background: transparent !important;
    color: #000000 !important;
    padding: 1px 4px !important;
  }
}
