/* EliteScript — ثيم + حركات خفيفة (لا تكسر التخطيط) */

:root {
  --elite-bg: #C5BBB0;
  --elite-bg2: #B3A99E;
  --elite-card: #D8D0C6;
  --elite-card2: #E8E0D6;
  --elite-soft: #F5F0EA;
  --elite-text: #1B1816;
  --elite-text2: #3D3834;
  --elite-muted: #78716A;
  --elite-ink: #988E83;
  --elite-dark: #4A443E;
  --elite-shadow: #1B1816;
  --elite-br: rgba(27, 24, 22, 0.12);
  --elite-br2: rgba(27, 24, 22, 0.22);
  --elite-glow: rgba(255, 255, 255, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Admin فقط (لا يطبّق على اللودر) ── */
body:not(.elite-loader) {
  background: var(--elite-bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 10% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(27, 24, 22, 0.06), transparent 50%);
}

#loginOverlay {
  position: relative;
  overflow: hidden;
}

#loginOverlay .elite-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(40px);
  opacity: 0.5;
  animation: eliteOrbFloat 14s ease-in-out infinite;
}

#loginOverlay .elite-orb:nth-child(1) {
  width: 280px;
  height: 280px;
  background: rgba(255, 255, 255, 0.35);
  top: 8%;
  right: 12%;
  animation-delay: 0s;
}

#loginOverlay .elite-orb:nth-child(2) {
  width: 200px;
  height: 200px;
  background: rgba(152, 142, 131, 0.45);
  bottom: 12%;
  left: 8%;
  animation-delay: -4s;
}

#loginOverlay .elite-orb:nth-child(3) {
  width: 120px;
  height: 120px;
  background: rgba(27, 24, 22, 0.08);
  top: 50%;
  left: 50%;
  animation-delay: -7s;
}

@keyframes eliteOrbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(12px, -18px) scale(1.05); }
  66% { transform: translate(-10px, 10px) scale(0.95); }
}

.login-box {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 24px 64px rgba(27, 24, 22, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.login-box:hover {
  transform: translateY(-2px);
}

.login-logo .logo-mark {
  width: min(300px, 90vw);
  margin: 0 auto 0.4rem;
  animation: eliteLogoFloat 4s ease-in-out infinite;
}

.login-logo .logo-mark img {
  width: 100%;
  height: auto;
  max-height: 105px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 14px rgba(27, 24, 22, 0.12));
}

.login-tagline {
  font-size: 0.8rem;
  color: var(--elite-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.sidebar .lm img {
  width: 100%;
  height: auto;
  max-height: 40px;
  object-fit: contain;
}

@keyframes eliteLogoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.login-field input {
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.2s;
}

.login-field input:focus {
  box-shadow: 0 0 0 3px rgba(120, 113, 106, 0.2);
  transform: translateY(-1px);
}

.btn-login {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.25s, opacity 0.2s;
  box-shadow: 0 8px 24px rgba(27, 24, 22, 0.2);
}

.btn-login::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 60%
  );
  transform: translateX(-120%);
  transition: transform 0.6s;
}

.btn-login:hover::after {
  transform: translateX(120%);
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(27, 24, 22, 0.28);
}

/* Sidebar */
.sidebar .nav-item {
  color: rgba(245, 240, 234, 0.75);
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.sidebar .nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(-3px);
}

.sidebar .nav-item.on {
  background: linear-gradient(135deg, var(--elite-muted), var(--elite-dark));
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.sidebar-logo small {
  color: rgba(245, 240, 234, 0.5) !important;
}

/* Cards & stats */
.stat-card {
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(27, 24, 22, 0.12);
}

.stat-val {
  transition: transform 0.3s var(--ease);
}

.stat-card:hover .stat-val {
  transform: scale(1.03);
}

.card {
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.25s var(--ease);
}

.card:hover {
  border-color: rgba(27, 24, 22, 0.2);
  box-shadow: 0 8px 28px rgba(27, 24, 22, 0.08);
}

.code-display {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, var(--elite-dark), var(--elite-shadow)) !important;
}

.code-display::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  animation: eliteShine 3s ease-in-out infinite;
}

@keyframes eliteShine {
  0% { transform: translateX(-100%) rotate(25deg); }
  100% { transform: translateX(100%) rotate(25deg); }
}

.btn-dark {
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn-dark:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(27, 24, 22, 0.2);
}

.toast.show {
  animation: eliteToastIn 0.35s var(--ease);
}

@keyframes eliteToastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.page.on {
  animation: elitePageIn 0.4s var(--ease);
}

@keyframes elitePageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Loader: شاشة التفعيل (فقط داخل .elite-loader) ── */
body.elite-loader body.elite-loader #activationScreen .act-divider {
  display: none !important;
}

body.elite-loader #activationScreen .act-card {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: eliteSlideUp 0.45s ease !important;
  box-shadow: 0 20px 50px rgba(27, 24, 22, 0.12) !important;
}

body.elite-loader #activationScreen .act-card::before,
body.elite-loader #activationScreen .act-card::after {
  display: none !important;
  content: none !important;
}

body.elite-loader #activationScreen .act-card-icon {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto 12px !important;
  animation: eliteLogoFloat 4s ease-in-out infinite !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.elite-loader #activationScreen .act-card-icon img {
  display: block;
  width: auto !important;
  max-width: min(300px, 82vw) !important;
  max-height: 90px !important;
  height: auto !important;
  margin: 0 auto;
  object-fit: contain !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: drop-shadow(0 6px 16px rgba(27, 24, 22, 0.12)) !important;
  background: transparent !important;
}

body.elite-loader #activationScreen .act-phone-wrap,
body.elite-loader #activationScreen #activationCode {
  animation: none !important;
}

body.elite-loader #activationScreen .act-card-title {
  display: none !important;
}

body.elite-loader #activationScreen .act-btn {
  position: relative;
  overflow: hidden;
}

body.elite-loader #activationScreen .act-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  animation: eliteBtnShine 4s ease-in-out infinite;
}

@keyframes eliteBtnShine {
  0%, 70%, 100% { transform: translateX(-100%); }
  85% { transform: translateX(100%); }
}

body.elite-loader #activationScreen .act-status-dot {
  animation: elitePulseDot 2s ease-in-out infinite;
}

@keyframes elitePulseDot {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(120, 113, 106, 0.5);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 0 6px rgba(120, 113, 106, 0);
  }
}

body.elite-loader #activationScreen .act-phone-wrap:focus-within,
body.elite-loader #activationScreen #activationCode:focus {
  transform: translateY(-1px);
}

/* احترام تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
