/* =====================================================================
   HOME VISIT MANAGEMENT SYSTEM — STYLES
   -----------------------------------------------------------------
   Design concept: a teacher's field visit, recorded like a journal
   entry. Deep pine + muted gold on quiet paper, serif headings for
   warmth, a dashed "route" motif on the login screen, and pill-style
   answers built for fast completion on a phone at someone's door.
===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&display=swap');


:root {

  /* ---------- color ---------- */

  --ink: #1C231F;
  --ink-soft: #5B6760;
  --ink-faint: #8A9089;

  --paper: #F1F2EC;
  --surface: #FFFFFF;

  --pine: #22493C;
  --pine-deep: #163229;
  --pine-tint: #E7EDE9;

  --gold: #B98A3E;
  --gold-deep: #93692C;
  --gold-tint: #F5EBDA;

  --line: #DEE0D3;
  --line-soft: #EAEBE1;

  --success: #1E6B42;
  --success-bg: #E4F3E9;

  --error: #9C3B24;
  --error-bg: #FBEAE3;

  /* ---------- type ---------- */

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* ---------- shape ---------- */

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  /* ---------- shadow ---------- */

  --shadow-card:
    0 1px 2px rgba(28, 35, 31, 0.04),
    0 16px 40px -20px rgba(34, 73, 60, 0.28);

  --shadow-button:
    0 1px 2px rgba(28, 35, 31, 0.12),
    0 10px 20px -10px rgba(34, 73, 60, 0.35);

  --shadow-lift:
    0 2px 4px rgba(28, 35, 31, 0.14),
    0 16px 28px -12px rgba(34, 73, 60, 0.4);

}


/* =====================================================================
   RESET / BASE
===================================================================== */

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: var(--pine);
}

button {
  border: 0;
  cursor: pointer;
  font-family: var(--font-body);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.hidden {
  display: none !important;
}

::selection {
  background: var(--gold-tint);
  color: var(--pine-deep);
}


/* =====================================================================
   LOGIN SCREEN
   A quiet paper backdrop with a dashed route and three waypoint dots
   drifting toward the card — the shape of a home visit.
===================================================================== */

.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  overflow: hidden;

  background:
    radial-gradient(
      780px 520px at 14% 10%,
      rgba(34, 73, 60, 0.10),
      transparent 60%
    ),
    var(--paper);
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(
      132deg,
      transparent 0%,
      transparent 38%,
      rgba(185, 138, 62, 0.5) 38.4%,
      rgba(185, 138, 62, 0.5) 38.9%,
      transparent 39.3%,
      transparent 100%
    );
  background-size: 6px 6px;
  background-repeat: repeat;
  -webkit-mask-image:
    radial-gradient(
      620px 620px at 78% 82%,
      black,
      transparent 70%
    );
  mask-image:
    radial-gradient(
      620px 620px at 78% 82%,
      black,
      transparent 70%
    );
  opacity: 0.5;
}

.login-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 40px 34px 34px;
  text-align: center;
  animation: rise-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: var(--radius-md);
  background: var(--pine-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.login-card h1 {
  font-size: 26px;
}

.login-subtitle {
  margin: 8px 0 26px;
  color: var(--ink-soft);
  font-size: 14.5px;
}

.login-message {
  min-height: 0;
}

.login-message:not(:empty) {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
}

.login-message.error {
  background: var(--error-bg);
  color: var(--error);
}

.login-message.success {
  background: var(--success-bg);
  color: var(--success);
}

.login-field {
  margin-bottom: 16px;
  text-align: left;
}

.login-field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.pin-wrapper {
  position: relative;
  display: flex;
}

.pin-wrapper input {
  padding-right: 64px;
}

.pin-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--pine-tint);
  color: var(--pine-deep);
  font-size: 12.5px;
  font-weight: 700;
}

.pin-toggle:hover {
  background: var(--gold-tint);
  color: var(--gold-deep);
}

.login-button {
  width: 100%;
  margin-top: 6px;
}

.login-note {
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--ink-faint);
}


/* =====================================================================
   BUTTON SYSTEM
===================================================================== */

.login-button,
#submitButton,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  background: var(--pine);
  color: #FCFBF7;
  font-size: 15px;
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    var(--shadow-button);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.login-button:hover,
#submitButton:hover,
.primary-button:hover {
  background: var(--pine-deep);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    var(--shadow-lift);
}

.login-button:active,
#submitButton:active,
.primary-button:active {
  transform: translateY(0);
}

.logout-button {
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
}

.logout-button:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-bg);
}


/* =====================================================================
   APP SHELL
===================================================================== */

.app {
  min-height: 100vh;
  padding: 28px 20px 60px;
}

.page {
  width: min(720px, 100%);
  margin: 0 auto;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.header-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.header-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--pine-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
}

.system-label {
  text-transform: lowercase;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--gold-deep);
  margin-bottom: 3px;
}

.system-label::first-letter {
  text-transform: uppercase;
}

.header h1 {
  font-size: 23px;
  margin-bottom: 3px;
}

.header p {
  font-size: 13.5px;
  color: var(--ink-soft);
}

.session-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logged-class {
  text-align: left;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.logged-class span {
  display: block;
}

.logged-class strong {
  display: block;
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 700;
}


/* =====================================================================
   MESSAGE BANNER
===================================================================== */

.message {
  min-height: 0;
}

.message:not(:empty) {
  margin-bottom: 18px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
}

.message.success {
  background: var(--success-bg);
  color: var(--success);
}

.message.error {
  background: var(--error-bg);
  color: var(--error);
}


/* =====================================================================
   MODE SWITCH
===================================================================== */

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--line-soft);
  border-radius: var(--radius-pill);
  margin-bottom: 22px;
}

.mode-button {
  padding: 11px 14px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 14px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.mode-button:hover {
  color: var(--ink);
}

.mode-button.active {
  background: var(--surface);
  color: var(--pine-deep);
  box-shadow: var(--shadow-button);
}

/* "Back to student list" reuses .mode-button outside the switch */
.submit-area .mode-button {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  margin-top: 10px;
}

.submit-area .mode-button:hover {
  border-color: var(--pine);
  color: var(--pine-deep);
  background: var(--pine-tint);
}

.submit-area .mode-button.active {
  box-shadow: none;
}


/* =====================================================================
   EDIT PANEL
===================================================================== */

.edit-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 26px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 22px;
}

.edit-header h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

.edit-header p {
  margin-bottom: 20px;
  color: var(--ink-soft);
  font-size: 14px;
}

.edit-search {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 14px;
  align-items: end;
}

.record-status:not(:empty) {
  margin-top: 14px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
}

.record-status.error {
  background: var(--error-bg);
  color: var(--error);
}

.record-status.success {
  background: var(--success-bg);
  color: var(--success);
}


/* =====================================================================
   FORM FIELDS
===================================================================== */

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field label span {
  color: var(--gold-deep);
  margin-left: 2px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(185, 138, 62, 0.22);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--line-soft);
  color: var(--ink-faint);
  cursor: not-allowed;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) center,
    calc(100% - 15px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}


/* =====================================================================
   FORM SECTIONS (CARDS)
   A hairline dashed rule along the left edge threads each numbered
   step together, like waypoints along the visit.
===================================================================== */

form section.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px dashed var(--gold);
  padding: 26px 26px 8px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
}

.section-number {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  background: var(--pine);
  color: #FCFBF7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14.5px;
}

.section-heading h2 {
  font-size: 19px;
  margin-bottom: 4px;
}

.section-heading p {
  font-size: 13.5px;
  color: var(--ink-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 18px;
}

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


/* =====================================================================
   QUESTIONS / PILL OPTIONS
===================================================================== */

.question {
  margin-bottom: 20px;
}

.question label {
  display: block;
  margin-bottom: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.option:hover {
  border-color: var(--pine);
  color: var(--pine-deep);
}

.option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.option:has(input:checked) {
  background: var(--pine);
  border-color: var(--pine);
  color: #FCFBF7;
}

.option:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(185, 138, 62, 0.35);
}


/* =====================================================================
   SUBMIT AREA
===================================================================== */

.submit-area {
  padding: 22px 2px 6px;
  text-align: center;
}

.submit-area p {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--ink-faint);
}


/* =====================================================================
   FOOTER
===================================================================== */

.site-footer {
  text-align: center;
  margin-top: 30px;
  padding: 22px;
  color: var(--ink-faint);
  font-size: 13px;
}

.footer-brand {
  font-family: var(--font-display);
  color: var(--ink-soft);
  font-size: 14.5px;
  margin-bottom: 8px;
}

.developers {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
}

.developer {
  display: flex;
  align-items: center;
  gap: 6px;
}

.developer strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.developer a {
  color: var(--ink-faint);
  text-decoration: none;
}

.developer a:hover {
  color: var(--pine);
  text-decoration: underline;
}

.footer-dot {
  color: var(--gold);
}


/* =====================================================================
   FOCUS-VISIBLE (keyboard accessibility)
===================================================================== */

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}


/* =====================================================================
   RESPONSIVE
===================================================================== */

@media (max-width: 640px) {

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

  .edit-search {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    grid-template-columns: 1fr 1fr;
  }

  .header {
    flex-direction: column;
  }

  .session-area {
    width: 100%;
    justify-content: space-between;
  }

  .login-card h1 {
    font-size: 23px;
  }

}

@media (max-width: 420px) {

  .app {
    padding: 20px 14px 48px;
  }

  form section.card,
  .edit-panel {
    padding: 20px 18px 6px;
  }

  .edit-panel {
    padding-bottom: 20px;
  }

  .login-card {
    padding: 32px 24px 26px;
  }

  .options {
    flex-direction: column;
    align-items: stretch;
  }

  .option {
    justify-content: center;
  }

}


/* =====================================================================
   VISIT LOCATION CAPTURE
===================================================================== */

.location-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.location-row input {
  flex: 1;
  color: var(--ink-soft);
}

.location-row input:not(:placeholder-shown) {
  color: var(--pine-deep);
  font-weight: 600;
}

.location-button {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--gold-tint);
  color: var(--gold-deep);
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.location-button:hover {
  background: var(--gold);
  color: #FCFBF7;
}

.location-button:active {
  transform: translateY(1px);
}

.field-hint {
  margin-top: 7px;
  font-size: 12px;
  color: var(--ink-faint);
}


/* =====================================================================
   RESPONSIVE — LOCATION ROW
===================================================================== */

@media (max-width: 480px) {

  .location-row {
    flex-direction: column;
  }

  .location-button {
    padding: 11px 16px;
  }

}


/* =====================================================================
   REDUCED MOTION
===================================================================== */

@media (prefers-reduced-motion: reduce) {

  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

}