/* ============================================================
   دفتر المركز — صفحتا الدخول والحساب الجديد
   ------------------------------------------------------------
   من النموذج المعتمد prototypes/auth-prototype.html.
   في الحاسوب لوحة هوية كحلية ثابتة يميناً، وفي الجوال الشعار
   و«إلغاء» ثم النموذج. يُحمَّل بعد style.css وحده.
   ============================================================ */

/* حدود الحقول بلون النموذج، في هاتين الصفحتين وحدهما */
body.auth { --border: #DCE2EF; }

:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html { scroll-padding-top: env(safe-area-inset-top, 0px); background: var(--bg); }
body.auth { min-height: 100vh; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }
.auth button, .auth input, .auth select { font: inherit; }

/* الصفحة */
.page { display: grid; min-height: 100vh; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* ---------- لوحة الهوية ---------- */
.brand { position: relative; overflow: hidden; background: linear-gradient(160deg, #1B2A6B 0%, #111B47 100%); color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 56px; }
.brand::after { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(26,157,184,.28), transparent 70%); right: -80px; top: -80px; }
.blogo { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; }
.blogo .lmark { height: 56px; width: auto; overflow: visible; }
.blogo .lword { height: 36px; width: auto; }
.bmid { position: relative; z-index: 1; }
.bmid h2 { margin: 0; font-size: clamp(24px, 2.2vw, 32px); line-height: 1.35; font-weight: 900; }
.bmid h2 span { color: #5fd0e3; }
.bmid ul { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bmid li { display: flex; gap: 12px; align-items: center; font-size: 15px; color: #dbe1f2; }
.bmid li i { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #5fd0e3; }
.bmid li svg { width: 17px; height: 17px; }
.bfoot { position: relative; z-index: 1; margin-top: 18px; font-size: 13px; color: #8e98c0; }

.brand { position: sticky; top: 0; height: 100vh; align-self: start; }
/* المدار الدوّار (وحده، لا يختلط بمدار الشعار .lmark .orb) */
.brand > .orb { position: absolute; width: 560px; height: 560px; left: -200px; bottom: -220px; border-radius: 50%; border: 1.5px solid rgba(26,157,184,.35); animation: spin 60s linear infinite; }
.brand > .orb i { position: absolute; top: 50%; right: -6px; width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%; background: #5fd0e3; box-shadow: 0 0 14px 3px rgba(95,208,227,.55); }
@keyframes spin { to { transform: rotate(360deg); } }
.bmid h2 em { display: inline; font-style: normal; }
.bmid h2 .ln1::after { content: " "; }
.bmid li { opacity: 0; transform: translateY(12px); animation: rise .6s cubic-bezier(.2,.7,.2,1) forwards; }
.bmid li:nth-child(1) { animation-delay: .8s; }
.bmid li:nth-child(2) { animation-delay: 1s; }
@keyframes rise { to { opacity: 1; transform: none; } }
.rot b { font-weight: inherit; transition: color .5s; }
.rot b.hl { color: #5fd0e3; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .brand > .orb { animation: none; } .bmid li { animation: none; opacity: 1; transform: none; } }
.brand { padding: 34px 52px 30px; justify-content: flex-start; gap: 0; }

/* المشهد: الهاتف الحيّ والبطاقات العائمة */
.stage { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; margin: 6px 0 10px; }
.mph { width: min(214px, 26vh); aspect-ratio: 9/18.4; background: #0b1233; border-radius: 30px; padding: 7px; box-shadow: 0 40px 80px rgba(0,0,0,.45), inset 0 0 0 1.5px rgba(255,255,255,.12); transform: perspective(1400px) rotateY(14deg) rotateX(6deg) rotate(-2deg); animation: pin 1s cubic-bezier(.2,.7,.2,1) .2s both; }
@keyframes pin { from { opacity: 0; transform: perspective(1400px) rotateY(24deg) rotateX(10deg) rotate(-2deg) translateY(30px); } }
.mscr { height: 100%; border-radius: 24px; overflow: hidden; background: #f5f7fc; display: flex; flex-direction: column; }
.mtop { position: relative; background: #1B2A6B; color: #fff; padding: 22px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.mtop b { font-size: 13px; font-weight: 800; }
.mtop small { font-size: 8.5px; color: #aeb8da; }
.mring { position: absolute; left: 10px; top: 18px; width: 34px; height: 34px; }
.mring svg { width: 34px; height: 34px; }
.mring em { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 10px; font-weight: 800; }
.mr, .frr { transition: stroke-dasharray .9s cubic-bezier(.2,.7,.2,1); }
.mrows { flex: 1; padding: 8px 8px 0; display: flex; flex-direction: column; gap: 5px; }
.mrw { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: #fff; border: 1px solid #e3e8f2; border-radius: 9px; padding: 0 8px; flex: 1; max-height: 52px; font-size: 9.5px; font-weight: 700; color: #1B2A6B; }
.mb { font-style: normal; font-size: 8.5px; font-weight: 800; padding: 2px 7px; border-radius: 999px; opacity: 0; transform: scale(.6); transition: opacity .3s, transform .35s cubic-bezier(.3,1.6,.5,1); }
.mb.on { opacity: 1; transform: none; }
.mb.ex { background: #17804A; color: #fff; }
.mb.vg, .mb.gd { background: #e6f4ec; color: #17804A; }
.mb.ab { background: #fbe9e9; color: #c62828; }
.mbar { margin: 8px; border-radius: 10px; background: #1B2A6B; color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; font-size: 9.5px; font-weight: 700; }
.mbar b { color: #3fc3db; }
.mbar em { font-style: normal; }
.fc { position: absolute; display: flex; align-items: center; gap: 10px; background: #fff; color: #1B2A6B; border-radius: 16px; padding: 12px 14px; box-shadow: 0 22px 48px rgba(3,8,30,.38); opacity: 0; }
.fc strong { display: block; font-size: 13.5px; font-weight: 800; line-height: 1.4; }
.fc small { display: block; font-size: 11.5px; font-weight: 600; color: #5B6788; line-height: 1.5; }
.fc1 { right: calc(50% + 60px); top: 14%; animation: fin .7s cubic-bezier(.2,.7,.2,1) 1.2s forwards, bob 7s ease-in-out 2s infinite; }
.fc2 { left: calc(50% + 70px); top: 42%; width: 262px; animation: fin .7s cubic-bezier(.2,.7,.2,1) 2.4s forwards, bob 8s ease-in-out 3.2s infinite; }
.fc3 { right: calc(50% + 40px); bottom: 10%; width: 220px; flex-direction: column; align-items: stretch; gap: 8px; animation: fin .7s cubic-bezier(.2,.7,.2,1) 3.4s forwards, bob 9s ease-in-out 4.2s infinite; }
@keyframes fin { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.fring { position: relative; width: 46px; height: 46px; flex-shrink: 0; }
.fring svg { width: 46px; height: 46px; }
.fring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 900; }
.fic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fic svg { width: 18px; height: 18px; }
.fic.red { background: #fbe9e9; color: #c62828; }
.fic.grn { background: #e6f4ec; color: #17804A; }
.redt { color: #c62828 !important; }
.grnt { color: #17804A !important; font-weight: 800 !important; }
.f3h { display: flex; align-items: center; gap: 10px; }
.ftr { height: 6px; border-radius: 99px; background: #e8edf6; overflow: hidden; }
.fk { display: block; height: 100%; width: 0; border-radius: 99px; background: #17804A; transition: width 1.2s cubic-bezier(.2,.7,.2,1); }
/* البطاقة الثالثة تختفي في الشاشات القصيرة */
@media (max-height: 760px) { .fc3 { display: none; } }
@media (prefers-reduced-motion: reduce) { .mph, .fc { animation: none !important; opacity: 1; } .mb { opacity: 1; transform: none; } }

/* ---------- عمود النموذج ---------- */
.side { display: flex; flex-direction: column; padding: 28px 40px 40px; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* بمقاس شعار الرئيسية في الجوال، ويصغر حين يضيق السطر فلا تتّسع الصفحة */
.mlogo { display: none; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0; }
.mlogo .lmark { flex: 0 1 auto; min-width: 0; width: 71.5px; height: auto; overflow: visible; }
.mlogo .lword { flex: 0 1 auto; min-width: 0; width: 102px; height: auto; }
.cancel { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--text-muted); font-size: 14.5px; font-weight: 700; cursor: pointer; text-decoration: none; transition: color .2s, border-color .2s; }
.cancel:hover { color: var(--text); border-color: #c3cbe0; }
.cancel svg { width: 15px; height: 15px; }
.wrapf { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 0; }
.form { width: 100%; max-width: 440px; }
.form h1 { margin: 0; font-size: clamp(26px, 3vw, 32px); line-height: 1.35; font-weight: 900; color: var(--text); }
.form .sub { margin: 8px 0 0; font-size: 16px; line-height: 1.8; color: var(--text-muted); }
.fields { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.f label { display: block; margin-bottom: 7px; font-size: 14.5px; font-weight: 700; color: var(--text); }
.inp { position: relative; }
.inp input, .inp select { width: 100%; height: 50px; border-radius: 12px; border: 1.5px solid var(--border); background: #fff; padding: 0 44px 0 14px; color: var(--text); font-size: 15.5px; outline: none; transition: border-color .2s, box-shadow .2s; appearance: none; -webkit-appearance: none; }
.inp select { padding-left: 36px; cursor: pointer; }
.inp input::placeholder { color: #9aa3bd; }
.inp input:focus, .inp select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(26,157,184,.14); }
.inp .ic { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #8e98b8; pointer-events: none; }
.inp .chev { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #8e98b8; pointer-events: none; }
.inp .eye { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: transparent; color: #8e98b8; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.inp .eye svg { width: 19px; height: 19px; }
.inp.pw input { padding-left: 48px; }
.phone { display: grid; grid-template-columns: minmax(0, 1fr) 124px; gap: 8px; direction: rtl; }
.phone input[type=tel] { direction: ltr; text-align: right; }
.f.bad input, .f.bad select { border-color: var(--danger); }
.err { display: none; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--danger); }
.f.bad .err { display: block; }

/* قائمة الدول */
.cc { position: relative; }
.ccb { width: 100%; height: 50px; border-radius: 12px; border: 1.5px solid var(--border); background: #fff; display: flex; align-items: center; gap: 8px; padding: 0 12px; cursor: pointer; color: var(--text); transition: border-color .2s, box-shadow .2s; }
.ccb:focus-visible, .cc.open .ccb { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(26,157,184,.14); outline: none; }
/* العلم صورة صغيرة في خانة بعرض 24px، بنسبته الأصلية */
.fl { width: 24px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.fl img { display: block; width: auto; height: auto; max-width: 24px; max-height: 18px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(27,42,107,.1); }
.cd { font-size: 15px; font-weight: 700; color: var(--text); }
.chev2 { width: 15px; height: 15px; margin-inline-start: auto; color: #8e98b8; transition: transform .2s; }
.cc.open .chev2 { transform: rotate(180deg); }
.ccp { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: 300px; max-width: calc(100vw - 32px); background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 40px rgba(17,27,71,.16); overflow: hidden; }
.ccs { padding: 10px; border-bottom: 1px solid var(--border); }
.ccs input { width: 100%; height: 40px; border-radius: 10px; border: 1.5px solid var(--border); padding: 0 12px; font-size: 14.5px; color: var(--text); outline: none; }
.ccs input:focus { border-color: var(--primary); }
.ccl { list-style: none; margin: 0; padding: 6px; max-height: 280px; overflow-y: auto; overscroll-behavior: contain; }
.ccl li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 15px; color: var(--text); }
.ccl li .nm { flex: 1; font-weight: 600; }
.ccl li .cd { font-size: 13.5px; font-weight: 600; color: var(--text-muted); }
.ccl li.act, .ccl li:hover { background: #f0f3fa; }
.ccl li[aria-selected="true"] { background: var(--info-bg); }
.ccl li[aria-selected="true"] .nm::after { content: ""; display: inline-block; width: 6px; height: 10px; border: solid var(--primary-dark); border-width: 0 2px 2px 0; transform: rotate(45deg); margin-inline-start: 8px; vertical-align: 1px; }
.ccl .sep { height: 1px; background: var(--border); margin: 6px 4px; padding: 0; cursor: default; }
.ccl .none { cursor: default; color: var(--text-muted); justify-content: center; }
/* «دولة أخرى»: كرة أرضية مكان العلم، وحقل صغير للرمز مكان الرمز، والخانة أعرض قليلاً لتتّسع لأربعة أرقام */
.glb { width: 18px; height: 18px; color: #8e98b8; }
.phone.oth { grid-template-columns: minmax(0, 1fr) 150px; }
.phone .cco { margin: 0; position: absolute; top: 9px; bottom: 9px; right: 45px; left: 36px; display: flex; align-items: center; gap: 1px; direction: ltr; padding: 0 7px; border: 1.5px solid var(--border); border-radius: 8px; background: #fff; font-size: 15px; font-weight: 700; color: var(--text); cursor: text; }
.phone .cco[hidden] { display: none; }
.phone .cco input { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; background: transparent; font-size: 15px; font-weight: 700; color: var(--text); outline: none; }
.phone .cco:focus-within { border-color: var(--primary); }
.f.badc .phone .cco { border-color: var(--danger); }
.errc { display: none; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--danger); }
.f.badc .errc { display: block; }

/* النسخة */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg label { margin: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--border); background: #fff; cursor: pointer; transition: border-color .2s, background .2s; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg b { font-size: 15px; font-weight: 800; color: var(--text); }
.seg span { font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
.seg input:checked + label { border-color: var(--primary); background: var(--info-bg); }
.seg input:focus-visible + label { box-shadow: 0 0 0 4px rgba(26,157,184,.2); }

/* الزرّ والرسائل */
.form .btn { margin-top: 24px; width: 100%; height: 54px; border: 0; border-radius: 12px; background: var(--primary-deep); color: #fff; font-size: 17px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: background .2s, transform .1s; }
.form .btn:hover { background: #22348a; }
.form .btn:active { transform: scale(.99); }
.form .btn svg { width: 20px; height: 20px; }
.note { margin: 12px 0 0; display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.7; color: var(--text-muted); }
.note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 3px; color: var(--primary-dark); }
.msg { display: none; margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--info-bg); border: 1px solid #bfe4ec; color: var(--primary-dark); font-size: 14.5px; line-height: 1.75; font-weight: 600; }
.msg.on { display: block; }
.msg a { color: var(--primary-deep); font-weight: 800; }
.alt { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); text-align: center; font-size: 15px; color: var(--text-muted); }
.alt a { color: var(--primary-dark); font-weight: 800; text-decoration: none; cursor: pointer; }
.alt a:hover { text-decoration: underline; }

/* ---------- الجوال: لا لوحة، الشعار و«إلغاء» ثم النموذج ---------- */
@media (max-width: 900px) {
  .page { display: block; }
  .brand { display: none; }
  .side { min-height: 100vh; padding: 18px 20px 40px; }
  .mlogo { display: flex; }
  .wrapf { align-items: flex-start; padding-top: 28px; }
}
@media (max-width: 380px) {
  .side { padding-inline: 16px; }
  .row2 { grid-template-columns: 1fr; }
  .phone { grid-template-columns: minmax(0, 1fr) 112px; }
  .phone.oth { grid-template-columns: minmax(0, 1fr) 140px; }
}
/* حين لا يتّسع حقل الرقم بجانب خانة الرمز لعشرة أرقام، تنزل الخانة إلى سطرها فوقه */
@media (max-width: 333px) { .phone.oth { grid-template-columns: minmax(0, 1fr); } .phone.oth .cc { order: -1; } }
@media (max-width: 298px) { .phone { grid-template-columns: minmax(0, 1fr); } .phone .cc { order: -1; } }

/* ---------- صفحة «غير موجود» (404.html): الشعار، ثم السطر، ثم زرّ الرئيسية، في وسط الشاشة ---------- */
.nf { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 40px 20px; text-align: center; }
.nflogo { display: flex; align-items: center; gap: 10px; max-width: 100%; }
.nflogo .lmark { flex: 0 1 auto; min-width: 0; width: 105px; height: auto; overflow: visible; }
.nflogo .lword { flex: 0 1 auto; min-width: 0; width: 153px; height: auto; }
.nf h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); line-height: 1.35; font-weight: 900; color: var(--text); }
.nf .btn { height: 54px; padding: 0 32px; border-radius: 12px; background: var(--primary-deep); color: #fff; font-size: 17px; font-weight: 800; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; transition: background .2s, transform .1s; }
.nf .btn:hover { background: #22348a; }
.nf .btn:active { transform: scale(.99); }
