/* Bantu Platform Docs — custom theme: light/dark mode, collapsible
   sidebar groups, active-link highlighting, and code/table polish. */

:root {
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.10);
  --bg: #ffffff;
  --bg-secondary: #f6f8fa;
  --text: #2c3e50;
  --text-muted: #6b7785;
  --border: #ebeef2;
  --sidebar-bg: #fafbfc;
  --sidebar-border: #eef1f4;
  --link: #5b5fc7;
  --code-bg: #2d2d2d;
  --code-text: #e6e6e6;
  --inline-code-bg: #f1f3f6;
  --inline-code-text: #c0341d;
  --table-stripe: #f8f9fb;
  --shadow: rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] {
  --accent: #818cf8;
  --accent-soft: rgba(129, 140, 248, 0.16);
  --bg: #0f172a;
  --bg-secondary: #131c31;
  --text: #cbd5e1;
  --text-muted: #8b98ac;
  --border: #1f2c44;
  --sidebar-bg: #0b1322;
  --sidebar-border: #1c2840;
  --link: #a5b4fc;
  --code-bg: #1a1f2e;
  --code-text: #e2e8f0;
  --inline-code-bg: #1e293b;
  --inline-code-text: #f0a3a3;
  --table-stripe: #111c30;
  --shadow: rgba(0, 0, 0, 0.4);
}

* {
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.content,
section.content {
  background: var(--bg);
}

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

.sidebar h1,
.sidebar h1 a,
.sidebar .app-name-link {
  color: var(--text);
}

.sidebar ul li a {
  color: var(--text-muted);
  border-radius: 6px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar ul li a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.sidebar ul li.active > a,
.sidebar ul li a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
  border-left: 3px solid var(--accent);
  padding-left: calc(1rem - 3px);
}

.sidebar ul li ul {
  margin: 0.1em 0 0.4em 0.4em;
  border-left: 1px solid var(--border);
  padding-left: 0.6em;
}

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

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

/* ---------- Collapsible sidebar groups ---------- */
.sidebar-nav > ul > li.sidebar-group > .sidebar-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 0.55em 0.4em 0.55em 1em;
  border-radius: 6px;
  margin-top: 0.4em;
}

.sidebar-nav > ul > li.sidebar-group > .sidebar-group-header:hover {
  background: var(--accent-soft);
}

.sidebar-group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
  margin-left: 0.4em;
  flex-shrink: 0;
  transform: rotate(90deg);
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.sidebar-group-toggle::before {
  content: "\276F";
  font-size: 0.7em;
}

.sidebar-group.sidebar-collapsed .sidebar-group-toggle {
  transform: rotate(0deg);
}

.sidebar-group.sidebar-collapsed > ul {
  display: none;
}

/* ---------- Dark mode toggle button ---------- */
.theme-toggle {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 50;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--shadow);
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.theme-toggle:hover {
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .theme-toggle {
    bottom: 1rem;
    right: 1rem;
  }
}

/* ---------- Content typography ---------- */
.markdown-section {
  max-width: 880px;
}

.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4 {
  color: var(--text);
  font-weight: 700;
}

.markdown-section h1 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4em;
}

.markdown-section h2 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3em;
  margin-top: 2.2em;
}

.markdown-section a {
  color: var(--link);
}

.markdown-section p,
.markdown-section li,
.markdown-section strong {
  color: var(--text);
}

.markdown-section blockquote {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  color: var(--text);
}

/* ---------- Tables ---------- */
.markdown-section table {
  display: table;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-collapse: collapse;
}

.markdown-section table th {
  background: var(--bg-secondary);
  color: var(--text);
  font-weight: 700;
  border: 1px solid var(--border);
}

.markdown-section table td {
  border: 1px solid var(--border);
  color: var(--text);
}

.markdown-section table th,
.markdown-section table td {
  word-break: normal;
}

.markdown-section table tr {
  background: var(--bg);
}

.markdown-section table tr:nth-child(2n) {
  background: var(--table-stripe);
}

/* ---------- Code ---------- */
.markdown-section code {
  word-break: normal;
}

.markdown-section :not(pre) > code {
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
  border-radius: 4px;
  padding: 0.15em 0.4em;
  font-size: 0.85em;
}

.markdown-section pre {
  background: var(--code-bg) !important;
  border-radius: 10px;
  box-shadow: 0 2px 10px var(--shadow);
}

.markdown-section pre > code {
  color: var(--code-text);
  background: transparent !important;
  border-radius: 10px;
}

.docsify-copy-code-button {
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 6px !important;
}

/* ---------- Search ---------- */
.search input[type="search"] {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.search .results-panel {
  background: var(--bg);
  color: var(--text);
}

.search h2 {
  border-color: var(--border);
}

.search a {
  border-bottom: 1px solid var(--border);
}

.search .matching-post p {
  color: var(--text-muted);
}

.search .clear-button svg {
  fill: var(--text-muted);
}

/* ---------- Pagination ---------- */
.pagination-item a {
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--bg-secondary);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.pagination-item a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
