:root {
  --cream: #faf6f0;
  --warm-white: #fffdf9;
  --terracotta: #c2714f;
  --deep-green: #1e3a2f;
  --sage: #6b8f71;
  --gold: #d4a853;
  --charcoal: #2c2c2c;
  --light-sage: #edf2ee;
  --border: #ddd5c8;
  --error: #c0392b;
  --success: #27ae60;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "DM Sans", sans-serif;
  background: var(--cream);
  color: var(--charcoal);
  min-height: 100vh;
}

/* NAV */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 4rem;
  background: var(--deep-green);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-family: "Playfair Display", serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  line-height: 1.1;
}

.nav-logo span {
  display: block;
  font-size: 0.6rem;
  font-family: "DM Sans", sans-serif;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-back {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.nav-back:hover {
  color: var(--gold);
}

/* PAGE HEADER */
.page-header {
  background: linear-gradient(135deg, var(--deep-green) 0%, #2d5240 100%);
  padding: 4rem;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -10%;
  width: 60%;
  height: 200%;
  background: rgba(255, 255, 255, 0.03);
  transform: rotate(-15deg);
  border-radius: 50%;
}

.page-header .badge {
  display: inline-block;
  background: var(--gold);
  color: var(--deep-green);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.9rem;
  margin-bottom: 1rem;
}

.page-header h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.page-header p {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.95rem;
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.7;
}

/* FORM WRAPPER */
.form-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

/* PROGRESS */
.progress-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3rem;
  position: relative;
}

.progress-bar::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.progress-fill {
  position: absolute;
  top: 18px;
  left: 0;
  height: 2px;
  background: var(--sage);
  z-index: 1;
  transition: width 0.4s ease;
}

.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  z-index: 2;
  cursor: pointer;
}

.dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: #999;
  transition: all 0.3s;
}

.step-dot.active .dot {
  border-color: var(--sage);
  background: var(--sage);
  color: #fff;
}

.step-dot.done .dot {
  border-color: var(--deep-green);
  background: var(--deep-green);
  color: #fff;
}

.dot-label {
  font-size: 0.7rem;
  color: #999;
  font-weight: 500;
  white-space: nowrap;
}

.step-dot.active .dot-label,
.step-dot.done .dot-label {
  color: var(--deep-green);
  font-weight: 600;
}

/* FORM SECTION */
.form-section {
  display: none;
}

.form-section.active {
  display: block;
  animation: slideIn 0.35s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.section-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.section-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.2rem;
  border-bottom: 2px solid var(--light-sage);
}

.section-card-icon {
  width: 46px;
  height: 46px;
  background: var(--light-sage);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.section-card-title {
  font-family: "Playfair Display", serif;
  font-size: 1.3rem;
  color: var(--deep-green);
}

.section-card-sub {
  font-size: 0.82rem;
  color: #888;
  margin-top: 0.1rem;
}

/* FORM FIELDS */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.form-grid.full {
  grid-template-columns: 1fr;
}

.form-grid.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.field {
  margin-bottom: 0;
}

.field.span-2 {
  grid-column: span 2;
}

.field.span-3 {
  grid-column: span 3;
}

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 0.45rem;
}

label .req {
  color: var(--terracotta);
  margin-left: 2px;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  font-family: "DM Sans", sans-serif;
  font-size: 0.9rem;
  background: var(--cream);
  color: var(--charcoal);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  appearance: none;
}

input[type="checkbox"] {
  appearance: auto;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(107, 143, 113, 0.12);
}

input.error,
select.error {
  border-color: var(--error);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.field-hint {
  font-size: 0.74rem;
  color: #999;
  margin-top: 0.35rem;
}

.error-msg {
  font-size: 0.74rem;
  color: var(--error);
  margin-top: 0.3rem;
  display: none;
}

.field.has-error .error-msg {
  display: block;
}

.field.has-error input,
.field.has-error select {
  border-color: var(--error);
}

/* RADIO / CHECKBOX */
.radio-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.2s;
  user-select: none;
}

.radio-label input[type="radio"] {
  display: none;
}

.radio-label.checked {
  border-color: var(--sage);
  background: var(--light-sage);
  color: var(--deep-green);
  font-weight: 600;
}

.radio-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: all 0.2s;
  flex-shrink: 0;
}

.radio-label.checked .radio-dot {
  border-color: var(--sage);
  background: var(--sage);
}

/* PHOTO UPLOAD */
.photo-upload {
  border: 2px dashed var(--border);
  border-radius: 6px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--cream);
}

.photo-upload:hover {
  border-color: var(--sage);
  background: var(--light-sage);
}

.photo-upload input {
  display: none;
}

.photo-icon {
  font-size: 2.5rem;
  margin-bottom: 0.6rem;
}

.photo-text {
  font-size: 0.88rem;
  color: #666;
}

.photo-text strong {
  color: var(--deep-green);
}

.photo-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--sage);
  margin: 0 auto 0.8rem;
  display: none;
}

/* T&C */
.tnc-box {
  background: var(--light-sage);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.tnc-box h4 {
  color: var(--deep-green);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.tnc-box p {
  font-size: 0.84rem;
  color: #555;
  line-height: 1.6;
}

.tnc-link {
  color: var(--terracotta);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.consent-row:last-child {
  border-bottom: none;
}

.consent-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--sage);
  cursor: pointer;
}

.consent-text {
  font-size: 0.85rem;
  line-height: 1.55;
  color: #444;
}

/* DECLARATION */
.declaration-box {
  background: #fff;
  border: 1.5px solid var(--gold);
  border-radius: 6px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.declaration-box p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #555;
}

.sig-field {
  border: none;
  border-bottom: 2px solid var(--charcoal);
  border-radius: 0;
  background: transparent;
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--deep-green);
  padding: 0.5rem 0;
}

.sig-field:focus {
  box-shadow: none;
  border-bottom-color: var(--terracotta);
}

/* NAVIGATION BUTTONS */
.form-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn-back {
  padding: 0.85rem 1.8rem;
  border: 1.5px solid var(--border);
  background: transparent;
  border-radius: 4px;
  font-family: "DM Sans", sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--charcoal);
}

.btn-back:hover {
  border-color: var(--deep-green);
  color: var(--deep-green);
}

.btn-next {
  padding: 0.85rem 2.2rem;
  background: var(--terracotta);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: "DM Sans", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.03em;
}

.btn-next:hover {
  background: var(--deep-green);
}

.btn-next:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-submit {
  padding: 1rem 2.5rem;
  background: var(--deep-green);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-submit:hover {
  background: var(--terracotta);
}

.btn-submit:disabled {
  background: #aaa;
  cursor: not-allowed;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(30px);
  transition: transform 0.3s;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 1.8rem 2rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-header h2 {
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
  color: var(--deep-green);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #999;
  padding: 0.2rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--terracotta);
}

.modal-body {
  padding: 1.5rem 2rem;
  overflow-y: auto;
  flex: 1;
}

.tnc-section {
  margin-bottom: 1.8rem;
}

.tnc-section h3 {
  font-family: "Playfair Display", serif;
  font-size: 1.05rem;
  color: var(--deep-green);
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--light-sage);
}

.tnc-section p,
.tnc-section li {
  font-size: 0.87rem;
  color: #555;
  line-height: 1.7;
  margin-bottom: 0.4rem;
}

.tnc-section ul {
  padding-left: 1.4rem;
}

.modal-footer {
  padding: 1.2rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.btn-modal-close {
  padding: 0.75rem 1.8rem;
  background: var(--deep-green);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: "DM Sans", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

/* SUCCESS */
.success-screen {
  display: none;
  text-align: center;
  padding: 4rem 2rem;
}

.success-screen.show {
  display: block;
  animation: fadeUp 0.5s ease;
}

.success-icon {
  font-size: 5rem;
  margin-bottom: 1.5rem;
}

.success-screen h2 {
  font-family: "Playfair Display", serif;
  font-size: 2rem;
  color: var(--deep-green);
  margin-bottom: 1rem;
}

.success-screen p {
  color: #666;
  line-height: 1.7;
  max-width: 480px;
  margin: 0 auto 2rem;
}

.ref-code {
  display: inline-block;
  background: var(--light-sage);
  border: 2px dashed var(--sage);
  border-radius: 4px;
  padding: 0.8rem 2rem;
  font-family: "Playfair Display", serif;
  font-size: 1.4rem;
  color: var(--deep-green);
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 2rem;
}

/* SPINNER */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* FIREBASE STATUS */
.firebase-note {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 0.8rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.82rem;
  color: #856404;
  display: none;
}

.firebase-note.show {
  display: block;
}

@media (max-width: 640px) {
  nav {
    padding: 1rem 1.5rem;
  }

  .page-header {
    padding: 2.5rem 1.5rem;
  }

  .form-wrapper {
    padding: 1.5rem 1rem 4rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid.three {
    grid-template-columns: 1fr 1fr;
  }

  .field.span-2,
  .field.span-3 {
    grid-column: span 1;
  }

  .section-card {
    padding: 1.5rem;
  }

  .progress-bar {
    gap: 0;
  }

  .dot-label {
    display: none;
  }
}

.consent-row.checked {
  background: var(--light-sage);
  border-radius: 4px;
}
