/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f7fa;
  color: #1a1a2e;
  line-height: 1.6;
  min-height: 100vh;
}

/* === Layout === */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
}
header {
  text-align: center;
  padding: 1.5rem 0;
}
header h1 {
  font-size: 1.5rem;
  color: #1a1a2e;
}
.subtitle {
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* === Progress === */
.progress {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  opacity: 0.4;
  transition: opacity 0.2s;
}
.progress-step.active, .progress-step.done { opacity: 1; }
.step-number {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  transition: background 0.2s, color 0.2s;
}
.progress-step.active .step-number { background: #2563eb; color: #fff; }
.progress-step.done .step-number { background: #16a34a; color: #fff; }
.step-label { font-size: 0.75rem; color: #666; }

/* === Steps === */
.step {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.step h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  color: #1a1a2e;
}
.hidden { display: none !important; }

/* === Fields === */
.field {
  margin-bottom: 1rem;
}
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}
.required { color: #dc2626; }
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}
.field input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.field input.invalid { border-color: #dc2626; }
.field-error {
  display: block;
  color: #dc2626;
  font-size: 0.8rem;
  min-height: 1.2em;
  margin-top: 0.15rem;
}
.help-text {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.2rem;
}

/* === Password toggle === */
.password-wrap {
  position: relative;
}
.password-wrap input { padding-right: 2.5rem; }
.btn-toggle-pw {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
}

/* === Buttons === */
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.btn {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover:not(:disabled) { background: #d1d5db; }
.btn-small { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-submit { min-width: 160px; }

/* === Info box === */
.info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #1e40af;
}
.info-box strong { display: block; margin-bottom: 0.25rem; }
.info-box p { margin: 0; color: #1e3a5f; }

/* === Credential check === */
.credential-check {
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

/* === Drop zone === */
.drop-zone {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
}
.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.drop-zone-text { pointer-events: none; }
.drop-icon { font-size: 1.5rem; }
.drop-zone-file {
  font-size: 0.9rem;
  color: #374151;
  pointer-events: none;
}

/* === Cert guide === */
.cert-guide {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}
.guide-item {
  flex: 1;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
}
.guide-correct { background: #f0fdf4; border: 1px solid #bbf7d0; }
.guide-wrong { background: #fef2f2; border: 1px solid #fecaca; }
.guide-icon { font-size: 1.5rem; flex-shrink: 0; }

/* === Validation results === */
.validation-results {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.validation-results h3 { font-size: 0.9rem; margin-bottom: 0.5rem; }
.val-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.25rem 0;
}
.val-ok { color: #16a34a; }
.val-warn { color: #ca8a04; }
.val-error { color: #dc2626; }

/* === Review === */
.review-card {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
}
.review-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}
.review-row:last-child { border-bottom: none; }
.review-label { color: #666; font-size: 0.8rem; }
.review-value { font-weight: 500; text-align: right; max-width: 60%; word-break: break-all; }
.review-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-ok { background: #dcfce7; color: #16a34a; }
.badge-warn { background: #fef9c3; color: #ca8a04; }
.badge-error { background: #fee2e2; color: #dc2626; }

/* === Success === */
.success-card { text-align: center; }
.success-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.magic-link-box {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}
.magic-link-box input {
  flex: 1;
  padding: 0.5rem;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.85rem;
  background: #f8fafc;
}

/* === Status === */
.status-card {
  background: #f8fafc;
  border-radius: 8px;
  padding: 1rem;
}
.status-display { margin-top: 1rem; }
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
}
.status-submitted { background: #dbeafe; color: #1d4ed8; }
.status-validated { background: #dcfce7; color: #16a34a; }
.status-approved { background: #dcfce7; color: #15803d; }
.status-rejected { background: #fee2e2; color: #dc2626; }
.status-completed { background: #f3e8ff; color: #7c3aed; }
.status-error { background: #fee2e2; color: #dc2626; }

/* === Loading === */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Mobile tweaks === */
@media (max-width: 480px) {
  .cert-guide { flex-direction: column; }
  header h1 { font-size: 1.25rem; }
  .progress { gap: 1rem; }
}
