:root {
  --bg: #000000;
  --bg-soft: #0e0e13;
  --card: #15151d;
  --card-hover: #1e1e28;
  --border: #2a2a35;
  --text: #ffffff;
  --muted: #9aa1b2;
  --accent: #2563eb;
  --accent-hi: #3b82f6;
  --accent-soft: #15306e;
  --green: #22c55e;
  --amber: #f59e0b;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.5);
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, system-ui, -apple-system, "Noto Kufi Arabic", sans-serif;
}

a { color: inherit; text-decoration: none; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ── الترويسة ── */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; gap: 12px;
  padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; white-space: nowrap; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  color: #fff; font-size: 20px;
}
.search { flex: 1; min-width: 200px; position: relative; }
.search input {
  width: 100%; height: 44px;
  padding-block: 0; padding-inline: 44px 16px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text); font-size: 15px; outline: none;
}
.search input:focus { border-color: var(--accent); }
.search .icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }

select {
  height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg-soft);
  color: var(--text); font-size: 14px; outline: none; cursor: pointer;
}

.lang-btn {
  height: 44px; min-width: 52px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text);
  font-size: 14px; font-weight: 700; cursor: pointer; transition: .15s;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent-hi); }

/* ── الأصناف ── */
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: thin; }
.cats::-webkit-scrollbar { height: 6px; }
.cats::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
.chip {
  white-space: nowrap; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-soft);
  color: var(--muted); font-size: 13px; cursor: pointer; transition: .15s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip .n { opacity: .7; font-size: 11px; margin-inline-start: 4px; }

/* ── الشبكة ── */
.meta-row { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 10px; color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; gap: 12px; align-items: center; transition: .15s; cursor: pointer;
}
.card:hover { background: var(--card-hover); transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.card .ic {
  width: 58px; height: 58px; border-radius: 14px; flex: 0 0 58px;
  object-fit: cover; background: var(--bg-soft); border: 1px solid var(--border);
}
.card .body { min-width: 0; flex: 1; }
.card .nm { font-weight: 700; font-size: 15px; margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sub { color: var(--muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── الصفحات ── */
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 26px 0 40px; flex-wrap: wrap; }
.pager button {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); cursor: pointer; font-size: 14px;
}
.pager button:disabled { opacity: .4; cursor: default; }
.pager button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.state { text-align: center; color: var(--muted); padding: 60px 20px; font-size: 15px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── صفحة التطبيق ── */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin: 22px 0 10px; font-size: 14px; }
.back:hover { color: var(--accent-hi); }
.detail { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 40px; }
.detail .head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.detail .ic { width: 96px; height: 96px; border-radius: 22px; object-fit: cover; border: 1px solid var(--border); background: var(--bg-soft); }
.detail h1 { font-size: 24px; margin: 0 0 6px; }
.detail .sub { color: var(--muted); font-size: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; }
.stat { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; min-width: 90px; }
.stat .k { color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.stat .v { font-weight: 700; font-size: 16px; }

.dl-box { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin: 20px 0; }
.dl-box .label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.dl-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.dl-link {
  flex: 1; min-width: 220px; direction: ltr; text-align: left;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 0 14px; height: 48px; display: flex; align-items: center;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; color: var(--text);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer;
}
.btn {
  height: 48px; padding: 0 20px; border-radius: 10px; border: none; cursor: pointer;
  font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  transition: .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hi); }
.btn.copied { background: var(--green); }

.desc { line-height: 1.9; font-size: 15px; white-space: pre-wrap; margin-top: 14px; color: var(--text); }
.desc-title { font-weight: 800; font-size: 17px; margin: 24px 0 8px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--green); color: #fff; padding: 12px 22px; border-radius: 12px;
  font-weight: 700; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 0 40px; border-top: 1px solid var(--border); }

/* ── صفحة تسجيل الدخول ── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 30px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.login-logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-hi)); color: #fff; font-size: 30px; margin: 0 auto 4px; }
.login-card h1 { text-align: center; font-size: 22px; margin: 0; }
.login-card input {
  height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text); font-size: 15px; outline: none; width: 100%;
}
.login-card input:focus { border-color: var(--accent); }
.login-card .btn { width: 100%; }
.login-err { background: rgba(239,68,68,.14); border: 1px solid #ef4444; color: #fca5a5; border-radius: 10px; padding: 10px 12px; font-size: 13px; text-align: center; }
.login-card .lang-btn { align-self: center; }
