/* ===== THEME VARIABLES ===== */
:root {
  --bg-page: #ffffff;
  --bg-sidebar: #f8f9fa;
  --bg-header: #ffffff;
  --bg-code: #f8f9fa;
  --bg-code-header: #f1f3f5;
  --bg-table-head: #f9fafb;
  --bg-search: #f9fafb;
  --bg-inline-code: #f3f4f6;
  --bg-active-nav: #eff6ff;
  --bg-nav-hover: #edf1f4;
  --bg-badge-2xx: #d1fae5;
  --bg-badge-4xx: #fee2e2;
  --bg-badge-5xx: #f3f4f6;
  --bg-event-badge: #f3f4f6;
  --bg-callout-info: #eff6ff;
  --bg-base-url: #eff6ff;

  --color-text: #374151;
  --color-heading: #111827;
  --color-muted: #6b7280;
  --color-subtle: #9ca3af;
  --color-active: #2563eb;
  --color-inline-code: #dc2626;
  --color-code-text: #1e293b;
  --color-nav-link: #4b5563;
  --color-nav-hover: #1f2937;
  --color-badge-2xx: #065f46;
  --color-badge-4xx: #991b1b;
  --color-badge-5xx: #374151;
  --color-event-badge: #374151;
  --color-post-badge-bg: #d1fae5;
  --color-post-badge-text: #065f46;
  --color-base-url-text: #1e40af;
  --color-search-text: #9ca3af;
  --color-brand-name: #111827;

  --border-color: #e5e7eb;
  --border-color-subtle: #f3f4f6;
  --border-sidebar: #e5e7eb;
  --border-nav-active: #2563eb;
  --border-code: #e5e7eb;
  --border-inline: #e5e7eb;
  --border-base-url: #bfdbfe;
  --border-callout-info: #bfdbfe;

  --shadow-toggle: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  --bg-page: #0f1117;
  --bg-sidebar: #161b22;
  --bg-header: #0f1117;
  --bg-code: #1e2430;
  --bg-code-header: #1a2030;
  --bg-table-head: #161b22;
  --bg-search: #21262d;
  --bg-inline-code: #21262d;
  --bg-active-nav: #1c2a47;
  --bg-nav-hover: #1e242d;
  --bg-badge-2xx: #0d3321;
  --bg-badge-4xx: #3b1111;
  --bg-badge-5xx: #21262d;
  --bg-event-badge: #21262d;
  --bg-callout-info: #1a2a42;
  --bg-base-url: #1a2a42;

  --color-text: #c9d1d9;
  --color-heading: #f0f6fc;
  --color-muted: #8b949e;
  --color-subtle: #6e7681;
  --color-active: #58a6ff;
  --color-inline-code: #ff7b72;
  --color-code-text: #cdd9e5;
  --color-nav-link: #8b949e;
  --color-nav-hover: #c9d1d9;
  --color-badge-2xx: #3fb950;
  --color-badge-4xx: #f85149;
  --color-badge-5xx: #8b949e;
  --color-event-badge: #8b949e;
  --color-post-badge-bg: #0d3321;
  --color-post-badge-text: #3fb950;
  --color-base-url-text: #79c0ff;
  --color-search-text: #6e7681;
  --color-brand-name: #f0f6fc;

  --border-color: #30363d;
  --border-color-subtle: #21262d;
  --border-sidebar: #30363d;
  --border-nav-active: #58a6ff;
  --border-code: #30363d;
  --border-inline: #30363d;
  --border-base-url: #1f4068;
  --border-callout-info: #1f4068;

  --shadow-toggle: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.2s, color 0.2s;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===== TOP HEADER ===== */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  align-items: center;
  transition: background 0.2s, border-color 0.2s;
}

.header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 24px;
  gap: 16px;
  justify-content: space-between;
}


.header-brand {
  width: 260px;
  flex-shrink: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-logo-img {
  height: 68px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-brand-name);
  white-space: nowrap;
  transition: color 0.2s;
}

/* ===== SEARCH BAR ===== */
.header-search {
  flex: 1;
  display: flex;
  justify-content: center;
}
@media (max-width: 768px) {
  .header-search {
    display: none;
  }
}
.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 420px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-subtle);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  background: var(--bg-search);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 80px 8px 38px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s, background 0.2s, box-shadow 0.15s;
  cursor: text;
}

.search-input::placeholder {
  color: var(--color-subtle);
}

.search-input:focus {
  border-color: var(--color-active);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: var(--bg-page);
}

.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--border-color);
  color: var(--color-muted);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11px;
  font-family: inherit;
  pointer-events: none;
  border: 1px solid var(--border-color);
}

/* Search Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow-toggle);
  display: none;
  z-index: 200;
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

.search-dropdown.active {
  display: block;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color-subtle);
  transition: background 0.12s;
  text-decoration: none;
  color: var(--color-text);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--bg-nav-hover);
}

.search-result-icon {
  color: var(--color-subtle);
  margin-top: 1px;
  flex-shrink: 0;
}

.search-result-text strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-heading);
  margin-bottom: 2px;
}

.search-result-text span {
  font-size: 12px;
  color: var(--color-muted);
}

.search-no-results {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--color-muted);
}

/* ===== THEME TOGGLE ===== */
.header-actions {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-search);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.theme-toggle:hover {
  border-color: var(--color-active);
  color: var(--color-active);
}

.theme-toggle svg {
  flex-shrink: 0;
}

/* sun icon showed in dark mode, moon in light mode */
.icon-moon {
  display: block;
}

.icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

/* ===== LAYOUT ===== */
.layout {
  display: flex;
  margin-top: 60px;
  min-height: calc(100vh - 60px);
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: background 0.2s, border-color 0.2s;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.sidebar-nav {
  padding: 20px 0;
  flex: 1;
}

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

.nav-link {
  display: block;
  padding: 8px 20px;
  font-size: 14px;
  color: var(--color-nav-link);
  transition: background 0.15s, color 0.15s;
  border-left: 2px solid transparent;
  font-weight: 450;
}

.nav-link:hover {
  background: var(--bg-nav-hover);
  color: var(--color-nav-hover);
  border-left-color: var(--border-color);
}

.nav-link.active {
  color: var(--color-active);
  font-weight: 600;
  background: var(--bg-active-nav);
  border-left: 2px solid var(--border-nav-active);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: 280px;
  flex: 1;
  min-width: 0;
}

.content-wrapper {
  display: flex;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 40px 80px;
  gap: 48px;
}

.page-content {
  flex: 1;
  min-width: 0;
  max-width: 760px;
}

/* ===== PAGE TYPOGRAPHY ===== */
.page-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-heading);
  margin-bottom: 20px;
  line-height: 1.2;
  transition: color 0.2s;
}

.page-lead {
  font-size: 16px;
  color: var(--color-text);
  margin-bottom: 16px;
}

.page-content p {
  color: var(--color-text);
  margin-bottom: 12px;
  font-size: 15px;
}

.page-content h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-heading);
  margin: 40px 0 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color-subtle);
  transition: color 0.2s;
}

.page-content h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-heading);
  margin: 28px 0 12px;
  transition: color 0.2s;
}

.page-content h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-heading);
  margin: 20px 0 10px;
  transition: color 0.2s;
}

.feature-list,
.auth-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.feature-list li,
.auth-list li {
  padding: 4px 0 4px 20px;
  position: relative;
  font-size: 15px;
  color: var(--color-text);
}

.feature-list li::before,
.auth-list li::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-subtle);
}

/* ===== INLINE CODE ===== */
.inline-code,
code:not(pre code) {
  background: var(--bg-inline-code);
  border: 1px solid var(--border-inline);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: var(--color-inline-code);
  transition: background 0.2s, color 0.2s;
}

/* ===== CODE BLOCKS ===== */
.code-block {
  position: relative;
  margin: 16px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-code);
  background: var(--bg-code);
  transition: background 0.2s, border-color 0.2s;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-code-header);
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-code);
  transition: background 0.2s;
}

.code-lang {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-muted);
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.copy-btn:hover {
  background: var(--border-color);
  color: var(--color-heading);
}

.copy-btn.copied {
  color: #16a34a;
}

.code-block pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-code-text);
  transition: color 0.2s;
}

.code-block pre::-webkit-scrollbar {
  height: 4px;
}

.code-block pre::-webkit-scrollbar-track {
  background: transparent;
}

.code-block pre::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

/* Method badge */
.endpoint-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.method-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 12px;
  font-family: 'Fira Code', monospace;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.method-post {
  background: var(--color-post-badge-bg);
  color: var(--color-post-badge-text);
}

.endpoint-url {
  color: var(--color-code-text);
  font-size: 13px;
  font-family: 'Fira Code', monospace;
  word-break: break-all;
}

/* ===== BASE URL BLOCK ===== */
.base-url-block {
  background: var(--bg-base-url);
  border: 1px solid var(--border-base-url);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 16px 0;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  color: var(--color-base-url-text);
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

/* ===== TABLES ===== */
.docs-table,
.response-table,
.events-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: border-color 0.2s;
}

.docs-table thead tr,
.response-table thead tr,
.events-table thead tr {
  background: var(--bg-table-head);
  transition: background 0.2s;
}

.docs-table th,
.response-table th,
.events-table th {
  text-align: left;
  padding: 10px 16px;
  font-weight: 600;
  color: var(--color-text);
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
}

.docs-table td,
.response-table td,
.events-table td {
  padding: 10px 16px;
  color: var(--color-text);
  border-bottom: 1px solid var(--border-color-subtle);
  vertical-align: top;
  transition: color 0.2s;
}

.docs-table tr:last-child td,
.response-table tr:last-child td,
.events-table tr:last-child td {
  border-bottom: none;
}

.docs-table code {
  background: var(--bg-inline-code);
  border: 1px solid var(--border-inline);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  color: var(--color-inline-code);
}

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Fira Code', monospace;
}

.status-2xx {
  background: var(--bg-badge-2xx);
  color: var(--color-badge-2xx);
}

.status-4xx {
  background: var(--bg-badge-4xx);
  color: var(--color-badge-4xx);
}

.status-5xx {
  background: var(--bg-badge-5xx);
  color: var(--color-badge-5xx);
}

/* ===== EVENT BADGES ===== */
.event-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Fira Code', monospace;
  background: var(--bg-event-badge);
  color: var(--color-event-badge);
  border: 1px solid var(--border-color);
  transition: background 0.2s, color 0.2s;
}

/* ===== STEPS LIST ===== */
.steps-list {
  list-style: none;
  counter-reset: step-counter;
  margin: 12px 0;
  padding: 0;
}

.steps-list li {
  counter-increment: step-counter;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
  font-size: 14px;
  color: var(--color-text);
}

.steps-list li::before {
  content: counter(step-counter);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--color-active);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ===== PAGE NAVIGATION ===== */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
  gap: 16px;
}

.page-nav-prev,
.page-nav-next {
  flex: 1;
}


.page-nav-next {
  display: flex;
  justify-content: flex-end;
}

.page-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  max-width: 460px;
    min-width: 120px;
  width: 100%;
}

.page-nav-link:hover {
  border-color: var(--color-active);
  background: var(--bg-active-nav);
}

.page-nav-label-prev {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-subtle);
  text-align: right;

}

.page-nav-label-next {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-subtle);
  text-align: left;
}

.page-nav-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-active);
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: space-between;
}

/* ===== TOC (right sidebar) ===== */
.toc-sidebar {
  width: 200px;
  min-width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  height: fit-content;
}

.toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-subtle);
  margin-bottom: 12px;
}

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

.toc-list li {
  margin-bottom: 4px;
}

.toc-list a {
  font-size: 13px;
  color: var(--color-muted);
  text-decoration: none;
  display: block;
  padding: 3px 0 3px 8px;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.toc-list a:hover,
.toc-list a.active {
  color: var(--color-active);
  border-left-color: var(--color-active);
}

.toc-list a.toc-h3 {
  padding-left: 20px;
  font-size: 12px;
}

/* ===== SECTION DIVIDER ===== */
.section-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 32px 0;
}

/* ===== DESC TEXT ===== */
.desc-text {
  font-size: 15px;
  color: var(--color-text);
  margin-bottom: 20px;
  line-height: 1.65;
}

/* ===== CALLOUT ===== */
.callout {
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: background 0.2s;
}

.callout-info {
  background: var(--bg-callout-info);
  border: 1px solid var(--border-callout-info);
  color: var(--color-base-url-text);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .toc-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .content-wrapper {
    padding: 24px 20px 60px;
  }

  .page-title {
    font-size: 26px;
  }

  .header-brand {
    width: auto;
  }

  .header-actions {
    width: auto;
  }

  .brand-name {
    display: none;
  }
}