/* ============================================================
   SA Commerce Pro — Login Page CSS
   Card layout only. No split, no panel, no layout variants.
   ============================================================ */

: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;
  --gold: #e0b54a;
  --primary-grad: linear-gradient(135deg, #8b5cf6, #4c1d95);
  --danger: #c0392b;
  --danger-soft: #fbe7e4;
}

/* ── Reset ── */
*, *::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); }

/* ── Layout helpers ── */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; width: 100%; }
.hidden { display: none !important; }

/* ── 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,.3);
}
.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(--green); }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 14px; }
.btn svg { width: 18px; height: 18px; }

/* ── Header ── */
.auth-header {
  position: sticky; top: 0; z-index: 60;
  background: #F4F1E8;
  backdrop-filter: saturate(1.4) blur(14px);
  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 — dark background, card centred ── */
.stage {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}

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

/* ── View 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; }
.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); }

/* ── 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); }

/* ── Fields ── */
.field { margin-top: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 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; }
.inp .eye {
  position: absolute; inset-inline-end: 12px; width: 32px; height: 32px;
  border: 0; background: none; cursor: pointer; color: var(--muted);
  display: grid; place-items: center; border-radius: 8px;
}
.inp .eye:hover { color: var(--ink); background: var(--sand-2); }
.inp .eye svg { width: 18px; height: 18px; }

/* 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; }

.field-row { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }
.link { color: var(--green); font-weight: 600; font-size: 13.5px; cursor: pointer; background: none; border: 0; padding: 0; }
.link:hover { text-decoration: underline; }
.checkrow { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); cursor: pointer; user-select: none; }
.checkrow input { appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--line); border-radius: 6px; background: var(--paper); cursor: pointer; position: relative; flex-shrink: 0; }
.checkrow input:checked { background: var(--primary-grad); border-color: transparent; }
.checkrow input:checked::after { content: ""; position: absolute; left: 5px; top: 2px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

.submit { margin-top: 22px; }
.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); }

/* ── Error banner ── */
.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: 20px; }
.banner svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── OTP ── */
.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; }
.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(--green); }
.otp-box.bad { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.resend { text-align: center; margin-top: 8px; font-size: 13.5px; color: var(--muted); }

/* ── Success ── */
.success { text-align: center; padding: 10px 0; }
.succ-ic {
  width: 74px; height: 74px; border-radius: 50%; background: var(--green-soft);
  color: var(--green); display: grid; place-items: center;
  margin: 0 auto 22px; animation: pop .5s cubic-bezier(.2,1.3,.4,1);
}
@keyframes pop { 0%{transform:scale(.5)} 60%{transform:scale(1.08)} 100%{transform:scale(1)} }
.succ-ic svg { width: 38px; height: 38px; }
.success h1 { font-size: 25px; font-weight: 800; letter-spacing: -.02em; }
.success p { color: var(--muted); font-size: 15px; margin-top: 8px; }
.redir { display: inline-flex; align-items: center; gap: 9px; margin-top: 22px; font-size: 13.5px; color: var(--muted); }

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

/* ── View animation ── */
.view { animation: fade .4s cubic-bezier(.2,.8,.2,1); }
@media (prefers-reduced-motion: no-preference) {
  @keyframes fade { from { transform: translateY(7px); } to { transform: none; } }
}

/* ── 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(--green); }
.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(--green); border-color: var(--green); }
.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; }
  .otp-box { width: 52px; height: 62px; font-size: 24px; }
  .auth-prompt { display: none; }
}
