/* ══════════════════════════════════════════════════════════════
   BeeReach Public Forms — Styles
   Mobile-first, clean, modern form styling.
   ══════════════════════════════════════════════════════════════ */

:root {
  --brand: #f59e0b;
  --brand-light: #fbbf24;
  --brand-dark: #d97706;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --bg-page: #f9fafb;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --error: #ef4444;
  --success: #10b981;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  min-height: 100vh;
}

/* ── Loading ── */

.loading-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 300px; gap: 16px; color: var(--text-tertiary);
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error State ── */

.error-state {
  text-align: center; padding: 48px 24px;
}
.error-state h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; }
.error-state p { color: var(--text-secondary); font-size: 0.9375rem; }

/* ── Success State ── */

.success-state {
  text-align: center; padding: 48px 24px;
}
.success-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  background: rgba(16,185,129,0.1); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.success-icon svg { width: 32px; height: 32px; color: var(--success); }
.success-state h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; }
.success-state p { color: var(--text-secondary); font-size: 0.9375rem; }

/* ── Form Card ── */

.form-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px 28px;
  animation: fadeUp 0.4s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.form-logo {
  display: block; max-width: 160px; max-height: 80px;
  margin: 0 auto 16px; object-fit: contain;
}
.form-title {
  font-size: 1.375rem; font-weight: 700; text-align: center; margin-bottom: 4px;
}
.form-desc {
  font-size: 0.9375rem; color: var(--text-secondary); text-align: center;
  margin-bottom: 24px; line-height: 1.5;
}
.form-fields { display: flex; flex-direction: column; gap: 18px; }

/* ── Field Groups ── */

.field-group { }
.field-label {
  display: block; font-size: 0.875rem; font-weight: 500;
  color: var(--text-primary); margin-bottom: 5px;
}
.field-label .req { color: var(--error); margin-left: 2px; }
.field-error {
  font-size: 0.75rem; color: var(--error); margin-top: 4px;
}

/* ── Inputs ── */

.input, select, textarea {
  display: block; width: 100%;
  padding: 10px 14px; font-size: 0.9375rem;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg-card); color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
.input.has-error { border-color: var(--error); }
textarea { resize: vertical; min-height: 80px; }

/* ── Checkbox ── */

.checkbox-group {
  display: flex; align-items: flex-start; gap: 10px;
}
.checkbox-group input[type="checkbox"] {
  width: 18px; height: 18px; margin-top: 2px;
  accent-color: var(--brand); cursor: pointer;
}
.checkbox-text { font-size: 0.875rem; color: var(--text-primary); line-height: 1.4; }

/* ── Heading & Content Block ── */

.field-heading {
  padding: 12px 0 4px; border-bottom: 2px solid var(--brand);
}
.field-heading h3 { font-size: 1.0625rem; font-weight: 700; }
.field-heading p { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 2px; }
.field-content-block {
  padding: 14px 16px; background: #f3f4f6;
  border-radius: var(--radius-md); border-left: 3px solid var(--brand);
  font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5;
  white-space: pre-wrap;
}

/* ── Signature Pad ── */

.signature-wrapper { position: relative; }
.signature-canvas {
  width: 100%; height: 150px;
  border: 2px dashed var(--border); border-radius: var(--radius-md);
  background: #fff; cursor: crosshair; touch-action: none;
}
.signature-canvas.has-error { border-color: var(--error); }
.signature-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px;
}
.btn-clear {
  font-size: 0.75rem; color: var(--text-tertiary); background: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px 10px; cursor: pointer;
}
.btn-clear:hover { color: var(--error); border-color: var(--error); }

/* ── File Upload ── */

.upload-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 20px; min-height: 80px;
  border: 2px dashed var(--border); border-radius: var(--radius-md);
  color: var(--text-tertiary); font-size: 0.875rem;
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--brand); background: rgba(245,158,11,0.04);
}
.upload-zone.has-error { border-color: var(--error); }
.upload-zone input[type="file"] { display: none; }
.upload-zone svg { width: 24px; height: 24px; }
.upload-filename {
  font-size: 0.8125rem; color: var(--text-primary); font-weight: 500;
}
.upload-progress {
  width: 100%; height: 4px; background: var(--border); border-radius: 2px;
  overflow: hidden; margin-top: 6px;
}
.upload-progress-bar {
  height: 100%; background: var(--brand); border-radius: 2px;
  transition: width 0.3s;
}

/* ── Submit Button ── */

.btn-submit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 24px; margin-top: 24px;
  font-size: 1rem; font-weight: 600; font-family: inherit;
  color: #fff; background: var(--brand); border: none;
  border-radius: var(--radius-md); cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-submit:hover { background: var(--brand-dark); }
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Footer ── */

.form-footer {
  text-align: center; margin-top: 24px;
  font-size: 0.6875rem; color: var(--text-tertiary);
}
.form-footer a {
  color: var(--brand-dark); text-decoration: none;
}
.form-footer a:hover { text-decoration: underline; }

/* ── Responsive ── */

@media (max-width: 480px) {
  .app { padding: 16px 12px 32px; }
  .form-card { padding: 24px 20px; }
  .form-title { font-size: 1.25rem; }
}
