/* Baldwin Greens rental application — mobile-first responsive styles */

:root {
  --green: #2f5d43;
  --green-dark: #244934;
  --green-light: #e8f0ea;
  --ink: #1f2a24;
  --muted: #5c6b62;
  --line: #d6ddd8;
  --bg: #f6f8f6;
  --white: #ffffff;
  --red: #b3261e;
  --radius: 10px;
  --tap: 44px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  background: var(--green);
  color: #fff;
  padding: 22px 0;
}
.site-header h1 { margin: 0; font-size: 1.5rem; letter-spacing: .5px; }
.site-header .tagline { margin: 2px 0 0; opacity: .9; font-size: 1rem; }

.intro { color: var(--muted); margin: 20px 0 8px; }

/* "Applying for" panel — landlord-set unit details from the URL */
.applying-for {
  background: var(--green-light);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 4px 0 18px;
}
.applying-for h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--green-dark);
}
.af-grid { display: grid; grid-template-columns: 1fr; gap: 0 24px; margin: 0; }
.af-grid > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed rgba(47, 93, 67, .35);
}
.af-grid dt { margin: 0; color: var(--muted); }
.af-grid dd { margin: 0; font-weight: 700; color: var(--ink); text-align: right; }
@media (min-width: 700px) { .af-grid { grid-template-columns: 1fr 1fr; } }

/* Fieldsets */
form { margin: 8px 0 40px; }
fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  margin: 0 0 18px;
  padding: 16px;
}
legend {
  font-weight: 600;
  color: var(--green-dark);
  padding: 0 6px;
  font-size: 1.05rem;
}
legend .hint { font-weight: 400; }

/* Grid: 1 column on mobile, 2 on wider screens */
.grid { display: grid; grid-template-columns: 1fr; gap: 12px 16px; }

.field { display: flex; flex-flow: row wrap; align-items: baseline; font-size: .9rem; color: var(--muted); gap: 6px; }
/* Caption (label text + "*") sits on one line; the control drops to the next line. */
.field > input, .field > select, .field > small { flex: 1 1 100%; }
.field .req-mark { order: -1; }
.field.span-2 { grid-column: 1 / -1; }

input, select {
  font: inherit;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  min-height: var(--tap);
  width: 100%;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-light);
}
input:invalid:not(:placeholder-shown) { border-color: var(--red); }

.hint { color: var(--muted); font-size: .78rem; font-weight: 400; }
.req-mark { color: var(--red); font-weight: 700; }

/* Repeatable rows */
.rows { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  position: relative;
}
.row .field.small { max-width: 100%; }
.remove-btn {
  justify-self: end;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--red);
  border-radius: 8px;
  width: var(--tap);
  height: var(--tap);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.add-btn {
  margin-top: 12px;
  border: 1px solid var(--green);
  background: var(--green-light);
  color: var(--green-dark);
  border-radius: 8px;
  padding: 10px 16px;
  min-height: var(--tap);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.add-btn:hover { background: #dce8df; }

/* Consent */
.consent .consent-text {
  background: var(--green-light);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: .9rem;
  color: var(--ink);
}
.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 12px 0;
  font-size: .95rem;
  color: var(--ink);
}
.checkbox input { width: 22px; height: 22px; min-height: 0; margin-top: 2px; flex: 0 0 auto; }

/* Honeypot */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Errors */
.form-error {
  background: #fdecea;
  border: 1px solid #f5c6c2;
  color: var(--red);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 4px 0 12px;
  font-size: .92rem;
}

/* Submit bar — sticky on mobile for easy reach */
.submit-bar {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 12px 0 16px;
}
.submit-btn {
  width: 100%;
  border: none;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 15px;
  min-height: var(--tap);
  border-radius: 10px;
  cursor: pointer;
}
.submit-btn:hover { background: var(--green-dark); }
.submit-btn:disabled { opacity: .6; cursor: progress; }

/* Success */
.success-panel {
  text-align: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 20px;
  margin: 24px 0 48px;
}
.success-panel .check {
  width: 64px; height: 64px; margin: 0 auto 12px;
  background: var(--green); color: #fff; border-radius: 50%;
  font-size: 2rem; line-height: 64px;
}
.success-panel h2 { margin: 0 0 8px; color: var(--green-dark); }

.site-footer { color: var(--muted); font-size: .82rem; padding-bottom: 28px; }

/* Wider screens: two-column grid, roomier rows */
@media (min-width: 700px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .row { grid-template-columns: repeat(3, 1fr) auto; }
  .site-header h1 { font-size: 1.9rem; }
  .submit-btn { width: auto; padding: 15px 40px; }
  .submit-bar { text-align: right; }
}

/* Print-friendly */
@media print {
  .site-header { background: #fff; color: #000; }
  .submit-bar, .add-btn, .remove-btn { display: none; }
  fieldset { break-inside: avoid; border-color: #999; }
  body { background: #fff; }
}
