/* ============================================
   REGISTRATION PAGE
   ============================================ */

.register-page {
  background: var(--cream);
  min-height: 100vh;
  padding-bottom: 80px;
}

.register-hero {
  padding: 60px 0 40px;
  background:
    radial-gradient(ellipse at top, rgba(113, 182, 44, 0.12), transparent 60%),
    var(--cream);
  text-align: center;
}

.register-hero .badge {
  margin-bottom: 16px;
}

.register-hero h1 {
  font-size: clamp(36px, 6vw, 64px);
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.register-hero p {
  color: var(--text-soft);
  max-width: 560px;
  margin: 0 auto;
  font-size: 16px;
}

.register-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: start;
  margin-top: 40px;
}

/* Form card */
.form-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.form-section {
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.form-section-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.form-section-num {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--green-dark);
  color: var(--white);
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
}

.form-section-title {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  margin: 0;
}

.form-section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* Photo upload preview */
.photo-upload {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  align-items: start;
}
.photo-preview {
  width: 140px;
  height: 186px; /* 3x4 ratio */
  background: var(--cream);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}
.photo-upload-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.photo-upload-info h4 {
  font-size: 16px;
  font-weight: 700;
}
.photo-upload-info p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Validation errors */
.field-error {
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: #c0392b;
  line-height: 1.45;
}

/* Real-time inline feedback (password match, file accept/reject) */
.match-hint,
.file-feedback {
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  min-height: 18px;
  transition: color 150ms ease-out;
}
.match-hint.match-ok,
.file-feedback.feedback-ok {
  color: var(--green-bright);
}
.match-hint.match-err,
.file-feedback.feedback-err {
  color: #c0392b;
}

/* Multi-file id_documents chips */
.doc-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--green-dark);
  max-width: 100%;
  transition: background 150ms ease-out, border-color 150ms ease-out;
}
.doc-chip small { color: var(--text-muted); font-size: 11px; margin-left: 2px; }
.doc-chip-text { display: inline-flex; align-items: baseline; gap: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-chip-icon {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green-primary);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.doc-chip-remove {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  transition: color 150ms ease-out, transform 150ms ease-out;
}
.doc-chip-remove:hover { color: #c0392b; transform: scale(1.15); }

/* Invalid file chip — accept/reject visual feedback */
.doc-chip.doc-chip-invalid {
  background: rgba(192, 57, 43, 0.06);
  border-color: rgba(192, 57, 43, 0.4);
  color: #c0392b;
}
.doc-chip.doc-chip-invalid small { color: #c0392b; }
.doc-chip.doc-chip-invalid .doc-chip-icon { background: #c0392b; }

.doc-chip-warn {
  flex-basis: 100%;
  padding: 8px 12px;
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.4);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: #c0392b;
}

/* Alert */
.alert-success {
  padding: 12px 16px;
  background: rgba(113, 182, 44, 0.12);
  border: 1px solid var(--green-primary);
  color: var(--green-dark);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 14px;
}

/* Sticky sidebar */
.register-sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-card {
  background: var(--green-dark);
  color: var(--white);
  padding: 28px;
  border-radius: var(--radius-lg);
}
.sidebar-card h3 {
  color: var(--white);
  font-size: 18px;
  margin-bottom: 16px;
  font-family: var(--font-display);
  font-weight: 700;
}
.sidebar-info-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sidebar-info-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
}
.sidebar-info-item svg {
  flex-shrink: 0;
  color: var(--green-primary);
  margin-top: 2px;
}

.sidebar-help {
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.sidebar-help h4 {
  font-size: 15px;
  margin-bottom: 8px;
  font-family: var(--font-display);
}
.sidebar-help p {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 12px;
  line-height: 1.5;
}
.sidebar-help a {
  font-size: 14px;
  color: var(--green-primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sidebar-help a:hover { color: var(--green-bright); }

/* Submit area */
.form-submit {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-submit-note {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* ============================================
   Consent link inside checkbox label
   ============================================ */
.consent-link {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-primary);
  background: none;
  border: 0;
  cursor: pointer;
  position: relative;
  transition: color 150ms ease-out;
}
.consent-link::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: currentColor;
  opacity: 0.4;
  transition: opacity 150ms ease-out;
}
.consent-link:hover { color: var(--green-bright); }
.consent-link:hover::after { opacity: 1; }
.consent-link:focus-visible {
  outline: 2px solid var(--green-primary);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ============================================
   Consent modal
   ============================================ */
.consent-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  visibility: hidden;
  pointer-events: none;
}
.consent-modal[aria-hidden="false"] {
  visibility: visible;
  pointer-events: auto;
}

.consent-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 61, 18, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 200ms ease-out;
}
.consent-modal[aria-hidden="false"] .consent-modal-backdrop { opacity: 1; }

.consent-modal-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow:
    0 30px 80px -20px rgba(0, 61, 18, 0.45),
    0 8px 24px -8px rgba(0, 61, 18, 0.20);
  /* Modals scale from center per global animation rules */
  transform-origin: center;
  transform: scale(0.96);
  opacity: 0;
  transition:
    transform 220ms cubic-bezier(0.23, 1, 0.32, 1),
    opacity 180ms ease-out;
}
.consent-modal[aria-hidden="false"] .consent-modal-panel {
  transform: scale(1);
  opacity: 1;
}

.consent-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border);
}
.consent-modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--green-dark);
  margin: 0;
  line-height: 1.25;
}
.consent-modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--cream);
  color: var(--green-dark);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition:
    background 150ms ease-out,
    transform 150ms ease-out;
}
.consent-modal-close:hover { background: rgba(0, 61, 18, 0.08); }
.consent-modal-close:active { transform: scale(0.94); }

.consent-modal-body {
  padding: 20px 28px;
  overflow-y: auto;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-soft);
  white-space: pre-line;
}

.consent-modal-foot {
  padding: 16px 28px 24px;
  border-top: 1px solid var(--border);
}

/* Lock body scroll while modal is open */
body.modal-open { overflow: hidden; }

@media (max-width: 560px) {
  .consent-modal { padding: 12px; align-items: end; }
  .consent-modal-panel {
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 12px 12px;
    /* On mobile slide up slightly — still center origin, just shorter travel */
    transform: translateY(8px) scale(0.98);
  }
  .consent-modal[aria-hidden="false"] .consent-modal-panel {
    transform: translateY(0) scale(1);
  }
  .consent-modal-head { padding: 20px 22px 14px; }
  .consent-modal-body { padding: 18px 22px; font-size: 14px; }
  .consent-modal-foot { padding: 14px 22px 20px; }
  .consent-modal-title { font-size: 18px; }
}

/* Reduced motion: drop transform, keep fade */
@media (prefers-reduced-motion: reduce) {
  .consent-modal-panel { transform: none !important; }
  .consent-modal-backdrop,
  .consent-modal-panel { transition-duration: 0.01ms !important; }
}

/* RESPONSIVE */
@media (max-width: 960px) {
  .register-layout { grid-template-columns: 1fr; }
  .register-sidebar { position: static; order: -1; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .form-card { padding: 24px 20px; }
  .form-section-num { width: 32px; height: 32px; font-size: 14px; }
  .form-section-title { font-size: 18px; }
  .photo-upload { grid-template-columns: 1fr; }
  .photo-preview { width: 100%; max-width: 200px; height: auto; aspect-ratio: 3 / 4; margin: 0 auto; }
}
