/**
 * POLITICADE: BALANCE YOUR CITY & COUNTY BUDGET GAME
 * Powered by YDHLGE Local Government Dataset (1,218 Cities & 254 Counties)
 * Dark Mode Theme (#080c14) with Cyan, Emerald, Indigo, and Amber Accents
 */

:root {
  --loc-cyan: #06b6d4;
  --loc-cyan-hover: #0891b2;
  --loc-cyan-glow: rgba(6, 182, 212, 0.25);
  --loc-blue: #3b82f6;
  --loc-emerald: #10b981;
  --loc-amber: #f59e0b;
  --loc-red: #f43f5e;
  --loc-purple: #a855f7;

  --bg-primary: #080c14;
  --bg-card: rgba(15, 23, 42, 0.78);
  --bg-card-hover: rgba(30, 41, 59, 0.88);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-active: rgba(6, 182, 212, 0.45);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-bright: #ffffff;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --font-mono: 'JetBrains Mono', monospace, ui-monospace;
}

.local-page-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 5rem;
}

/* Hero Section */
.local-hero {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 2.25rem 1.5rem;
  background: radial-gradient(circle at 50% 20%, rgba(6, 182, 212, 0.14), rgba(59, 130, 246, 0.05) 55%, transparent 75%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
}

.local-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  background: rgba(6, 182, 212, 0.14);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius-full);
  color: #22d3ee;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.local-title {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.85rem;
}

.local-title-gradient {
  background: linear-gradient(135deg, #22d3ee 0%, #3b82f6 50%, #10b981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.local-desc {
  max-width: 860px;
  margin: 0 auto;
  font-size: 1.02rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Jurisdiction Selector Command Box */
.jurisdiction-command-card {
  background: var(--bg-card);
  border: 1px solid rgba(6, 182, 212, 0.28);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.jur-search-row {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr 0.8fr;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 1rem;
}

@media (max-width: 920px) {
  .jur-search-row {
    grid-template-columns: 1fr;
  }
}

.jur-search-input-wrap {
  position: relative;
}

.jur-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.78rem 1rem 0.78rem 2.5rem;
  background: rgba(8, 12, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.jur-search-input:focus {
  border-color: var(--loc-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.jur-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 1rem;
}

.jur-select-dropdown {
  width: 100%;
  padding: 0.78rem 0.9rem;
  background: rgba(8, 12, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.jur-search-results-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 340px;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid rgba(6, 182, 212, 0.45);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
  z-index: 250;
  display: none;
}

.jur-search-item {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
}

.jur-search-item:hover {
  background: rgba(6, 182, 212, 0.15);
}

.jur-featured-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 1.15rem;
}

.jur-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  border-radius: var(--radius-full);
  padding: 0.32rem 0.78rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.jur-chip:hover {
  border-color: var(--loc-cyan);
  color: #fff;
  background: rgba(6, 182, 212, 0.12);
}

.jur-chip.active {
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
}

/* Active Jurisdiction Snapshot Banner */
.jur-active-banner {
  background: rgba(8, 12, 20, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.jur-badge-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.22rem 0.65rem;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.18);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.jur-badge-type.county {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.jur-quick-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.jur-stat-pill {
  display: flex;
  flex-direction: column;
}

.jur-stat-pill .lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}

.jur-stat-pill .val {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
}

/* Sticky KPI Bar */
.sticky-kpi-bar {
  position: sticky;
  top: 0.75rem;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(10, 15, 26, 0.93);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.25rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.kpi-metrics-group {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  flex-wrap: wrap;
  flex: 1;
}

.kpi-box {
  display: flex;
  flex-direction: column;
  min-width: 130px;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.kpi-value {
  font-size: 1.3rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: #fff;
}

.kpi-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-sub.surplus {
  color: var(--loc-emerald);
}

.kpi-sub.deficit {
  color: var(--loc-red);
}

.kpi-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-auto-tax-cut {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-auto-tax-cut:hover {
  background: rgba(16, 185, 129, 0.28);
  color: #fff;
}

.btn-reset-local {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-reset-local:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.btn-lock-local {
  background: linear-gradient(135deg, #06b6d4 0%, #2563eb 100%);
  border: none;
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-lock-local:hover {
  filter: brightness(1.1);
}

/* Tabs Bar */
.local-tabs-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.local-tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.8rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: all 0.15s;
}

.local-tab-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.local-tab-btn.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(37, 99, 235, 0.2));
  border-color: var(--loc-cyan);
  color: #fff;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.15);
}

/* Department & Lever Cards */
.dept-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dept-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  transition: border-color 0.2s;
}

.dept-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.dept-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.dept-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dept-title {
  font-size: 1.12rem;
  font-weight: 800;
  margin: 0;
  color: #fff;
}

.dept-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0.3rem 0 0;
  line-height: 1.45;
  max-width: 760px;
}

.dept-amounts {
  text-align: right;
}

.dept-current-val {
  font-size: 1.35rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: #fff;
}

.dept-delta-badge {
  display: inline-block;
  font-size: 0.76rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.dept-delta-badge.cut {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.dept-delta-badge.hike {
  background: rgba(244, 63, 94, 0.18);
  color: #fb7185;
}

.spending-slider {
  width: 100%;
  accent-color: var(--loc-cyan);
  height: 8px;
  cursor: pointer;
  margin: 0.5rem 0;
}

.preset-btns-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-step-pct {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 0.32rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-step-pct:hover,
.btn-step-pct.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--loc-cyan);
  color: #fff;
}

.subitems-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.6rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.subitem-box {
  background: rgba(8, 12, 20, 0.55);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

/* Structural Reforms Grid */
.reforms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.1rem;
}

.reform-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s;
  cursor: pointer;
}

.reform-card.active {
  border-color: var(--loc-emerald);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.12);
}

/* Results View */
.results-banner {
  text-align: center;
  background: radial-gradient(circle at 50% 0%, rgba(6, 182, 212, 0.2), rgba(15, 23, 42, 0.9) 70%);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  margin-bottom: 1.75rem;
}

.results-grade-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4, #10b981);
  color: #fff;
  font-size: 2.4rem;
  font-weight: 900;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 28px rgba(6, 182, 212, 0.4);
}

.results-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.res-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  text-align: center;
}

.res-stat-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}

.res-stat-value {
  font-size: 1.45rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: #fff;
  margin: 0.35rem 0;
}

.res-stat-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Modals & Toast */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 560px;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}

.budget-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #0f172a;
  border: 1px solid var(--loc-cyan);
  color: #fff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  z-index: 2000;
  display: none;
}

.permalink-input {
  background: rgba(8, 12, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #f8fafc;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.btn-copy-permalink {
  background: rgba(6, 182, 212, 0.18);
  border: 1px solid var(--loc-cyan);
  color: #22d3ee;
  font-weight: 700;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-copy-permalink:hover {
  background: rgba(6, 182, 212, 0.3);
  color: #fff;
}
