
:root {
  --primary:        #3399cc;
  --primary-dark:   #0d657f;
  --primary-darker: #002d39;
  --primary-light:  #e8f4fb;
  --sidebar-w:      280px;
  --topbar-h:       60px;
  --text:           #1a2332;
  --text-muted:     #6b7280;
  --border:         #e5e7eb;
  --bg:             #f8fafc;
  --code-bg:        #1a2332;
  --get:    #3399cc;
  --post:   #27ae60;
  --put:    #e67e22;
  --delete: #e74c3c;
  --patch:  #9b59b6;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* ── Top bar ── */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--primary-dark);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 200;
  box-shadow: 0 1px 0 rgba(0,0,0,0.18);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: white;
  flex-shrink: 0;
}
.logo svg { width: 34px; height: 34px; }
.logo-text { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.logo-badge {
  background: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.9);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.top-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.top-nav a { color: rgba(255,255,255,0.72); text-decoration: none; font-size: 14px; transition: color 0.15s; }
.top-nav a:hover { color: white; }
.top-nav .support-btn {
  background: rgba(255,255,255,0.14);
  padding: 6px 14px;
  border-radius: 6px;
  color: white !important;
}
.top-nav .support-btn:hover { background: rgba(255,255,255,0.24) !important; }

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--topbar-h);
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: white;
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.search-wrap {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: white;
  position: sticky;
  top: 0;
  z-index: 10;
}
.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.nav-sections { padding: 8px 0 24px; }

.nav-item {
  display: block;
  padding: 8px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  border-left: 2px solid transparent;
  transition: color 0.1s, background 0.1s;
}
.nav-item:hover { color: var(--text); background: var(--bg); }
.nav-item.active {
  color: var(--primary-dark);
  background: var(--primary-light);
  border-left-color: var(--primary);
  font-weight: 500;
}

.nav-group { border-top: 1px solid var(--border); }

.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: inherit;
  transition: color 0.1s;
}
.nav-group-toggle:hover { color: var(--text); }
.nav-group-toggle .chevron { font-size: 10px; transition: transform 0.2s; }
.nav-group.collapsed .chevron { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-items { display: none; }
.nav-group-items { display: flex; flex-direction: column; }

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 22px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
  transition: color 0.1s, background 0.1s;
  overflow: hidden;
}
.nav-sub-item:hover { color: var(--text); background: var(--bg); }
.nav-sub-item.active {
  color: var(--primary-dark);
  background: var(--primary-light);
  border-left-color: var(--primary);
}
.nav-sub-item span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-sub-item.hidden,
.nav-group.search-hidden { display: none; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  padding: 2px 0;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: white;
  flex-shrink: 0;
}
.badge.get    { background: var(--get); }
.badge.post   { background: var(--post); }
.badge.put    { background: var(--put); }
.badge.delete { background: var(--delete); }
.badge.patch  { background: var(--patch); }

/* ── Content ── */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 52px 56px 96px;
  max-width: 1000px;
}

/* ── Section ── */
.section { margin-bottom: 72px; }

.section-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-darker);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
}

.intro-version {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: -12px;
  margin-bottom: 20px;
}
.intro-desc { margin-bottom: 24px; line-height: 1.75; }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.info-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.info-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.info-card code { font-size: 13px; color: var(--primary-dark); }

.auth-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin: 18px 0 28px;
}
.auth-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}
.auth-card-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary-dark);
  margin-bottom: 8px;
}
.auth-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 12px; }

/* ── Tag section ── */
.tag-section { margin-bottom: 72px; }
.tag-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: capitalize;
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.tag-description { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }

/* ── Endpoint cards ── */
.endpoint {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.endpoint:hover { box-shadow: 0 2px 14px rgba(0,0,0,0.06); }

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  cursor: pointer;
  user-select: none;
}
.endpoint-header:hover { background: var(--bg); }

.endpoint-path {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 14px;
  font-weight: 500;
}
.endpoint-summary { color: var(--text-muted); font-size: 13px; margin-left: 2px; }
.endpoint-chevron {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.endpoint.open .endpoint-chevron { transform: rotate(180deg); }

.endpoint-body {
  display: none;
  padding: 0 18px 20px;
  border-top: 1px solid var(--border);
}
.endpoint.open .endpoint-body { display: block; }
.endpoint-desc { color: var(--text); font-size: 14px; line-height: 1.75; padding: 14px 0 6px; }

.deprecated-banner {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #8a6900;
  margin-top: 14px;
}

/* ── Tables ── */
.params-section { margin-top: 20px; }
.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.params-table th {
  text-align: left;
  padding: 8px 14px;
  background: var(--bg);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.params-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
  line-height: 1.5;
}
.params-table tr:last-child td { border-bottom: none; }

.param-name {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-weight: 600;
  font-size: 13px;
  color: var(--primary-dark);
}
.param-nested { font-weight: 400; color: var(--text-muted); }
.required {
  display: inline-block;
  color: var(--delete);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-left: 5px;
  vertical-align: middle;
}
.param-type {
  background: #f0f4f8;
  color: var(--primary-darker);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}
.param-in {
  background: #f0f4f8;
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.response-code {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-family: monospace;
  font-size: 13px;
}
.status-2xx { background: #e6f4ea; color: #1a7f37; }
.status-3xx { background: #e8f0fe; color: #1a56db; }
.status-4xx { background: #fff0f0; color: #c0392b; }
.status-5xx { background: #fff8e6; color: #b7791f; }

/* ── Code blocks ── */
pre {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 10px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
pre::-webkit-scrollbar { height: 4px; }
pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
pre code {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  color: #e2e8f0;
  white-space: pre;
}

p code, td code, li code {
  background: #f0f4f8;
  color: var(--primary-dark);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 13px;
}

.section h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 12px;
}
.section p { margin-bottom: 12px; }

/* ── Markdown-rendered content ── */
.md-content p { margin-bottom: 10px; }
.md-content p:last-child { margin-bottom: 0; }
.md-content h1, .md-content h2, .md-content h3, .md-content h4 {
  font-weight: 700; margin: 20px 0 8px; color: var(--text);
}
.md-content h1 { font-size: 22px; }
.md-content h2 { font-size: 18px; }
.md-content h3 { font-size: 15px; }
.md-content h4 { font-size: 14px; }
.md-content ul, .md-content ol { padding-left: 20px; margin-bottom: 10px; }
.md-content li { margin-bottom: 4px; }
.md-content a { color: var(--primary); text-decoration: none; }
.md-content a:hover { text-decoration: underline; }
.md-content code {
  background: #f0f4f8; color: var(--primary-dark);
  padding: 1px 5px; border-radius: 3px;
  font-family: 'JetBrains Mono', Consolas, monospace; font-size: 13px;
}
.md-content pre {
  background: var(--code-bg); border-radius: 8px;
  padding: 14px 18px; margin: 10px 0; overflow-x: auto;
}
.md-content pre code { background: none; color: #e2e8f0; padding: 0; }
.md-content blockquote {
  border-left: 3px solid var(--border); padding-left: 14px;
  color: var(--text-muted); margin: 12px 0;
}
.md-content strong { font-weight: 600; }
.md-content table { border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.md-content th, .md-content td { border: 1px solid var(--border); padding: 6px 10px; }
.md-content th { background: var(--bg); font-weight: 600; }

/* ── Version sections (main content) ── */
.version-section { margin-bottom: 96px; }
.version-title {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary-darker);
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
}
.version-latest-badge {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
}
.version-latest-badge.small {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 8px;
}

/* ── Fallback badge on endpoints ── */
.fallback-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: #f0f4f8;
  color: var(--text-muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
  font-family: 'JetBrains Mono', Consolas, monospace;
}
.fallback-badge.small { padding: 1px 5px; font-size: 9px; }

/* ── Version groups in sidebar ── */
.nav-version-group { border-top: 2px solid var(--border); }
.nav-version-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 20px;
  background: var(--primary-light);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  font-family: inherit;
  transition: background 0.1s;
}
.nav-version-toggle:hover { background: #d4eaf5; }
.nav-version-toggle .chevron { font-size: 10px; transition: transform 0.2s; }
.nav-version-group.collapsed .chevron { transform: rotate(-90deg); }
.nav-version-group.collapsed .nav-version-items { display: none; }
.nav-version-items { display: flex; flex-direction: column; }
.nav-version-group.search-hidden { display: none; }

/* ── Resource links inside version groups ── */
.nav-resource-item {
  display: block;
  padding: 7px 20px 7px 28px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  border-left: 2px solid transparent;
  transition: color 0.1s, background 0.1s;
}
.nav-resource-item:hover { color: var(--text); background: var(--bg); }
.nav-resource-item.active {
  color: var(--primary-dark);
  background: var(--primary-light);
  border-left-color: var(--primary);
  font-weight: 500;
}
.nav-resource-item.hidden { display: none; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding: 24px 20px 48px; }
  .top-nav a:not(.support-btn) { display: none; }
}
