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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100%;
}

/* ── Header ── */
.site-header {
  background: #0f0f23;
  border-bottom: 3px solid #c0392b;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.logo {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.03em;
}
.logo span { color: #e74c3c; }
.site-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-nav a {
  color: #a0aec0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.site-nav a:hover { color: #fff; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 100%);
  padding: 48px 18px 52px;
  border-bottom: 1px solid #2d2d4e;
}
.hero-inner {
  max-width: 860px;
  margin: 0 auto;
}
.hero h1 {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}
.hero .subhead {
  font-size: 15px;
  color: #a0aec0;
  margin-bottom: 28px;
  line-height: 1.6;
  max-width: 620px;
}

/* ── Search form ── */
.search-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label {
  font-size: 12px;
  font-weight: 600;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.optional { font-weight: 400; text-transform: none; letter-spacing: 0; }
.field-group input {
  padding: 11px 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.field-group input::placeholder { color: rgba(255,255,255,0.3); }
.field-group input:focus { border-color: #e74c3c; }

.search-btn {
  padding: 11px 24px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}
.search-btn:hover { background: #e74c3c; }

.search-error {
  color: #fc8181;
  font-size: 13px;
  margin-top: 10px;
}

/* ── Results ── */
#results-section {
  max-width: 1100px;
  margin: 28px auto 0;
  padding: 0 18px;
}
.results-header {
  font-size: 14px;
  color: #4a5568;
  margin-bottom: 16px;
  font-weight: 500;
}
.results-header strong { color: #1a1a2e; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

/* ── Inmate card ── */
.inmate-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}
.inmate-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.inmate-photo-wrap {
  position: relative;
  background: #2d2d4e;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.inmate-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #1a1a2e;
}
.inmate-photo-placeholder {
  color: rgba(255,255,255,0.2);
  font-size: 64px;
}

.status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-incarcerated { background: #c0392b; color: #fff; }
.status-supervised   { background: #e67e22; color: #fff; }
.status-released     { background: #27ae60; color: #fff; }
.status-unknown      { background: #718096; color: #fff; }

.inmate-info {
  padding: 16px;
  flex: 1;
}
.inmate-name {
  font-size: 18px;
  font-weight: 800;
  color: #0f0f23;
  margin-bottom: 4px;
  line-height: 1.2;
}
.inmate-dc {
  font-size: 12px;
  color: #718096;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.inmate-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 12px;
}
.detail-item { display: flex; flex-direction: column; gap: 1px; }
.detail-label {
  color: #a0aec0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
}
.detail-value { color: #2d3748; font-weight: 500; }

.inmate-location {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #edf2f7;
  font-size: 12px;
  color: #4a5568;
}
.inmate-location strong { color: #0f0f23; }

.inmate-actions {
  padding: 12px 16px;
  border-top: 1px solid #edf2f7;
  display: flex;
  gap: 8px;
}
.btn-detail {
  flex: 1;
  text-align: center;
  padding: 8px;
  background: #0f0f23;
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.btn-detail:hover { background: #1a1a3e; }

/* Loading / error states */
.loading-state, .error-state, .empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: #718096;
  font-size: 15px;
}
.loading-spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #c0392b;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.error-state { color: #e53e3e; }

/* ── Slide-puzzle CAPTCHA ── */
.captcha-wrap {
  margin-top: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 14px 16px;
  max-width: 340px;
  transition: border-color 0.3s, background 0.3s;
}
.captcha-wrap.captcha-done {
  border-color: rgba(39,174,96,0.5);
  background: rgba(39,174,96,0.07);
}
.captcha-label {
  font-size: 11px;
  color: #718096;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}
.captcha-canvas-wrap {
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 10px;
  line-height: 0;
  border: 1px solid rgba(255,255,255,0.08);
}
#captcha-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 7px;
}
.captcha-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.captcha-arrow {
  color: rgba(255,255,255,0.3);
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
#captcha-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 34px;
  background: rgba(255,255,255,0.07);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  cursor: ew-resize;
  padding: 0;
  outline: none;
}
#captcha-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 34px;
  height: 28px;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border-radius: 6px;
  cursor: ew-resize;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: background 0.2s;
}
#captcha-slider:disabled::-webkit-slider-thumb {
  background: linear-gradient(135deg, #27ae60, #219a52);
  cursor: default;
}
#captcha-slider::-moz-range-thumb {
  width: 34px;
  height: 28px;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  border-radius: 6px;
  border: none;
  cursor: ew-resize;
}
#captcha-slider:disabled::-moz-range-thumb {
  background: linear-gradient(135deg, #27ae60, #219a52);
}
.captcha-status {
  font-size: 12px;
  color: #718096;
  white-space: nowrap;
  min-width: 56px;
  text-align: right;
  flex-shrink: 0;
}
.captcha-ok {
  color: #68d391 !important;
  font-weight: 700;
}

/* ── County section ── */
.county-section {
  background: #fff;
  padding: 48px 18px;
  margin-top: 32px;
  border-top: 1px solid #e2e8f0;
}
.county-inner { max-width: 1100px; margin: 0 auto; }
.county-inner h2 {
  font-size: 22px;
  font-weight: 800;
  color: #0f0f23;
  margin-bottom: 8px;
}
.county-inner > p {
  font-size: 14px;
  color: #718096;
  margin-bottom: 24px;
  max-width: 600px;
  line-height: 1.6;
}

.county-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.county-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.15s;
}
.county-card:hover {
  background: #0f0f23;
  border-color: #0f0f23;
}
.county-card:hover .county-name,
.county-card:hover .county-city { color: #fff; }
.county-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f0f23;
}
.county-city {
  font-size: 12px;
  color: #718096;
}

/* ── Info section ── */
.info-section {
  background: #f7fafc;
  padding: 40px 18px;
  border-top: 1px solid #e2e8f0;
}
.info-inner {
  max-width: 760px;
  margin: 0 auto;
}
.info-inner h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0f0f23;
  margin-bottom: 14px;
}
.info-inner p {
  font-size: 14px;
  line-height: 1.7;
  color: #4a5568;
  margin-bottom: 14px;
}
.info-inner a { color: #c0392b; }
.disclaimer {
  font-size: 12px !important;
  color: #a0aec0 !important;
  border-left: 3px solid #e2e8f0;
  padding-left: 12px;
}

/* ── Footer ── */
.site-footer {
  background: #0f0f23;
  padding: 24px 18px;
  margin-top: 0;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}
.footer-logo {
  font-size: 16px;
  color: #a0aec0;
  margin-bottom: 10px;
}
.footer-logo strong { color: #e74c3c; }
.footer-nav {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.footer-nav a {
  color: #718096;
  font-size: 13px;
  text-decoration: none;
}
.footer-nav a:hover { color: #fff; }
.footer-legal {
  font-size: 11px;
  color: #4a5568;
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Responsive ── */
@media (max-width: 700px) {
  .search-grid {
    grid-template-columns: 1fr 1fr;
  }
  .submit-group {
    grid-column: 1 / -1;
  }
  .hero h1 { font-size: 24px; }
  .site-nav { display: none; }
  .inmate-details { grid-template-columns: 1fr; }
}
@media (max-width: 440px) {
  .search-grid { grid-template-columns: 1fr; }
}
