/* ===== XISBIGA HILAAC — Diiwaangelinta Codbixiyaha ===== */
:root {
  --gold: #F5A800;
  --gold-dark: #E09400;
  --gold-light: #FFC94D;
  --gold-50: #FFF8E7;
  --gold-100: #FDEFC7;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #ececec;
  --white: #ffffff;
  --danger: #d64545;
  --danger-bg: #fdecec;
  --success: #1a9e5f;
  --success-bg: #e8f8ef;
  --radius: 14px;
  --shadow: 0 20px 45px -20px rgba(180, 130, 0, 0.35);
  --font: "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, var(--gold-50) 0%, #ffffff 45%, var(--gold-50) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
}

/* ===== Header ===== */
.masthead {
  width: 100%;
  max-width: 620px;
  text-align: center;
  margin-bottom: 22px;
}
.masthead .logo {
  width: 108px;
  height: 108px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 24px -10px rgba(200, 150, 0, 0.5);
  padding: 6px;
}
.masthead h1 {
  margin: 12px 0 2px;
  font-size: 1.5rem;
  letter-spacing: 1px;
  color: var(--gold-dark);
  font-weight: 800;
}
.masthead p { margin: 0; color: var(--muted); font-size: .95rem; }

/* ===== Card ===== */
.card {
  width: 100%;
  max-width: 620px;
  background: var(--white);
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gold-100);
  overflow: hidden;
}
.card-band {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #fff;
  padding: 22px 26px;
  text-align: center;
}
.card-band h2 { margin: 0 0 4px; font-size: 1.25rem; font-weight: 800; }
.card-band p { margin: 0; opacity: .95; font-size: .9rem; }
.card-body { padding: 22px 26px 28px; }

/* ===== Registration COMPLETE — celebration ===== */
.success-screen { text-align: center; padding: 22px 8px 12px; }
.success-stage { position: relative; width: 160px; height: 160px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; }
.s-ring {
  position: absolute; top: 50%; left: 50%; width: 110px; height: 110px; margin: -55px 0 0 -55px;
  border-radius: 50%; border: 3px solid var(--success); opacity: 0;
  animation: sRing 1.9s ease-out .2s infinite;
}
.s-ring.d2 { animation-delay: 1.1s; }
@keyframes sRing { 0% { opacity: .5; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.5); } }

.s-check { width: 118px; height: 118px; }
.s-circle {
  fill: none; stroke: var(--success); stroke-width: 5; opacity: .25;
  stroke-dasharray: 252; stroke-dashoffset: 252;
  animation: sDraw .6s ease-out .1s forwards;
}
.s-tick {
  fill: none; stroke: var(--success); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 80; stroke-dashoffset: 80;
  animation: sDraw .45s cubic-bezier(.6,0,.4,1) .55s forwards;
  filter: drop-shadow(0 3px 6px rgba(26,158,95,.4));
}
@keyframes sDraw { to { stroke-dashoffset: 0; } }
.success-stage::after {
  /* subtle green glow behind */
  content: ""; position: absolute; width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle, rgba(26,158,95,.25), transparent 70%);
  opacity: 0; animation: sGlow .5s ease-out .5s forwards;
}
@keyframes sGlow { to { opacity: 1; } }

/* confetti */
.confetti { position: absolute; top: 40%; left: 50%; width: 9px; height: 9px; border-radius: 2px; opacity: 0; }
.confetti.c1 { background: var(--gold); --tx: -70px; --r: -40deg; }
.confetti.c2 { background: var(--success); --tx: 70px; --r: 50deg; }
.confetti.c3 { background: var(--gold-dark); --tx: -110px; --r: 120deg; }
.confetti.c4 { background: var(--gold-light); --tx: 110px; --r: -120deg; }
.confetti.c5 { background: var(--success); --tx: -40px; --r: 200deg; border-radius: 50%; }
.confetti.c6 { background: var(--gold); --tx: 40px; --r: -200deg; border-radius: 50%; }
.confetti.c7 { background: var(--gold-dark); --tx: -95px; --r: 30deg; }
.confetti.c8 { background: var(--gold-light); --tx: 95px; --r: -30deg; }
.success-screen .confetti { animation: confPop .9s ease-out .6s forwards; }
@keyframes confPop {
  0% { opacity: 0; transform: translate(0,0) rotate(0) scale(.4); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--tx), -70px) rotate(var(--r)) scale(1); }
}

.s-title { margin: 4px 0 8px; color: var(--success); font-size: 1.5rem; opacity: 0; transform: translateY(12px); animation: fadeUp .6s ease-out .8s forwards; }
.s-sub { color: var(--muted); margin: 0 0 14px; opacity: 0; transform: translateY(12px); animation: fadeUp .6s ease-out .95s forwards; }
.ref-box {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--gold-50); border: 1.5px dashed var(--gold);
  border-radius: 12px; padding: 10px 12px 10px 18px; opacity: 0; transform: translateY(12px) scale(.96);
  animation: refIn .55s cubic-bezier(.2,.9,.3,1.3) 1.1s forwards;
}
@keyframes refIn { to { opacity: 1; transform: translateY(0) scale(1); } }
.ref-box .ref-code { margin: 0; background: none; border: none; padding: 0; letter-spacing: 1.5px; }
.ref-copy {
  background: var(--gold); color: #fff; border: none; border-radius: 8px;
  width: 36px; height: 36px; font-size: 1rem; cursor: pointer; transition: transform .1s, background .15s;
}
.ref-copy:hover { background: var(--gold-dark); transform: scale(1.05); }
.s-hint { color: var(--success); font-weight: 600; font-size: .85rem; margin: 8px 0 0; }
.s-link { margin-top: 18px; opacity: 0; animation: fadeUp .6s ease-out 1.3s forwards; }
.s-link a { color: var(--gold-dark); font-weight: 700; text-decoration: none; }
.s-link a:hover { text-decoration: underline; }

/* ===== Registration CLOSED — animated lock scene ===== */
.closed-screen { text-align: center; padding: 24px 8px 12px; }
.lock-stage {
  position: relative; width: 180px; height: 180px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
}
/* pulsing rings */
.lock-ring {
  position: absolute; top: 50%; left: 50%; width: 120px; height: 120px;
  margin: -60px 0 0 -60px; border-radius: 50%;
  border: 2px solid var(--gold); opacity: 0;
}
.closed-screen.animate .lock-ring { animation: ringPulse 2.8s ease-out infinite; }
.closed-screen.animate .lock-ring.r1 { animation-delay: .9s; }
.closed-screen.animate .lock-ring.r2 { animation-delay: 1.8s; }
.closed-screen.animate .lock-ring.r3 { animation-delay: 2.7s; }
@keyframes ringPulse {
  0%   { opacity: .55; transform: scale(.55); }
  100% { opacity: 0;   transform: scale(1.5); }
}

.lock-holder {
  position: relative; width: 120px; height: 150px;
  opacity: 0; transform: scale(.6) translateY(10px);
}
.closed-screen.animate .lock-holder {
  animation: lockPop .6s cubic-bezier(.2,.9,.3,1.3) forwards,
             lockWobble 2.6s ease-in-out 1.2s infinite;
}
@keyframes lockPop { to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes lockWobble {
  0%,88%,100% { transform: rotate(0); }
  92% { transform: rotate(-4deg); }
  96% { transform: rotate(4deg); }
}

.lock-svg { width: 120px; height: 150px; overflow: visible; }
.lock-body { fill: url(#lg); filter: drop-shadow(0 8px 14px rgba(224,148,0,.45)); }
.lock-hole { fill: #fff; opacity: .95; }
.lock-shackle {
  fill: none; stroke: var(--gold-dark); stroke-width: 11; stroke-linecap: round;
  /* start "open": lifted up */
  transform: translateY(-16px);
  transform-origin: center;
}
.closed-screen.animate .lock-shackle { animation: shackleDrop .7s cubic-bezier(.3,1.4,.5,1) .35s forwards; }
@keyframes shackleDrop {
  0%   { transform: translateY(-16px); }
  70%  { transform: translateY(3px); }
  85%  { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

/* little sparks that fly out when it snaps shut */
.lock-spark {
  position: absolute; top: 50%; left: 50%; width: 7px; height: 7px;
  margin: -3px; border-radius: 50%; background: var(--gold-light); opacity: 0;
}
.closed-screen.animate .lock-spark { animation: sparkFly .6s ease-out 1s forwards; }
.lock-spark.s1 { --dx: -46px; --dy: -30px; }
.lock-spark.s2 { --dx:  46px; --dy: -30px; }
.lock-spark.s3 { --dx: -40px; --dy:  26px; }
.lock-spark.s4 { --dx:  40px; --dy:  26px; }
@keyframes sparkFly {
  0%   { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); }
}

/* staggered text */
.closed-h, .closed-p, .closed-link {
  opacity: 0; transform: translateY(12px);
}
.closed-h { margin: 4px 0 8px; color: var(--gold-dark); font-size: 1.5rem; }
.closed-p { color: var(--muted); max-width: 420px; margin: 0 auto; }
.closed-link { margin-top: 18px; }
.closed-link a { color: var(--gold-dark); font-weight: 600; text-decoration: none; }
.closed-link a:hover { text-decoration: underline; }
.closed-screen.animate .closed-h { animation: fadeUp .6s ease-out 1.05s forwards; }
.closed-screen.animate .closed-p { animation: fadeUp .6s ease-out 1.25s forwards; }
.closed-screen.animate .closed-link { animation: fadeUp .6s ease-out 1.45s forwards; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* ===== Announcement (who we're voting for) ===== */
.announce {
  background: linear-gradient(135deg, var(--gold-50), var(--gold-100));
  border: 1px solid var(--gold);
  border-left: 5px solid var(--gold-dark);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.announce h3 { margin: 0 0 6px; color: var(--gold-dark); font-size: 1.05rem; }
.announce p { margin: 0; color: var(--ink); font-size: .92rem; white-space: pre-wrap; }
.announce:empty, .announce h3:empty { display: none; }

/* ===== Step indicator ===== */
.steps { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 22px; }
.steps .step { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.steps .step .dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: #eee; color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: .82rem;
}
.steps .step.active { color: var(--gold-dark); }
.steps .step.active .dot { background: var(--gold); color: #fff; }
.steps .step.done .dot { background: var(--success); color: #fff; }
.steps .step.done { color: var(--success); }
.step-line { width: 34px; height: 2px; background: #e5e5e5; }

/* ===== Verified badge & OTP lead ===== */
.verified-badge {
  background: var(--success-bg); color: var(--success);
  border: 1px solid #bfe9d2; border-radius: var(--radius);
  padding: 10px 14px; font-size: .9rem; font-weight: 600; margin-bottom: 16px;
}
.otp-lead { font-size: .9rem; color: var(--muted); margin: 4px 0 14px; text-align: center; }
.link-inline {
  background: none; border: none; color: var(--gold-dark);
  font-weight: 700; cursor: pointer; font-size: .9rem; padding: 0 2px; text-decoration: underline;
}

/* ===== Existing-member callout ===== */
.callout {
  display: block;
  text-decoration: none;
  border: 1px dashed var(--gold);
  background: var(--gold-50);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 20px;
  color: var(--ink);
  transition: background .15s, transform .1s;
}
.callout:hover { background: var(--gold-100); }
.callout small { color: var(--muted); display: block; margin-bottom: 2px; }
.callout strong { color: var(--gold-dark); }

/* ===== Form ===== */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 6px;
}
.req { color: var(--danger); }
.field input,
.field select {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 168, 0, 0.18);
}
.field select:disabled { background: #f7f7f7; color: #aaa; cursor: not-allowed; }

/* Phone with +252 prefix */
.phone { display: flex; align-items: stretch; }
.phone .prefix {
  display: flex; align-items: center;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--gold-50);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.phone input {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.field .error-msg {
  color: var(--danger);
  font-size: .82rem;
  margin-top: 5px;
  display: none;
}
.field.invalid input,
.field.invalid select { border-color: var(--danger); }
.field.invalid .error-msg { display: block; }

.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.opt { color: var(--muted); font-weight: 400; font-size: .82rem; }

/* ===== Photo upload ===== */
.photo-upload { display: flex; align-items: center; gap: 16px; }
.photo-preview {
  width: 92px; height: 92px; border-radius: 14px; flex-shrink: 0;
  border: 2px dashed var(--gold); background: var(--gold-50);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; text-align: center; color: var(--muted); font-size: .72rem; padding: 4px;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { flex: 1; }
.btn-file {
  display: inline-block; background: var(--gold-50); color: var(--gold-dark);
  border: 1.5px solid var(--gold); border-radius: var(--radius);
  padding: 10px 16px; font-weight: 700; cursor: pointer; font-size: .9rem;
}
.btn-file:hover { background: var(--gold-100); }

/* ===== Radio pills (gender / place) ===== */
.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-pill {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 11px 18px; cursor: pointer; font-weight: 600; flex: 1; justify-content: center;
  transition: border-color .15s, background .15s;
}
.radio-pill input { accent-color: var(--gold-dark); width: 18px; height: 18px; }
.radio-pill:has(input:checked) { border-color: var(--gold); background: var(--gold-50); color: var(--gold-dark); }

/* ===== Admins block ===== */
.section-title {
  font-weight: 800;
  font-size: 1rem;
  margin: 24px 0 4px;
  color: var(--gold-dark);
}
.section-sub { font-size: .84rem; color: var(--muted); margin: 0 0 12px; }

.admin-row {
  border: 1.5px solid var(--gold-100);
  background: var(--gold-50);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  position: relative;
}
.admin-row .row-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.admin-row .row-head strong { color: var(--gold-dark); font-size: .9rem; }
.admin-row .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .admin-row .grid2 { grid-template-columns: 1fr; } }

.btn-remove {
  background: none; border: none; color: var(--danger);
  font-size: .82rem; cursor: pointer; padding: 2px 4px; font-weight: 600;
}
.btn-add {
  width: 100%;
  border: 1.5px dashed var(--gold);
  background: #fff;
  color: var(--gold-dark);
  border-radius: var(--radius);
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.btn-add:hover:not(:disabled) { background: var(--gold-50); }
.btn-add:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Consent ===== */
.consent {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 20px 0 8px;
  font-size: .9rem;
}
.consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--gold-dark); flex-shrink: 0; }

/* ===== Submit ===== */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  margin-top: 12px;
  box-shadow: 0 10px 20px -10px rgba(224, 148, 0, 0.7);
  transition: transform .08s, box-shadow .15s, opacity .15s;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

/* ===== Banners ===== */
.banner { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: .9rem; display: none; }
.banner.show { display: block; }
.banner.error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f3c9c9; }
.banner.success { background: var(--success-bg); color: var(--success); border: 1px solid #bfe9d2; }

/* ===== OTP Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(30, 25, 0, 0.5);
  display: none; align-items: center; justify-content: center;
  padding: 16px; z-index: 50;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 20px; max-width: 400px; width: 100%;
  padding: 26px; text-align: center; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 6px; color: var(--gold-dark); }
.modal p { color: var(--muted); font-size: .9rem; margin: 0 0 18px; }
.otp-inputs { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.otp-inputs input {
  width: 46px; height: 54px; text-align: center; font-size: 1.5rem; font-weight: 700;
  border: 1.5px solid var(--line); border-radius: 12px;
}
.otp-inputs input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,168,0,.18); }
.modal .link-btn {
  background: none; border: none; color: var(--gold-dark); cursor: pointer;
  font-weight: 600; font-size: .88rem; margin-top: 10px;
}
.modal .link-btn:disabled { color: var(--muted); cursor: default; }

/* ===== Success screen ===== */
.done { text-align: center; padding: 20px 0; }
.done .check {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--success-bg); color: var(--success);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; margin: 0 auto 14px;
}
.done h2 { margin: 0 0 8px; color: var(--success); }
.done p { color: var(--muted); }
.ref-code {
  display: inline-block; background: var(--gold-50); border: 1px dashed var(--gold);
  color: var(--gold-dark); font-weight: 800; letter-spacing: 1px;
  padding: 8px 16px; border-radius: 10px; margin-top: 10px; font-size: 1.1rem;
}

/* ===== Footer / list on verify page ===== */
.info-list { list-style: none; padding: 0; margin: 0 0 18px; }
.info-list li {
  position: relative; padding: 8px 8px 8px 34px; margin-bottom: 6px;
  background: var(--gold-50); border-radius: 10px; font-size: .9rem;
}
.info-list li::before {
  content: counter(step); counter-increment: step;
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; background: var(--gold); color: #fff;
  border-radius: 50%; font-size: .75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.info-list { counter-reset: step; }

.help-box {
  background: var(--gold-100); border-radius: var(--radius);
  padding: 14px; margin-bottom: 18px; font-size: .88rem;
}
.help-box strong { color: var(--gold-dark); }
.help-box .phones { font-weight: 800; color: var(--ink); margin-top: 4px; }

.site-footer { margin-top: 28px; color: var(--muted); font-size: .8rem; text-align: center; }
.site-footer a { color: var(--gold-dark); }
