/* ===== OpenSpringfield - Shining a Light on City Spending ===== */

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

:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-card-hover: #1a1a1a;
  --bg-input: #1a1a1a;
  --gold: #d4a843;
  --gold-dim: #b8922e;
  --gold-glow: rgba(212,168,67,.25);
  --white: #f0f0f0;
  --white-dim: #a0a0a0;
  --text: #e0e0e0;
  --text-muted: #888;
  --border: #2a2a2a;
  --red: #e05555;
  --green: #55b870;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,.4);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; transition: color .2s; }
a:hover { color: var(--white); }

/* --- Typography --- */
h1, h2, h3, h4 { color: var(--white); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
h3 { font-size: 1.25rem; }

/* --- Layout --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 60px 0; }

/* --- Navigation --- */
.navbar {
  background: rgba(10,10,10,.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 24px;
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-brand {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-brand .brand-icon {
  width: 1.2em;
  height: 1.2em;
  stroke: var(--gold);
  flex-shrink: 0;
}
.nav-brand span { color: var(--white); }
.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a {
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: color .2s;
  position: relative;
}
.nav-links a:hover, .nav-links a.active { color: var(--gold); }
.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
}
.nav-toggle { display: none; background: none; border: none; color: var(--white); font-size: 1.5rem; cursor: pointer; }

/* --- Hero --- */
.hero {
  position: relative;
  text-align: center;
  padding: 120px 24px 90px;
  overflow: hidden;
  background: url('../assets/city-hall.jpg') center center / cover no-repeat;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 50% 40%, rgba(212,168,67,0.12) 0%, transparent 70%),
    linear-gradient(to bottom, rgba(10,10,10,0.72) 0%, rgba(10,10,10,0.88) 60%, var(--bg) 100%);
  pointer-events: none;
  z-index: 0;
}
.hero::before {
  content: '';
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 60%);
  pointer-events: none;
  z-index: 1;
  opacity: .6;
}
.hero > * { position: relative; z-index: 2; }
.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
.hero h1 .highlight { color: var(--gold); }
.hero .tagline {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 32px;
}
.hero .quote {
  font-style: italic;
  color: var(--gold-dim);
  font-size: .95rem;
  margin-bottom: 40px;
  opacity: .85;
}
.hero .quote cite { display: block; font-style: normal; font-size: .8rem; color: var(--text-muted); margin-top: 4px; }

/* --- Search Bar (hero) --- */
.search-hero {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}
.search-hero input {
  width: 100%;
  padding: 16px 56px 16px 20px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--white);
  font-size: 1rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-hero input::placeholder { color: var(--text-muted); }
.search-hero input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.search-hero button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--gold);
  border: none;
  color: var(--bg);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.search-hero button:hover { background: var(--gold-dim); }

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  transition: border-color .2s, transform .15s;
}
.stat-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold);
  font-family: var(--mono);
}
.stat-card .stat-label {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* --- About --- */
.about-section {
  max-width: 740px;
  margin: 0 auto;
  text-align: center;
}
.about-section p {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-top: 16px;
}

/* --- Cards / Panels --- */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

/* --- Filters --- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group-search { flex: 2; min-width: 200px; }
.filter-group label {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.filter-group input,
.filter-group select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  padding: 10px 12px;
  font-size: .9rem;
  outline: none;
  transition: border-color .2s;
  min-width: 140px;
  box-sizing: border-box;
}
.filter-group input:focus,
.filter-group select:focus { border-color: var(--gold); }
.filter-group select option { background: var(--bg-card); }

/* --- Search Page Filters --- */
.search-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.search-filters-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  width: 100%;
}
.search-filters-row .filter-group {
  flex: 1;
  min-width: 0;
}
.search-filters-row .filter-group input,
.search-filters-row .filter-group select {
  width: 100%;
  box-sizing: border-box;
}

/* --- Vendor Filters --- */
.vendor-filters {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  width: 100%;
}
.vendor-search-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vendor-search-wrap label,
.vendor-sort-wrap label {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.search-input-row {
  display: flex;
  gap: 8px;
}
.search-input-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  padding: 10px 12px;
  font-size: .9rem;
  outline: none;
  transition: border-color .2s;
}
.search-input-row input:focus { border-color: var(--gold); }
.btn-reset {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  padding: 10px 14px;
  font-size: .9rem;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn-reset:hover { border-color: var(--gold); color: var(--white); }
.vendor-sort-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}
.vendor-sort-wrap select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  padding: 10px 12px;
  font-size: .9rem;
  outline: none;
  transition: border-color .2s;
}
.vendor-sort-wrap select:focus { border-color: var(--gold); }
.vendor-sort-wrap select option { background: var(--bg-card); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
}
a.btn-primary, .btn-primary { background: var(--gold); color: #0a0a0a !important; font-weight: 700; text-decoration: none; }
a.btn-primary:hover, .btn-primary:hover { background: var(--gold-dim); color: #0a0a0a !important; }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--gold); color: var(--gold); }
.btn-sm { padding: 6px 14px; font-size: .8rem; }

/* --- Tables --- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
thead th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
thead th:hover { color: var(--gold); }
thead th.sorted { color: var(--gold); }
thead th .sort-arrow { margin-left: 4px; font-size: .7rem; }
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  white-space: nowrap;
}
tbody tr:hover { background: rgba(212,168,67,.04); }
td.amount {
  font-family: var(--mono);
  text-align: right;
  font-weight: 600;
}
td.vendor-link { cursor: pointer; color: var(--gold); }
td.vendor-link:hover { text-decoration: underline; }

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}
.pagination button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
  transition: all .2s;
}
.pagination button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.pagination button:disabled { opacity: .3; cursor: default; }
.pagination button.active { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.pagination .page-info { color: var(--text-muted); font-size: .85rem; }

/* --- Results Info --- */
.results-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.results-count { color: var(--text-muted); font-size: .9rem; }
.results-count strong { color: var(--gold); }
.results-total { font-family: var(--mono); color: var(--gold); font-weight: 700; font-size: 1.1rem; }

/* --- Vendor Detail Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 900px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.modal-header h2 { font-size: 1.4rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--white); }
.modal-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.modal-stat { }
.modal-stat .label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.modal-stat .value { font-size: 1.2rem; font-weight: 700; color: var(--gold); font-family: var(--mono); }

/* --- Charts --- */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 24px;
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.chart-card h3 { margin-bottom: 16px; font-size: 1.1rem; }
.chart-card canvas { width: 100% !important; }
.chart-card-full {
  grid-column: 1 / -1;
}

/* --- About Page --- */
.about-section {
  margin-bottom: 48px;
}
.about-section h2 {
  font-size: 1.5rem;
  margin-bottom: 16px;
  color: var(--gold);
}
.about-section p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 12px;
}
.about-section a {
  color: var(--gold);
  text-decoration: underline;
}
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.about-card-missing {
  border-color: rgba(255,255,255,0.08);
  opacity: 0.85;
}
.about-card-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.about-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--white);
}
.about-card p {
  font-size: .88rem;
  margin-bottom: 0;
}
.about-roadmap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}
.roadmap-item {
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.roadmap-content {
  flex: 1;
  text-align: center;
}
.roadmap-status {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
  min-width: 80px;
  text-align: center;
}
.roadmap-pending {
  background: rgba(212,168,67,0.15);
  color: var(--gold);
}
.roadmap-planned {
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
}
.roadmap-content h3 {
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--white);
}
.roadmap-content p {
  font-size: .88rem;
  margin-bottom: 0;
}
.about-list {
  color: var(--text-muted);
  line-height: 1.7;
  padding-left: 20px;
}
.about-list li {
  margin-bottom: 12px;
}
.about-list strong {
  color: var(--white);
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
}
.footer a { color: var(--gold); }

/* --- Page Header --- */
.page-header {
  padding: 40px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}
.page-header h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.page-header p { color: var(--text-muted); margin-top: 8px; }

/* --- Vendor List --- */
.vendor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}
.vendor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  transition: border-color .2s, transform .15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.vendor-card:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}
.vendor-card .vendor-name { font-weight: 600; color: var(--white); font-size: .95rem; }
.vendor-card .vendor-meta { text-align: right; }
.vendor-card .vendor-total { font-family: var(--mono); color: var(--gold); font-weight: 700; }
.vendor-card .vendor-count { font-size: .8rem; color: var(--text-muted); }

/* --- Loading --- */
.loading { text-align: center; padding: 60px; color: var(--text-muted); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 16px;
  }
  .nav-toggle { display: block; }
  .hero { padding: 60px 16px 50px; }
  /* Search page filters mobile */
  .search-filters-row { flex-direction: column; }
  .search-filters-row .filter-group { width: 100%; flex: unset; }
  .search-filters-row .filter-group input,
  .search-filters-row .filter-group select { width: 100%; }

  /* Global filter mobile fix */
  .filters { flex-direction: column; width: 100%; }
  .filters .filter-group { width: 100%; flex: unset; min-width: 0; }
  .filter-group-search { flex: unset; min-width: 0; }
  .filter-group input,
  .filter-group select { width: 100%; min-width: 0; box-sizing: border-box; }

  /* Vendor page filters */
  .vendor-filters { flex-direction: column; width: 100%; }
  .vendor-search-wrap,
  .vendor-sort-wrap { width: 100%; }
  .search-input-row { width: 100%; }
  .search-input-row input { min-width: 0; width: 100%; flex: 1; box-sizing: border-box; }
  .vendor-sort-wrap select { width: 100%; box-sizing: border-box; }
  .chart-grid { grid-template-columns: 1fr; }
  .vendor-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 20px; margin: 12px; }
  .results-info { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* --- Utility --- */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
