/* Shared look for the language page's consent screens (/en and /ar).
   Written with logical properties (inline-start/end) so the Arabic page mirrors itself. */
:root {
  --bg: #f6f8fc; --bg2: #eaf0ff; --card: #ffffff; --ink: #0f1b2d; --muted: #5b6b80; --line: #e1e7f0;
  --brand: #0b5cff; --brand-ink: #ffffff; --brand-soft: #e8efff; --ok: #12a150; --ok-soft: #e3f6ea; --err: #d93636;
  --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 12px 32px rgba(15, 27, 45, .08);
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0a1120; --bg2: #101c38; --card: #111a2c; --ink: #eef3fb; --muted: #94a3ba; --line: #22304a;
          --brand: #4d86ff; --brand-soft: #182a52; --ok: #2fbf6c; --ok-soft: #12321f;
          --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px rgba(0, 0, 0, .35); }
}
html[lang="ar"] { --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh; display: flex; flex-direction: column;
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg2), var(--bg) 70%) fixed;
  color: var(--ink); font: 16px/1.55 var(--font);
}

/* Header: Signit on one side, Sanad on the other. */
/* direction: ltr keeps Signit on the left and Sanad on the right in Arabic too. */
.site-header { direction: ltr; padding: 24px clamp(16px, 5vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-header .signit img { height: 54px; display: block; }
.site-header .sanad img { height: 48px; width: auto; display: block; }
.site-footer { text-align: center; padding: 0 16px 24px; font-size: 13px; color: var(--muted); }

main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.screen { display: none; }
.screen.on { display: flex; }

/* Centred card screens: enter ID, done. */
.center { flex: 1; align-items: center; justify-content: center; padding: 16px 16px 56px; }
.card { width: 100%; max-width: 480px; background: var(--card); border: 1px solid var(--line); border-radius: 22px;
        padding: 36px 36px 32px; box-shadow: var(--shadow); }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); text-decoration: none;
        margin-bottom: 22px; }
.back:hover { color: var(--brand); }

.steps { display: flex; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; }
.steps li { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }
.steps li::before { content: ""; height: 4px; border-radius: 4px; background: var(--line); }
.steps li.on { color: var(--ink); font-weight: 600; }
.steps li.on::before { background: var(--brand); }

h1 { font-size: 28px; line-height: 1.25; margin: 0 0 8px; font-weight: 700; letter-spacing: -0.01em; }
html[lang="ar"] h1 { letter-spacing: 0; }
p.sub { color: var(--muted); margin: 0 0 28px; }

label.field { display: block; font-weight: 600; margin-bottom: 8px; font-size: 15px; }
input[type=text] { width: 100%; font: inherit; font-size: 17px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px;
                   background: transparent; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input[type=text]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
#nid { font-size: 22px; letter-spacing: 4px; text-align: center; direction: ltr; font-family: Inter, system-ui, sans-serif; }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; min-height: 20px; overflow-wrap: anywhere; }
.hint.err { color: var(--err); }

.check { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line);
         border-radius: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.check:hover { border-color: var(--brand); }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--brand); flex: none; }
.check span { font-weight: 600; }
.check small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
#nameBox { margin-top: 16px; }
#nameBox[hidden] { display: none; }

.btn { display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 24px; padding: 15px 20px;
       font: inherit; font-size: 17px; font-weight: 600; border: 0; border-radius: 14px; text-decoration: none;
       background: var(--brand); color: var(--brand-ink); cursor: pointer; transition: filter .15s, transform .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.link { display: block; text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); text-decoration: none; }
.link:hover { color: var(--brand); }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-inline-end-color: transparent;
        border-radius: 50%; animation: s .7s linear infinite; margin-inline-end: 10px; flex: none; }
@keyframes s { to { transform: rotate(360deg); } }
.secure { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; font-size: 12px; color: var(--muted); }

/* One-click signing screen: the document fills the space, the action sits below it. */
body.signing { height: 100dvh; overflow: hidden; }
body.signing .site-header { padding-block: 14px; }
body.signing .site-header .signit img { height: 40px; }
body.signing .site-header .sanad img { height: 36px; }
body.signing .site-footer { display: none; }
#signScreen { flex: 1; min-height: 0; flex-direction: column; width: 100%; max-width: 1100px; margin: 0 auto;
              padding: 0 clamp(12px, 3vw, 32px) 16px; gap: 12px; }
.sign-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sign-top h2 { margin: 0; font-size: 20px; }
.sign-top p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.tag { flex: none; font-size: 13px; color: var(--muted); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
       background: var(--card); direction: ltr; unicode-bidi: isolate; }
#frame { flex: 1; min-height: 0; position: relative; background: #fff; border: 1px solid var(--line); border-radius: 18px;
         overflow: hidden; box-shadow: var(--shadow); }
#frame iframe { width: 100%; height: 100%; border: 0; display: block; }
#loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #5b6b80; background: #fff; }
.bar { display: flex; align-items: center; gap: 16px; padding: 14px 16px 14px 20px; background: var(--card);
       border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
       margin-bottom: env(safe-area-inset-bottom); }
.bar .info { flex: 1; display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.bar .info b { display: block; color: var(--ink); font-size: 15px; }
.nafath { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
          background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.bar .btn { width: auto; min-width: 280px; margin: 0; }

/* Done. */
.done { text-align: center; }
.tick { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center;
        margin: 4px auto 20px; }
.tick svg { width: 36px; height: 36px; }

@media (max-width: 640px) {
  .site-header { padding: 16px; }
  .site-header .signit img { height: 42px; }
  .site-header .sanad img { height: 36px; }
  .card { padding: 28px 22px 24px; border-radius: 18px; }
  h1 { font-size: 24px; }
  .sign-top p { display: none; }
  .bar { flex-direction: column; align-items: stretch; padding: 12px; gap: 10px; }
  .bar .info { display: none; }
  .bar .btn { min-width: 0; width: 100%; }
}
