/* ============================================================
   SA Commerce Pro — Register Page CSS
   Matches login.css palette exactly.
   ============================================================ */

:root {
  --ink: #10241c;
  --muted: #5d6b63;
  --sand: #f4f1e8;
  --sand-2: #ece6d7;
  --paper: #fffdf8;
  --line: #e4dfcf;
  --radius-lg: 26px;
  --shadow: 0 1px 2px rgba(16,36,28,.05), 0 22px 48px -24px rgba(16,36,28,.4);
  --shadow-soft: 0 1px 2px rgba(16,36,28,.04), 0 14px 34px -22px rgba(16,36,28,.32);
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-ar: "Tajawal", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --mono: "IBM Plex Mono", monospace;
  --maxw: 1180px;
  --emerald: #2b0f54;
  --emerald-2: #6d28d9;
  --green: #7c3aed;
  --green-soft: #f0e8fd;
  --primary-grad: linear-gradient(135deg, #8b5cf6, #4c1d95);
  --danger: #c0392b;
  --danger-soft: #fbe7e4;
  --success: #0a6640;
  --success-soft: #e0f1e9;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--emerald);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
html[dir="rtl"] body { font-family: var(--font-ar); }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
::selection { background: var(--green-soft); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; width: 100%; }
.hidden { display: none !important; }
.req { color: var(--danger); margin-inline-start: 2px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 9px; border-radius: 999px; padding: 13px 20px;
  font-weight: 600; font-size: 15px; cursor: pointer;
  border: 1px solid transparent;
  transition: transform .12s, box-shadow .2s, filter .2s, border-color .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary-grad); color: #fff; box-shadow: 0 12px 26px -12px rgba(139,92,246,.4); }
.btn-primary:hover:not([disabled]) { filter: brightness(1.07); }
.btn-outline { border-color: var(--line); background: var(--paper); color: var(--ink); }
.btn-outline:hover { border-color: var(--emerald-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 14px; }

/* ── Header ── */
.auth-header {
  position: sticky; top: 0; z-index: 60;
  background: #F4F1E8;
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; height: 64px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; color: var(--ink); white-space: nowrap; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(150deg, var(--emerald-2), var(--green)); display: grid; place-items: center; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.logo svg { width: 18px; height: 18px; }
.nav-right { margin-inline-start: auto; display: flex; align-items: center; gap: 14px; }
.auth-prompt { font-size: 14.5px; font-weight: 600; color: #7C3AED; white-space: nowrap; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--paper); }
.lang-btn { border: 0; background: transparent; padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); transition: background .15s, color .15s; }
.lang-btn.on { background: var(--emerald); color: #fff; }

/* ── Stage ── */
.stage { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding: 48px 20px; }

/* ── Card ── */
.card { width: 100%; max-width: 440px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 40px 38px; }

/* ── Headings ── */
.head h1 { font-size: 27px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.head p { color: var(--muted); font-size: 15px; margin-top: 8px; }

/* ── Fields ── */
.field { margin-top: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.helper { font-size: 12.5px; color: var(--muted); margin-top: 7px; }
.inp { position: relative; display: flex; align-items: center; }
.inp input {
  width: 100%; border: 1.5px solid var(--line); background: var(--paper);
  border-radius: 13px; padding: 13px 15px; font: inherit; font-size: 15px;
  color: var(--ink); transition: border-color .15s, box-shadow .15s; outline: none;
}
.inp input::placeholder { color: #a8b0a9; }
.inp input:focus { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.inp.err input { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.inp .icon { position: absolute; inset-inline-start: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }

/* Phone prefix */
.pre { position: absolute; inset-inline-start: 0; display: flex; align-items: center; gap: 7px; padding-inline-start: 14px; padding-inline-end: 11px; font-size: 14.5px; font-weight: 600; color: var(--ink); border-inline-end: 1px solid var(--line); height: 26px; pointer-events: none; }
.inp.haspre.phone input { padding-inline-start: 96px; font-family: var(--mono); letter-spacing: .5px; }
.flag-emoji { font-size: 18px; line-height: 1; flex-shrink: 0; }

.submit { margin-top: 22px; }
.link { color: var(--emerald-2); font-weight: 600; font-size: 13.5px; cursor: pointer; background: none; border: 0; padding: 0; }
.link:hover { text-decoration: underline; }
.switch { text-align: center; margin-top: 26px; font-size: 14px; color: var(--muted); }
.compliance { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 22px; font-size: 12px; color: var(--muted); }
.compliance svg { width: 14px; height: 14px; color: var(--green); }

/* ── Banners ── */
.banner { display: flex; align-items: center; gap: 10px; background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 11px 14px; font-size: 13.5px; font-weight: 500; margin-top: 16px; }
.banner svg { width: 18px; height: 18px; flex-shrink: 0; }
.banner-ok { background: var(--success-soft); color: var(--success); }

/* ── OTP section ── */
#otp-section { margin-top: 4px; }

/* ── Resend ── */
.resend { text-align: center; margin-top: 12px; font-size: 13.5px; color: var(--muted); }

/* ── Spinner ── */
.spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ── Footer ── */
footer { background: var(--paper); border-top: 1px solid var(--line); padding: 54px 0 28px; flex-shrink: 0; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.foot-brand .brand { color: var(--ink); }
.foot-brand p { color: var(--muted); font-size: 14px; margin: 16px 0; max-width: 30ch; }
.foot-col h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 16px; }
.foot-col a { display: block; color: var(--ink); font-size: 14.3px; margin-bottom: 11px; opacity: .85; }
.foot-col a:hover { opacity: 1; color: var(--emerald-2); }
.foot-bottom { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); margin-top: 42px; padding-top: 24px; color: var(--muted); font-size: 13px; flex-wrap: wrap; gap: 12px; }
.socials { display: flex; gap: 10px; }
.socials a { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.socials a:hover { color: var(--emerald-2); border-color: var(--emerald-2); }
.socials svg { width: 16px; height: 16px; }

/* ── Responsive ── */
@media (max-width: 900px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) {
  .foot-grid { grid-template-columns: 1fr; }
  .card { padding: 28px 20px; }
  .stage { padding: 28px 16px; }
  .auth-prompt { display: none; }
}

/* ── OTP view ── */
.otp-sent { font-size: 14px; color: var(--muted); margin-top: 8px; }
.otp-sent b { color: var(--ink); font-family: var(--mono); direction: ltr; display: inline-block; }
.back { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13.5px; font-weight: 600; cursor: pointer; background: none; border: 0; margin-bottom: 18px; padding: 0; }
.back:hover { color: var(--ink); }
.back svg { width: 16px; height: 16px; }
html[dir="rtl"] .back svg { transform: scaleX(-1); }
.otp-row { display: flex; gap: 12px; margin: 26px 0 6px; justify-content: center; }
.otp-row.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-7px)} 40%,80%{transform:translateX(7px)} }
.otp-box { width: 60px; height: 70px; border: 1.5px solid var(--line); border-radius: 15px; background: var(--paper); text-align: center; font-size: 28px; font-weight: 700; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.otp-box:focus { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.otp-box.filled { border-color: var(--green); background: var(--green-soft); color: var(--emerald-2); }
.otp-box.bad { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
#resend-wrapper { text-align: center; margin-top: 8px; font-size: 13.5px; color: var(--muted); }
#resend-countdown { display: inline; }

/* ── View animation ── */
.view { animation: fade .35s cubic-bezier(.2,.8,.2,1); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Method tabs ── */
.tabs { display: flex; gap: 4px; background: var(--sand-2); border-radius: 13px; padding: 4px; margin: 24px 0 4px; }
.tab-btn { flex: 1; border: 0; background: transparent; border-radius: 10px; padding: 10px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; transition: .15s; display: flex; align-items: center; justify-content: center; gap: 7px; }
.tab-btn svg { width: 16px; height: 16px; }
.tab-btn.on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-soft); }
