/* GovOps Permit Intake Form — 508-compliant, mobile-friendly */

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

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2233;
  --bg-card-hover: #1e2940;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-dim: #1e40af;
  --accent-light: rgba(59, 130, 246, 0.08);
  --border: #1e293b;
  --border-hover: #334155;
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.1);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.1);
  --orange: #f59e0b;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.mono { font-family: 'JetBrains Mono', monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---- LAYOUT ---- */
.container { max-width: 780px; margin: 0 auto; padding: 0 24px; }

/* ---- NAV ---- */
.form-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10,14,23,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.form-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav-logo .dot { color: var(--accent); }

.nav-breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ---- MAIN ---- */
.form-main {
  padding: 56px 0 80px;
}

/* ---- HEADER ---- */
.form-header {
  margin-bottom: 56px;
  text-align: center;
}

.form-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-light);
  border: 1px solid rgba(59,130,246,0.2);
  color: var(--accent);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 20px;
}

.form-header h1 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  letter-spacing: -0.025em;
  margin-bottom: 16px;
}

.form-header p {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ---- SECTIONS ---- */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  margin-bottom: 24px;
  transition: border-color 0.2s;
}

.form-section:focus-within {
  border-color: rgba(59,130,246,0.4);
}

.section-heading {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  letter-spacing: -0.01em;
}

.section-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: 6px;
}

.section-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

/* ---- FIELDS ---- */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-full { grid-column: 1 / -1; }

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.required { color: var(--red); }

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 16px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-primary);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

select option { background: var(--bg-secondary); }

textarea { resize: vertical; min-height: 120px; line-height: 1.6; }

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -4px;
}

.field-group {
  margin-top: 20px;
}

/* ---- CHECKBOX GROUP ---- */
.checkbox-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkbox-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.checkbox-card:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.checkbox-card input[type="checkbox"] { display: none; }

.checkbox-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
}

.checkbox-card input[type="checkbox"] {
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  cursor: pointer;
  appearance: none;
  flex-shrink: 0;
  margin-top: 2px;
  transition: border-color 0.2s, background 0.2s;
}

.checkbox-card input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8' fill='none'%3E%3Cpath d='M1 4L3.5 6.5L9 1' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.checkbox-card input[type="checkbox"]:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.checkbox-label { display: flex; flex-direction: column; gap: 4px; }
.checkbox-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.checkbox-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }

/* ---- SUBMIT ---- */
.submit-section { background: transparent; border: none; padding: 0; }
.submit-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
}

.submit-actions { display: flex; justify-content: flex-start; margin-top: 24px; }

.submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #fff;
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  min-width: 200px;
  justify-content: center;
}

.submit-btn:hover { background: var(--accent-dim); transform: translateY(-1px); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.submit-note {
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--green);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.submit-error {
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--red);
  font-weight: 500;
}

.submit-note::before { content: ''; display: none; }
.submit-error::before { content: ''; display: none; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- FOOTER ---- */
.form-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
}

.form-footer p { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 8px; }
.form-footer a { color: var(--accent); text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }
.footer-meta { font-size: 0.75rem; color: var(--text-muted); opacity: 0.6; }

/* ---- CONDITIONAL FIELDS ---- */
.conditional-field { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .form-main { padding: 32px 0 60px; }
  .form-section { padding: 28px 20px; }
  .field-grid { grid-template-columns: 1fr; }
  .checkbox-group { grid-template-columns: 1fr; }
  .submit-box { padding: 28px 20px; }
  .form-header { margin-bottom: 36px; }
}