/* ============================================
   ZipDataPortal - Main Stylesheet
   www.zipdataportal.com
   ============================================ */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  line-height: 1.6;
  color: #333;
  margin: 0;
  padding: 0;
  background: #f5f7fa;
}

a { color: #1a5fa8; text-decoration: none; }
a:hover { color: #0d3d6f; text-decoration: underline; }

h1 { font-size: 1.75rem; color: #1a3c5e; margin-top: 0; margin-bottom: 0.75rem; }
h2 { font-size: 1.25rem; color: #1a3c5e; margin-top: 1.5rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.1rem; color: #2c5282; margin-top: 1.25rem; }
p  { margin-top: 0; margin-bottom: 1rem; }

/* ============================================
   Page Layout
   ============================================ */

.page-wrap {
  display: flex;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

.left-ad, .right-ad {
  width: 160px;
  flex-shrink: 0;
  padding: 20px 8px;
}


.main-column {
  flex: 1;
  min-width: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
}

/* ============================================
   Navigation
   ============================================ */

.topbar {
  display: flex;
  align-items: center;
  padding: 10px 24px;
  background: #1a3c5e;
  gap: 20px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.logo { height: 38px; width: auto; display: block; }

.nav-links { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }

.nav-links a {
  color: #c8dff5;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
  text-decoration: none;
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
  flex: 1;
  padding: 28px 36px;
}

/* ============================================
   Search
   ============================================ */

.search-wrapper { position: relative; flex: 1; }

.search { display: flex; gap: 8px; margin: 20px 0; }

.search input {
  flex: 1;
  width: 100%;
  padding: 11px 16px;
  border: 2px solid #cbd5e0;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search input:focus {
  border-color: #1a5fa8;
  box-shadow: 0 0 0 3px rgba(26,95,168,0.12);
}

.search button {
  padding: 11px 22px;
  background: #1a5fa8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.search button:hover { background: #0d3d6f; }

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #cbd5e0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  max-height: 320px;
  overflow-y: auto;
  z-index: 300;
  display: none;
}

.search-dropdown.visible { display: block; }

.search-dropdown a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  color: #333;
  text-decoration: none;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  transition: background 0.1s;
}

.search-dropdown a:last-child { border-bottom: none; }
.search-dropdown a:hover { background: #f0f6ff; text-decoration: none; }

.result-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  background: #718096;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.result-type.type-zip    { background: #2b6cb0; }
.result-type.type-city   { background: #276749; }
.result-type.type-county { background: #744210; }
.result-type.type-state  { background: #6b21a8; }

/* ============================================
   Homepage Links
   ============================================ */

.home-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.home-links a {
  display: block;
  padding: 18px 20px;
  background: #f0f6ff;
  border: 1px solid #bee3f8;
  border-radius: 10px;
  text-decoration: none;
  color: #1a5fa8;
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  transition: background 0.15s, box-shadow 0.15s;
}

.home-links a:hover {
  background: #dbeafe;
  box-shadow: 0 2px 8px rgba(26,95,168,0.12);
  text-decoration: none;
}

/* ============================================
   Trust Bar
   ============================================ */

.trust-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 16px;
  background: #f0f6ff;
  border: 1px solid #bee3f8;
  border-radius: 10px;
  padding: 18px 24px;
  margin: 8px 0 28px;
}

.trust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.trust-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a3c5e;
  line-height: 1.2;
}

.trust-label {
  font-size: 0.78rem;
  color: #5a7a99;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trust-divider {
  width: 1px;
  height: 40px;
  background: #bee3f8;
  flex-shrink: 0;
}

/* ============================================
   State Grid
   ============================================ */

.state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 12px 0 28px;
}

.state-grid a {
  display: block;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  color: #1a5fa8;
  text-align: center;
  transition: background 0.15s, box-shadow 0.15s;
}

.state-grid a:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  box-shadow: 0 2px 6px rgba(26,95,168,0.1);
  text-decoration: none;
}

/* ============================================
   ZIP Code Profile
   ============================================ */

.zip-overview {
  display: flex;
  gap: 24px;
  margin: 20px 0;
  flex-wrap: wrap;
  align-items: flex-start;
}

.zip-stats {
  flex: 1;
  min-width: 240px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  background: #f8fafc;
}

.zip-stats h2 {
  margin-top: 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 12px;
}

.zip-map-wrapper { flex: 1.5; min-width: 260px; }

#zip-map {
  height: 320px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #edf2f7;
  gap: 12px;
}

.stat-row:last-child { border-bottom: none; }
.stat-label { color: #718096; font-size: 14px; }
.stat-value { font-weight: 700; color: #1a3c5e; font-size: 15px; text-align: right; }

/* ============================================
   Tables
   ============================================ */

.zip-compare, .ranking-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.zip-compare th, .ranking-table th {
  background: #1a3c5e;
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.03em;
}

.zip-compare td, .ranking-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #edf2f7;
  color: #333;
}

.zip-compare tr:last-child td, .ranking-table tr:last-child td { border-bottom: none; }
.zip-compare tr:hover td, .ranking-table tr:hover td { background: #f0f6ff; }
.ranking-table td:first-child { font-weight: 600; color: #718096; width: 50px; }

/* ============================================
   Lists (States, Cities, Counties, ZIPs)
   ============================================ */

.nearby-zips {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 6px;
}

.nearby-zips li a {
  display: block;
  padding: 7px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  color: #1a5fa8;
  transition: background 0.12s;
}

.nearby-zips li a:hover { background: #ebf4ff; text-decoration: none; }

.state-list, .city-list, .county-list, .zip-list, .zipcounty-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 5px;
}

.state-list li a, .city-list li a, .county-list li a,
.zip-list li a, .zipcounty-list li a {
  display: block;
  padding: 6px 11px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  font-size: 14px;
  color: #1a5fa8;
  transition: background 0.12s;
}

.state-list li a:hover, .city-list li a:hover, .county-list li a:hover,
.zip-list li a:hover, .zipcounty-list li a:hover {
  background: #ebf4ff;
  text-decoration: none;
}

/* ============================================
   City Page
   ============================================ */

.city-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin: 16px 0;
  align-items: start;
}

/* ============================================
   Ranking List
   ============================================ */

.ranking-list { list-style: none; padding: 0; margin: 0; }

.ranking-list li {
  padding: 7px 0;
  border-bottom: 1px solid #edf2f7;
  font-size: 14px;
}

.ranking-list li:last-child { border-bottom: none; }

/* ============================================
   Breadcrumb
   ============================================ */

.breadcrumb {
  font-size: 13px;
  color: #718096;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.breadcrumb a { color: #4a90c4; }
.breadcrumb span { color: #a0aec0; }

/* ============================================
   Footer
   ============================================ */

.site-footer {
  margin-top: auto;
  padding: 28px 36px;
  background: #1a3c5e;
  color: #a0bacf;
  font-size: 13px;
  line-height: 1.7;
}

.footer-links { display: flex; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }

.footer-links a {
  color: #90b8d4;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.footer-links a:hover { color: #fff; text-decoration: none; }

.footer-data { margin-bottom: 18px; }
.footer-data p { margin-bottom: 6px; }
.footer-data a { color: #90b8d4; text-decoration: underline; }
.footer-data a:hover { color: #fff; }

.footer-copy { color: #607d8b; font-size: 12px; }
.footer-copy p { margin: 0; }

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1100px) {
  .left-ad, .right-ad { width: 120px; }
}

/* -----------------------------------------------
   Collapsible city/county lists (details/summary)
   ----------------------------------------------- */

details.collapsible-list {
  margin-bottom: 16px;
}
details.collapsible-list summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: #2563eb;
  padding: 8px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  list-style: none;
  user-select: none;
  margin-bottom: 12px;
}
details.collapsible-list summary::-webkit-details-marker { display: none; }
details.collapsible-list summary::after {
  content: '▸';
  font-size: 0.8rem;
  transition: transform 0.15s;
}
details.collapsible-list[open] summary::after {
  content: '▾';
}
details.collapsible-list summary:hover {
  background: #dbeafe;
}

/* -----------------------------------------------
   ZIP info block: see-more links + comparison table
   ----------------------------------------------- */

.see-more-links {
  display: inline-block;
  margin: 24px 0 8px;
  padding: 14px 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  vertical-align: top;
}
.see-more-links p {
  margin: 0 0 8px 0;
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.see-more-links ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.see-more-links ul li {
  margin: 5px 0;
}
.see-more-links ul li::before {
  content: '• ';
  color: #94a3b8;
}
.see-more-links ul li a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}
.see-more-links ul li a:hover { text-decoration: underline; }

/* Comparison table */
.comparison-block {
  margin: 24px 0;
}
.comparison-block h2 {
  margin-bottom: 12px;
}
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.comparison-table th,
.comparison-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}
.comparison-table thead tr {
  background: #f1f5f9;
}
.comparison-table th {
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
}
.comparison-table td.val-zip {
  font-weight: 700;
  color: #1d4ed8;
}
.comparison-table tbody tr:hover { background: #f8fafc; }
.comparison-table .na { color: #94a3b8; }

/* ==============================
   COLLAPSIBLE RANKING GROUPS
============================== */

.ranking-group,
.ranking-subgroup {
  border-bottom: 1px solid #e2e8f0;
}

.ranking-group > summary,
.ranking-subgroup > summary {
  cursor: pointer;
  padding: 10px 4px;
  font-weight: 600;
  color: #1e293b;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.ranking-group > summary::before {
  content: '▶';
  font-size: 0.65rem;
  color: #94a3b8;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.ranking-group[open] > summary::before {
  transform: rotate(90deg);
}

.ranking-subgroup > summary {
  font-weight: 500;
  font-size: 0.93rem;
  padding-left: 18px;
  color: #374151;
}

.ranking-subgroup > summary::before {
  content: '▶';
  font-size: 0.6rem;
  color: #cbd5e1;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.ranking-subgroup[open] > summary::before {
  transform: rotate(90deg);
}

.ranking-group ul,
.ranking-subgroup ul {
  margin: 0 0 10px 0;
  padding-left: 32px;
}

.ranking-group > ul,
.ranking-subgroup > ul {
  padding-left: 20px;
}

.ranking-group li,
.ranking-subgroup li {
  padding: 4px 0;
  font-size: 0.92rem;
}

.ranking-group summary:hover,
.ranking-subgroup summary:hover {
  color: #2563eb;
}

/* ==============================
   DEMOGRAPHICS CHARTS
============================== */

.charts-section {
  margin-top: 40px;
}

.charts-section h2 {
  margin-bottom: 16px;
}

.chart-subtitle {
  font-size: 0.85rem;
  font-weight: 400;
  color: #64748b;
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
}

.chart-box h3 {
  margin: 0 0 14px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #374151;
}

.chart-box-full {
  width: 100%;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 260px;
}

.chart-canvas-wrap-sm {
  height: 200px;
}

.chart-canvas-wrap-edu {
  height: 200px;
}

@media (max-width: 900px) {
  .left-ad, .right-ad { display: none; }
  .main-content { padding: 20px; }
  .topbar { padding: 10px 16px; }
  .site-footer { padding: 20px; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.1rem; }
  .trust-divider { display: none; }
  .trust-bar { gap: 12px; }
  .state-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .city-grid { grid-template-columns: 1fr; gap: 16px; }
  .zip-overview { flex-direction: column; }
  .nearby-zips, .state-list, .city-list, .county-list,
  .zip-list, .zipcounty-list {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  .search { flex-direction: column; }
  .zip-compare, .ranking-table { font-size: 13px; display: block; overflow-x: auto; }
  .charts-row { grid-template-columns: 1fr; }
  .chart-canvas-wrap { height: 220px; }
  .chart-canvas-wrap-sm { height: 180px; }
}
