/* ─────────────────────────────────────────────────────────────
   APPLICATION FORM  —  Multi-step membership request
   ───────────────────────────────────────────────────────────── */

.form-page { background: var(--sand); padding-top: 68px; }

/* Hero banner */
.form-hero {
  background: linear-gradient(160deg, var(--teal-deep) 0%, var(--teal) 100%);
  padding: 64px 0 80px; text-align: center;
}
.form-hero h1 { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 700; color: var(--white); margin-bottom: 12px; }
.form-hero p  { font-size: 1rem; color: rgba(255,255,255,0.65); }

/* Form wrapper */
.form-container { max-width: 720px; margin: -40px auto 80px; padding: 0 32px; }

/* ── Progress indicator ──────────────────────────────────────── */
.form-progress {
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--border); border-bottom: none;
  padding: 32px 40px 28px;
}
.progress-steps { display: flex; position: relative; margin-bottom: 16px; }
.progress-step  { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
.progress-step:not(:last-child)::after {
  content: ''; position: absolute; top: 16px;
  inset-inline-start: 50%; inset-inline-end: -50%;
  height: 2px; background: var(--sand-dark); z-index: 0;
}
.progress-step.done:not(:last-child)::after,
.progress-step.active:not(:last-child)::after { background: var(--gold); }

.progress-dot {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--sand-dark); background: var(--white); z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--ink-faint);
  transition: var(--transition);
}
.progress-step.active .progress-dot {
  border-color: var(--gold); background: var(--gold); color: var(--white);
  box-shadow: 0 0 0 4px rgba(201,168,76,0.2);
}
.progress-step.done .progress-dot { border-color: var(--teal); background: var(--teal); color: var(--white); }
.progress-label { margin-top: 10px; font-size: 0.75rem; font-weight: 500; color: var(--ink-faint); text-align: center; }
.progress-step.active .progress-label { color: var(--gold); font-weight: 600; }
.progress-step.done   .progress-label { color: var(--teal); }

.progress-bar-track { height: 4px; background: var(--sand-dark); border-radius: 2px; overflow: hidden; }
.progress-bar-fill  { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 2px; transition: width 0.5s ease; }

/* ── Step wrapper ────────────────────────────────────────────── */
.form-step-wrapper {
  background: var(--white); border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 48px 40px 40px;
}
.form-step { display: none; }
.form-step.active { display: block; }
.form-step-title { font-size: 1.5rem; font-weight: 700; font-family: var(--font-serif); color: var(--ink); margin-bottom: 8px; }
.form-step-sub   { font-size: 0.9375rem; color: var(--ink-muted); margin-bottom: 36px; line-height: 1.6; }

/* ── Fields ──────────────────────────────────────────────────── */
.form-field  { margin-bottom: 28px; }
.form-label  { display: block; font-size: 0.875rem; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.form-label .req { color: var(--terra); margin-inline-start: 2px; }
.form-label .form-optional-tag { font-size: 0.75rem; font-weight: 400; color: var(--ink-faint); margin-inline-start: 8px; letter-spacing: 0.03em; }

.form-input,
.form-select,
.form-textarea {
  width: 100%; padding: 14px 18px;
  font-size: 0.9375rem; font-family: var(--font-sans); color: var(--ink);
  background: var(--sand); border: 1.5px solid var(--sand-dark);
  border-radius: var(--radius-sm); transition: var(--transition); outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--teal); background: var(--white);
  box-shadow: 0 0 0 4px rgba(0,109,91,0.1);
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--ink-faint); }
.form-select  { appearance: none; cursor: pointer; }
.form-textarea { resize: vertical; min-height: 140px; line-height: 1.65; }

.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-hint   { margin-top: 8px; font-size: 0.8125rem; color: var(--ink-faint); line-height: 1.5; }
.form-error  { margin-top: 6px; font-size: 0.8125rem; color: var(--danger); display: none; }

.form-field.has-error .form-input,
.form-field.has-error .form-select,
.form-field.has-error .form-textarea { border-color: var(--danger); }
.form-field.has-error .form-error    { display: block; }

/* ── Searchable dropdown (cultural background) ───────────────── */
.combo { position: relative; }
.combo::after {
  content: ''; position: absolute; top: 50%; inset-inline-end: 20px;
  width: 7px; height: 7px; pointer-events: none;
  border-right: 1.5px solid var(--ink-faint); border-bottom: 1.5px solid var(--ink-faint);
  transform: translateY(-70%) rotate(45deg);
}
.combo-input { padding-inline-end: 44px; }
.combo-list {
  display: none; position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0;
  max-height: 264px; overflow-y: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
.combo-list.open { display: block; }
.combo-list li[role="option"] {
  padding: 10px 12px; border-radius: var(--radius-xs);
  font-size: 0.9375rem; color: var(--ink); cursor: pointer;
}
.combo-list li[role="option"]:hover,
.combo-list li[role="option"].active { background: var(--teal-faint); color: var(--teal); }
.combo-list li[aria-selected="true"] { font-weight: 600; color: var(--teal); }
.combo-list li[hidden] { display: none; }
.combo-empty { display: none; padding: 10px 12px; font-size: 0.8125rem; color: var(--ink-faint); }
.combo-list.no-results .combo-empty { display: block; }

/* ── Applicant photo ─────────────────────────────────────────── */
.photo-upload       { display: flex; align-items: center; gap: 16px; }
.photo-preview      { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }
.photo-upload-body  { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.photo-upload-btn   { cursor: pointer; }
.photo-input        { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo-status       { font-size: 0.8125rem; color: var(--ink-faint); }
.photo-status.is-ok { color: var(--emerald); }
.form-field.has-error .photo-preview { border-color: var(--danger); }

/* ── Live selfie camera ──────────────────────────────────────── */
.selfie-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(13, 59, 48, 0.72);
}
.selfie-modal[hidden] { display: none; }
.selfie-card {
  width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--white); border-radius: var(--radius-lg); padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.selfie-title { font-family: var(--font-serif); font-size: 1.125rem; font-weight: 700; color: var(--ink); }
.selfie-video-wrap {
  position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden;
  border-radius: var(--radius-lg); background: #000;
}
/* Mirrored like a normal selfie camera; captured frames are the raw image. */
.selfie-video-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.selfie-oval {
  position: absolute; left: 50%; top: 46%; width: 62%; height: 68%;
  transform: translate(-50%, -50%); border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.selfie-countdown {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 4rem; font-weight: 700; color: var(--white);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5); pointer-events: none;
}
.selfie-instruction { font-size: 1rem; font-weight: 600; color: var(--ink); text-align: center; line-height: 1.5; min-height: 3em; }
.selfie-error { font-size: 0.875rem; color: var(--danger); text-align: center; line-height: 1.5; }
.selfie-error:empty { display: none; }
.selfie-actions { display: flex; justify-content: space-between; gap: 12px; }

.char-counter { display: flex; justify-content: flex-end; font-size: 0.75rem; color: var(--ink-faint); margin-top: 6px; }

/* ── Radio options ───────────────────────────────────────────── */
.radio-group  { display: flex; flex-direction: column; gap: 12px; }
.radio-option {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 20px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--sand-dark);
  cursor: pointer; transition: var(--transition);
}
.radio-option:hover   { border-color: var(--gold-muted); background: rgba(201,168,76,0.04); }
.radio-option.selected { border-color: var(--gold); background: rgba(201,168,76,0.07); }
.radio-dot {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  border: 2px solid var(--sand-dark); transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.radio-option.selected .radio-dot { border-color: var(--gold); background: var(--gold); }
.radio-dot::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--white); opacity: 0; }
.radio-option.selected .radio-dot::after { opacity: 1; }
.radio-text-title { font-size: 0.9375rem; font-weight: 600; color: var(--ink); }
.radio-text-desc  { font-size: 0.8125rem; color: var(--ink-muted); margin-top: 2px; line-height: 1.4; }

/* Checkbox variant (confirm intent) */
.check-dot { border-radius: var(--radius-xs); }

/* ── Form navigation ─────────────────────────────────────────── */
.form-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 40px; padding-top: 32px;
  border-top: 1px solid var(--sand-dark);
}
.form-step-indicator { font-size: 0.8125rem; color: var(--ink-faint); }

/* ── Review summary box ──────────────────────────────────────── */
.review-box {
  background: var(--sand); border-radius: var(--radius-md);
  padding: 28px; margin-bottom: 28px; border: 1px solid var(--border);
}
.review-box-title {
  font-size: 0.875rem; font-weight: 700; color: var(--ink);
  margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.06em;
}
html[dir="rtl"] .review-box-title { letter-spacing: 0; }
.review-row { font-size: 0.9rem; color: var(--ink-muted); line-height: 2; }
.review-row strong { color: var(--ink); display: inline-block; min-width: 80px; }
.review-photo img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; vertical-align: middle; }

/* ── Success screen ──────────────────────────────────────────── */
.form-success { text-align: center; padding: 20px 0 8px; display: none; }
.success-circle {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 28px; font-size: 2rem;
  box-shadow: 0 12px 40px rgba(0,77,64,0.3);
}
.form-success h2   { font-size: 1.75rem; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.form-success p    { font-size: 1rem; color: var(--ink-muted); line-height: 1.7; max-width: 420px; margin: 0 auto 8px; }
.form-success .arabic-note { font-size: 1.125rem; color: var(--gold); margin-top: 20px; font-style: italic; }
html[dir="rtl"] .form-success .arabic-note { font-style: normal; }

/* ── Form Responsive ─────────────────────────────────────────── */
@media (max-width: 720px) {
  .form-container  { padding: 0 20px; }
  .form-progress   { padding: 24px 24px 20px; }
  .form-step-wrapper { padding: 32px 24px; }
  .form-row        { grid-template-columns: 1fr; }
}
