/* ============================================
   WARNData Design System — Shared Styles
   ============================================ */

:root {
  --bg: #FAFAF7;
  --bg-card: #FFFFFF;
  --bg-warm: #F5F0EB;
  --bg-resource: #EEF2E8;
  --text-primary: #1A1A1A;
  --text-secondary: #5C5C5C;
  --text-muted: #8A8A8A;
  --accent: #C25B3F;
  --accent-light: #E8C4B8;
  --accent-hover: #A84830;
  --blue: #3B6B8A;
  --blue-light: #E3EEF4;
  --green: #4A7A5B;
  --green-light: #E2EDE5;
  --amber: #B8860B;
  --amber-light: #FDF3D7;
  --border: #E5E2DC;
  --border-light: #DDD8D0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- NAV ---- */
nav {
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.nav-logo {
  font-family: 'Source Serif 4', serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo .dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }
.nav-logo-icon { width: 22px; height: 22px; flex-shrink: 0; }
.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a {
  text-decoration: none; color: var(--text-secondary); font-size: 0.88rem;
  font-weight: 500; transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a.active { color: var(--text-primary); font-weight: 600; }

/* ---- NAV SEARCH ---- */
.nav-search-wrap { position: relative; }
.nav-search {
  width: 220px; padding: 6px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif; background: var(--bg);
  outline: none; transition: border-color 0.2s, width 0.2s;
}
.nav-search:focus { border-color: var(--blue); width: 280px; }
.search-dropdown {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  min-width: 320px; max-height: 400px; overflow-y: auto;
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  z-index: 200; margin-top: 4px;
}
.search-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; text-decoration: none; color: var(--text-primary);
  border-bottom: 1px solid var(--border-light); transition: background 0.1s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-warm); }
.search-name { font-size: 0.85rem; font-weight: 500; }
.search-meta {
  font-size: 0.72rem; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace; white-space: nowrap; margin-left: 12px;
}
.nav-cta {
  background: var(--text-primary); color: white !important; padding: 6px 16px;
  border-radius: 6px; font-size: 0.82rem !important; font-weight: 600 !important;
  transition: background 0.2s;
}
.nav-cta:hover { background: #333 !important; }

/* ---- CONTAINER ---- */
.container {
  max-width: 1280px; margin: 0 auto; padding: 2rem 2rem 3rem;
}

/* ---- PAGE HEADER ---- */
.page-header { margin-bottom: 2rem; }
.breadcrumb {
  font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem;
}
.breadcrumb a { color: var(--blue); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 6px; color: var(--border); }
.page-header h1 {
  font-family: 'Source Serif 4', serif; font-size: 2rem; font-weight: 700;
  line-height: 1.2; margin-bottom: 0.25rem;
}
.page-header .subtitle {
  font-size: 0.95rem; color: var(--text-secondary); max-width: 640px;
}
.last-updated {
  font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ---- SECTION LABELS ---- */
.section-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.75rem 0;
}

/* ---- STAT CARDS ---- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 1.25rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.stat-label {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.5rem;
}
.stat-value {
  font-family: 'Source Serif 4', serif; font-size: 2rem; font-weight: 700;
  line-height: 1.1;
}
.stat-value-text {
  font-size: 1.1rem; font-family: 'DM Sans', sans-serif; font-weight: 600;
  line-height: 1.3;
}
.stat-change {
  font-size: 0.78rem; margin-top: 0.35rem; font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}
.stat-change.up { color: var(--accent); }
.stat-change.down { color: var(--green); }
.stat-change.neutral { color: var(--text-muted); }
.stat-card.highlight { background: var(--accent); border-color: var(--accent); }
.stat-card.highlight .stat-label { color: rgba(255,255,255,0.7); }
.stat-card.highlight .stat-value { color: white; }
.stat-card.highlight .stat-change { color: rgba(255,255,255,0.8); }

/* ---- CHART BOXES ---- */
.chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.chart-row.equal { grid-template-columns: 1fr 1fr; }
.chart-box {
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem;
}
.chart-box h3 {
  font-size: 0.88rem; font-weight: 600; margin-bottom: 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.chart-toggle {
  font-size: 0.75rem; color: var(--blue); cursor: pointer; font-weight: 500;
}

/* ---- BAR CHART ---- */
.chart-header-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}
.chart-header-row h3 { margin-bottom: 0; flex-shrink: 0; }
.chart-avg {
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  color: var(--text-muted); white-space: nowrap;
}
.chart-placeholder {
  height: 220px; display: flex; align-items: flex-end;
  gap: 3px; padding-top: 20px; position: relative;
}
.chart-bar {
  flex: 1; border-radius: 3px 3px 0 0; transition: opacity 0.2s;
  position: relative; cursor: pointer; min-width: 8px;
}
.chart-bar:hover { opacity: 0.8; z-index: 10; }
.chart-bar::after {
  content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%); background: var(--text-primary); color: white;
  padding: 4px 8px; border-radius: 4px; font-size: 0.7rem; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
  font-family: 'JetBrains Mono', monospace; z-index: 20;
}
.chart-bar:hover::after { opacity: 1; }

/* ---- YOY COMPARISON BARS ---- */
.yoy-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
  font-size: 0.82rem;
}
.yoy-label { width: 80px; text-align: right; color: var(--text-muted); font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace; flex-shrink: 0; }
.yoy-track { flex: 1; height: 24px; background: var(--border-light); border-radius: 3px; position: relative; overflow: hidden; }
.yoy-fill { height: 100%; border-radius: 3px; display: flex; align-items: center; padding-left: 8px;
  font-size: 0.72rem; font-weight: 600; color: white; font-family: 'JetBrains Mono', monospace;
  transition: width 0.6s ease; }
.yoy-fill.current { background: var(--accent); }
.yoy-fill.previous { background: var(--accent-light); color: var(--text-secondary); }

/* ---- DONUT CHART ---- */
.donut-wrap { display: flex; align-items: center; gap: 1.5rem; }
.donut-svg { flex-shrink: 0; }
.donut-legend { flex: 1; }
.donut-legend-item {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  font-size: 0.82rem;
}
.donut-legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.donut-legend-pct { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  color: var(--text-muted); margin-left: auto; }

/* ---- RATIO BAR (closure vs layoff) ---- */
.ratio-bar-wrap { margin-bottom: 1.5rem; }
.ratio-bar-label { display: flex; justify-content: space-between; font-size: 0.78rem;
  color: var(--text-secondary); margin-bottom: 6px; }
.ratio-bar { height: 28px; border-radius: 4px; overflow: hidden; display: flex; }
.ratio-segment { display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 600; color: white; transition: width 0.6s ease; }
.ratio-segment.closure { background: var(--accent); }
.ratio-segment.layoff { background: var(--amber); }

/* ---- NOTICE DAYS DISTRIBUTION ---- */
.notice-dist { display: flex; align-items: flex-end; gap: 2px; height: 60px; margin-top: 8px; }
.notice-bar { flex: 1; border-radius: 2px 2px 0 0; position: relative; cursor: pointer;
  transition: opacity 0.15s; }
.notice-bar:hover { opacity: 0.75; }
.notice-bar::after {
  content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%); background: var(--text-primary); color: white;
  padding: 3px 6px; border-radius: 3px; font-size: 0.65rem; white-space: nowrap;
  opacity: 0; pointer-events: none; font-family: 'JetBrains Mono', monospace; }
.notice-bar:hover::after { opacity: 1; }
.notice-labels { display: flex; justify-content: space-between; font-size: 0.68rem;
  color: var(--text-muted); margin-top: 4px; font-family: 'JetBrains Mono', monospace; }
.notice-stat { font-size: 0.82rem; color: var(--text-secondary); margin-top: 8px; }
.notice-stat strong { color: var(--text-primary); }
.notice-warn { color: var(--accent); font-weight: 600; }

/* ---- MAP / HEATMAP TOGGLE ---- */
.map-view-toggle {
  font-size: 0.78rem; font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}
.map-toggle-link {
  color: var(--text-muted); text-decoration: none; padding: 2px 0;
  transition: color 0.15s;
}
.map-toggle-link:hover { color: var(--accent); }
.map-toggle-link.active { color: var(--accent); font-weight: 600; }
.map-toggle-sep { color: var(--border); margin: 0 0.35rem; }

/* ---- US GEO MAP ---- */
.us-map-wrap { position: relative; width: 100%; max-width: 720px; margin: 0 auto; }
.us-map-svg { width: 100%; height: auto; display: block; }
.us-map-state {
  stroke: var(--bg-card); stroke-width: 1.2; cursor: pointer;
  transition: opacity 0.12s, stroke-width 0.12s;
}
.us-map-state:hover { opacity: 0.82; stroke-width: 2; stroke: var(--text-primary); }
.us-map-state-link { text-decoration: none; }
.us-map-tooltip {
  position: absolute; pointer-events: none; opacity: 0;
  background: var(--text-primary); color: var(--bg-card);
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; font-weight: 600;
  padding: 4px 10px; border-radius: 4px; white-space: nowrap;
  transition: opacity 0.1s; z-index: 10;
}
.map-legend {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; margin-top: 0.75rem; font-size: 0.7rem; color: var(--text-muted);
}
.map-legend-swatch { width: 28px; height: 10px; border-radius: 2px; }
.map-legend-label { font-weight: 600; margin: 0 4px; }

/* ---- HEATMAP GRID ---- */
.heatmap-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.heatmap-cell {
  aspect-ratio: 1.6; border-radius: 3px; display: flex;
  align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; cursor: pointer;
  transition: transform 0.1s; position: relative; color: var(--text-primary);
}
.heatmap-cell:hover { transform: scale(1.15); z-index: 2; }
.heat-0 { background: #f0ede8; }
.heat-1 { background: #f5ddd3; }
.heat-2 { background: #e8b8a4; }
.heat-3 { background: #d4917a; }
.heat-4 { background: #c25b3f; color: white; }
.heat-5 { background: #8b3a25; color: white; }

/* ---- COUNTY CHOROPLETH (simplified grid) ---- */
.county-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.county-cell {
  aspect-ratio: 1.3; border-radius: 3px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 0.6rem; cursor: pointer;
  transition: transform 0.1s; position: relative;
}
.county-cell:hover { transform: scale(1.1); z-index: 2; }
.county-cell .county-name { font-weight: 600; line-height: 1.1; text-align: center; }
.county-cell .county-count { font-family: 'JetBrains Mono', monospace; font-size: 0.58rem; opacity: 0.8; }

/* ---- TABLES ---- */
.data-table-wrap {
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem;
}
.data-table-header {
  padding: 1rem 1.5rem; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--border-light);
}
.data-table-header h3 { font-size: 0.88rem; font-weight: 600; }
.data-table-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filter-pill {
  padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 500;
  border: 1px solid var(--border); background: var(--bg-card); cursor: pointer;
  transition: all 0.15s; color: var(--text-secondary);
}
.filter-pill.active, .filter-pill:hover {
  background: var(--text-primary); color: white; border-color: var(--text-primary);
}
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th {
  text-align: left; padding: 0.75rem 1.25rem; font-size: 0.72rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); border-bottom: 1px solid var(--border-light);
  background: var(--bg-card); user-select: none;
}
th[data-col] { cursor: pointer; position: relative; transition: color 0.15s; }
th[data-col]:hover { color: var(--text-primary); }
th[data-col]::after {
  content: ''; display: inline-block; margin-left: 4px;
  opacity: 0.3; font-size: 0.6rem; vertical-align: middle;
}
th.sorted::after { opacity: 0.8; }
th.sorted.desc::after { content: '\25BE'; }
th.sorted.asc::after { content: '\25B4'; }
td { padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border-light); }
.td-right { text-align: right; white-space: nowrap; }
.th-right { text-align: right; }
tr:hover td { background: rgba(0,0,0,0.015); }
.company-link { color: var(--blue); text-decoration: none; font-weight: 500; }
.company-link:hover { text-decoration: underline; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.72rem; font-weight: 600; }
.badge-closure { background: #FCEAEA; color: #B33A3A; }
.badge-layoff { background: var(--amber-light); color: #8B6914; }
.workers-count { font-family: 'JetBrains Mono', monospace; font-weight: 500; font-size: 0.85rem; text-align: right; }
.filing-address { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.filing-badge {
  display: inline-block; font-size: 0.68rem; font-weight: 600;
  background: #f0e6d3; color: #7a6545; border: 1px solid #c4a97a;
  border-radius: 3px; padding: 1px 6px; margin-left: 6px;
  vertical-align: middle; cursor: help; white-space: nowrap;
}
.table-toggle {
  padding: 0.75rem 1.25rem; text-align: center; font-size: 0.82rem;
  font-weight: 500; color: var(--blue); cursor: pointer;
  border-top: 1px solid var(--border-light); transition: background 0.15s;
}
.table-toggle:hover { background: var(--blue-light); }
.badge[title] { cursor: help; }

/* ---- NOTABLE CALLOUT ---- */
.notable-callout {
  background: var(--amber-light); border: 1px solid #E8D9A0;
  border-radius: var(--radius); padding: 0.75rem 1.25rem; margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 0.75rem;
  font-family: 'DM Sans', sans-serif; font-size: 0.88rem;
}
.notable-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--amber); white-space: nowrap; flex-shrink: 0;
}
.notable-stat {
  margin-left: auto; font-family: 'JetBrains Mono', monospace;
  font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); white-space: nowrap;
}

/* ---- TOP LISTS ---- */
.top-list { list-style: none; }
.top-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0; border-bottom: 1px solid var(--border-light); font-size: 0.85rem;
}
.top-list li:last-child { border-bottom: none; }
.top-list .rank {
  width: 24px; height: 24px; border-radius: 50%; background: var(--bg-warm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  margin-right: 0.75rem; flex-shrink: 0;
}
.top-list .rank-1 { background: var(--accent); color: white; }
.top-list .rank-2 { background: var(--accent-light); color: var(--accent); }
.top-list .rank-3 { background: var(--accent-light); color: var(--accent); }
.top-list .name { flex: 1; }
.top-list .count { font-family: 'JetBrains Mono', monospace; font-weight: 500; color: var(--text-secondary); font-size: 0.82rem; }

/* ---- RESOURCE BOX (displaced workers) ---- */
.resource-box {
  background: var(--bg-resource); border: 1px solid #D1DDCA;
  border-radius: var(--radius-lg); padding: 1.75rem; margin-bottom: 2rem;
}
.resource-box h3 {
  font-family: 'Source Serif 4', serif; font-size: 1.15rem; font-weight: 600;
  margin-bottom: 0.25rem; color: var(--green);
}
.resource-box > p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1.25rem; }

/* Resource items (icon + link + description) */
.resource-items { margin-bottom: 0.25rem; }
.resource-item {
  display: flex; gap: 0.75rem; padding: 0.75rem 0;
  border-bottom: 1px solid rgba(193, 212, 184, 0.5);
}
.resource-item:last-child { border-bottom: none; }
.resource-icon {
  width: 22px; height: 22px; flex-shrink: 0; color: var(--green);
  margin-top: 1px;
}
.resource-item-link {
  font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 600;
  color: var(--green); text-decoration: none;
}
.resource-item-link:hover { text-decoration: underline; }
.resource-item-desc {
  font-family: 'DM Sans', sans-serif; font-size: 0.82rem;
  color: var(--text-secondary); margin-top: 2px; line-height: 1.5;
}

/* Legacy flat resource links (kept for backward compat) */
.resource-links { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.resource-link {
  padding: 8px 16px; background: white; border: 1px solid #C1D4B8;
  border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 500;
  color: var(--green); text-decoration: none; transition: all 0.15s;
}
.resource-link:hover { background: var(--green); color: white; border-color: var(--green); }

/* About WARN Act explainer box */
.about-warn-box {
  background: var(--bg-warm); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem 1.75rem; margin-bottom: 2rem;
}
.about-warn-box h3 {
  font-family: 'Source Serif 4', serif; font-size: 1rem; font-weight: 600;
  margin-bottom: 0.5rem; color: var(--text-primary);
}
.about-warn-box p {
  font-family: 'DM Sans', sans-serif; font-size: 0.85rem;
  color: var(--text-secondary); line-height: 1.7;
}

/* AJCC Job Center Finder */
.ajcc-section {
  margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid #C1D4B8;
}
.ajcc-section h4 {
  font-family: 'Source Serif 4', serif; font-size: 1.05rem;
  font-weight: 600; color: var(--green); margin-bottom: 0.5rem;
}
.ajcc-intro { font-family: 'DM Sans', sans-serif; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1rem; }
.ajcc-intro strong { color: var(--text-primary); }
.ajcc-selectors { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.ajcc-select-group { display: flex; flex-direction: column; gap: 0.25rem; min-width: 200px; flex: 1; }
.ajcc-select-group label { font-family: 'DM Sans', sans-serif; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.ajcc-select-group select {
  padding: 0.5rem 0.75rem; border: 1px solid #C1D4B8; border-radius: var(--radius-sm);
  background: white; font-size: 0.85rem; color: var(--text-primary);
  font-family: 'DM Sans', sans-serif; cursor: pointer;
}
.ajcc-select-group select:disabled { opacity: 0.5; cursor: not-allowed; }
.ajcc-card {
  display: flex; gap: 0.75rem; padding: 1rem; background: white;
  border: 1px solid #C1D4B8; border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}
.ajcc-card-icon { color: var(--green); flex-shrink: 0; padding-top: 2px; }
.ajcc-card-icon svg { display: block; }
.ajcc-card-body { flex: 1; }
.ajcc-card-name { font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.2rem; }
.ajcc-card-addr { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 0.35rem; }
.ajcc-card-links { display: flex; gap: 1rem; font-family: 'DM Sans', sans-serif; font-size: 0.82rem; }
.ajcc-card-links a { color: var(--green); text-decoration: none; }
.ajcc-card-links a:hover { text-decoration: underline; }

/* ---- ALERT BOX (recruiters) ---- */
.alert-box {
  background: var(--blue-light); border: 1px solid #B8D1E0;
  border-radius: var(--radius-lg); padding: 1.75rem; margin-bottom: 2rem;
}
.alert-box h3 {
  font-family: 'Source Serif 4', serif; font-size: 1.15rem; font-weight: 600;
  margin-bottom: 0.5rem; color: var(--blue);
}
.alert-box p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1rem; }
.alert-form { display: flex; gap: 0.5rem; max-width: 480px; }
.alert-input {
  flex: 1; padding: 10px 14px; border: 1px solid #B8D1E0; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-family: 'DM Sans', sans-serif; background: white;
}
.alert-input:focus { outline: none; border-color: var(--blue); }
.alert-btn {
  padding: 10px 20px; background: var(--blue); color: white; border: none;
  border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; font-family: 'DM Sans', sans-serif; transition: background 0.15s;
  white-space: nowrap;
}
.alert-btn:hover { background: #2D5770; }

/* ---- SEARCH BAR ---- */
.search-bar {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 2rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,107,138,0.1); }
.search-bar svg { flex-shrink: 0; color: var(--text-muted); }
.search-bar input {
  flex: 1; border: none; background: none; font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif; outline: none; color: var(--text-primary);
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ---- TICKER BAR ---- */
.ticker-bar {
  background: var(--bg-warm); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1.25rem; margin-bottom: 2rem;
  display: flex; align-items: center; justify-content: space-evenly;
  overflow: hidden; font-size: 0.82rem; max-height: 44px;
}
.ticker-label {
  font-weight: 700; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--accent); white-space: nowrap; flex-shrink: 0;
}
.ticker-item { white-space: nowrap; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.ticker-item strong { color: var(--text-primary); }
.ticker-link { color: var(--text-primary); text-decoration: none; }
.ticker-link:hover { text-decoration: underline; }
.ticker-divider { color: var(--border); }

/* ---- COMPANY HEADER ---- */
.company-header {
  display: flex; align-items: flex-start; gap: 2rem; margin-bottom: 2rem;
  padding-bottom: 2rem; border-bottom: 1px solid var(--border-light);
}
.company-info { flex: 1; }
.company-meta { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.company-meta-item {
  font-size: 0.85rem; color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
}
.company-meta-item strong { color: var(--text-primary); font-weight: 600; }

/* ---- EFFECTIVE BADGE ---- */
.eff-badge {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 3px 12px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 0.5rem;
}
.eff-badge.upcoming { background: #e8f5e9; color: #2e7d32; }
.eff-badge.recent { background: #fff3e0; color: #e65100; }

/* ---- NARRATIVE BLOCK ---- */
.narrative-block {
  background: var(--bg-offset);
  border-left: 3px solid var(--accent-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* ---- SPARKLINE ---- */
.sparkline { display: inline-flex; align-items: flex-end; gap: 1px; height: 24px; vertical-align: middle; }
.sparkline-bar { width: 3px; border-radius: 1px; background: var(--accent-light); transition: background 0.15s; }
.sparkline-bar:last-child { background: var(--accent); }

/* ---- TIMELINE ---- */
.timeline { margin-bottom: 2rem; padding-top: 0.25rem; }
.timeline-group { margin-bottom: 1rem; }

/* Summary card for multi-filing dates */
.tl-summary-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 1rem 1.25rem;
  cursor: pointer; position: relative; z-index: 2;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.tl-summary-card:hover { border-color: var(--accent-light); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.tl-summary-top { display: flex; justify-content: space-between; align-items: flex-start; }
.tl-summary-date {
  font-family: 'JetBrains Mono', monospace; font-size: 0.82rem;
  font-weight: 600; color: var(--text-primary); margin-bottom: 0.2rem;
}
.tl-summary-detail { font-size: 0.82rem; color: var(--text-secondary); }
.tl-summary-toggle {
  font-size: 0.78rem; color: var(--accent); white-space: nowrap;
  padding-top: 2px; font-weight: 500;
}

/* Stacked layers behind summary card */
.tl-stack-layers { position: relative; height: 8px; margin: 0 6px; }
.tl-stack-layer {
  position: absolute; left: 0; right: 0;
  height: 6px; border: 1px solid var(--border-light);
  border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--bg);
}
.tl-stack-layer:first-child { top: 0; }
.tl-stack-layer:last-child { top: 4px; left: 4px; right: 4px; }

/* Hide stack layers when expanded */
.tl-summary-card.expanded + .timeline-entries ~ .tl-stack-layers,
.timeline-group .tl-stack-layers.hidden { display: none; }

/* Entries container */
.timeline-entries { padding: 0.5rem 0 0 0; }
.timeline-entries.collapsed { display: none; }

/* Individual entry cards */
.timeline-entry-card {
  background: var(--bg); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); padding: 1rem 1.25rem;
  margin-bottom: 0.5rem; margin-left: 1.5rem;
  border-left: 3px solid var(--accent-light);
}
.timeline-entry-card h4 { font-size: 0.88rem; font-weight: 600; margin-bottom: 0.2rem; }
.timeline-entry-card p { font-size: 0.8rem; color: var(--text-secondary); margin: 0; }
.timeline-address { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.2rem; }

/* Single-filing cards */
.timeline-entry-card.single {
  margin-left: 0; border-left: 3px solid var(--accent);
}
.tl-single-date {
  font-family: 'JetBrains Mono', monospace; font-size: 0.78rem;
  color: var(--text-muted); margin-bottom: 0.35rem;
}

/* View toggle (Table / Timeline) */
.view-toggle { display: flex; gap: 0; }
.view-btn {
  padding: 0.35rem 0.85rem; font-size: 0.78rem; font-weight: 500;
  border: 1px solid var(--border-light); background: var(--bg);
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.view-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.view-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; }
.view-btn.active {
  background: var(--text-primary); color: var(--bg); border-color: var(--text-primary);
}
.data-table-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.data-table-controls { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* ---- RELATED ITEMS ---- */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.related-card {
  background: var(--bg); border: 1px solid var(--border-light); border-radius: var(--radius);
  padding: 1.25rem; transition: transform 0.15s, box-shadow 0.15s; text-decoration: none; color: inherit;
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.related-card h4 { font-size: 0.88rem; font-weight: 600; margin-bottom: 0.25rem; color: var(--blue); }
.related-card p { font-size: 0.78rem; color: var(--text-muted); }
.related-card .related-stat { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; font-weight: 600; margin-top: 0.5rem; }

/* ---- FOOTER ---- */
.footer {
  max-width: 1280px; margin: 0 auto; padding: 2rem;
  border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.78rem;
  display: flex; justify-content: space-between; align-items: center;
}
.footer a { color: var(--text-secondary); text-decoration: none; }
.footer a:hover { color: var(--text-primary); }
.footer-links { display: flex; gap: 1.5rem; }

/* ---- RESPONSIVE: tablets and most phones ---- */
@media (max-width: 768px) {
  nav { padding: 0 1rem; }
  .nav-links { gap: 0.75rem; }
  .nav-links a:not(.nav-cta) { display: none; }

  /* Shrink search so it doesn't crowd "Get Alerts" */
  .nav-search { width: 160px; font-size: 0.78rem; }
  .nav-search:focus { width: 190px; }

  /* Search dropdown: fixed position so it escapes nav overflow:hidden, clamps to viewport */
  .search-dropdown {
    min-width: 0;
    width: calc(100vw - 2rem);
    right: 1rem;
    left: auto;
    position: fixed;
    top: 56px;
    margin-top: 0;
  }

  .container { padding: 1.25rem 1rem 2rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-row, .chart-row.equal { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.5rem; }
  .company-header { flex-direction: column; gap: 1rem; }
  .heatmap-grid { grid-template-columns: repeat(5, 1fr); }
  .us-map-wrap { max-width: 100%; }
  .map-legend-swatch { width: 20px; }
  .county-grid { grid-template-columns: repeat(4, 1fr); }
  .alert-form { flex-direction: column; }
  .timeline-item { grid-template-columns: 20px 1fr; gap: 0 0.5rem; }
  .donut-wrap { flex-direction: column; }
  .related-grid { grid-template-columns: 1fr; }

  /* Ticker: stack each filing on its own line, hide | dividers */
  .ticker-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    max-height: none;
    overflow: visible;
    padding: 0.75rem 1rem;
  }
  .ticker-item { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ticker-divider { display: none; }

  /* Quick-help bar: stack vertically, hide dot separators */
  .quick-help-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .quick-help-bar > * { flex-shrink: 0; }
  .quick-help-sep { display: none; }
}

/* ---- RESPONSIVE: narrow phones (under 480px) ---- */
@media (max-width: 480px) {

  /* Tables: reduce font size and padding to fit more content */
  table.sortable { font-size: 0.78rem; }
  table.sortable th,
  table.sortable td { padding: 8px 6px; }

  /*
   * Hide the "Filed" date column (always last, col 5 or 6) on all page types.
   * Hide the "Type" column (col 3 on 6-col tables) on national/state/company pages.
   * City table is 5 cols: Company | Type | Workers | Effective | Filed
   *   -- hide col 5 (Filed) only; Type is col 2 and is the only type indicator so keep it.
   * 6-col tables: Company/Location | City/State/Location | Type | Workers | Effective | Filed
   *   -- hide col 3 (Type) and col 6 (Filed).
   *
   * CSS nth-child targets visible columns in thead and tbody rows equally.
   */

  /* All tables: hide the last column (Filed) */
  table.sortable thead tr th:last-child,
  table.sortable tbody tr td:last-child { display: none; }

  /*
   * 6-column tables only: also hide the Type column (3rd column).
   * Guards:
   *   :not(:last-child)         -- not the only column
   *   :not(:nth-last-child(2))  -- not second-to-last (would be Effective)
   *   :not(:nth-last-child(3))  -- not third-from-last (protects Workers in 5-col city table)
   * In 6-col tables col3 is nth-last-child(4), so all guards pass -> hidden.
   * In 5-col city table col3 is nth-last-child(3), so the third guard blocks it -> safe.
   * In 4-col companies table col3 is nth-last-child(2), so the second guard blocks it -> safe.
   */
  table.sortable thead tr th:nth-child(3):not(:last-child):not(:nth-last-child(2)):not(:nth-last-child(3)),
  table.sortable tbody tr td:nth-child(3):not(:last-child):not(:nth-last-child(2)):not(:nth-last-child(3)) { display: none; }

  /* Stat cards: tighten up on very small screens */
  .stat-value { font-size: 1.6rem; }
  .stat-grid { gap: 0.75rem; }

  /* Page header: tighten spacing */
  .page-header h1 { font-size: 1.3rem; }
  .page-header .subtitle { font-size: 0.85rem; }

  /* Footer: stack on small screens */
  .footer { flex-direction: column; gap: 1rem; text-align: center; }
  .footer-links { justify-content: center; }
}
/* ================================================
   Alert Form Enhancements (append to styles.css)
   ================================================ */

/* Alert location dropdowns for company pages */
.alert-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.alert-fields .alert-input {
  width: 100%;
  box-sizing: border-box;
}

.alert-location-row {
  display: flex;
  gap: 8px;
}

.alert-select {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d3cec7;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  background: #fff;
  color: var(--text);
  appearance: auto;
}

.alert-select:disabled {
  background: #f5f1ec;
  color: #aaa;
  cursor: not-allowed;
}

.alert-fields .alert-btn {
  width: 100%;
  white-space: nowrap;
}

/* Override the inline flex layout for company alert forms */
.alert-box .alert-form[data-alert-type="company"],
.alert-box .alert-form[data-alert-type="state_company"],
.alert-box .alert-form[data-alert-type="city_company"] {
  flex-direction: column;
}

/* Success/error message styling */
.alert-msg {
  text-align: center;
}

@media (min-width: 600px) {
  .alert-location-row {
    max-width: 100%;
  }

  .alert-fields .alert-input {
    max-width: 100%;
  }
}
