/* ============================================================
   LifeOS — واجهة الدخول السرية (Dark Secret Theme)
   خلفية جسيمات متحركة + زجاجية + توهج أزرق/زمردي
   ============================================================ */

:root {
  --sx-bg:      #050505;
  --sx-panel:   #111111;
  --sx-blue:    #0F4C81;
  --sx-emerald: #00C896;
  --sx-text:    #F2F5F4;
  --sx-muted:   #8FA39C;
  --sx-line:    rgba(255, 255, 255, .08);
  --sx-danger:  #FF5C6E;
}

html, body.sx-body {
  height: 100%;
}

body.sx-body {
  margin: 0;
  background:
    radial-gradient(900px 600px at 80% -10%, rgba(15, 76, 129, .28) 0%, transparent 60%),
    radial-gradient(800px 560px at 8% 108%, rgba(0, 200, 150, .16) 0%, transparent 58%),
    linear-gradient(160deg, #0A0C0E 0%, var(--sx-bg) 45%, #07090B 100%);
  color: var(--sx-text);
  font-family: 'IBM Plex Sans Arabic', 'Rajdhani', 'Segoe UI', Tahoma, sans-serif;
  overflow: hidden;
}

/* ---------- خلفية الجسيمات ---------- */
#sxCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* خطوط شبكة تقنية خافتة فوق الخلفية */
.sx-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 78%);
}

/* ---------- حاوية الدخول ---------- */
.sx-wrap {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ---------- الصندوق الزجاجي ---------- */
.sx-card {
  width: 100%;
  max-width: 410px;
  padding: 38px 34px 28px;
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(20, 24, 27, .72), rgba(12, 14, 16, .55));
  border: 1px solid var(--sx-line);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, .55),
    inset 0 1px 0 rgba(255, 255, 255, .06);
  animation: sxRise .7s cubic-bezier(.2, .8, .25, 1) both;
  transition: opacity .45s ease, transform .45s ease;
}
.sx-card::before { /* خيط ضوء علوي */
  content: '';
  display: block;
  height: 2px;
  margin: -38px -34px 30px;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(90deg, transparent, var(--sx-blue), var(--sx-emerald), transparent);
  opacity: .8;
}
.sx-card.leaving { opacity: 0; transform: translateY(-18px) scale(.98); }
.sx-card.shake { animation: sxShake .5s cubic-bezier(.36, .07, .19, .97) both; }

@keyframes sxRise {
  from { opacity: 0; transform: translateY(22px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes sxShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* ---------- الشعار والعنوان ---------- */
.sx-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  text-align: center;
}
.sx-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: radial-gradient(circle at 30% 25%, rgba(0, 200, 150, .22), rgba(15, 76, 129, .18));
  border: 1px solid var(--sx-line);
  box-shadow: 0 0 26px rgba(0, 200, 150, .18);
  animation: sxPulse 3.2s ease-in-out infinite;
}
.sx-mark svg .mark-a { fill: var(--sx-emerald); }
.sx-mark svg .mark-b { fill: var(--sx-blue); opacity: .8; }
@keyframes sxPulse {
  0%, 100% { box-shadow: 0 0 18px rgba(0, 200, 150, .14); }
  50%      { box-shadow: 0 0 34px rgba(0, 200, 150, .30); }
}
.sx-title {
  font-family: 'Rajdhani', 'IBM Plex Sans Arabic', sans-serif;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 4px;
  margin: 0;
  text-transform: uppercase;
  background: linear-gradient(90deg, #E9FFF8, var(--sx-emerald) 55%, #7FB6E8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sx-sub {
  font-size: 12.5px;
  color: var(--sx-muted);
  letter-spacing: .6px;
}

/* ---------- الحقول مع الأيقونات ---------- */
.sx-field { position: relative; margin-bottom: 16px; }
.sx-field .sx-ico {
  position: absolute;
  inset-inline-start: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sx-muted);
  pointer-events: none;
  transition: color .2s ease;
  display: inline-flex;
}
.sx-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  padding-inline-start: 46px;
  font: inherit;
  font-size: 15px;
  color: var(--sx-text);
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--sx-line);
  border-radius: 13px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.sx-field input::placeholder { color: #5F6E69; }
.sx-field input:focus {
  border-color: rgba(0, 200, 150, .65);
  background: rgba(0, 200, 150, .05);
  box-shadow: 0 0 0 4px rgba(0, 200, 150, .12), 0 0 22px rgba(0, 200, 150, .10);
}
.sx-field input:focus ~ .sx-ico,
.sx-field input:focus + .sx-ico { color: var(--sx-emerald); }

/* ---------- زر الدخول ---------- */
.sx-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 14px 18px;
  margin-top: 6px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #03110C;
  background: linear-gradient(90deg, var(--sx-blue), var(--sx-emerald) 70%);
  border: none;
  border-radius: 13px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .25s ease, filter .2s ease;
}
.sx-btn::after { /* لمعة تمر عند التحويم */
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: -80%;
  width: 55%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .45), transparent);
  transform: skewX(-20deg);
  transition: inset-inline-start .55s ease;
}
.sx-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 10px 30px rgba(0, 200, 150, .35), 0 0 0 1px rgba(0, 200, 150, .35);
}
.sx-btn:hover::after { inset-inline-start: 120%; }
.sx-btn:active { transform: translateY(0); }

/* ---------- التنبيه الأنيق ---------- */
.sx-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  margin-bottom: 18px;
  font-size: 13.5px;
  border-radius: 12px;
  border: 1px solid rgba(255, 92, 110, .45);
  background: rgba(255, 92, 110, .10);
  color: var(--sx-danger);
  animation: sxRise .4s ease both;
}
.sx-alert.info {
  border-color: rgba(0, 200, 150, .40);
  background: rgba(0, 200, 150, .08);
  color: var(--sx-emerald);
}

.sx-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: 2px;
  color: #55625D;
  text-transform: uppercase;
}

/* ============================================================
   شاشة الترحيب بعد نجاح الدخول
   ============================================================ */
.sx-welcome {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: center;
  animation: sxFadeIn .8s ease both;
  padding: 24px;
}
@keyframes sxFadeIn { from { opacity: 0; } to { opacity: 1; } }

.sx-type {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(34px, 7vw, 64px);
  font-weight: 700;
  letter-spacing: 5px;
  min-height: 1.3em;
  direction: ltr;
  color: var(--sx-text);
  text-shadow:
    0 0 12px rgba(0, 200, 150, .55),
    0 0 42px rgba(0, 200, 150, .28),
    0 0 80px rgba(15, 76, 129, .35);
}
.sx-caret {
  display: inline-block;
  width: 3px;
  height: .95em;
  margin-inline-start: 6px;
  vertical-align: -0.12em;
  background: var(--sx-emerald);
  box-shadow: 0 0 12px var(--sx-emerald);
  animation: sxBlink .8s steps(1) infinite;
}
@keyframes sxBlink { 50% { opacity: 0; } }

.sx-access {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(14px, 2.4vw, 19px);
  letter-spacing: 6px;
  text-transform: uppercase;
  direction: ltr;
  color: var(--sx-emerald);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .8s ease, transform .8s ease;
}
.sx-access.show { opacity: .95; transform: none; }

/* حلقة التحميل */
.sx-loader {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  position: relative;
  opacity: 0;
  transition: opacity .6s ease;
  background: conic-gradient(from 0deg, transparent 12%, var(--sx-emerald) 45%, var(--sx-blue) 78%, transparent 92%);
  animation: sxSpin 1.1s linear infinite;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), black calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), black calc(100% - 4px));
}
.sx-loader.show { opacity: 1; }
@keyframes sxSpin { to { transform: rotate(360deg); } }

.sx-bar { /* شريط تقدم رفيع أسفل الشاشة */
  position: fixed;
  bottom: 0;
  inset-inline-start: 0;
  height: 3px;
  width: 0;
  z-index: 3;
  background: linear-gradient(90deg, var(--sx-blue), var(--sx-emerald));
  box-shadow: 0 0 14px rgba(0, 200, 150, .6);
  transition: width 2.6s linear;
}
.sx-bar.run { width: 100%; }

/* ---------- تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  .sx-card, .sx-alert, .sx-welcome { animation: none !important; }
  .sx-mark { animation: none; }
  .sx-btn::after { display: none; }
  .sx-caret { animation: none; }
}

@media (max-width: 480px) {
  .sx-card { padding: 30px 22px 22px; }
  .sx-card::before { margin: -30px -22px 24px; }
}
