:root {
  color-scheme: light;
  --ink: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --cta: #ea580c;
  --cta-dark: #c2410c;
  --border: #e2e8f0;
  --surface: #f8fafc;
  --gray-hex: #c9ccd1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #ffffff;
  color: var(--ink);
  line-height: 1.4;
}

a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* Header: solid blue bar (brought back per feedback -- the bars read as more
   trustworthy/branded than a plain white header), white text/wordmark instead
   of the yellow that was here before. */
.site-header {
  background: var(--accent);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.site-title {
  font-weight: 800;
  text-decoration: none;
  color: #ffffff;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.site-title:hover { text-decoration: none; }

.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.site-nav a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.site-nav a:hover { text-decoration: underline; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  color: #ffffff;
}

.nav-toggle svg { width: 24px; height: 24px; display: block; }

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 8px rgba(15, 23, 42, 0.06);
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.5rem 1.25rem 0.85rem;
    z-index: 10;
  }
  .site-nav.open { display: flex; }
  /* The dropdown panel itself is white, not blue like the header bar, so its
     links need dark text again -- white-on-white would be invisible. */
  .site-nav a { padding: 0.4rem 0; width: 100%; color: var(--ink); }
  .site-nav a:hover { color: var(--accent); text-decoration: none; }
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

/* Section headings: solid blue bar, full-bleed within main's padding, white
   text (brought back per feedback). Excludes .answer-panel h2, which is
   already inside its own highlighted callout box -- a second blue bar there
   would be visual noise, not clarity. */
main h2 {
  background: var(--accent);
  color: #ffffff;
  margin: 1.75rem -1rem 0.85rem;
  padding: 0.55rem 1rem;
  font-size: 1.05rem;
  font-weight: 700;
}

main h2:first-child { margin-top: 0; }

.answer-panel h2 {
  background: none;
  color: var(--ink);
  margin: 0 0 0.5rem;
  padding: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

/* Front-page hero: full-bleed gradient band so the address search reads as
   THE thing to do on this page, not one option among several -- big input,
   big CTA, drop shadow lifting the form off the gradient. */
.search-hero {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  margin: 0 -1rem 1.75rem;
  padding: 2.5rem 1.25rem 2.25rem;
  border-radius: 0 0 20px 20px;
  text-align: center;
}
.search-hero h1 { margin: 0 0 0.5rem; font-size: 2rem; color: white; }
.search-hero > p { margin: 0 auto 1.25rem; max-width: 34rem; color: rgba(255, 255, 255, 0.92); font-size: 1.1rem; }

.search-hero .address-form {
  max-width: 32rem;
  margin: 0 auto 0.6rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.3);
  overflow: hidden;
  gap: 0;
}
.search-hero .address-form input {
  border: none;
  padding: 1.1rem 1.25rem;
  font-size: 1.15rem;
  border-radius: 0;
}
.search-hero .address-form input:focus { outline: 2px solid var(--accent-dark); outline-offset: -2px; }
.search-hero .address-form button {
  padding: 1.1rem 1.6rem;
  font-size: 1.1rem;
  border-radius: 0;
  background: var(--cta);
}
.search-hero .address-form button:hover { background: var(--cta-dark); }

.search-hero .locate-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: white;
  font-size: 0.9rem;
  padding: 0.5rem 0.9rem;
}
.search-hero .locate-btn:hover { background: rgba(255, 255, 255, 0.22); }
.search-hero .address-status { color: white; font-weight: 600; }

@media (max-width: 480px) {
  .search-hero .address-form { flex-direction: column; border-radius: 12px; }
  .search-hero .address-form button { padding: 0.9rem; }
}

.district-intro h1 { margin-bottom: 0.25rem; font-size: 1.4rem; color: var(--ink); }
.muted { color: var(--muted); font-size: 0.9rem; }

.address-form {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 0.25rem;
}

.address-form input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.address-form button {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.address-form button:hover { background: var(--accent-dark); }

.address-status {
  min-height: 1.2em;
  font-size: 0.9rem;
  color: var(--muted);
}

.locate-btn { font-size: 0.85rem; padding: 0.4rem 0.75rem; }

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.toggle-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.toggle-group button {
  padding: 0.4rem 0.75rem;
  border: none;
  background: white;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink);
}

.toggle-group button.active {
  background: var(--accent);
  color: white;
}

.map {
  width: 100%;
  height: 60vh;
  min-height: 320px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.map-legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.map-legend i { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 3px; }

.ad-slot { margin: 1.5rem 0; }
.ad-slot-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.answer-panel {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.school-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.school-row:last-child { border-bottom: none; }

.district-list ul, .school-list ul, .county-group ul, .state-list { list-style: none; padding: 0; }
.district-list li, .school-list li { padding: 0.3rem 0; }
.county-group li {
  padding: 0.4rem 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

/* Big-number headline stats -- shown above the map on district/school pages
   since typical walk/drive/bus time is what people come to the page for,
   not something that should require a map click to see. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}
.stat-tile .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-dark);
  line-height: 1.1;
}
.stat-tile .stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.level-stats-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}
.level-stats-table caption {
  text-align: left;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}
.level-stats-table th, .level-stats-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.level-stats-table th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }

.district-row-stats { color: var(--muted); font-size: 0.85rem; }

.district-search { margin-top: 1.5rem; }
.district-search-results { list-style: none; padding: 0; margin: 0.5rem 0; }
.district-search-results li {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.district-search-results li:first-child { border-top: 1px solid var(--border); }

.state-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.state-list li a { font-weight: 600; }

#district-filter {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0.5rem 0 0.75rem;
}

/* ---- Report wizard (/report) ---- */
.wizard-steps {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 1rem 0 1.5rem;
  gap: 0;
  counter-reset: wizard-step;
}
.wizard-steps li {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 3px solid var(--border);
}
.wizard-steps li.active { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
.wizard-steps li::before {
  counter-increment: wizard-step;
  content: counter(wizard-step) '. ';
}

.wizard-panel h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }

.wizard-school-list { list-style: none; padding: 0; margin: 0.5rem 0; }
.wizard-school-pick {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.wizard-school-pick:hover { border-color: var(--accent); background: var(--surface); }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  background: #22c55e;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.3rem;
}

/* Honeypot: hidden from real users but not via display:none/visibility:hidden,
   which some bots specifically detect and skip -- off-screen positioning instead. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.report-bus { margin-top: 0.4rem; font-size: 0.85rem; }
.report-bus summary { cursor: pointer; color: var(--accent); }
.bus-report-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
.bus-report-form label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--muted); gap: 0.15rem; }
.bus-report-form input[type="number"] { width: 4.5rem; padding: 0.3rem; border: 1px solid var(--border); border-radius: 4px; }
.bus-report-form button { padding: 0.35rem 0.75rem; border: none; border-radius: 4px; background: var(--accent); color: white; cursor: pointer; font-size: 0.85rem; }
.report-status { font-size: 0.8rem; color: var(--muted); }

@media (min-width: 600px) {
  .map { height: 70vh; }
}

.auth-page { max-width: 26rem; }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--ink);
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.auth-form button {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.auth-form button:hover { background: var(--accent-dark); }

.nav-auth-slot { display: inline-flex; gap: 1rem; align-items: center; }
.nav-auth-slot a { color: inherit; text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.nav-auth-slot a:hover { text-decoration: underline; }
.nav-auth-slot button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}
.nav-auth-slot button:hover { text-decoration: underline; }

.account-reports table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.account-reports th, .account-reports td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.account-reports th { color: var(--muted); font-weight: 600; }
.account-reports input[type="number"] { width: 4rem; padding: 0.3rem; border: 1px solid var(--border); border-radius: 4px; }
.account-reports button { padding: 0.3rem 0.6rem; border: 1px solid var(--border); border-radius: 4px; background: white; cursor: pointer; font-size: 0.85rem; }
.account-reports button:hover { background: var(--surface); }
.account-reports button.danger { border-color: #ef4444; color: #ef4444; }

/* ---- Admin ---- */

/* Admin nav is a handful of links, always visible -- simpler than the public
   hamburger menu (there's no #nav-toggle button on admin pages to drive it),
   so it overrides the public nav's mobile collapse and just wraps instead. */
.admin-nav {
  display: flex !important;
  position: static !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  padding: 0 !important;
  gap: 1.25rem;
}
.admin-nav a { color: #ffffff !important; width: auto !important; padding: 0 !important; }

.admin-main { max-width: 1100px; }

.admin-flash {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.admin-filter {
  width: 100%;
  max-width: 26rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0.5rem 0;
  display: block;
}

.admin-filter-form { display: flex; gap: 0.5rem; align-items: center; margin: 0.5rem 0; flex-wrap: wrap; }
.admin-filter-form .admin-filter { margin: 0; flex: 1; min-width: 16rem; }

.admin-pager { display: flex; gap: 0.75rem; align-items: center; margin: 1rem 0; }

.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.88rem; }
.admin-table th, .admin-table td { border: 1px solid var(--border); padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
.admin-table th { background: var(--surface); font-weight: 600; }
.admin-table tr:hover { background: #fafbfc; }

.admin-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.admin-actions form { display: inline; }

.btn {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--surface); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-accept { background: #22c55e; border-color: #22c55e; color: white; }
.btn-accept:hover { background: #16a34a; }
.btn-reject { background: #ef4444; border-color: #ef4444; color: white; }
.btn-reject:hover { background: #dc2626; }
.btn-danger { border-color: #ef4444; color: #ef4444; background: white; }
.btn-danger:hover { background: #fef2f2; }

.admin-form { max-width: 40rem; }
.admin-form .field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; }
.admin-form label { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.admin-form .hint { font-size: 0.78rem; color: var(--muted); font-weight: 400; }
.admin-form input[type="text"],
.admin-form input[type="number"],
.admin-form input[type="email"],
.admin-form input[type="url"],
.admin-form select,
.admin-form textarea {
  padding: 0.5rem 0.65rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
}
.admin-form textarea { min-height: 6rem; font-family: ui-monospace, monospace; font-size: 0.8rem; }
.admin-form .checkbox-field { flex-direction: row; align-items: center; gap: 0.5rem; }
.admin-form .checkbox-field label { font-weight: 500; }

.admin-section { margin: 2rem 0; padding-top: 1rem; border-top: 1px solid var(--border); }
.admin-danger-zone { margin: 2rem 0; padding: 1rem; border: 1px solid #fecaca; border-radius: 8px; background: #fef2f2; }
.admin-danger-zone h2 { background: none !important; color: #991b1b !important; margin: 0 0 0.5rem !important; padding: 0 !important; font-size: 1rem !important; }

/* Site-wide floating address search -- appears on every page via _foot.php so
   "find my school" is never more than one click away, regardless of what page
   a visitor lands on from search/social. */
.fab-search-btn {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem;
  border: none;
  border-radius: 999px;
  background: var(--cta);
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.4);
  cursor: pointer;
}
.fab-search-btn:hover { background: var(--cta-dark); box-shadow: 0 12px 32px rgba(15, 23, 42, 0.48); }
.fab-search-btn svg { width: 1.15rem; height: 1.15rem; flex: none; }

.fab-search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 45;
}

.fab-search-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  width: min(340px, calc(100vw - 2.5rem));
  background: white;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.3);
  padding: 1rem;
}
.fab-search-panel h2 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.fab-search-panel .address-form { margin: 0.5rem 0 0.25rem; }
.fab-search-panel .locate-btn { display: block; margin: 0 auto; }
.fab-search-panel-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: none;
  background: none;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem;
}

[hidden] { display: none !important; }

@media (max-width: 600px) {
  .fab-search-btn { padding: 0.7rem 0.95rem; font-size: 0.85rem; gap: 0.4rem; }
  .fab-search-btn svg { width: 1rem; height: 1rem; }
}
