/* ═══════════════════════════════════════════════════
   GX eSports — Design System
   ═══════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --font: 'Tajawal', system-ui, sans-serif;

  /* Surfaces */
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface-2: #f3f4f8;
  --surface-3: #edeef3;
  --elevated: #ffffff;

  /* Sidebar */
  --sidebar-bg: #0f1117;
  --sidebar-text: rgba(255,255,255,0.55);
  --sidebar-text-hover: rgba(255,255,255,0.85);
  --sidebar-text-active: #ffffff;
  --sidebar-active-bg: rgba(255,255,255,0.08);
  --sidebar-border: rgba(255,255,255,0.06);
  --sidebar-w: 270px;

  /* Colors */
  --text-1: #0f1117;
  --text-2: #5f6068;
  --text-3: #9d9ea6;
  --border: #e6e7ec;
  --border-light: #f0f1f5;

  --accent: #635bff;
  --accent-soft: rgba(99,91,255,0.08);
  --accent-hover: #7c75ff;
  --green: #00c853;
  --green-soft: rgba(0,200,83,0.08);
  --red: #ff3d57;
  --red-soft: rgba(255,61,87,0.08);
  --orange: #ff9100;
  --orange-soft: rgba(255,145,0,0.08);
  --blue: #2979ff;
  --blue-soft: rgba(41,121,255,0.08);

  /* Radius */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* Shadows */
  --sh-sm: 0 1px 2px rgba(0,0,0,0.04);
  --sh-md: 0 4px 16px rgba(0,0,0,0.05);
  --sh-lg: 0 12px 40px rgba(0,0,0,0.08);
  --sh-xl: 0 24px 64px rgba(0,0,0,0.12);

  --ease: cubic-bezier(.4,0,.2,1);
}

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Mobile Blocker ───────────────────────────────── */
#mobile-wall {
  display: none;
  position: fixed; inset: 0; z-index: 99999;
  background: #0f1117;
  place-items: center;
}
.mw-inner { text-align: center; padding: 40px; color: #fff; }
.mw-icon {
  width: 80px; height: 80px; border-radius: 20px;
  background: rgba(99,91,255,0.15); color: var(--accent);
  display: grid; place-items: center; margin: 0 auto 24px;
}
.mw-icon-logo {
  background: rgba(255,255,255,0.06);
  padding: 12px;
}
.mw-icon-logo img {
  width: 100%; height: 100%; object-fit: contain; border-radius: 12px;
}
.mw-inner h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.mw-inner p { color: rgba(255,255,255,0.5); font-size: 0.95rem; }

@media (max-width: 1099px) {
  #mobile-wall { display: grid; }
  #app { display: none !important; }
}

/* ── Toast ────────────────────────────────────────── */
#toast {
  position: fixed; top: 28px; left: 50%; z-index: 100000;
  transform: translateX(-50%) translateY(-24px);
  padding: 13px 32px; border-radius: 999px;
  font-size: 0.88rem; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: all .4s var(--ease);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--sh-lg);
}
#toast.ok { background: rgba(0,200,83,0.92); color: #fff; opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
#toast.err { background: rgba(255,61,87,0.92); color: #fff; opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* ── Login ────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-hero {
  background: #1a1b2e;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 80px 60px; position: relative; overflow: hidden;
}

.login-hero-content { position: relative; z-index: 1; text-align: center; }

.hero-logo {
  display: block;
  width: min(320px, 75vw);
  max-height: 140px;
  height: auto;
  object-fit: contain;
  margin: 0 auto 16px;
}

.hero-tagline {
  font-size: 1.1rem; color: rgba(255,255,255,0.4); font-weight: 400; max-width: 320px;
}

.login-form-side {
  display: flex; align-items: center; justify-content: center; padding: 60px;
  background: var(--surface);
}

.login-box { width: 100%; max-width: 380px; }

.login-box h2 {
  font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.3px;
}

.login-box .sub {
  color: var(--text-3); font-size: 0.9rem; margin-bottom: 32px;
}

/* ── Form Elements ────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font); font-size: 0.92rem; color: var(--text-1);
  background: var(--surface);
  outline: none; transition: all .2s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border: none; border-radius: var(--r-sm);
  font-family: var(--font); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: all .2s var(--ease); white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: #fff; width: 100%;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 6px 20px rgba(99,91,255,0.35); transform: translateY(-1px); }
.btn-secondary { background: var(--surface-2); color: var(--text-1); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #e6354d; }
.btn-sm { padding: 8px 16px; font-size: 0.8rem; border-radius: 8px; }
.btn-pill { border-radius: 999px; padding: 9px 20px; font-size: 0.82rem; }
.btn-pill.active { background: var(--accent); color: #fff; }
.btn-pill:not(.active) { background: transparent; color: var(--text-2); }
.btn-pill:not(.active):hover { background: var(--surface-3); color: var(--text-1); }

/* ── Layout ───────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  align-items: stretch;
}

/* ── Sidebar ──────────────────────────────────────── */
.side {
  background: var(--sidebar-bg);
  padding: 32px 18px 24px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-left: 1px solid var(--sidebar-border);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
  padding: 0 12px;
}
.side-brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
  flex-shrink: 0;
}
.side-brand-name {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #ffffff;
  line-height: 1.2;
}
.side-sub { font-size: 0.72rem; color: var(--sidebar-text); padding: 0 12px; margin-bottom: 36px; }

.side-label {
  font-size: 0.68rem; font-weight: 700; color: rgba(255,255,255,0.25);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 0 12px; margin-bottom: 10px; margin-top: 28px;
}
.side-label:first-of-type { margin-top: 0; }

.side-nav { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.side-btn {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border: none; border-radius: var(--r-sm);
  background: transparent; font-family: var(--font);
  font-size: 0.88rem; font-weight: 500;
  color: var(--sidebar-text); cursor: pointer;
  text-align: right; transition: all .15s var(--ease);
}
.side-btn:hover { background: var(--sidebar-active-bg); color: var(--sidebar-text-hover); }
.side-btn.on {
  background: var(--sidebar-active-bg); color: var(--sidebar-text-active); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

.side-icon {
  width: 20px; height: 20px; flex-shrink: 0; opacity: 0.55;
}
.side-btn.on .side-icon { opacity: 1; }

.side-foot {
  margin-top: auto; padding-top: 20px;
  border-top: 1px solid var(--sidebar-border);
}
.side-user { font-size: 0.82rem; font-weight: 600; color: rgba(255,255,255,0.85); padding: 0 4px; }
.side-email { font-size: 0.72rem; color: rgba(255,255,255,0.3); padding: 0 4px; margin-bottom: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Main (centered column) ───────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  padding: 40px 28px 56px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-inner {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-inner > * {
  width: 100%;
}

.pg-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  text-align: center;
  width: 100%;
}
.pg-desc {
  color: var(--text-3);
  font-size: 0.9rem;
  margin-bottom: 32px;
  text-align: center;
  width: 100%;
}

/* Narrow panels (forms) centered in column */
.narrow {
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
}
.narrow-md { max-width: 640px; }
.narrow-lg { max-width: 720px; }

/* ── Stat Cards ───────────────────────────────────── */
.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
  width: 100%;
}
.st {
  flex: 1 1 200px;
  max-width: 240px;
  min-width: 168px;
  border-radius: var(--r-lg); padding: 22px 24px;
  transition: all .25s var(--ease); position: relative;
  text-align: center;
  border: 1px solid transparent;
}
.st.purple { background: #edeaff; border-color: rgba(99, 91, 255, 0.2); }
.st.purple .st-val { color: #4f46e5; }
.st.blue { background: #e8f1ff; border-color: rgba(41, 121, 255, 0.2); }
.st.blue .st-val { color: #1d4ed8; }
.st.green { background: #e8f8ef; border-color: rgba(0, 200, 83, 0.2); }
.st.green .st-val { color: #047857; }
.st.orange { background: #fff4e5; border-color: rgba(255, 145, 0, 0.25); }
.st.orange .st-val { color: #c2410c; }

.st:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.st-label { font-size: 0.78rem; font-weight: 600; color: var(--text-3); margin-bottom: 8px; position: relative; }
.st-val { font-size: 2rem; font-weight: 900; letter-spacing: -1px; position: relative; }

/* ── Cards ────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--r-lg); padding: 28px;
  transition: box-shadow .25s var(--ease);
}
.card:hover { box-shadow: var(--sh-sm); }
.card-h {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}
.card-h .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* ── Info Grid ────────────────────────────────────── */
.ig {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  justify-items: stretch;
}
.ig-item {
  text-align: center;
  padding: 18px 20px; background: var(--surface-2); border-radius: var(--r-md);
  transition: background .2s var(--ease);
}
.ig-item:hover { background: var(--surface-3); }
.ig-l { font-size: 0.72rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.ig-v { font-size: 1rem; font-weight: 600; }

/* ── Tables ───────────────────────────────────────── */
.tw { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--border-light); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface-2); }
th {
  padding: 13px 18px; font-size: 0.72rem; font-weight: 700;
  color: var(--text-3); text-align: center;
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
td { padding: 15px 18px; font-size: 0.88rem; border-top: 1px solid var(--border-light); text-align: center; }
tr:hover td { background: var(--surface-2); }

/* ── Badges ───────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 4px 14px;
  border-radius: 999px; font-size: 0.73rem; font-weight: 700;
}
.b-green { background: var(--green-soft); color: #00a344; }
.b-red { background: var(--red-soft); color: #d9304a; }
.b-orange { background: var(--orange-soft); color: #c57200; }
.b-blue { background: var(--blue-soft); color: #1a5ed4; }
.b-gray { background: var(--surface-2); color: var(--text-3); }

/* ── Forms in Panels ──────────────────────────────── */
.fg { display: grid; gap: 16px; }
.fr { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.fa { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ── Layout Helpers ───────────────────────────────── */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-20 { margin-bottom: 20px; }
.mb-28 { margin-bottom: 28px; }

/* ── Tabs ─────────────────────────────────────────── */
.tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: 999px;
  margin-bottom: 24px;
}
.tabs-row {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}
.tabs-row .tabs { margin-bottom: 0; }

/* ── Empty ─────────────────────────────────────────── */
.empty { text-align: center; padding: 48px; color: var(--text-3); font-size: 0.88rem; }

/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.side::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); }

/* ── Animations ───────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.main-inner > * { animation: fadeUp .35s var(--ease) both; }
.main-inner > *:nth-child(2) { animation-delay: .05s; }
.main-inner > *:nth-child(3) { animation-delay: .1s; }
.main-inner > *:nth-child(4) { animation-delay: .15s; }
.main-inner > *:nth-child(5) { animation-delay: .2s; }
