/* ContractorRecord — Design System
   Color palette:
     Navy:   #1a1a2e (primary bg, headers)
     White:  #ffffff (content bg)
     Green:  #16a34a (verified/safe)
     Red:    #dc2626 (violations/warnings)
     Gray:   #64748b (secondary text)
     Light:  #f8fafc (alt bg)
*/

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

:root {
  --navy: #1a1a2e;
  --navy-light: #16213e;
  --white: #ffffff;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fef2f2;
  --gray: #64748b;
  --gray-light: #94a3b8;
  --gray-border: #e2e8f0;
  --bg-light: #f8fafc;
  --text: #1e293b;
  --text-light: #475569;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --radius: 8px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg-light);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

img {
  max-width: 100%;
  height: auto;
}

/* ── Layout ── */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

main {
  flex: 1;
  padding: 2rem 0;
}

/* ── Header ── */

.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
}
.site-logo:hover {
  text-decoration: none;
}
.site-logo span {
  color: var(--green);
}

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

.site-nav a {
  color: var(--gray-light);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}
.site-nav a:hover {
  color: var(--white);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ── Footer ── */

.site-footer {
  background: var(--navy);
  color: var(--gray-light);
  padding: 2rem 0;
  font-size: 0.875rem;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--gray-light);
}
.footer-links a:hover {
  color: var(--white);
}

/* ── Cards ── */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  border: 1px solid var(--gray-border);
}

.card + .card {
  margin-top: 1rem;
}

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

.card h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

/* ── Badges ── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-green {
  background: var(--green-light);
  color: var(--green);
}

.badge-red {
  background: var(--red-light);
  color: var(--red);
}

.badge-gray {
  background: var(--bg-light);
  color: var(--gray);
}

/* ── Hero ── */

.hero {
  background: var(--navy);
  color: var(--white);
  padding: 4rem 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 1.125rem;
  color: var(--gray-light);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-search {
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 1rem 1.25rem;
  padding-right: 3.5rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.hero-search input::placeholder {
  color: var(--gray-light);
}

.hero-search input:focus {
  border-color: var(--green);
}

.hero-search button {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.hero-search button:hover {
  background: #15803d;
}

/* ── Stats bar ── */

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: -1.5rem 0 2rem;
  position: relative;
  z-index: 10;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--navy);
}

.stat-card .stat-label {
  font-size: 0.875rem;
  color: var(--gray);
  margin-top: 0.25rem;
}

/* ── Contractor profile ── */

.profile-header {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--gray-border);
}

.profile-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-light);
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

.profile-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray);
  font-weight: 600;
}

.detail-value {
  font-size: 1rem;
  font-weight: 500;
}

/* ── Violations table ── */

.violations-section {
  margin-top: 1.5rem;
}

.violations-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.violations-count {
  font-size: 0.875rem;
  color: var(--red);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--gray-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background: var(--bg-light);
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--gray-border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-border);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background: var(--bg-light);
}

.penalty {
  color: var(--red);
  font-weight: 600;
}

/* ── Trade/city pages ── */

.page-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--text-light);
  font-size: 1.125rem;
  margin-bottom: 2rem;
}

.contractor-list {
  display: grid;
  gap: 1rem;
}

.contractor-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-border);
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: box-shadow 0.2s;
}

.contractor-card:hover {
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.contractor-card-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.contractor-card-info p {
  color: var(--text-light);
  font-size: 0.875rem;
}

.contractor-card-status {
  text-align: right;
}

/* ── Lookup page ── */

.lookup-form {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  border: 1px solid var(--gray-border);
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text-light);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-border);
  border-radius: 6px;
  font-size: 1rem;
  background: var(--white);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--navy);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--navy-light);
}

.btn-green {
  background: var(--green);
  color: var(--white);
}
.btn-green:hover {
  background: #15803d;
}

#search-results {
  margin-top: 1rem;
}

/* ── Breadcrumb ── */

.breadcrumb {
  font-size: 0.875rem;
  color: var(--gray);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--gray);
}
.breadcrumb a:hover {
  color: var(--navy);
}

.breadcrumb span {
  margin: 0 0.5rem;
  color: var(--gray-light);
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .site-nav {
    display: none;
  }

  .site-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--navy);
    padding: 1rem;
    gap: 0.75rem;
    box-shadow: var(--shadow-md);
  }

  .nav-toggle {
    display: block;
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-header h1 {
    font-size: 1.375rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .contractor-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .contractor-card-status {
    text-align: left;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

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

/* ── Utilities ── */

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-gray { color: var(--gray); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ── No-violations message ── */

.clean-record {
  background: var(--green-light);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--green);
  font-weight: 600;
}
