/* Going API Documentation - Dark Theme (VS Code style) */

:root {
  --bg:          #1e1e1e;
  --sidebar-bg:  #252526;
  --panel-bg:    #2d2d2d;
  --card-bg:     #1e1e1e;
  --border:      #3e3e42;
  --text:        #d4d4d4;
  --text-muted:  #808080;
  --keyword:     #569cd6;
  --type:        #4ec9b0;
  --method:      #dcdcaa;
  --property:    #9cdcfe;
  --string:      #ce9178;
  --comment:     #6a9955;
  --accent:      #0078d4;
  --accent-hover:#005a9e;
  --highlight:   #264f78;
  --danger:      #f14c4c;
  --warning:     #cca700;
  --success:     #4ec9b0;
  --sidebar-w:   260px;
  --header-h:    52px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

/* ─── Header ─────────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  z-index: 100;
}

.site-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.site-header .logo span.pkg {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.search-wrapper {
  flex: 1;
  max-width: 440px;
  position: relative;
}

.search-wrapper input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 6px 12px 6px 34px;
  font-size: 13px;
  outline: none;
  transition: border-color .2s;
}

.search-wrapper input:focus {
  border-color: var(--accent);
}

.search-wrapper::before {
  content: '🔍';
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: .5;
}

.header-nav {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.header-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 4px;
  transition: background .15s, color .15s;
}

.header-nav a:hover, .header-nav a.active {
  background: var(--highlight);
  color: var(--text);
}

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

/* ─── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.sidebar-section {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child { border-bottom: none; }

.sidebar-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: color .15s;
}

.sidebar-group-header:hover { color: var(--text); }

.sidebar-group-header .toggle-icon {
  margin-left: auto;
  font-size: 10px;
  transition: transform .2s;
}

.sidebar-group-header.collapsed .toggle-icon { transform: rotate(-90deg); }

.sidebar-group-body { overflow: hidden; }

.sidebar-ns {
  padding: 2px 0;
}

.sidebar-ns-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px 5px 22px;
  font-size: 12px;
  font-weight: 600;
  color: var(--keyword);
  cursor: pointer;
  user-select: none;
}

.sidebar-ns-header:hover { background: rgba(255,255,255,.04); }

.sidebar-ns-header .ns-icon { font-size: 10px; transition: transform .2s; }
.sidebar-ns-header.collapsed .ns-icon { transform: rotate(-90deg); }

.sidebar-ns-items { padding-left: 8px; overflow: hidden; }

.sidebar-item {
  display: block;
  padding: 4px 14px 4px 32px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
}

.sidebar-item:hover {
  color: var(--text);
  background: rgba(255,255,255,.04);
}

.sidebar-item.active {
  color: var(--property);
  border-left-color: var(--accent);
  background: rgba(0,120,212,.12);
}

.sidebar-item.type-class::before { content: 'C '; color: var(--keyword); font-size: 10px; font-weight: 700; }
.sidebar-item.type-interface::before { content: 'I '; color: var(--success); font-size: 10px; font-weight: 700; }
.sidebar-item.type-enum::before { content: 'E '; color: var(--warning); font-size: 10px; font-weight: 700; }
.sidebar-item.type-static::before { content: 'S '; color: var(--string); font-size: 10px; font-weight: 700; }

/* ─── Main Content ───────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px 40px 80px;
  max-width: calc(100vw - var(--sidebar-w));
  min-width: 0;
}

/* ─── Breadcrumb ─────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { opacity: .5; }

/* ─── Page Title ─────────────────────────────────────────────────── */
.page-title {
  font-size: 26px;
  font-weight: 300;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.page-subtitle code {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px;
  color: var(--string);
}

/* ─── Namespace Section ──────────────────────────────────────────── */
.ns-section {
  margin-bottom: 48px;
}

.ns-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

/* ─── Class Card ─────────────────────────────────────────────────── */
.class-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 24px;
  overflow: hidden;
}

.class-card-header {
  padding: 16px 20px;
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.class-card-header:hover { background: rgba(255,255,255,.05); }

.class-signature {
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.7;
}

.kw { color: var(--keyword); }
.tp { color: var(--type); }
.nm { color: #e8e8e8; font-weight: 600; }
.base { color: var(--text-muted); }

.class-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.class-card-body {
  padding: 0;
  overflow: hidden;
}

/* ─── Member Section ─────────────────────────────────────────────── */
.member-section {
  border-top: 1px solid var(--border);
}

.member-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 10px 20px 8px;
  background: rgba(0,0,0,.15);
  border-bottom: 1px solid var(--border);
}

/* ─── API Tables ─────────────────────────────────────────────────── */
.api-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 12.5px;
}

.api-table tr {
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .1s;
}

.api-table tr:last-child { border-bottom: none; }

.api-table tr:hover { background: rgba(255,255,255,.03); }

.api-table td {
  padding: 7px 20px;
  vertical-align: top;
}

.api-table .col-type { width: 220px; color: var(--type); }
.api-table .col-name { width: 220px; color: var(--property); }
.api-table .col-method-name { width: 260px; color: var(--method); }
.api-table .col-desc { color: var(--text-muted); font-family: 'Segoe UI', sans-serif; font-size: 12px; }
.api-table .col-default { color: var(--string); width: 120px; }

.api-table .accessor {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255,255,255,.06);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 4px;
}

.api-table .params { color: var(--text); }
.api-table .ret { color: var(--type); }
.api-table .static-badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--string);
  background: rgba(206,145,120,.12);
  border: 1px solid rgba(206,145,120,.25);
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 4px;
  vertical-align: middle;
}

.api-table .event-args { color: var(--type); }

/* ─── Enum Cards ─────────────────────────────────────────────────── */
.enum-values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 20px;
}

.enum-value {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 10px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px;
  color: var(--warning);
}

.enum-value .val-eq {
  color: var(--text-muted);
}

/* ─── Landing Page Cards ─────────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
  margin: 32px 0;
}

.project-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  text-decoration: none;
  color: inherit;
  transition: border-color .2s, box-shadow .2s;
  display: block;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.project-card h2 {
  font-size: 20px;
  font-weight: 400;
  color: #fff;
  margin-bottom: 6px;
}

.project-card .pkg-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}

.project-card p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 16px;
}

.project-card .stats {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.project-card .stats span strong {
  color: var(--text);
}

.ns-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.ns-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s;
}

.ns-card:hover { border-color: var(--accent); }

.ns-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--keyword);
  margin-bottom: 4px;
  font-family: 'Cascadia Code', 'Consolas', monospace;
}

.ns-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.ns-card .class-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ─── No-results ─────────────────────────────────────────────────── */
.no-results {
  display: none;
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 20px; }
}

/* ─── Highlight search match ─────────────────────────────────────── */
mark.search-highlight {
  background: rgba(255, 200, 0, 0.25);
  color: inherit;
  border-radius: 2px;
}

/* ─── "hidden by search" state ───────────────────────────────────── */
.search-hidden { display: none !important; }

/* ─── Back to top ────────────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
}

.back-to-top.visible { opacity: 1; }
.back-to-top:hover { background: var(--accent-hover); }
