
/* ============================================================
   1. المتغيرات الأساسية (مطابقة لـ www.divct.workers.dev)
   ============================================================ */
:root {
  --bg: #0a0f1a;
  --surface: #131b2e;
  --surface-hover: #1a2332;
  --border: #243044;
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --accent: #38bdf8;
  --accent-2: #4049C6;
  --accent-hover: #7dd3fc;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
  --font-size: 14px;
  --max-width: 1200px;
  --header-height: 64px;
  --sidebar-width: 260px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   2. إعادة الضبط والأساسيات
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--font-size); scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg); /* خلفية نظيفة بدون نسيج */
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; width: 100%; }

/* ============================================================
   3. Navbar
   ============================================================ */
.navbar {
  background: rgba(19, 27, 46, 0.8);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px); height: var(--header-height);
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.navbar-brand { display: flex; align-items: center; gap: 0.5rem; font-size: 1.2rem; font-weight: 700; color: var(--text); letter-spacing: 0.5px; }
.navbar-brand:hover { text-decoration: none; color: var(--accent); }
.navbar-nav { display: flex; align-items: center; gap: 1.5rem; list-style: none; }
.navbar-nav a { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.navbar-nav a:hover { color: var(--accent); text-decoration: none; }

/* ============================================================
   4. Docs Layout (Sidebar + Content)
   ============================================================ */
.docs-layout { display: flex; max-width: var(--max-width); margin: 0 auto; min-height: calc(100vh - var(--header-height) - 120px); }
.sidebar {
  width: var(--sidebar-width); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 1.5rem 1rem;
  position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); overflow-y: auto;
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.sidebar-title { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.sidebar-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.2rem; cursor: pointer; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar-link {
  display: block; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500; transition: all var(--transition);
}
.sidebar-link:hover { background: rgba(56, 189, 248, 0.08); color: var(--accent); text-decoration: none; }
.sidebar-link.active { background: rgba(56, 189, 248, 0.12); color: var(--accent); font-weight: 600; border-left: 3px solid var(--accent); }
.docs-content { flex: 1; padding: 2rem 3rem; min-width: 0; }

/* ============================================================
   5. Typography & Code
   ============================================================ */
.docs-content h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 1rem; line-height: 1.3; }
.docs-content h2 { font-size: 1.6rem; font-weight: 700; margin: 2.5rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.docs-content h3 { font-size: 1.2rem; font-weight: 600; margin: 1.5rem 0 0.75rem; color: var(--accent); }
.docs-content p { margin-bottom: 1rem; color: var(--text-muted); line-height: 1.8; }

.code-block {
  position: relative; background: #0d1117; border: 1px solid var(--border);
  border-radius: var(--radius); margin: 1rem 0; overflow: hidden;
}
.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: 0.75rem; color: var(--text-muted); font-family: monospace;
}
.code-block pre { padding: 1rem; overflow-x: auto; margin: 0; }
.code-block code { font-family: "JetBrains Mono", monospace; font-size: 0.85rem; color: #e6edf3; line-height: 1.6; }
.copy-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 0.7rem; padding: 0.2rem 0.5rem; cursor: pointer; transition: all var(--transition);
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.inline-code {
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  padding: 0.1rem 0.4rem; font-family: monospace; font-size: 0.85rem; color: var(--accent);
}

/* ============================================================
   6. Tables & Cards
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); margin: 1rem 0; }
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th { background: var(--surface); color: var(--text-muted); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(56, 189, 248, 0.03); }

.demo-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 1.5rem 0; }
.demo-card-header { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; background: var(--bg); border-bottom: 1px solid var(--border); font-size: 0.85rem; font-weight: 600; }
.demo-card-body { padding: 1.5rem; text-align: center; background: #fff; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.demo-card-body img { max-width: 100%; height: auto; margin: 0 auto; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; transition: border-color var(--transition); }
.card:hover { border-color: var(--accent); }
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }
.card-text { font-size: 0.9rem; color: var(--text-muted); line-height: 1.7; }

/* ============================================================
   7. Badges, Alerts & Utilities
   ============================================================ */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.3px; }
.badge-success { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.badge-danger { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.badge-warning { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.badge-accent { background: rgba(56, 189, 248, 0.15); color: var(--accent); }

.alert { padding: 1rem 1.25rem; border-radius: var(--radius); border: 1px solid var(--border); font-size: 0.9rem; margin: 1rem 0; }
.alert-info { background: rgba(56, 189, 248, 0.1); border-color: var(--accent); color: var(--accent); }
.alert-warning { background: rgba(251, 191, 36, 0.1); border-color: var(--warning); color: var(--warning); }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.hidden { display: none !important; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }

/* ============================================================
   8. Footer & Back to Top (مصحح - الزر في اليمين)
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer a { font-weight: 600; }

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem; /* تم النقل من اليسار إلى اليمين */
  left: auto;  /* إلغاء التمركز */
  transform: translateY(100px); /* إزالة translateX */
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: all var(--transition);
  z-index: 400;
  pointer-events: none;
}

.back-to-top.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent);
  color: #0b1120;
  border-color: var(--accent);
}
  /* ============================================================
   9. Responsive
   ============================================================ */
@media (max-width: 900px) {
  .docs-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; top: 0; border-right: none; border-bottom: 1px solid var(--border); padding: 1rem; }
  .sidebar-toggle { display: block; }
  .sidebar-nav { display: none; margin-top: 0.5rem; }
  .sidebar-nav.open { display: flex; }
  .docs-content { padding: 1.5rem; }
}

/* Mobile header: keep brand on one line, let links scroll sideways */
@media (max-width: 640px) {
  .navbar .container { gap: 0.75rem; }
  .navbar-brand { flex-shrink: 0; white-space: nowrap; font-size: 1.05rem; }
  .navbar-nav { gap: 0.9rem; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .navbar-nav::-webkit-scrollbar { display: none; }
  .navbar-nav > li { flex-shrink: 0; }
  .navbar-nav a { font-size: 0.85rem; white-space: nowrap; }
}
.navbar-toggle,.sidebar-extra{display:none}.sidebar-extra-last{margin-bottom:0.5rem;border-bottom:1px solid var(--border)}@media (max-width: 900px){.navbar-nav{display:none}.navbar-toggle{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:44px;height:44px;background:none;border:1px solid var(--border);border-radius:8px;color:var(--text);font-size:1.3rem;line-height:1;cursor:pointer}.navbar-toggle:hover{color:var(--accent);border-color:var(--accent)}.sidebar{display:none;position:fixed;top:var(--header-height);left:0;right:0;width:100%;height:auto;max-height:calc(100vh - var(--header-height));max-height:calc(100dvh - var(--header-height));overflow-y:auto;z-index:99;padding:0.75rem 1rem 1.25rem;border-right:none;border-bottom:1px solid var(--border);box-shadow:var(--shadow-md)}.sidebar.open{display:block}.sidebar-header{display:none}.sidebar-nav,.sidebar-nav.open{display:flex;margin-top:0}.sidebar .sidebar-link{min-height:44px;display:flex;align-items:center}}
