/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #5B7B8A;
  --accent: #E74C3C;
  --dark: #2C3E50;
  --light-bg: #F8F9FA;
  --white: #ffffff;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --success: #10B981;
  --error: #EF4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --transition: .2s ease;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--light-bg);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ===== CONTAINER ===== */
.form-container {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ===== HEADER ===== */
.form-header {
  text-align: center;
  padding: 24px 0 16px;
}
.logo {
  width: 140px;
  height: auto;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.1));
}
.brand-name {
  font-family: 'Pacifico', cursive;
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 2px;
}
.tagline {
  font-size: .85rem;
  color: var(--gray-500);
  font-weight: 500;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ===== PROGRESS ===== */
.progress-container { padding: 8px 0 20px; }
.progress-bar {
  height: 4px;
  background: var(--gray-200);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  width: 25%;
  transition: width .4s cubic-bezier(.4,0,.2,1);
}
.progress-steps { display: flex; justify-content: space-between; }
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.step-number {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 600;
  background: var(--gray-200);
  color: var(--gray-500);
  transition: all var(--transition);
}
.step.active .step-number,
.step.completed .step-number {
  background: var(--primary);
  color: var(--white);
}
.step.completed .step-number { background: var(--success); }
.step-label {
  font-size: .65rem;
  font-weight: 500;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  transition: color var(--transition);
}
.step.active .step-label { color: var(--primary); font-weight: 600; }
.step.completed .step-label { color: var(--success); }

/* ===== FORM STEPS ===== */
.form-step {
  display: none;
  animation: fadeSlideIn .35s ease;
}
.form-step.active { display: block; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-header { margin-bottom: 20px; }
.step-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}
.step-header p { font-size: .9rem; color: var(--gray-500); }

/* ===== FORM GROUPS ===== */
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.required { color: var(--accent); }
.optional { color: var(--gray-400); font-weight: 400; font-size: .8rem; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,123,138,.15);
}
input.error, select.error {
  border-color: var(--error);
}
input.error:focus, select.error:focus {
  box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}
.error-message {
  display: none;
  font-size: .78rem;
  color: var(--error);
  margin-top: 4px;
  font-weight: 500;
}
.error-message.visible { display: block; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-icon { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow);
}
.btn-primary:hover { background: #4e6b78; box-shadow: var(--shadow-md); }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-200); }

.btn-ghost {
  background: transparent;
  color: var(--gray-500);
}
.btn-ghost:hover { color: var(--gray-700); background: var(--gray-100); }

.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}
.step-actions .btn-next,
.step-actions .btn-submit { margin-left: auto; }

/* ===== MINORS ===== */
.minor-entry {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color var(--transition);
}
.minor-entry:hover { border-color: var(--gray-300); }
.minor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.minor-header h3 {
  font-size: 1rem;
  color: var(--primary);
  font-weight: 600;
}
.btn-remove-minor {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--gray-400);
  transition: color var(--transition);
}
.btn-remove-minor:hover { color: var(--error); }
.btn-remove-minor svg { width: 20px; height: 20px; }
.btn-add-minor {
  width: 100%;
  margin-bottom: 8px;
  border-style: dashed;
  border-width: 2px;
}

/* ===== PHOTO UPLOAD ===== */
.photo-upload {
  display: flex;
  align-items: center;
  gap: 16px;
}
.photo-preview {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--gray-100);
  border: 2px dashed var(--gray-300);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.photo-placeholder-icon { width: 32px; height: 32px; color: var(--gray-400); }
.photo-image { width: 100%; height: 100%; object-fit: cover; display: none; }
.photo-preview.has-photo .photo-placeholder-icon { display: none; }
.photo-preview.has-photo .photo-image { display: block; }
.photo-preview.has-photo { border-style: solid; border-color: var(--primary); }
.photo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-actions .btn { padding: 8px 12px; font-size: .8rem; }
.photo-actions .btn svg { width: 16px; height: 16px; }

/* ===== WAIVER ===== */
.waiver-container {
  margin-bottom: 20px;
}
.waiver-text {
  max-height: 280px;
  overflow-y: auto;
  padding: 16px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  line-height: 1.65;
  color: var(--gray-700);
}
.waiver-text h3 {
  font-size: 1rem;
  color: var(--dark);
  margin-bottom: 12px;
  text-align: center;
}
.waiver-text h4 {
  font-size: .9rem;
  color: var(--dark);
  margin: 16px 0 8px;
}
.waiver-text ul { padding-left: 20px; margin: 8px 0; }
.waiver-text li { margin-bottom: 6px; }
.waiver-text p { margin-bottom: 8px; }

/* ===== CHECKBOXES ===== */
.checkbox-group { margin-bottom: 14px; }
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 400;
  color: var(--gray-700);
  line-height: 1.4;
}
.checkbox-label input[type="checkbox"] {
  width: 20px; height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
  accent-color: var(--primary);
  cursor: pointer;
}
.checkbox-text { flex: 1; }

/* ===== SIGNATURE ===== */
.signature-group { margin-bottom: 16px; }
.signature-container {
  position: relative;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
  touch-action: none;
}
.signature-container.error { border-color: var(--error); }
.signature-container.signed { border-color: var(--primary); }
#signatureCanvas {
  width: 100%;
  height: 150px;
  display: block;
  cursor: crosshair;
}
.signature-placeholder {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  color: var(--gray-400);
  transition: opacity var(--transition);
}
.signature-placeholder svg { width: 28px; height: 28px; }
.signature-placeholder span { font-size: .85rem; }
.signature-placeholder.hidden { opacity: 0; }
.btn-clear-signature {
  margin-top: 8px;
  font-size: .8rem;
  padding: 6px 12px;
}

/* ===== SUBMIT ===== */
.btn-submit { min-width: 180px; }
.btn-loading { display: none; align-items: center; gap: 8px; }
.btn-submit.loading .btn-text { display: none; }
.btn-submit.loading .btn-loading { display: flex; }
.btn-submit.loading { opacity: .8; pointer-events: none; }
.spinner { width: 20px; height: 20px; animation: spin 1s linear infinite; }
.spinner circle {
  stroke-dasharray: 50;
  stroke-dashoffset: 35;
  stroke-linecap: round;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SUCCESS ===== */
.success-screen {
  display: none;
  text-align: center;
  padding: 40px 16px;
  animation: fadeSlideIn .5s ease;
}
.success-screen.visible { display: block; }
.success-icon {
  width: 72px; height: 72px;
  background: rgba(16,185,129,.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.success-icon svg { width: 40px; height: 40px; color: var(--success); }
.success-content h2 {
  font-size: 1.5rem;
  color: var(--dark);
  margin-bottom: 8px;
}
.success-content > p { color: var(--gray-500); margin-bottom: 20px; }
.reminder-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 24px;
  text-align: left;
}
.reminder-box svg { width: 24px; height: 24px; color: #F59E0B; flex-shrink: 0; margin-top: 1px; }
.reminder-box p { font-size: .85rem; color: #92400E; line-height: 1.5; }

/* ===== CAMERA MODAL ===== */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.visible { display: flex; }
.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { font-size: 1rem; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--gray-500); padding: 4px;
}
.modal-close svg { width: 20px; height: 20px; }
.camera-container { background: #000; }
#cameraVideo { width: 100%; display: block; }
.modal-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 14px;
}
.modal-actions .btn { border-radius: 50%; width: 48px; height: 48px; padding: 0; }
.modal-actions .btn svg { width: 24px; height: 24px; }
#capturePhoto { width: 56px; height: 56px; }

/* ===== SCROLLBAR ===== */
.waiver-text::-webkit-scrollbar { width: 6px; }
.waiver-text::-webkit-scrollbar-track { background: var(--gray-100); border-radius: 99px; }
.waiver-text::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 380px) {
  .form-container { padding: 12px; }
  .step-label { font-size: .58rem; }
  .step-number { width: 24px; height: 24px; font-size: .7rem; }
  .form-row { flex-direction: column; gap: 0; }
}
