/* ==============================================================================
   ПрВМ Docs — Стилистическая система LibreChat Docs (Fumadocs / Next.js)
   ============================================================================== */

:root {
  --font-sans: 'GeistSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'GeistMono', ui-monospace, SFMono-Regular, 'Roboto Mono', Menlo, Consolas, monospace;

  /* Темная тема LibreChat по умолчанию (Ultra-clean OLED / Slate) */
  --bg-page: #030712;
  --bg-header: rgba(3, 7, 18, 0.85);
  --bg-sidebar: #050814;
  --bg-card: #0b1120;
  --bg-card-hover: #111a2e;
  --bg-input: #090e1a;
  --bg-code: #02040a;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(16, 185, 129, 0.6);
  --border-card: rgba(255, 255, 255, 0.09);

  --text-main: #f9fafb;
  --text-body: #9ca3af;
  --text-muted: #6b7280;
  --text-link: #38bdf8;

  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.15);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.15);
  --accent-indigo: #6366f1;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --callout-tip-bg: rgba(16, 185, 129, 0.07);
  --callout-tip-border: rgba(16, 185, 129, 0.3);
  --callout-tip-text: #34d399;

  --callout-warn-bg: rgba(245, 158, 11, 0.07);
  --callout-warn-border: rgba(245, 158, 11, 0.3);
  --callout-warn-text: #fbbf24;

  --callout-note-bg: rgba(6, 182, 212, 0.07);
  --callout-note-border: rgba(6, 182, 212, 0.3);
  --callout-note-text: #38bdf8;

  --callout-imp-bg: rgba(99, 102, 241, 0.07);
  --callout-imp-border: rgba(99, 102, 241, 0.3);
  --callout-imp-text: #818cf8;

  --header-height: 60px;
  --sidebar-width: 300px;
  --toc-width: 250px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

/* Светлая тема */
[data-theme="light"] {
  --bg-page: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.9);
  --bg-sidebar: #fafafa;
  --bg-card: #ffffff;
  --bg-card-hover: #f4f4f5;
  --bg-input: #f4f4f5;
  --bg-code: #f8fafc;

  --border-subtle: #e4e4e7;
  --border-active: rgba(16, 185, 129, 0.8);
  --border-card: #e4e4e7;

  --text-main: #09090b;
  --text-body: #52525b;
  --text-muted: #a1a1aa;
  --text-link: #0284c7;

  --accent-emerald-glow: rgba(16, 185, 129, 0.1);
  --accent-cyan-glow: rgba(6, 182, 212, 0.1);

  --callout-tip-bg: #ecfdf5;
  --callout-tip-border: #a7f3d0;
  --callout-tip-text: #059669;

  --callout-warn-bg: #fffbeb;
  --callout-warn-border: #fde68a;
  --callout-warn-text: #d97706;

  --callout-note-bg: #f0f9ff;
  --callout-note-border: #bae6fd;
  --callout-note-text: #0284c7;

  --callout-imp-bg: #eef2ff;
  --callout-imp-border: #c7d2fe;
  --callout-imp-text: #4f46e5;

  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

/* Сброс и базовые элементы */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-body);
  background-color: var(--bg-page);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
}

/* ==============================================================================
   Шапка (Header)
   ============================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
}

.site-logo:hover {
  text-decoration: none;
}

.site-logo svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.logo-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  letter-spacing: 0.02em;
}

/* Поиск в шапке */
.header-center {
  flex: 1;
  max-width: 440px;
  margin: 0 1.5rem;
}

.search-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-trigger:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-main);
}

.search-key {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

/* Действия в правой части */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header-nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 3px;
  border-radius: 8px;
}

.header-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.header-tab-btn:hover {
  color: var(--text-main);
}

.header-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Группа действий с Markdown (Копирование в буфер + Скачивание) */
.md-actions-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  transition: all 0.2s ease;
}

.md-actions-group:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.md-action-btn {
  background: transparent;
  border: none;
  font-size: 0.82rem;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

/* Основное действие — Копирование MD в буфер */
.primary-copy-btn {
  color: var(--text-main);
  font-weight: 600;
}

.primary-copy-btn:hover {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
}

.primary-copy-btn.copied {
  background: rgba(16, 185, 129, 0.18);
  color: var(--accent-emerald);
}

/* Дополнительное действие — Экспорт (Скачивание) файла .md */
.secondary-download-btn {
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 5px 8px;
  border-left: 1px solid var(--border-subtle);
  border-radius: 0 5px 5px 0;
}

.secondary-download-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.export-md-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.export-md-btn:hover {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  background: var(--accent-emerald-glow);
}

.theme-toggle-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 7px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

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

/* ==============================================================================
   Основной макет документации (3 колонки)
   ============================================================================== */
.docs-container {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

/* Боковая панель навигации (Sidebar) */
.docs-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
  padding: 1.5rem 1rem;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
}

.docs-sidebar::-webkit-scrollbar {
  width: 5px;
}

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

.sidebar-group {
  margin-bottom: 1.5rem;
}

.sidebar-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.25rem;
  cursor: pointer;
  user-select: none;
}

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

.sidebar-group-title svg {
  transition: transform 0.2s ease;
}

.sidebar-group.collapsed .sidebar-group-title svg {
  transform: rotate(-90deg);
}

.sidebar-group.collapsed .sidebar-links {
  display: none;
}

.sidebar-links {
  list-style: none;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  border-radius: 7px;
  font-size: 0.88rem;
  color: var(--text-body);
  text-decoration: none;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}

.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
  font-weight: 600;
  border-left: 3px solid var(--accent-emerald);
}

.sidebar-pill {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

/* Центральная область контента */
.docs-content-area {
  flex: 1;
  min-width: 0;
  padding: 2.25rem 3rem 4rem;
}

.content-inner {
  max-width: 880px;
  margin: 0 auto;
}

/* Правая колонка — Содержание страницы (TOC) */
.docs-toc {
  width: var(--toc-width);
  flex-shrink: 0;
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
  padding: 2.25rem 1.25rem;
  border-left: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.toc-list {
  list-style: none;
}

.toc-item {
  margin-bottom: 0.4rem;
}

.toc-link {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  line-height: 1.4;
  padding: 2px 0;
  transition: color 0.15s ease;
}

.toc-link:hover {
  color: var(--text-main);
  text-decoration: none;
}

.toc-link.active {
  color: var(--accent-emerald);
  font-weight: 600;
}

.toc-item.level-3 {
  padding-left: 0.85rem;
  font-size: 0.8rem;
}

/* ==============================================================================
   Стилизация контента статьи
   ============================================================================== */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.breadcrumbs span {
  color: var(--text-body);
}

.page-header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.meta-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.meta-badge.important {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.meta-badge.medium {
  background: rgba(6, 182, 212, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.meta-badge.easy {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.meta-badge.topic {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.page-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.page-lead {
  font-size: 1.12rem;
  color: var(--text-body);
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Типографика статьи */
.article-body h2 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.article-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.article-body p {
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

.article-body ul, .article-body ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.article-body li {
  margin-bottom: 0.4rem;
  line-height: 1.65;
}

/* Карточки графиков Matplotlib */
.plot-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  overflow: hidden;
  margin: 1.75rem 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.plot-card-header {
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.plot-img-wrapper {
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
}

.plot-img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.plot-img:hover {
  transform: scale(1.01);
}

.plot-caption {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: var(--text-body);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

/* Callout блоки */
.callout {
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border: 1px solid transparent;
  display: flex;
  gap: 0.85rem;
  font-size: 0.94rem;
  line-height: 1.6;
}

.callout-icon {
  flex-shrink: 0;
  padding-top: 2px;
}

.callout-content {
  flex: 1;
}

.callout-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.callout-tip {
  background: var(--callout-tip-bg);
  border-color: var(--callout-tip-border);
  color: var(--text-main);
}
.callout-tip .callout-title { color: var(--callout-tip-text); }

.callout-warning {
  background: var(--callout-warn-bg);
  border-color: var(--callout-warn-border);
  color: var(--text-main);
}
.callout-warning .callout-title { color: var(--callout-warn-text); }

.callout-note {
  background: var(--callout-note-bg);
  border-color: var(--callout-note-border);
  color: var(--text-main);
}
.callout-note .callout-title { color: var(--callout-note-text); }

.callout-important {
  background: var(--callout-imp-bg);
  border-color: var(--callout-imp-border);
  color: var(--text-main);
}
.callout-important .callout-title { color: var(--callout-imp-text); }

/* Карточки упражнений */
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.75rem 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.task-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.task-condition {
  background: rgba(0, 0, 0, 0.25);
  padding: 1rem 1.15rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  border-left: 3px solid var(--accent-cyan);
}

/* Спойлер подробного решения */
.solution-spoiler {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 1rem;
  background: rgba(0, 0, 0, 0.15);
}

.solution-spoiler summary {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--accent-emerald);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
  background: var(--bg-card-hover);
  transition: background 0.15s ease;
}

.solution-spoiler summary:hover {
  background: rgba(16, 185, 129, 0.1);
}

.solution-body {
  padding: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.task-answer-box {
  background: var(--accent-emerald-glow);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 8px;
  padding: 0.85rem 1.15rem;
  margin-top: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.task-answer-box strong {
  color: var(--accent-emerald);
}

/* Блоки кода */
.code-container {
  position: relative;
  margin: 1.25rem 0;
  border-radius: 9px;
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.code-lang {
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

pre {
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #e2e8f0;
}

pre::-webkit-scrollbar {
  height: 6px;
}
pre::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 6px;
}

/* Таблицы */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}

th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

th {
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-hover);
}

/* KaTeX адаптивность */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
}

/* Всплывающее уведомление (Toast) */
.toast-msg {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #10b981;
  color: #042f1a;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s ease;
  pointer-events: none;
}

.toast-msg.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==============================================================================
   Модальное окно поиска (Search Modal)
   ============================================================================== */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.search-modal-backdrop.open {
  display: flex;
}

.search-modal {
  width: 100%;
  max-width: 620px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalSlide 0.15s ease-out;
}

@keyframes modalSlide {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.search-input-field {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.1rem;
  outline: none;
}

.search-results-list {
  max-height: 420px;
  overflow-y: auto;
  list-style: none;
  padding: 0.5rem;
}

.search-result-item {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-bottom: 2px;
}

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

.search-res-title {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

.search-res-snippet {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.search-res-badge {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  float: right;
}

.search-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.search-footer {
  padding: 0.65rem 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==============================================================================
   Адаптивность (Mobile & Tablet)
   ============================================================================== */
@media (max-width: 1180px) {
  .docs-toc {
    display: none;
  }
  .docs-content-area {
    padding: 2rem 2rem 4rem;
  }
}

@media (max-width: 860px) {
  .mobile-menu-btn {
    display: block;
  }
  .header-nav-tabs {
    display: none;
  }
  .docs-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }
  .docs-sidebar.mobile-open {
    transform: translateX(0);
  }
  .docs-content-area {
    padding: 1.5rem 1rem 3rem;
  }
  .header-center {
    margin: 0 0.5rem;
  }
}

@media (max-width: 640px) {
  .secondary-download-btn .btn-subtext {
    display: none;
  }
  .secondary-download-btn {
    padding: 5px 6px;
  }
  .primary-copy-btn {
    padding: 5px 8px;
  }
}
