/* ============================================================
   جواهر آل بندر — صفحتا التراكر (تسجيل الدخول · الربط)
   اتجاه تحريري فاخر — مسطح
   المبادئ: بلا تدرجات لونية · بلا حدود ملونة · بلا بطاقات
   01 الخطوط   02 المتغيرات   03 الأساس   04 التخطيط
   05 المكوّنات   06 الاستجابة
   ============================================================ */

/* ---------- 01 الخطوط (محلية، بلا إنترنت) ---------- */
@font-face { font-family:'IBM Plex Sans Arabic'; font-weight:400; font-display:swap; src:url(fonts/ibmplex-400-arabic.woff2) format('woff2'); unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+200C-200E,U+204F,U+FB50-FDFF,U+FE70-FEFC,U+1EE00-1EE0F,U+1EE10-1EE1F; }
@font-face { font-family:'IBM Plex Sans Arabic'; font-weight:400; font-display:swap; src:url(fonts/ibmplex-400-latin.woff2) format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'IBM Plex Sans Arabic'; font-weight:500; font-display:swap; src:url(fonts/ibmplex-500-arabic.woff2) format('woff2'); unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+200C-200E,U+204F,U+FB50-FDFF,U+FE70-FEFC,U+1EE00-1EE0F,U+1EE10-1EE1F; }
@font-face { font-family:'IBM Plex Sans Arabic'; font-weight:500; font-display:swap; src:url(fonts/ibmplex-500-latin.woff2) format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'IBM Plex Sans Arabic'; font-weight:600; font-display:swap; src:url(fonts/ibmplex-600-arabic.woff2) format('woff2'); unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+200C-200E,U+204F,U+FB50-FDFF,U+FE70-FEFC,U+1EE00-1EE0F,U+1EE10-1EE1F; }
@font-face { font-family:'IBM Plex Sans Arabic'; font-weight:600; font-display:swap; src:url(fonts/ibmplex-600-latin.woff2) format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'IBM Plex Sans Arabic'; font-weight:700; font-display:swap; src:url(fonts/ibmplex-700-arabic.woff2) format('woff2'); unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+200C-200E,U+204F,U+FB50-FDFF,U+FE70-FEFC,U+1EE00-1EE0F,U+1EE10-1EE1F; }
@font-face { font-family:'IBM Plex Sans Arabic'; font-weight:700; font-display:swap; src:url(fonts/ibmplex-700-latin.woff2) format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ---------- 02 المتغيرات ---------- */
:root {
  --cream-0: #faf6ee;
  --cream-1: #f4eee0;
  --panel:   #ffffff;

  --grape-deep:  #481f34;
  --grape:       #6e314f;

  --gold:      #b9892f;
  --gold-deep: #966f18;
  --gold-soft: #f3e7c6;

  --ink:   #2a1620;
  --ink-2: #6d5a62;
  --ink-3: #a2909a;

  --success: #2e9e6b;
  --success-soft: #e6f4ec;
  --danger:  #c0554b;
  --danger-soft: #fbeae8;

  --rule: rgba(42, 22, 32, 0.14);
  --rule-soft: rgba(42, 22, 32, 0.07);

  --shadow-md: 0 16px 44px rgba(42, 22, 32, 0.10);

  --font-body: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --font-heading: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;
}

/* ---------- 03 الأساس ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { min-height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--cream-0);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--gold-soft); color: var(--grape-deep); }
a { color: inherit; text-decoration: none; }

/* ---------- 04 التخطيط ---------- */
.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.orn { text-align: center; }
.orn .dia {
  letter-spacing: 0.45em;
  padding-inline: 0.4em;
  color: var(--gold);
  font-size: 0.92rem;
}

/* اللوحة — بيضاء مسطحة بحد محايد */
.card {
  width: 100%;
  border-radius: var(--r-lg);
  padding: 40px 32px 36px;
  background: var(--panel);
  border: 1px solid var(--rule-soft);
  box-shadow: var(--shadow-md);
  animation: cardIn .5s cubic-bezier(.16, 1, .3, 1);
}

@keyframes cardIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.brand { text-align: center; margin-bottom: 24px; }

.logo {
  margin: 0 auto 14px;
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  color: var(--gold-deep);
}

.card h1 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--grape-deep);
  letter-spacing: 0.01em;
}

.card .sub {
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1.8;
  margin-top: 6px;
  text-align: center;
}

/* ---------- 05 المكوّنات ---------- */
form { margin-top: 6px; }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
  margin: 0 2px 8px;
  letter-spacing: 0.02em;
}

.pwbox { position: relative; }

input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color .18s, box-shadow .18s, background .18s;
}

input::placeholder { color: var(--ink-3); }

input:focus {
  outline: none;
  border-color: rgba(42, 22, 32, 0.32);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(42, 22, 32, 0.08);
}

.pwbox .eye {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  color: var(--ink-3);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 10px;
  transition: color .15s;
}
.pwbox .eye:hover { color: var(--grape); }
.pwbox .eye svg { width: 19px; height: 19px; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.98rem;
  border-radius: var(--r-sm);
  border: 0;
  cursor: pointer;
  padding: 14px 22px;
  color: var(--grape-deep);
  background: var(--gold);
  transition: transform .14s, background .18s, color .18s;
}
.btn:hover { transform: translateY(-1px); background: var(--gold-deep); color: var(--cream-0); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn.block { width: 100%; margin-top: 16px; }
.btn.ghost {
  background: var(--gold-soft);
  color: var(--grape-deep);
}
.btn.ghost:hover { background: var(--cream-1); color: var(--grape-deep); }

.spin {
  display: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(42, 22, 32, 0.3);
  border-top-color: var(--grape-deep);
  animation: rot .7s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }
.btn.loading .spin { display: inline-block; }
.btn.loading .label { opacity: .85; }

.err {
  display: none;
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--danger);
  background: var(--danger-soft);
}
.err.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.hint {
  color: var(--ink-3);
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.8;
}
.hint a { color: var(--gold-deep); }
.hint a:hover { color: var(--grape); text-decoration: underline; }

/* ---------- 06 صفحة الربط (حالات الجسر) ---------- */
.status { margin-top: 22px; }

/* رمز QR */
.qr-wrap { display: none; text-align: center; }
.qr-frame {
  position: relative;
  display: inline-block;
  padding: 10px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--rule-soft);
  box-shadow: var(--shadow-md);
}
.qr-box {
  width: 224px;
  height: 224px;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: grid;
  place-items: center;
}
.qr-box img { width: 100%; height: 100%; object-fit: contain; display: block; }

.steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 20px auto 4px;
  max-width: 320px;
  text-align: right;
}
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 0.86rem;
  line-height: 1.55;
}
.step .n {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--grape-deep);
  background: var(--gold-soft);
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--ink-3);
}
.live .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  animation: blink 1.3s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* الربط برمز الهاتف */
.pair-wrap { display: none; margin-top: 18px; }
.pair-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-3);
  font-size: 0.78rem;
  margin-bottom: 14px;
}
.pair-divider::before, .pair-divider::after { content: ""; flex: 1; height: 1px; background: var(--rule-soft); }

.pair-inputs { display: flex; gap: 10px; }
.pair-inputs input { flex: 1; }
.pair-inputs .btn { padding: 14px 16px; font-size: 0.9rem; }

.pair-code {
  display: none;
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--r-md);
  text-align: center;
  background: var(--gold-soft);
  animation: cardIn .3s ease-out;
}
.pair-code-label { color: var(--ink-2); font-size: 0.82rem; margin-bottom: 10px; }
.pair-code-val {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  direction: ltr;
  color: var(--grape);
}
.pair-copy {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--grape);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.pair-copy:hover { background: var(--gold-soft); border-color: rgba(42, 22, 32, 0.3); }
.pair-copy.copied { color: var(--success); border-color: rgba(46, 158, 107, 0.4); }

.pair-hint {
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 0.76rem;
  line-height: 1.7;
  text-align: center;
}
.pair-err { display: none; margin-top: 10px; color: var(--danger); font-size: 0.82rem; text-align: center; }

/* تم الربط */
.ready-wrap { display: none; text-align: center; padding: 8px 0 4px; }
.big-check {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--success);
  background: var(--success-soft);
}
.big-check svg { width: 40px; height: 40px; }
.ready-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--grape-deep);
}
.phone {
  margin: 8px auto 0;
  display: inline-block;
  padding: 7px 18px;
  border-radius: 999px;
  direction: ltr;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  color: var(--grape);
  background: var(--gold-soft);
}
.ready-sub { margin: 16px 0 20px; color: var(--ink-2); font-size: 0.86rem; line-height: 2; }
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--grape-deep);
  background: var(--gold-soft);
}

/* حالات جارية / أخطاء */
.state-note {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  padding: 13px 16px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 0.88rem;
  background: var(--panel);
  border: 1px solid var(--rule-soft);
}
.state-note .spin {
  display: inline-block;
  border-color: rgba(42, 22, 32, 0.25);
  border-top-color: var(--gold);
}
.state-note.err {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}
.err-msg {
  display: none;
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.7;
}

/* ---------- 07 الاستجابة ---------- */
@media (max-width: 480px) {
  body { padding: 16px; }
  .card { padding: 32px 22px 30px; }
  .pair-inputs { flex-direction: column; }
  .qr-box { width: 190px; height: 190px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
