/* Xendra docs — sidebar layout (Zyper-style) */
:root {
  --docs-bg: #fff;
  --docs-surface: #fafbfc;
  --docs-border: #e3e6ea;
  --docs-text: #0a0b0d;
  --docs-muted: #5b616e;
  --docs-faint: #8a9099;
  --docs-accent: #1b1bff;
  --docs-accent-soft: #e8e9ff;
  --docs-sidebar-w: 272px;
  --docs-content-pad: 32px;
  --docs-content-max: 920px;
  --docs-article-max: 720px;
  --docs-top: 56px;
  color-scheme: light;
}

.docs-body {
  margin: 0;
  background: var(--docs-bg);
  color: var(--docs-text);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.docs-app {
  display: flex;
  min-height: 100vh;
}

.docs-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: var(--docs-sidebar-w);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--docs-border);
  background: #fff;
  padding: 16px 0 32px;
  transform: translateX(0);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}

.docs-sidebar-head {
  padding: 8px 16px 14px;
  margin: 0 12px 10px;
  border-bottom: 1px solid var(--docs-border);
}

.docs-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--docs-text);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.docs-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(27, 27, 255, 0.18);
}

.docs-brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  line-height: 1.15;
}

.docs-brand-sub {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--docs-faint);
  font-weight: 400;
}

.docs-nav-group {
  margin: 16px 0 0;
  padding: 0 12px;
}

.docs-nav-label {
  margin: 0 0 6px 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--docs-faint);
}

.docs-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-nav-list a {
  display: block;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: 8px;
  font-size: 14px;
  color: var(--docs-muted);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.docs-nav-list a:hover {
  background: rgba(27, 27, 255, 0.06);
  color: var(--docs-text);
}

.docs-nav-list a.is-active {
  background: var(--docs-accent-soft);
  color: var(--docs-accent);
  font-weight: 500;
}

.docs-shell {
  flex: 1;
  margin-left: var(--docs-sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f3f4f6 0%, #fafbfc 220px, #fff 100%);
}

.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--docs-top);
  padding: 0 var(--docs-content-pad);
  border-bottom: 1px solid var(--docs-border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.docs-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.docs-menu-btn {
  display: none;
  border: 1px solid var(--docs-border);
  background: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--docs-muted);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 51;
  min-height: 44px;
  min-width: 44px;
}

.docs-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 0;
  padding: 8px 14px;
  border: 1px solid var(--docs-border);
  border-radius: 10px;
  background: var(--docs-surface);
  font-size: 13px;
  color: var(--docs-muted);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.docs-search-btn:hover {
  border-color: var(--docs-accent);
  box-shadow: 0 4px 16px rgba(27, 27, 255, 0.08);
}

.docs-search-kbd {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--docs-border);
  background: #fff;
  color: var(--docs-faint);
}

.docs-back-home {
  font-size: 13px;
  color: var(--docs-muted);
  text-decoration: none;
}

.docs-back-home:hover {
  color: var(--docs-accent);
}

.docs-main,
.docs-pager,
.docs-footer {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--docs-content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--docs-content-pad);
  padding-right: var(--docs-content-pad);
}

.docs-main {
  flex: 1;
  padding-top: 28px;
  padding-bottom: 24px;
  display: flex;
  justify-content: center;
}

.docs-article {
  width: 100%;
  max-width: var(--docs-article-max);
  background: #fff;
  border: 1px solid var(--docs-border);
  border-radius: 16px;
  padding: 32px 36px 36px;
  box-shadow:
    0 1px 2px rgba(10, 11, 13, 0.04),
    0 16px 48px rgba(10, 11, 13, 0.06);
}

.docs-article > .docs-eyebrow {
  margin-bottom: 8px;
}

.docs-article > h1 {
  margin-bottom: 14px;
}

.docs-article > .docs-lead {
  margin-bottom: 0;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--docs-border);
}

.docs-article > .docs-lead:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.docs-article > h1 + .docs-lead {
  margin-bottom: 0;
}

.docs-eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--docs-faint);
  margin: 0 0 10px;
}

.docs-main h1 {
  font-weight: 500;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin: 0 0 16px;
}

.docs-lead {
  font-size: 16px;
  line-height: 1.65;
  color: var(--docs-muted);
  margin: 0 0 28px;
  max-width: none;
}

.docs-main h2 {
  font-size: 18px;
  font-weight: 500;
  margin: 28px 0 0;
  padding: 14px 0 10px;
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--docs-top) + 16px);
  border-top: 1px solid var(--docs-border);
}

.docs-article > h1 + .docs-lead + * {
  margin-top: 24px;
}

.docs-article > .docs-tour + *,
.docs-article > .docs-lead + .docs-tour {
  margin-top: 24px;
}

.docs-main h2:first-of-type {
  border-top: 0;
  padding-top: 24px;
  margin-top: 24px;
}

.docs-main h2 + p,
.docs-main h2 + ul,
.docs-main h2 + ol,
.docs-main h2 + .docs-table-wrap,
.docs-main h2 + .docs-card-link {
  margin-top: 10px;
}

.docs-main h2 + p,
.docs-main h2 + ul,
.docs-main h2 + ol {
  padding: 0 0 4px;
}

.docs-main ul:not(.docs-steps):not(.docs-nav-list),
.docs-main ol:not(.docs-steps) {
  background: var(--docs-surface);
  border: 1px solid var(--docs-border);
  border-radius: 12px;
  padding: 14px 18px 14px 36px;
  margin-top: 12px;
  margin-bottom: 20px;
}

.docs-main h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 28px 0 8px;
}

.docs-main p,
.docs-main li {
  font-size: 16px;
  line-height: 1.65;
  color: #3d424a;
}

.docs-main ul,
.docs-main ol {
  margin: 0 0 18px;
  padding-left: 1.25rem;
}

.docs-main li {
  margin-bottom: 8px;
}

.docs-main a {
  color: var(--docs-accent);
}

.docs-section-block {
  margin: 32px 0;
  padding: 28px 28px 24px;
  border: 1px solid var(--docs-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(10, 11, 13, 0.04);
}

.docs-section-block > h2 {
  margin-top: 0;
}

.docs-card-link {
  display: block;
  margin: 20px 0;
  padding: 18px 20px;
  border: 1px solid #dfe3ff;
  border-radius: 14px;
  color: var(--docs-text);
  text-decoration: none;
  background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.docs-card-link:hover {
  border-color: var(--docs-accent);
  box-shadow: 0 8px 28px rgba(27, 27, 255, 0.07);
  color: var(--docs-text);
}

.docs-card-link strong {
  display: block;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.docs-card-link span {
  font-size: 14px;
  color: var(--docs-muted);
}

.docs-tour {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0 32px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px dashed var(--docs-border);
  background: linear-gradient(135deg, #f8f9ff 0%, #fafbfc 100%);
}

.docs-tour-play {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--docs-accent);
  color: #fff;
  font-size: 16px;
  cursor: default;
  box-shadow: 0 4px 14px rgba(27, 27, 255, 0.35);
}

.docs-tour-text strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}

.docs-tour-text span {
  font-size: 14px;
  color: var(--docs-muted);
}

.docs-table-wrap {
  overflow-x: auto;
  margin: 20px 0 24px;
  border: 1px solid var(--docs-border);
  border-radius: 12px;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.docs-table th,
.docs-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--docs-border);
  vertical-align: top;
}

.docs-table th {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--docs-faint);
  background: var(--docs-surface);
}

.docs-table tr:last-child td {
  border-bottom: 0;
}

.docs-table td:first-child {
  font-weight: 500;
  color: var(--docs-text);
  white-space: nowrap;
}

.docs-tip,
.docs-note {
  margin: 24px 0;
  padding: 14px 16px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  position: relative;
  overflow: hidden;
}

.docs-tip {
  background: linear-gradient(135deg, #eef2ff 0%, #f8faff 48%, #fff 100%);
  border: 1px solid #c7d2fe;
  box-shadow: 0 4px 20px rgba(27, 27, 255, 0.06);
  color: #1e293b;
}

.docs-note {
  background: linear-gradient(135deg, #f4f5f7 0%, #fafbfc 55%, #fff 100%);
  border: 1px solid #dfe3e8;
  box-shadow: 0 4px 18px rgba(10, 11, 13, 0.04);
  color: #4b5563;
}

.docs-tip::before,
.docs-note::before {
  display: flex;
  align-items: center;
  gap: 8px;
  position: static;
  margin-bottom: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.docs-tip::before {
  content: "Tip";
  color: var(--docs-accent);
}

.docs-tip::after,
.docs-note::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
}

.docs-tip::after {
  background: linear-gradient(180deg, #1b1bff 0%, #6366f1 100%);
}

.docs-note::before {
  content: "Note";
  color: #6b7280;
}

html[lang="zh-Hans"] .docs-tip::before {
  content: "提示";
}

html[lang="zh-Hans"] .docs-note::before {
  content: "说明";
}

.docs-note::after {
  background: linear-gradient(180deg, #9ca3af 0%, #d1d5db 100%);
}

.docs-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 20px;
}

.docs-pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--docs-border);
  color: var(--docs-muted);
  background: #fafbfc;
}

.docs-pill-live {
  border-color: #c8e6c9;
  background: #f1f8f4;
  color: #2e7d32;
}

.docs-pill-soon {
  border-color: #dbeafe;
  background: #f0f6ff;
  color: var(--docs-accent);
}

.docs-steps {
  counter-reset: docstep;
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}

.docs-steps li {
  counter-increment: docstep;
  position: relative;
  padding: 0 0 20px 44px;
  margin: 0;
  border-left: 2px solid var(--docs-border);
  margin-left: 14px;
}

.docs-steps li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.docs-steps li::before {
  content: counter(docstep);
  position: absolute;
  left: -15px;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--docs-accent-soft);
  color: var(--docs-accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  padding-top: 24px;
  padding-bottom: 8px;
  border-top: 1px solid var(--docs-border);
}

.docs-pager a {
  flex: 1;
  max-width: 48%;
  padding: 16px 18px;
  border: 1px solid var(--docs-border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--docs-text);
  transition: border-color 0.15s;
}

.docs-pager a:hover {
  border-color: var(--docs-accent);
}

.docs-pager .label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--docs-faint);
  margin-bottom: 4px;
}

.docs-pager .title {
  font-size: 15px;
  font-weight: 500;
}

.docs-pager .next {
  text-align: right;
  margin-left: auto;
}

.docs-footer {
  margin-top: 0;
  padding-top: 16px;
  padding-bottom: 48px;
  font-size: 14px;
  color: var(--docs-faint);
  font-family: "IBM Plex Mono", monospace;
}

.docs-footer a {
  color: var(--docs-muted);
}

/* Search modal */
.docs-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 11, 13, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}

.docs-search-overlay.is-open {
  display: flex;
}

.docs-search-panel {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--docs-border);
  box-shadow: 0 24px 64px rgba(10, 11, 13, 0.18);
  overflow: hidden;
}

.docs-search-input {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid var(--docs-border);
  padding: 16px 18px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
}

.docs-search-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}

.docs-search-results a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--docs-text);
  text-decoration: none;
}

.docs-search-results a:hover,
.docs-search-results a:focus {
  background: var(--docs-accent-soft);
  outline: none;
}

.docs-search-results .meta {
  font-size: 12px;
  color: var(--docs-faint);
  font-family: "IBM Plex Mono", monospace;
}

.docs-search-empty {
  padding: 24px;
  text-align: center;
  color: var(--docs-muted);
  font-size: 14px;
}

@media (max-width: 900px) {
  :root {
    --docs-content-pad: 16px;
  }

  .docs-sidebar {
    transform: translateX(-100%);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    visibility: hidden;
  }

  .docs-sidebar.is-open {
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
    z-index: 45;
  }

  .docs-topbar {
    z-index: 50;
  }

  .docs-shell {
    margin-left: 0;
  }

  .docs-topbar {
    flex-wrap: wrap;
    align-items: center;
    height: auto;
    min-height: var(--docs-top);
    padding: 8px var(--docs-content-pad);
    gap: 8px;
  }

  .docs-back-home {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .docs-topbar-actions {
    margin-left: auto;
    flex-shrink: 0;
  }

  .docs-menu-btn {
    display: inline-block;
    flex-shrink: 0;
  }

  .docs-search-kbd {
    display: none;
  }

  .docs-article {
    margin: 0 8px;
    padding: 24px 20px 28px;
    border-radius: 14px;
  }

  .docs-body .docs-topbar .lang-switch {
    flex-shrink: 0;
  }

  .docs-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgba(10, 11, 13, 0.35);
    border: 0;
    padding: 0;
    cursor: pointer;
  }

  body.docs-nav-open .docs-nav-backdrop {
    display: block;
  }

  .docs-sidebar:not(.is-open) {
    display: none;
  }

  .docs-sidebar.is-open {
    display: block;
  }
}

/* Lang toggle lives in topbar on docs — never overlap Search */
.docs-body #site-lang-switch.lang-switch {
  position: static !important;
  top: auto !important;
  right: auto !important;
  z-index: 1 !important;
  flex-shrink: 0;
  box-shadow: none;
  display: inline-flex !important;
  align-items: center;
  padding: 1px;
  border-radius: 999px;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #c8cdd6;
}

.docs-body #site-lang-switch button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 999px;
  color: #5b616e;
  font: inherit;
  font-size: 10px;
}

.docs-body #site-lang-switch button.is-active {
  color: #0a0b0d;
  background: #e8e9ff;
}

.docs-body #site-lang-switch button:hover {
  color: #1b1bff;
}
