/* ── IBM Plex Sans Arabic ──────────────────────────────────────────────── */
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../fonts/IBMPlexSansArabic-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../fonts/IBMPlexSansArabic-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../fonts/IBMPlexSansArabic-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans Arabic'; src: url('../fonts/IBMPlexSansArabic-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --nav-w: 270px;
  --toc-w: 220px;
  --header-h: 56px;

  --brand-blue:  #1e3a6e;
  --brand-green: #22c55e;
  --accent:      #1d4ed8;
  --accent-light:#dbeafe;

  --bg:      #f9fafb;
  --surface: #ffffff;
  --border:  #e5e7eb;
  --text:    #111827;
  --muted:   #6b7280;
  --faint:   #9ca3af;

  --code-bg: #0f172a;
  --code-text: #e2e8f0;

  --get:    #0284c7; --get-bg:    #e0f2fe;
  --post:   #16a34a; --post-bg:   #dcfce7;
  --delete: #dc2626; --delete-bg: #fee2e2;

  --r: 6px;
  --sh: 0 1px 3px rgba(0,0,0,.08);
  --sh-md: 0 4px 12px rgba(0,0,0,.08);
  --font: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'SF Mono', Consolas, 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); font-size: 15px; color: var(--text); background: var(--bg); line-height: 1.7; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top header ────────────────────────────────────────────────────────── */
#top-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: var(--brand-blue); border-bottom: 1px solid #162d56;
  display: flex; align-items: center; padding: 0 20px; gap: 20px; z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.header-logo { display: flex; align-items: center; gap: 10px; }
.header-logo img { height: 30px; }
.header-logo span { color: #e2e8f0; font-size: 13px; font-weight: 500; }
.header-sep { width: 1px; height: 24px; background: #2d4a7a; }
.header-title { color: #93c5fd; font-size: 14px; font-weight: 500; }
.header-right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.header-link { color: #94a3b8; font-size: 13px; padding: 5px 10px; border-radius: var(--r); }
.header-link:hover { background: #1e3a6e; color: #e2e8f0; text-decoration: none; }
#menu-toggle { display: none; background: none; border: none; color: #e2e8f0; font-size: 20px; cursor: pointer; }

/* ── Layout ────────────────────────────────────────────────────────────── */
#layout { display: flex; margin-top: var(--header-h); min-height: calc(100vh - var(--header-h)); }

/* Left nav */
#left-nav {
  width: var(--nav-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); position: fixed;
  top: var(--header-h); bottom: 0; overflow-y: auto;
  padding: 16px 0 40px;
}
.nav-section-title {
  padding: 12px 20px 4px; font-size: 11px; font-weight: 700;
  color: var(--faint); text-transform: uppercase; letter-spacing: .08em;
}
.nav-link {
  display: block; padding: 6px 20px; font-size: 13.5px; color: var(--muted);
  transition: color .12s, background .12s; border-left: 3px solid transparent;
}
.nav-link:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-light); border-left-color: var(--accent); font-weight: 500; }
.nav-sub { padding-left: 16px; }
.nav-sub .nav-link { font-size: 13px; }

/* Main content */
#main {
  margin-left: var(--nav-w); flex: 1; max-width: calc(100% - var(--nav-w) - var(--toc-w));
  padding: 48px 52px; min-width: 0;
}

/* Right TOC */
#toc {
  width: var(--toc-w); flex-shrink: 0; position: sticky;
  top: calc(var(--header-h) + 24px); height: fit-content;
  padding: 0 0 0 24px; margin-top: 48px;
}
.toc-title { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.toc-link { display: block; font-size: 12.5px; color: var(--muted); padding: 3px 0; }
.toc-link:hover { color: var(--text); text-decoration: none; }
.toc-sub { padding-left: 12px; }

/* ── Content typography ────────────────────────────────────────────────── */
.doc-section { margin-bottom: 64px; scroll-margin-top: calc(var(--header-h) + 24px); }

h1 { font-size: 30px; font-weight: 700; margin-bottom: 8px; color: var(--text); letter-spacing: -.3px; }
h2 { font-size: 22px; font-weight: 700; margin: 40px 0 12px; color: var(--text); padding-bottom: 8px; border-bottom: 1px solid var(--border); }
h3 { font-size: 17px; font-weight: 600; margin: 28px 0 10px; color: var(--text); }
h4 { font-size: 14px; font-weight: 600; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

p { margin-bottom: 14px; }
ul, ol { margin: 0 0 14px 20px; }
li { margin-bottom: 4px; }
strong { font-weight: 600; }

.lead { font-size: 17px; color: var(--muted); margin-bottom: 24px; line-height: 1.6; }

/* ── Method + path ─────────────────────────────────────────────────────── */
.endpoint-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.method {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 4px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 700; letter-spacing: .04em;
}
.method-get    { background: var(--get-bg);    color: var(--get); }
.method-post   { background: var(--post-bg);   color: var(--post); }
.method-delete { background: var(--delete-bg); color: var(--delete); }
.endpoint-path { font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--text); }

/* ── Code blocks ───────────────────────────────────────────────────────── */
pre {
  background: var(--code-bg); border-radius: var(--r); padding: 20px;
  overflow-x: auto; margin: 14px 0; position: relative; font-size: 13px;
  line-height: 1.6; border: 1px solid #1e293b;
}
pre code { font-family: var(--mono); color: var(--code-text); background: none; padding: 0; }
code {
  font-family: var(--mono); font-size: 13px; background: #f0f4f8;
  color: #c2410c; padding: 1px 6px; border-radius: 4px;
}
.copy-btn {
  position: absolute; top: 10px; right: 10px; font-size: 11px; padding: 3px 10px;
  background: #1e293b; color: #64748b; border: 1px solid #334155; border-radius: 4px;
  cursor: pointer; font-family: var(--font); transition: color .12s;
}
.copy-btn:hover { color: #e2e8f0; }

/* Syntax tokens */
.tok-key    { color: #93c5fd; }  /* JSON key */
.tok-str    { color: #86efac; }  /* string value */
.tok-num    { color: #fbbf24; }  /* number */
.tok-bool   { color: #f472b6; }  /* true/false/null */
.tok-cmt    { color: #64748b; font-style: italic; }  /* comment */
.tok-cmd    { color: #c4b5fd; }  /* curl / shell command */
.tok-flag   { color: #7dd3fc; }  /* -H -d */
.tok-url    { color: #34d399; }
.tok-header { color: #fde68a; }

/* Code tabs */
.code-tabs { margin: 14px 0; }
.tab-bar { display: flex; gap: 2px; margin-bottom: -1px; }
.tab-btn {
  padding: 5px 14px; font-size: 12px; font-weight: 500; cursor: pointer;
  background: #1e293b; color: #64748b; border: 1px solid #334155;
  border-bottom: none; border-radius: 4px 4px 0 0; font-family: var(--font);
  transition: background .12s, color .12s;
}
.tab-btn.active { background: var(--code-bg); color: #e2e8f0; border-color: #334155; }
.code-tabs pre { border-radius: 0 var(--r) var(--r) var(--r); margin-top: 0; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.param-table { width: 100%; border-collapse: collapse; margin: 14px 0 20px; font-size: 14px; }
.param-table th { text-align: left; padding: 8px 14px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--bg); border-bottom: 1px solid var(--border); }
.param-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.param-table tr:last-child td { border-bottom: none; }
.param-name { font-family: var(--mono); font-size: 13px; color: #c2410c; font-weight: 500; }
.param-type { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.req-badge { display: inline-block; font-size: 10px; font-weight: 700; background: #fef3c7; color: #92400e; padding: 1px 6px; border-radius: 3px; margin-left: 6px; }
.opt-badge { display: inline-block; font-size: 10px; font-weight: 700; background: var(--bg); color: var(--faint); padding: 1px 6px; border-radius: 3px; margin-left: 6px; }

/* ── Callout boxes ─────────────────────────────────────────────────────── */
.callout {
  padding: 14px 18px; border-radius: var(--r); margin: 18px 0;
  display: flex; gap: 12px; font-size: 14px; line-height: 1.55;
}
.callout-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.callout-info    { background: #eff6ff; border-left: 4px solid var(--accent); }
.callout-warning { background: #fffbeb; border-left: 4px solid #f59e0b; }
.callout-danger  { background: #fef2f2; border-left: 4px solid #ef4444; }
.callout-success { background: #f0fdf4; border-left: 4px solid var(--brand-green); }

/* ── Step list ─────────────────────────────────────────────────────────── */
.steps { list-style: none; margin: 0 0 20px; padding: 0; counter-reset: steps; }
.steps li {
  counter-increment: steps; padding: 14px 16px 14px 52px; position: relative;
  border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 10px;
  background: var(--surface);
}
.steps li::before {
  content: counter(steps); position: absolute; left: 14px; top: 14px;
  width: 24px; height: 24px; background: var(--accent); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.steps li strong { display: block; margin-bottom: 4px; font-size: 14.5px; }

/* ── State diagram ─────────────────────────────────────────────────────── */
.state-flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.state-node {
  padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
  border: 1px solid; white-space: nowrap;
}
.sn-requested  { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.sn-scanned    { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; }
.sn-processing { background: #fefce8; color: #854d0e; border-color: #fef08a; }
.sn-success    { background: #f0fdf4; color: #166534; border-color: #86efac; }
.sn-failed     { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.sn-cancelled  { background: #f9fafb; color: #374151; border-color: #d1d5db; }
.sn-expired    { background: #f5f3ff; color: #5b21b6; border-color: #c4b5fd; }
.state-arrow { color: var(--faint); font-size: 18px; }

/* ── Hero section ──────────────────────────────────────────────────────── */
.doc-hero { margin-bottom: 40px; }
.doc-hero h1 { font-size: 36px; margin-bottom: 16px; }
.version-badge { display: inline-block; background: var(--accent-light); color: var(--accent); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; margin-bottom: 16px; }
.hero-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.hero-card {
  border: 1px solid var(--border); border-radius: var(--r); padding: 20px;
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.hero-card:hover { border-color: var(--accent); box-shadow: var(--sh-md); text-decoration: none; }
.hero-card-icon { font-size: 24px; margin-bottom: 8px; }
.hero-card h3 { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.hero-card p { font-size: 13px; color: var(--muted); margin: 0; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  #toc { display: none; }
  #main { max-width: calc(100% - var(--nav-w)); }
}
@media (max-width: 768px) {
  #left-nav { transform: translateX(-100%); transition: transform .2s; z-index: 150; }
  #left-nav.open { transform: translateX(0); }
  #main { margin-left: 0; max-width: 100%; padding: 24px 20px; }
  #menu-toggle { display: block; }
  .hero-cards { grid-template-columns: 1fr; }
}

/* ── Utilities ─────────────────────────────────────────────────────────── */
.mt-0  { margin-top: 0; }
.mb-8  { margin-bottom: 8px; }
.text-muted { color: var(--muted); font-size: 13px; }
hr.section-divider { border: none; border-top: 1px solid var(--border); margin: 48px 0; }
