@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=DM+Sans:wght@300;400;500&family=DM+Mono:wght@300;400&display=swap');

/* ── FORM DESIGN SYSTEM ── */
:root {
  --white: #FFFFFF;
  --off-white: #F8F6F3;
  --cream: #F2EEE8;
  --black: #0A0A0A;
  --charcoal: #1C1C1C;
  --mid-grey: #6B6B6B;
  --light-grey: #D4D0CB;
  --accent: #1A3A2A;
  --accent-light: #2D5A3D;
  --gold: #B8963E;
  --gold-light: #D4AF6A;
  --border: rgba(10,10,10,0.1);
  --error: #C0392B;
  --success: #1A7A4A;
  --nav-h: 72px;

  --field-height: 52px;
  --radius: 2px;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--white);
  color: var(--charcoal);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── NAV (reused) ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.nav-inner {
  max-width: 1320px; margin: 0 auto; padding: 0 40px;
  width: 100%; display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px; font-weight: 500; letter-spacing: 0.08em;
  color: var(--black); text-decoration: none;
}
.nav-logo span { color: var(--gold); }
.nav-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--mid-grey); text-decoration: none; transition: color 0.2s;
}
.nav-back::before { content: '←'; }
.nav-back:hover { color: var(--accent); }

/* ── FORM PAGE LAYOUT ── */
.form-page { padding-top: var(--nav-h); min-height: 100vh; display: flex; flex-direction: column; }

.form-hero {
  background: var(--off-white);
  border-bottom: 1px solid var(--border);
  padding: 60px 40px 52px;
}
.form-hero-inner { max-width: 900px; margin: 0 auto; }
.form-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 18px;
  display: flex; align-items: center; gap: 12px;
}
.form-eyebrow::before {
  content: ''; display: inline-block;
  width: 28px; height: 1px; background: var(--gold);
}
.form-hero h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(32px, 4vw, 54px);
  font-weight: 300; line-height: 1.1;
  color: var(--black); letter-spacing: -0.01em;
}
.form-hero h1 em { font-style: italic; color: var(--accent); }
.form-hero-desc {
  margin-top: 16px;
  color: var(--mid-grey); font-size: 15px; line-height: 1.75;
  max-width: 640px;
}
.form-meta-pills {
  margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap;
}
.form-meta-pill {
  padding: 6px 14px; background: var(--white); border: 1px solid var(--border);
  font-family: 'DM Mono', monospace; font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--mid-grey);
}

/* ── FORM BODY ── */
.form-body {
  flex: 1; padding: 60px 40px 80px;
  display: flex; justify-content: center;
}
.form-container {
  width: 100%; max-width: 900px;
  display: grid; grid-template-columns: 1fr 300px; gap: 60px; align-items: start;
}
.form-container.full-width { grid-template-columns: 1fr; max-width: 720px; }
.form-main { }
.form-sidebar { }

/* ── FORM SECTIONS ── */
.form-section {
  margin-bottom: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--mid-grey); margin-bottom: 24px;
  display: flex; align-items: center; gap: 10px;
}
.form-section-label::before {
  content: ''; display: block;
  width: 20px; height: 1px; background: var(--light-grey);
}
.form-section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px; font-weight: 500; color: var(--black);
  margin-bottom: 28px; line-height: 1.2;
}

/* ── FIELD GROUPS ── */
.field-row { display: grid; gap: 20px; margin-bottom: 20px; }
.field-row-2 { grid-template-columns: 1fr 1fr; }
.field-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.field-group { display: flex; flex-direction: column; gap: 0; }

/* ── LABELS ── */
.field-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--charcoal); margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.required-star { color: var(--gold); }
.field-hint { font-size: 12px; color: var(--mid-grey); margin-top: 6px; line-height: 1.5; font-family: 'DM Sans', sans-serif; text-transform: none; letter-spacing: 0; }

/* ── INPUTS ── */
.field-input,
.field-select,
.field-textarea {
  width: 100%;
  background: var(--off-white);
  border: 1px solid var(--border);
  border-bottom: 2px solid var(--light-grey);
  padding: 0 16px;
  height: var(--field-height);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; color: var(--charcoal);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  appearance: none;
}
.field-textarea {
  height: auto; min-height: 120px;
  padding: 14px 16px; resize: vertical;
  line-height: 1.65;
}
.field-input::placeholder,
.field-textarea::placeholder { color: var(--light-grey); font-style: italic; }

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-bottom-color: var(--accent);
  background: var(--white);
  box-shadow: 0 4px 16px rgba(26,58,42,0.08);
}

.field-input.error,
.field-select.error,
.field-textarea.error {
  border-bottom-color: var(--error);
}
.field-input.success,
.field-select.success,
.field-textarea.success {
  border-bottom-color: var(--success);
}

/* Select arrow */
.field-select-wrap { position: relative; }
.field-select-wrap::after {
  content: '▾'; position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%); pointer-events: none;
  color: var(--mid-grey); font-size: 14px;
}
.field-select { padding-right: 40px; cursor: pointer; }

/* File input */
.field-file-wrap {
  position: relative;
  border: 2px dashed var(--light-grey);
  background: var(--off-white);
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  border-radius: var(--radius);
}
.field-file-wrap:hover { border-color: var(--accent); background: var(--white); }
.field-file-wrap input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.field-file-icon { font-size: 28px; margin-bottom: 10px; }
.field-file-text { font-size: 13px; color: var(--mid-grey); }
.field-file-text strong { color: var(--accent); }
.field-file-sub { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--light-grey); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 6px; }

/* ── CHECKBOXES & RADIOS ── */
.check-group, .radio-group { display: flex; flex-direction: column; gap: 12px; }
.check-group-inline { flex-direction: row; flex-wrap: wrap; gap: 10px; }
.check-item, .radio-item { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.check-item input[type="checkbox"],
.radio-item input[type="radio"] { display: none; }
.check-box, .radio-circle {
  width: 20px; height: 20px; min-width: 20px;
  border: 1px solid var(--light-grey);
  background: var(--off-white);
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px; transition: all var(--transition);
}
.radio-circle { border-radius: 50%; }
.check-item:hover .check-box,
.radio-item:hover .radio-circle { border-color: var(--accent); }
.check-item input:checked ~ .check-box {
  background: var(--accent); border-color: var(--accent);
}
.check-item input:checked ~ .check-box::after {
  content: '✓'; color: white; font-size: 12px; font-weight: 600;
}
.radio-item input:checked ~ .radio-circle {
  border-color: var(--accent);
}
.radio-item input:checked ~ .radio-circle::after {
  content: ''; display: block;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
}
.check-label, .radio-label { font-size: 14px; color: var(--charcoal); line-height: 1.5; }
.check-label small, .radio-label small { display: block; font-size: 12px; color: var(--mid-grey); margin-top: 2px; }

/* Inline pill checkboxes */
.pill-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.pill-check input { display: none; }
.pill-box {
  padding: 8px 16px; border: 1px solid var(--border);
  font-size: 13px; color: var(--mid-grey);
  transition: all var(--transition); border-radius: var(--radius);
  background: var(--off-white);
}
.pill-check input:checked ~ .pill-box {
  background: var(--accent); color: white; border-color: var(--accent);
}
.pill-check:hover .pill-box { border-color: var(--accent); color: var(--accent); }

/* ── RANGE SLIDER ── */
.field-range { width: 100%; appearance: none; height: 4px; background: var(--light-grey); border-radius: 2px; outline: none; cursor: pointer; }
.field-range::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; background: var(--accent); border-radius: 50%; cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; font-family: 'DM Mono', monospace; font-size: 10px; color: var(--mid-grey); letter-spacing: 0.08em; margin-top: 8px; }

/* ── FIELD ERROR MESSAGE ── */
.field-error {
  font-size: 12px; color: var(--error);
  margin-top: 6px; display: none;
  font-family: 'DM Mono', monospace; letter-spacing: 0.04em;
}
.field-error.show { display: block; }

/* ── SUBMIT BUTTON ── */
.form-submit-area { margin-top: 40px; padding-top: 40px; border-top: 1px solid var(--border); }
.form-submit-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.btn-submit {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--accent); color: var(--white);
  padding: 16px 36px; border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; border-radius: var(--radius);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-submit:hover { background: var(--accent-light); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(26,58,42,0.2); }
.btn-submit:active { transform: translateY(0); }
.btn-submit.loading { pointer-events: none; opacity: 0.7; }
.btn-submit .btn-spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white; border-radius: 50%; display: none;
  animation: spin 0.7s linear infinite;
}
.btn-submit.loading .btn-spinner { display: block; }
.btn-submit.loading .btn-text { opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-privacy-note {
  font-size: 12px; color: var(--mid-grey); line-height: 1.6;
  max-width: 400px;
}
.form-privacy-note a { color: var(--accent); text-decoration: none; }

/* ── SUCCESS STATE ── */
.form-success {
  display: none; text-align: center; padding: 60px 40px;
  animation: fadeIn 0.4s ease;
}
.form-success.show { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.success-icon {
  width: 72px; height: 72px; background: rgba(26,58,42,0.08);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin: 0 auto 24px;
}
.success-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 36px; font-weight: 300; color: var(--black); margin-bottom: 12px;
}
.success-desc { font-size: 15px; color: var(--mid-grey); line-height: 1.75; max-width: 480px; margin: 0 auto 32px; }
.success-ref {
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: var(--mid-grey); letter-spacing: 0.1em;
  background: var(--off-white); padding: 12px 20px; display: inline-block; margin-bottom: 32px;
}

/* ── SIDEBAR ── */
.sidebar-card {
  background: var(--off-white); padding: 32px 28px;
  border-left: 3px solid var(--gold); margin-bottom: 24px;
  position: sticky; top: calc(var(--nav-h) + 24px);
}
.sidebar-label {
  font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--mid-grey); margin-bottom: 14px;
}
.sidebar-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px; font-weight: 500; color: var(--black); margin-bottom: 12px;
}
.sidebar-body { font-size: 13px; color: var(--mid-grey); line-height: 1.75; }
.sidebar-list { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-list li { font-size: 13px; color: var(--mid-grey); display: flex; gap: 10px; line-height: 1.5; }
.sidebar-list li::before { content: '→'; color: var(--gold); font-size: 12px; margin-top: 2px; }
.sidebar-link { font-size: 13px; color: var(--accent); text-decoration: none; display: block; margin-top: 16px; font-weight: 500; }
.sidebar-link::after { content: ' →'; }

/* Progress bar */
.form-progress {
  display: flex; gap: 0; margin-bottom: 40px; border: 1px solid var(--border);
}
.progress-step {
  flex: 1; padding: 12px 16px; font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--mid-grey); border-right: 1px solid var(--border);
  background: var(--white); text-align: center;
}
.progress-step:last-child { border-right: none; }
.progress-step.active { background: var(--accent); color: white; }
.progress-step.done { background: var(--off-white); color: var(--accent); }

/* Divider */
.form-divider {
  height: 1px; background: var(--border); margin: 32px 0;
}

/* Character counter */
.char-counter {
  font-family: 'DM Mono', monospace; font-size: 10px;
  color: var(--mid-grey); text-align: right; margin-top: 6px; letter-spacing: 0.06em;
}
.char-counter.near { color: var(--gold); }
.char-counter.over { color: var(--error); }

/* ── FOOTER ── */
.form-footer {
  background: var(--charcoal);
  padding: 28px 40px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.form-footer p { font-size: 12px; color: rgba(255,255,255,0.4); }
.form-footer a { color: rgba(255,255,255,0.5); text-decoration: none; font-size: 12px; }
.form-footer a:hover { color: rgba(255,255,255,0.8); }

/* ── FIREBASE TOAST ── */
.toast {
  position: fixed; bottom: 32px; right: 32px; z-index: 999;
  padding: 16px 24px; min-width: 280px; max-width: 420px;
  display: flex; align-items: flex-start; gap: 14px;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  transform: translateY(80px); opacity: 0;
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.toast-success { background: var(--accent); }
.toast-error { background: #C0392B; }
.toast-icon { font-size: 20px; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 500; color: white; font-size: 14px; margin-bottom: 3px; }
.toast-msg { font-size: 12px; color: rgba(255,255,255,0.75); line-height: 1.5; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .form-container { grid-template-columns: 1fr; }
  .form-sidebar { order: -1; }
  .sidebar-card { position: static; }
  .field-row-2, .field-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .form-hero, .form-body { padding-left: 20px; padding-right: 20px; }
  .form-footer { flex-direction: column; gap: 12px; }
}
