/* Breitung Township Schools Enrollment App
   Palette: deep slate navy + warm signal amber, built for a civic/school context. */

:root {
  --navy-950: #16215c;
  --navy-800: #23328f;
  --navy-600: #3247b8;
  --slate-200: #dbe2ea;
  --slate-100: #eef2f6;
  --paper: #f7f5f0;
  --amber-500: #c9a227;
  --amber-600: #a8850f;
  --green-600: #2f7d4f;
  --red-600: #b3412c;
  --ink: #1a2330;
  --ink-soft: #4a5568;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.06), 0 4px 16px rgba(15, 27, 45, 0.07);
  --font-display: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
}

a { color: var(--navy-600); }

.topbar {
  background: var(--navy-950);
  color: white;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 4px solid var(--amber-500);
}

.topbar .brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.topbar .brand .district {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
  opacity: 0.85;
  text-transform: uppercase;
}

.topbar .brand .app-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.wrap.wide {
  max-width: 1080px;
}

h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--navy-950);
}

.subtitle {
  color: var(--ink-soft);
  font-size: 1rem;
  margin: 0 0 28px;
  line-height: 1.5;
}

/* ---- Step tracker (form) ---- */

.steps {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
}

.steps .step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.steps .step .num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--slate-200);
  color: var(--navy-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.steps .step.active .num {
  background: var(--amber-500);
  color: white;
}

.steps .step .bar {
  height: 3px;
  flex: 1;
  background: var(--slate-200);
  border-radius: 2px;
}

/* ---- Card / form sections ---- */

.card {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 4px;
  color: var(--navy-950);
}

.card .hint {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 18px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-800);
  margin-bottom: 6px;
}

.field .optional-tag {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  color: var(--ink);
  background: white;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--amber-500);
  outline-offset: 1px;
  border-color: var(--amber-500);
}

textarea { resize: vertical; min-height: 80px; }

.honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

/* ---- Buttons ---- */

button, .btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 8px;
  border: none;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
  display: inline-block;
  text-decoration: none;
}

button:active { transform: scale(0.98); }

.btn-primary {
  background: var(--amber-500);
  color: white;
}
.btn-primary:hover { background: var(--amber-600); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--slate-100);
  color: var(--navy-800);
}
.btn-secondary:hover { background: var(--slate-200); }

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

/* ---- Confirmation ---- */

.confirm {
  text-align: center;
  padding: 40px 20px;
}

.confirm .badge-check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green-600);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  font-size: 1.6rem;
}

.confirm .sub-id {
  font-family: monospace;
  background: var(--slate-100);
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 6px;
}

.error-banner {
  background: #fbeae5;
  border: 1px solid var(--red-600);
  color: var(--red-600);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.notice-banner {
  background: #eef2f9;
  border-left: 4px solid var(--navy-600);
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.55;
  margin-bottom: 24px;
}

.notice-banner a {
  color: var(--navy-800);
  font-weight: 700;
}

/* ---- Dashboard ---- */

.signin-gate {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  text-align: center;
  padding: 20px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.stat-card .count {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy-950);
}

.stat-card .label {
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.toolbar input[type="search"] {
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 0.9rem;
}

.toolbar select {
  width: auto;
  padding: 10px 12px;
}

table.enrollments {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table.enrollments th {
  text-align: left;
  background: var(--navy-950);
  color: white;
  padding: 10px 12px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

table.enrollments td {
  padding: 12px;
  border-bottom: 1px solid var(--slate-100);
  font-size: 0.9rem;
  vertical-align: top;
}

table.enrollments tr:last-child td { border-bottom: none; }
table.enrollments tr.clickable { cursor: pointer; }
table.enrollments tr.clickable:hover { background: var(--slate-100); }

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-new-submission { background: #e6ecf3; color: var(--navy-800); }
.status-hold-for-next-school-year { background: #ece6f7; color: #5b3a8f; }
.status-hold-for-school-of-choice-window { background: #e1f3f0; color: #1f7a68; }
.status-contacted-family { background: #fdf0dc; color: var(--amber-600); }
.status-awaiting-documents { background: #fdf0dc; color: var(--amber-600); }
.status-documents-received { background: #e3f0e8; color: var(--green-600); }
.status-enrolled-in-powerschool { background: #e3f0e8; color: var(--green-600); }
.status-complete { background: #dff2e5; color: var(--green-600); }
.status-withdrawn-not-proceeding { background: #f5e6e2; color: var(--red-600); }

/* ---- Detail panel (overlay) ---- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 45, 0.45);
  display: flex;
  justify-content: flex-end;
  z-index: 50;
}

.detail-panel {
  background: white;
  width: min(480px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 26px;
  box-shadow: -8px 0 24px rgba(0,0,0,0.15);
}

.detail-panel h2 {
  font-family: var(--font-display);
  margin-top: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 16px 0 22px;
}

.detail-grid .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  font-weight: 700;
}

.detail-grid .v {
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--ink-soft);
  float: right;
  padding: 0;
  line-height: 1;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -3px;
  margin-right: 6px;
}

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

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}

footer.app-footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.8rem;
  padding: 20px;
}

/* ---- Print view ---- */

.print-area { display: none; }

.print-header {
  border-bottom: 3px solid var(--navy-950);
  padding-bottom: 10px;
  margin-bottom: 18px;
}

.print-header .district {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--navy-950);
}

.print-header .doc-title {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.print-section {
  margin-bottom: 16px;
  page-break-inside: avoid;
}

.print-section h3 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy-800);
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 4px;
  margin: 0 0 8px;
}

.print-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}

.print-field .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}

.print-field .v {
  font-size: 0.92rem;
  margin-bottom: 6px;
}

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0;
  }
}

footer.app-footer .staff-link {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted var(--ink-soft);
}

footer.app-footer .staff-link:hover {
  color: var(--navy-800);
  border-bottom-color: var(--navy-800);
}
