/* ═══════════════════════════════════════════════════════════════
   تنسيق اللوحة

   مكتوب بـ CSS عادي بدون أي إطار (Tailwind/Bootstrap) - تفتح الملف
   وتعدّل أي شي بدون ما تتعلم أدوات جديدة.

   الألوان معرّفة كمتغيرات فوق: غيّر سطر واحد يتغيّر الموقع كله.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #0f1117;
  --bg-soft: #161923;
  --bg-card: #1a1e2b;
  --border: #262b3a;
  --text: #e6e8ef;
  --text-dim: #9aa1b4;
  --accent: #5865f2;      /* أزرق ديسكورد */
  --accent-hover: #4752c4;
  --green: #57f287;
  --red: #ed4245;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, "Noto Kufi Arabic", system-ui, sans-serif;
  line-height: 1.7;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: .9em;
  direction: ltr;
  display: inline-block;
}

/* ── الشريط العلوي ───────────────────────────────────────────── */
.nav {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.4rem; }

.nav-links { display: flex; gap: 6px; margin-inline-start: auto; }
.nav-links a {
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 8px;
}
.nav-links a:hover { background: var(--bg-card); color: var(--text); text-decoration: none; }
.nav-links a.active { background: var(--accent); color: #fff; }

.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.3; }
.nav-user-name { font-size: .9rem; font-weight: 600; }

.avatar { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border); }
.avatar-lg { width: 88px; height: 88px; }

/* ── الصفحات ─────────────────────────────────────────────────── */
.page { max-width: 1000px; margin: 0 auto; padding: 32px 20px; width: 100%; flex: 1; }
.page-head { margin-bottom: 28px; }
.page-head h1 { margin: 0 0 4px; font-size: 1.7rem; }

.center-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

/* ── البطاقات ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card-title { margin: 0 0 18px; font-size: 1.1rem; }

.card-login { max-width: 420px; width: 100%; text-align: center; }
.card-login h1 { margin: 0 0 8px; font-size: 1.5rem; }
.login-mark { font-size: 3rem; line-height: 1; margin-bottom: 8px; }

.login-note {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: .88rem;
  color: var(--text-dim);
  text-align: start;
}
.login-note p { margin: 6px 0; }

/* ── الملف الشخصي ────────────────────────────────────────────── */
.profile { display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; margin: 0; flex: 1; min-width: 260px; }
.kv dt { color: var(--text-dim); font-size: .9rem; }
.kv dd { margin: 0; }

/* ── الأزرار ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 20px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }

.btn-block { width: 100%; margin-top: 8px; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-discord { background: #5865f2; font-size: 1.02rem; padding: 13px 20px; }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text); }

/* ── الشارات ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: .8rem;
  color: var(--text-dim);
}
.badge-admin { background: rgba(88, 101, 242, .16); border-color: var(--accent); color: #aeb6ff; }

/* ── الجداول ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-dim); font-weight: 600; font-size: .85rem; }
.table tbody tr:last-child td { border-bottom: none; }
.nowrap { white-space: nowrap; }

/* ── الحالة الفارغة ──────────────────────────────────────────── */
.empty { text-align: center; padding: 26px 10px; }
.empty-mark { font-size: 2.4rem; margin-bottom: 6px; }
.empty p { margin: 4px 0; }

/* ── متفرقات ─────────────────────────────────────────────────── */
.muted { color: var(--text-dim); }

.footer {
  border-top: 1px solid var(--border);
  padding: 18px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: .85rem;
}
.footer-sep { margin: 0 8px; opacity: .5; }

/* ── الجوال ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-inner { flex-wrap: wrap; gap: 12px; }
  .nav-links { margin-inline-start: 0; order: 3; width: 100%; }
  .nav-user-meta { display: none; }
  .profile { justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════
   صفحات البوتات والإعدادات
   ═══════════════════════════════════════════════════════════════ */

.page-wide { max-width: 1180px; }
.ltr { direction: ltr; display: inline-block; }
.dot-sep { opacity: .4; margin: 0 4px; }

/* ── شبكة البوتات ────────────────────────────────────────────── */
.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.bot-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.bot-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.bot-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.bot-name { font-size: 1.05rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bot-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.bot-dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.bot-dot.off { background: #4a4f5e; }

.bot-meta { margin: 0; display: grid; gap: 8px; }
.bot-meta > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.bot-meta dt { color: var(--text-dim); font-size: .85rem; }
.bot-meta dd { margin: 0; font-size: .9rem; }

.bot-card-go { display: block; margin-top: 14px; color: var(--accent); font-size: .87rem; }

.pill { display: inline-block; border-radius: 999px; padding: 3px 12px; font-size: .8rem; font-weight: 600; }
.pill-green  { background: rgba(87,242,135,.14); color: #7ff0a8; }
.pill-orange { background: rgba(250,166,26,.16); color: #ffc46b; }
.pill-red    { background: rgba(237,66,69,.16);  color: #ff8b8d; }
.pill-gold   { background: rgba(255,215,0,.14);  color: #ffdb70; }

/* ── رأس صفحة الإعدادات ──────────────────────────────────────── */
.bot-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.bot-head h1 { margin: 0 0 2px; font-size: 1.45rem; }
.bot-head p { margin: 0; font-size: .9rem; }
.bot-head-back { margin-inline-start: auto; }

.guild-icon { width: 58px; height: 58px; border-radius: 16px; border: 1px solid var(--border); }
.guild-icon-empty { display: flex; align-items: center; justify-content: center; background: var(--bg-soft); font-size: 1.6rem; }

/* ── التخطيط: قائمة جانبية + محتوى ───────────────────────────── */
.settings-layout { display: grid; grid-template-columns: 262px 1fr; gap: 20px; align-items: start; }

.settings-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  position: sticky;
  top: 78px;
}

.settings-nav-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--text-dim);
}
.settings-nav-item:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.settings-nav-item.active { background: var(--accent); color: #fff; }
.settings-nav-item.active small { color: rgba(255,255,255,.75); }

.settings-nav-icon { font-size: 1.1rem; line-height: 1.4; }
.settings-nav-text { display: flex; flex-direction: column; line-height: 1.35; }
.settings-nav-text small { font-size: .76rem; opacity: .8; }

.card-sub { margin: -12px 0 20px; font-size: .88rem; }

/* ── الحقول ──────────────────────────────────────────────────── */
.field { padding: 16px 0; border-bottom: 1px solid var(--border); }
.field:last-of-type { border-bottom: none; }

.field-label { display: block; font-weight: 600; margin-bottom: 4px; }
.field-help { margin: 0 0 10px; color: var(--text-dim); font-size: .86rem; }
.field-range { display: block; margin-top: 6px; color: var(--text-dim); font-size: .8rem; }

.input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 13px;
  color: var(--text);
  font: inherit;
}
.input:focus { outline: none; border-color: var(--accent); }
.input-sm { max-width: 190px; }
.input-area { resize: vertical; min-height: 110px; font-family: "Cascadia Mono", Consolas, monospace; }

/* ── المفتاح (Toggle) ────────────────────────────────────────── */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; cursor: pointer; }
.toggle-text { display: flex; flex-direction: column; gap: 3px; }
.toggle-text small { color: var(--text-dim); font-size: .86rem; }

.switch { position: relative; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-track {
  display: block;
  width: 48px; height: 27px;
  background: #3a3f52;
  border-radius: 999px;
  transition: background .18s;
}
.switch-thumb {
  position: absolute;
  top: 3px; inset-inline-end: 3px;
  width: 21px; height: 21px;
  background: #fff;
  border-radius: 50%;
  transition: transform .18s;
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(-21px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── خيارات متعددة ───────────────────────────────────────────── */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.check {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: .9rem;
}
.check:hover { border-color: var(--accent); }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ── أزرار الحفظ ─────────────────────────────────────────────── */
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ── التنبيهات ───────────────────────────────────────────────── */
.alert { border-radius: 11px; padding: 13px 17px; margin-bottom: 18px; border: 1px solid; }
.alert-ok   { background: rgba(87,242,135,.1); border-color: rgba(87,242,135,.35); color: #9df3ba; }
.alert-warn { background: rgba(250,166,26,.1); border-color: rgba(250,166,26,.35); color: #ffce85; }
.alert ul { margin: 8px 0 0; padding-inline-start: 20px; }

/* ── الجوال ──────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 6px; }
  .settings-nav-item { flex-direction: column; align-items: center; text-align: center; min-width: 110px; }
  .settings-nav-text small { display: none; }
  .bot-head-back { margin-inline-start: 0; }
}
