/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #2563eb;
  --blue-lt: #eff6ff;
  --green:   #059669;
  --green-lt:#ecfdf5;
  --amber:   #d97706;
  --amber-lt:#fffbeb;
  --red:     #dc2626;
  --red-lt:  #fef2f2;
  --gray1:   #0f172a;
  --gray2:   #334155;
  --gray3:   #64748b;
  --gray4:   #94a3b8;
  --gray5:   #e2e8f0;
  --gray6:   #f8fafc;
  --sidebar-w: 240px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  /* Height of the sticky production warning banner — used by sidebar offset */
  --banner-h: 44px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  direction: rtl;
  background: var(--gray6);
  color: var(--gray1);
  display: flex;
  flex-direction: column; /* banner on top, app-shell below */
  min-height: 100vh;
  line-height: 1.7;
}

/* ── App shell: sidebar + main in a horizontal row ────────────────────── */
.app-shell {
  display: flex;
  flex: 1;          /* fill remaining viewport height below the banner */
  min-height: 0;    /* allow flex children to shrink */
  overflow-x: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #1e293b;
  color: #e2e8f0;
  position: sticky;
  top: var(--banner-h);           /* stick just below the warning banner */
  height: calc(100vh - var(--banner-h)); /* fill the viewport below the banner */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px 16px;
  border-bottom: 1px solid #334155;
}

.sidebar-brand h1 {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.4;
  letter-spacing: .01em;
}

.sidebar-brand p {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.sidebar-progress {
  padding: 12px 20px;
  border-bottom: 1px solid #334155;
}

.progress-bar {
  height: 4px;
  background: #334155;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  border-radius: 2px;
  width: 0%;
  transition: width .4s ease;
}

.progress-label {
  font-size: 11px;
  color: #64748b;
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

nav { padding: 12px 0 24px; flex: 1; }

nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px;
  color: #94a3b8;
  text-decoration: none;
  transition: background .15s, color .15s;
  border-right: 3px solid transparent;
}

nav a:hover { background: #273346; color: #e2e8f0; }

nav a.active {
  background: #1d3a5f;
  color: #60a5fa;
  border-right-color: #3b82f6;
}

nav a .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

nav a .nav-step {
  font-size: 10px;
  background: #334155;
  color: #94a3b8;
  border-radius: 10px;
  padding: 1px 6px;
  margin-right: auto;
}

nav a.active .nav-step {
  background: #1e40af;
  color: #93c5fd;
}

/* ── Main content ─────────────────────────────────────────────────────── */
#main {
  flex: 1;
  min-width: 0;
  padding: 48px 56px;
  max-width: 900px;
}

/* ── Page header ──────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--gray5);
}

.page-header .badge {
  display: inline-block;
  background: var(--blue-lt);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
  letter-spacing: .04em;
}

.page-header h2 {
  font-size: 30px;
  font-weight: 800;
  color: var(--gray1);
  line-height: 1.2;
  margin-bottom: 10px;
}

.page-header p {
  font-size: 16px;
  color: var(--gray3);
  max-width: 620px;
}

/* ── Sections ─────────────────────────────────────────────────────────── */
section {
  margin-bottom: 64px;
  scroll-margin-top: 24px;
}

section h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray1);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

section h2 .section-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--blue-lt);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

section h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray2);
  margin: 24px 0 12px;
}

section p { color: var(--gray2); margin-bottom: 12px; }

/* ── Step card ────────────────────────────────────────────────────────── */
.step-card {
  background: #fff;
  border: 1px solid var(--gray5);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  position: relative;
}

.step-card::before {
  content: attr(data-step);
  position: absolute;
  top: 24px;
  left: 32px;
  font-size: 11px;
  font-weight: 800;
  color: var(--blue);
  background: var(--blue-lt);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.step-card .endpoint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.method-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: .04em;
}

.method-get  { background: #dcfce7; color: #166534; }
.method-post { background: #dbeafe; color: #1e40af; }

.endpoint-path {
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray1);
}

.step-card .step-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray1);
  margin-bottom: 4px;
  margin-top: 8px;
}

.step-card .step-desc {
  color: var(--gray3);
  font-size: 14px;
  margin-bottom: 20px;
}

/* ── Field table ──────────────────────────────────────────────────────── */
.field-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 20px;
}

.field-table th {
  background: var(--gray6);
  color: var(--gray3);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid var(--gray5);
  text-align: right;
}

.field-table td {
  padding: 9px 12px;
  border: 1px solid var(--gray5);
  color: var(--gray2);
  vertical-align: top;
}

.field-table tr:hover td { background: var(--gray6); }

.field-table td code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--blue);
  background: var(--blue-lt);
  padding: 1px 5px;
  border-radius: 3px;
}

.req-badge {
  background: #fee2e2;
  color: #b91c1c;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
}

/* ── Code blocks ──────────────────────────────────────────────────────── */
.code-block {
  position: relative;
  margin: 12px 0 20px;
}

.code-block-header {
  background: #1e293b;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.code-block-header .code-lang {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.copy-btn {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  background: transparent;
  border: 1px solid #334155;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
  direction: rtl;
}

.copy-btn:hover { background: #334155; color: #e2e8f0; }
.copy-btn.copied { background: #065f46; color: #6ee7b7; border-color: #065f46; }

pre {
  background: #0f172a;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px 20px;
  overflow-x: auto;
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #e2e8f0;
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

pre .k  { color: #7dd3fc; }   /* key      */
pre .s  { color: #86efac; }   /* string   */
pre .n  { color: #fca5a5; }   /* number   */
pre .c  { color: #64748b; font-style: italic; } /* comment */

/* ── Alert boxes ──────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.6;
}

.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-warning {
  background: var(--amber-lt);
  border: 1px solid #fcd34d;
  color: #78350f;
}

.alert-danger {
  background: var(--red-lt);
  border: 1px solid #fca5a5;
  color: #7f1d1d;
}

.alert-info {
  background: var(--blue-lt);
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}

.alert-success {
  background: var(--green-lt);
  border: 1px solid #6ee7b7;
  color: #064e3b;
}

.alert strong { display: block; margin-bottom: 4px; }

/* ── Checklist ────────────────────────────────────────────────────────── */
.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--gray5);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--gray2);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  user-select: none;
}

.checklist li:hover { border-color: var(--blue); background: var(--blue-lt); }
.checklist li.done  { background: var(--green-lt); border-color: #6ee7b7; color: #065f46; }

.check-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray4);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all .15s;
}

.checklist li.done .check-box {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

/* ── Quick-ref card ───────────────────────────────────────────────────── */
.quick-ref {
  background: #1e293b;
  border-radius: var(--radius);
  padding: 24px 28px;
  color: #e2e8f0;
}

.quick-ref h3 { color: #f1f5f9; margin-bottom: 16px; font-size: 15px; }

.quick-ref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quick-ref-item {
  background: #0f172a;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 12px;
  font-family: "SF Mono", Consolas, monospace;
  direction: ltr;
  color: #94a3b8;
}

.quick-ref-item .qr-method { color: #7dd3fc; font-weight: 700; }
.quick-ref-item .qr-path   { color: #f1f5f9; }
.quick-ref-item .qr-save   { color: #86efac; }

/* ── Troubleshoot table ───────────────────────────────────────────────── */
.trouble-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0 24px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.trouble-table th {
  background: var(--gray2);
  color: #fff;
  padding: 10px 16px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
}

.trouble-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray5);
  vertical-align: top;
  background: #fff;
  color: var(--gray2);
}

.trouble-table tr:last-child td { border-bottom: none; }
.trouble-table td:first-child {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--red);
  white-space: nowrap;
}

/* ── Inline code ──────────────────────────────────────────────────────── */
code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: .85em;
  color: var(--blue);
  background: var(--blue-lt);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ── Swagger illustration ─────────────────────────────────────────────── */
.swagger-ui-guide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0 24px;
}

.swagger-ui-card {
  background: #fff;
  border: 1px solid var(--gray5);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.swagger-ui-card .card-icon { font-size: 24px; margin-bottom: 8px; }
.swagger-ui-card h4 { font-size: 13px; font-weight: 700; color: var(--gray1); margin-bottom: 4px; }
.swagger-ui-card p  { font-size: 12px; color: var(--gray3); line-height: 1.5; }

/* ── Copy notice ──────────────────────────────────────────────────────── */
.copy-notice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff3cd;
  border: 1px solid #f6cc69;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #7d5a00;
  margin: 8px 0;
}

/* ── Divider ──────────────────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--gray5); margin: 32px 0; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --banner-h: 56px; } /* allow one extra line on narrow screens */
  #sidebar { display: none; }
  .app-shell { display: block; } /* stack vertically on mobile */
  #main { padding: 24px 20px; max-width: 100%; }
  .swagger-ui-guide { grid-template-columns: 1fr; }
  .quick-ref-grid   { grid-template-columns: 1fr; }
  .prod-warning-banner { font-size: 0.8rem; }
}

/* ── Production warning banner ────────────────────────────────────────── */
.prod-warning-banner {
  /* Sticks to the very top of the viewport */
  position: sticky;
  top: 0;
  z-index: 999;
  /* Fixed height so it never grows to fill the screen */
  height: var(--banner-h);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Appearance */
  background: var(--red);
  color: #fff;
  padding: 0 1.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  line-height: 1.4;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  /* Ensure it spans full width as a flex column child */
  flex-shrink: 0;
  width: 100%;
}

/* ── performedBy field note ───────────────────────────────────────────── */
.field-note {
  font-size: 13px;
  color: #78350f;
  margin: 0 0 8px;
  padding: 8px 12px;
  background: var(--amber-lt);
  border-right: 3px solid var(--amber);
  border-radius: 4px;
  line-height: 1.6;
}

.field-note code {
  background: #fde68a;
  color: #78350f;
  padding: 1px 4px;
  border-radius: 3px;
}

/* ── Checklist reset button ───────────────────────────────────────────── */
.reset-btn {
  display: inline-block;
  margin-top: 14px;
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--gray4);
  border-radius: 6px;
  cursor: pointer;
  color: var(--gray3);
  font-size: 13px;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}

.reset-btn:hover {
  background: var(--red-lt);
  color: var(--red);
  border-color: var(--red);
}

/* ── Troubleshoot tip link ────────────────────────────────────────────── */
.tip {
  font-size: 13px;
  color: var(--gray3);
  margin-top: 16px;
}

.tip a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.tip a:hover { text-decoration: underline; }
