/* SimpleERP API Documentation — professional theme */

:root {
  --sidebar-bg: #0c1222;
  --sidebar-border: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f1f5f9;
  --sidebar-accent: #2dd4bf;
  --code-bg: #0d1117;
  --code-header: #161b22;
  --content-bg: #f8fafc;
  --card-border: #e2e8f0;
  --accent: #0d9488;
  --accent-light: #ccfbf1;
}

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body.docs-body {
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  background: var(--content-bg);
}

/* Sidebar */
.docs-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
}

.docs-sidebar .nav-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  padding: 1rem 1rem 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  margin: 0 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  color: var(--sidebar-text);
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}

.sidebar-link:hover {
  color: var(--sidebar-text-active);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-link.active {
  color: var(--sidebar-accent);
  background: rgba(45, 212, 191, 0.08);
  border-left-color: var(--sidebar-accent);
}

.sidebar-link.is-search-hidden {
  display: none;
}

.sidebar-sublink.is-search-hidden {
  display: none;
}

.sidebar-domain-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.25rem;
  font-size: 0.625rem;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.sidebar-link.active .sidebar-domain-icon {
  color: var(--sidebar-accent);
  background: rgba(45, 212, 191, 0.15);
}

/* Sidebar accordion — collapsible domains */
.sidebar-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-domain {
  margin: 0 0.5rem;
}

.sidebar-domain-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  color: var(--sidebar-text);
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.sidebar-domain-toggle:hover {
  color: var(--sidebar-text-active);
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-domain-toggle.active {
  color: var(--sidebar-accent);
  background: rgba(45, 212, 191, 0.08);
  border-left-color: var(--sidebar-accent);
}

.sidebar-chevron {
  width: 0.875rem;
  height: 0.875rem;
  color: #64748b;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sidebar-domain.is-open .sidebar-chevron {
  transform: rotate(90deg);
}

.sidebar-domain-panel {
  padding: 0.125rem 0 0.375rem 0.5rem;
  margin-left: 0.75rem;
  border-left: 1px solid rgba(148, 163, 184, 0.15);
}

.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  margin: 0.125rem 0;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  color: #64748b;
  transition: all 0.15s ease;
}

.sidebar-sublink:hover {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-sublink.active {
  color: var(--sidebar-accent);
  background: rgba(45, 212, 191, 0.06);
}

.nav-no-results {
  margin: 0.5rem 1rem;
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
}

.nav-no-results.hidden { display: none; }

.sidebar-domain.is-hidden,
.sidebar-domain.is-search-hidden { display: none; }

/* Endpoint groups on section pages */
.endpoint-group.doc-anchor {
  scroll-margin-top: 5.5rem;
}

.group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--card-border);
}

.group-header h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.group-count {
  font-size: 0.6875rem;
  font-weight: 500;
  color: #94a3b8;
  white-space: nowrap;
}

/* Method badges */
.method-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-family: 'JetBrains Mono', monospace;
  min-width: 3.5rem;
  text-align: center;
}

.method-get { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.25); }
.method-post { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.25); }
.method-patch { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.25); }
.method-delete { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.25); }

/* Endpoint cards — split layout */
.endpoint-card {
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease;
}

.endpoint-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.endpoint-path-bar {
  background: linear-gradient(to right, #f8fafc, #fff);
  border-bottom: 1px solid var(--card-border);
  padding: 0.875rem 1.25rem;
}

/* Code panel */
.code-panel {
  background: var(--code-bg);
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid #21262d;
}

.code-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--code-header);
  border-bottom: 1px solid #21262d;
  padding: 0.5rem 0.75rem;
}

.code-tab {
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 0.25rem;
  color: #8b949e;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  background: transparent;
}

.code-tab:hover { color: #c9d1d9; }

.code-tab.active {
  color: #f0f6fc;
  background: rgba(255, 255, 255, 0.08);
}

.code-panel pre {
  margin: 0;
  padding: 1rem 1.25rem;
  font-size: 0.75rem;
  line-height: 1.6;
  overflow-x: auto;
  color: #c9d1d9;
  font-family: 'JetBrains Mono', monospace;
  tab-size: 2;
  max-height: 22rem;
}

.code-panel pre .json-key { color: #79c0ff; }
.code-panel pre .json-string { color: #a5d6ff; }
.code-panel pre .json-number { color: #ffa657; }
.code-panel pre .json-bool { color: #ff7b72; }
.code-panel pre .json-null { color: #8b949e; }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: #8b949e;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid #30363d;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  color: #c9d1d9;
  border-color: #484f58;
  background: rgba(255, 255, 255, 0.04);
}

.copy-btn.copied {
  color: #3fb950;
  border-color: rgba(63, 185, 80, 0.4);
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid;
}

.tag-auth { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.tag-perm { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.tag-company { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.tag-public { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.tag-methods { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; font-family: 'JetBrains Mono', monospace; font-size: 0.625rem; }

/* Hero */
.docs-hero {
  background: linear-gradient(135deg, #0c1222 0%, #134e4a 50%, #0f766e 100%);
  position: relative;
  overflow: hidden;
}

.docs-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(45, 212, 191, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 40%);
  pointer-events: none;
}

/* Section divider */
.section-header {
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--card-border);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

/* Status pills */
.status-pill {
  font-size: 0.6875rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
}

.status-pill.is-success { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }
.status-pill.is-error { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }

/* Search */
.docs-search:focus {
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.25);
}

/* Table */
.docs-table th {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.docs-table td { font-size: 0.8125rem; }

/* Auth flow steps */
.flow-step {
  position: relative;
  padding-left: 2.5rem;
  padding-bottom: 1.5rem;
}

.flow-step::before {
  content: attr(data-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.75rem;
  text-align: center;
}

.flow-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 0.875rem;
  top: 2rem;
  bottom: 0;
  width: 1px;
  background: #e2e8f0;
}

/* Scrollbar */
.docs-sidebar::-webkit-scrollbar,
#main-content::-webkit-scrollbar,
.code-panel pre::-webkit-scrollbar { width: 6px; height: 6px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
#main-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* Login */
.login-grid-bg {
  background-color: #0c1222;
  background-image:
    linear-gradient(rgba(45, 212, 191, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 212, 191, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

.no-results { display: none; }
.no-results.hidden { display: none !important; }
.no-results:not(.hidden) { display: block; }

/* Domain cards (overview) */
.domain-card {
  display: block;
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--card-border);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.domain-card:hover {
  border-color: #99f6e4;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.08);
}

.domain-card-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}

/* Section prev/next pager */
.section-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--card-border);
}

.section-pager-spacer { min-height: 1px; }

.section-pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--card-border);
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.section-pager-link:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.section-pager-next { text-align: right; }

.section-pager-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.section-pager-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f172a;
}

.section-pager-prev .section-pager-label::before { content: '← '; }
.section-pager-next .section-pager-label::after { content: ' →'; }

@media (max-width: 640px) {
  .section-pager { grid-template-columns: 1fr; }
  .section-pager-next { text-align: left; }
}

@media (max-width: 1023px) {
  .endpoint-split { flex-direction: column; }
}
