/* Afonai API Documentation Styles */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --background: #ffffff;
  --surface: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --sidebar-width: 280px;
  --toc-width: 260px;
  --code-bg: #1e293b;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
}

.dark-theme {
  --background: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --code-bg: #0f172a;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

/* Layout */
.docs-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 100;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

/* ========================================
   MOBILE SIDEBAR HEADER - для мобильных
   ======================================== */

.mobile-sidebar-header {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  padding-bottom: 0.5rem;
}

.mobile-sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
}

.flex-spacer {
  flex: 1;
}

/* Sidebar Theme Button */
.sidebar-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid var(--border);
  padding: 0;
  width: 40px;
  height: 40px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.sidebar-theme-btn .theme-icon {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  padding: 0.375rem;
  transition: all 0.2s;
}

.sidebar-theme-btn .sun-icon {
  background: var(--border);
  color: var(--text);
}

.sidebar-theme-btn .moon-icon {
  color: var(--text-muted);
}

.dark-theme .sidebar-theme-btn .sun-icon {
  color: var(--text-muted);
  background: transparent;
}

.dark-theme .sidebar-theme-btn .moon-icon {
  background: var(--border);
  color: var(--text);
}

/* Кнопка закрытия sidebar */
.mobile-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  width: 40px;
  height: 40px;
  padding: 0.5rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mobile-close-btn:hover {
  background: var(--border);
}

.mobile-close-btn:active {
  transform: scale(0.95);
}

.mobile-close-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

@media (max-width: 1024px) {
  .mobile-sidebar-header {
    display: flex;
  }
  
  .mobile-close-btn {
    display: flex;
  }
  
  /* Скрываем desktop header на мобильных */
  .sidebar-header {
    display: none;
  }
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-nav {
  padding: 1.5rem 1rem;
  overflow-y: auto;
  flex: 1;
}

.nav-section {
  margin-bottom: 2rem;
}

.nav-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding: 0 0.75rem;
  letter-spacing: 0.05em;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  position: relative;
}

.nav-item:hover {
  background: var(--border);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.nav-item.active .nav-item-icon {
  color: white;
}

.nav-item-icon {
  margin-right: 0.5rem;
  width: 18px;
  height: 18px;
}

/* Collapsible Menu */
.nav-collapsible {
  margin-bottom: 0.25rem;
}

.nav-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--text);
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.2s;
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
}

.nav-toggle:hover {
  background: var(--border);
}

.nav-toggle-icon {
  margin-left: auto;
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.nav-toggle.open .nav-toggle-icon {
  transform: rotate(180deg);
}

.nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  opacity: 0;
  padding-left: 1.5rem;
}

.nav-submenu.open {
  max-height: 500px;
  opacity: 1;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

.nav-submenu .nav-item {
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
  position: relative;
  padding-left: 2rem;
}

.nav-submenu .nav-item::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-submenu .nav-item:hover::before {
  background: var(--primary);
  width: 6px;
  height: 6px;
}

.nav-submenu .nav-item.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
  transform: translateX(2px);
}

.nav-submenu .nav-item.active::before {
  background: white;
  width: 6px;
  height: 6px;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 2rem;
}

.content-wrapper {
  flex: 1;
  max-width: 900px;
  padding: 3rem 2rem;
}

/* TOC - Table of Contents */
.toc {
  position: sticky;
  top: 2rem;
  width: var(--toc-width);
  padding: 2rem 1.5rem;
  align-self: flex-start;
  flex-shrink: 0;
}

.toc-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toc-list {
  list-style: none;
  border-left: 2px solid var(--border);
  padding-left: 0;
}

.toc-item {
  position: relative;
}

.toc-link {
  display: block;
  padding: 0.375rem 0 0.375rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.toc-link:hover {
  color: var(--text);
  transform: translateX(2px);
}

.toc-link.active {
  color: var(--primary);
  font-weight: 500;
  transform: translateX(2px);
}

.toc-link.active::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.3);
}

/* Typography */
h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

h2 {
  font-size: 2rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  color: var(--text);
  scroll-margin-top: 2rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  color: var(--text);
  scroll-margin-top: 2rem;
}

h4 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
}

p {
  margin-bottom: 1rem;
  color: var(--text);
}

.subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* Endpoint Cards */
.endpoint-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.method-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.method-get {
  background: #10b981;
  color: white;
}

.method-post {
  background: #3b82f6;
  color: white;
}

.method-put {
  background: #f59e0b;
  color: white;
}

.method-delete {
  background: #ef4444;
  color: white;
}

.endpoint-path {
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  color: var(--text);
}

/* Parameter Tables */
.param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}

.param-table thead {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
}

.param-table th {
  text-align: left;
  padding: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.param-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.param-table tbody tr:hover {
  background: var(--surface);
}

.param-name {
  font-family: 'Courier New', monospace;
  background: var(--surface);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.param-required {
  color: #ef4444;
  font-weight: 500;
}

.param-optional {
  color: var(--text-muted);
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid;
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border-color: #3b82f6;
  color: var(--text);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: #f59e0b;
  color: var(--text);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: var(--text);
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  color: var(--text);
}

.alert strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* Inline Code */
.inline-code {
  font-family: 'Courier New', monospace;
  background: var(--surface);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
  color: #e11d48;
}

.dark-theme .inline-code {
  color: #fb7185;
}

/* Subtitle */
.subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Navigation Links - Previous/Next */
.content-wrapper a[href*="/docs/"]:has(svg) {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-wrapper a[href*="/docs/"]:has(svg):hover {
  background: var(--border) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Code Blocks */
pre {
  background: var(--code-bg);
  border-radius: 0.5rem;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
}

code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.7;
}

pre code {
  color: #e2e8f0;
}

.inline-code {
  background: var(--surface);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
  border: 1px solid var(--border);
  color: var(--primary);
}

/* Endpoint Cards */
.endpoint-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.method-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.method-post {
  background: #10b981;
  color: white;
}

.method-get {
  background: #3b82f6;
  color: white;
}

.endpoint-path {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
}

/* Parameter Table */
.param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.param-table th {
  background: var(--surface);
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.param-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.param-name {
  font-family: 'Consolas', 'Monaco', monospace;
  color: var(--primary);
  font-weight: 500;
}

.param-required {
  color: var(--error);
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.param-optional {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid;
}

.alert-info {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}

.alert-warning {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.alert-success {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

.alert-error {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.dark-theme .alert-info {
  background: #1e3a8a;
  color: #bfdbfe;
}

.dark-theme .alert-warning {
  background: #78350f;
  color: #fde68a;
}

.dark-theme .alert-success {
  background: #064e3b;
  color: #a7f3d0;
}

.dark-theme .alert-error {
  background: #7f1d1d;
  color: #fecaca;
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: var(--border);
}

/* Responsive */
@media (max-width: 1280px) {
  .toc {
    display: none;
  }
}

@media (max-width: 768px) {
  /* Удалено - заменено на новую систему mobile-header */
  
  .main-content {
    margin-left: 0;
  }
  
  .content-wrapper {
    padding: 2rem 1rem;
  }
}

/* Copy Button */
.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   MOBILE TOC HEADER - Навигация по секциям
   ======================================== */

.mobile-toc-header {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 150;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.2s;
}

.dark-theme .mobile-toc-header {
  background: rgba(15, 23, 42, 0.8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Blur эффект на TOC header при открытом sidebar */
.sidebar-open .mobile-toc-header {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.6);
}

.dark-theme.sidebar-open .mobile-toc-header {
  background: rgba(15, 23, 42, 0.6);
}

/* DEBUG: Принудительный показ на мобильных для тестирования */
@media (max-width: 1024px) {
  .mobile-toc-header {
    display: block !important;
  }
}

.mobile-toc-toggle {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  height: 40px;
  padding: 0.625rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.mobile-toc-toggle:active {
  background: var(--border);
}

/* Progress Circle */
.toc-progress-circle {
  flex-shrink: 0;
}

.toc-progress-circle .progress-bg {
  stroke: var(--border);
}

.toc-progress-circle .progress-bar {
  stroke: var(--primary);
  transition: stroke-dashoffset 0.3s ease;
}

.mobile-toc-current-section {
  flex: 1;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.3s;
}

.toc-chevron {
  flex-shrink: 0;
  transition: transform 0.3s;
  color: var(--text-muted);
}

.mobile-toc-toggle[aria-expanded="true"] .toc-chevron {
  transform: rotate(180deg);
}

/* TOC Dropdown */
.mobile-toc-dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-toc-dropdown.open {
  max-height: 50vh;
}

.mobile-toc-scroll {
  position: relative;
  max-height: 50vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem 1rem;
  mask-image: linear-gradient(to bottom, transparent, white 12px, white calc(100% - 12px), transparent);
}

/* TOC Indicator (вертикальная линия) */
.mobile-toc-indicator {
  position: absolute;
  left: 1rem;
  width: 1px;
  top: 0.75rem;
  bottom: 0.75rem;
  background: var(--border);
}

.mobile-toc-indicator::after {
  content: '';
  position: absolute;
  left: 0;
  width: 1px;
  height: 20px;
  background: var(--primary);
  transition: top 0.3s ease, height 0.3s ease;
  top: var(--toc-indicator-top, 0);
  height: var(--toc-indicator-height, 20px);
}

.mobile-toc-list {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  margin-left: 1rem;
}

.mobile-toc-link {
  position: relative;
  display: block;
  padding: 0.375rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.2s;
  overflow-wrap: anywhere;
}

.mobile-toc-link:hover {
  background: var(--surface);
  color: var(--text);
}

.mobile-toc-link.active {
  color: var(--primary);
  font-weight: 500;
}

.mobile-toc-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 1px;
  top: 0;
  bottom: 0;
  background: var(--primary);
}

/* Показываем TOC header на мобильных */
@media (max-width: 1024px) {
  .mobile-toc-header {
    display: block;
  }
}

/* Удалено - заменено на mobile-header */

/* Scrollbar - Красивый современный дизайн */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 10px;
  margin: 8px;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 50%, var(--primary) 100%);
  border-radius: 10px;
  border: 2px solid var(--surface);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #60a5fa 100%);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.6), inset 0 0 6px rgba(255, 255, 255, 0.3);
  border-color: rgba(37, 99, 235, 0.2);
  transform: scaleY(1.1);
}

::-webkit-scrollbar-thumb:active {
  background: var(--primary-dark);
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.8);
}

/* Анимация градиента для scrollbar */
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--surface);
}

/* Dark theme scrollbar */
.dark-theme ::-webkit-scrollbar-track {
  background: #1e293b;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}

.dark-theme ::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
  border-color: #1e293b;
}

/* Smooth Scroll - отзывчивый и быстрый */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

/* Мобильный scroll padding (учитывает высоту header) */
@media (max-width: 1024px) {
  html {
    scroll-padding-top: 72px;
  }
  
  :root {
    --background-rgb: 255, 255, 255;
  }
  
  .dark-theme {
    --background-rgb: 15, 23, 42;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   MOBILE STYLES - АДАПТИВНЫЙ ДИЗАЙН
   ======================================== */

/* ========================================
   MOBILE HEADER - Современная минималистичная шапка
   ======================================== */

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 200;
  background: rgba(var(--background-rgb, 255, 255, 255), 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: all 0.2s;
  padding: 0 1rem 0 1.25rem;
  align-items: center;
}

.dark-theme .mobile-header {
  background: rgba(15, 23, 42, 0.8);
}

/* Усиленный blur на header при открытом sidebar */
.sidebar-open .mobile-header {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.6);
}

.dark-theme.sidebar-open .mobile-header {
  background: rgba(15, 23, 42, 0.6);
}

/* Mobile Logo Link */
.mobile-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s;
}

.mobile-logo-link:active {
  opacity: 0.7;
}

.mobile-logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

/* Логотипы (светлый/темный) */
.mobile-logo-light {
  display: block;
  flex-shrink: 0;
}

.mobile-logo-dark {
  display: none;
  flex-shrink: 0;
}

.dark-theme .mobile-logo-light {
  display: none;
}

.dark-theme .mobile-logo-dark {
  display: block;
}

/* Разделитель */
.mobile-header-divider {
  display: none;
  width: 1px;
  height: 1.5rem;
  background: var(--border);
}

@media (min-width: 640px) {
  .mobile-header-divider {
    display: block;
  }
}

/* Подзаголовок "Документация" */
.mobile-header-subtitle {
  display: none;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (min-width: 640px) {
  .mobile-header-subtitle {
    display: block;
  }
}

/* Spacer для растягивания */
.mobile-header-spacer {
  flex: 1;
}

/* Кнопка открытия sidebar */
.mobile-sidebar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mobile-sidebar-btn:hover {
  background: var(--border);
  color: var(--text);
}

.mobile-sidebar-btn:active {
  transform: scale(0.95);
}

.mobile-sidebar-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* ========================================
   DESKTOP THEME TOGGLE - только для ПК
   ======================================== */

.desktop-theme-toggle {
  display: block;
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 150;
  width: 44px;
  height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.desktop-theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.desktop-theme-toggle:active {
  transform: scale(0.95);
}

.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s;
}

.mobile-overlay.active {
  opacity: 1;
}

/* ========================================
   MOBILE LAYOUT - Адаптация для планшетов и телефонов
   ======================================== */

@media (max-width: 1024px) {
  .mobile-header {
    display: flex;
  }
  
  .desktop-theme-toggle {
    display: none !important;
  }
  
  /* Padding для контента с учетом headers */
  .docs-container {
    padding-top: 96px; /* Header (56px) + TOC (40px) */
  }
  
  /* Если нет TOC на странице (404 и т.д.) */
  body:not(:has(.mobile-toc-header)) .docs-container {
    padding-top: 56px; /* Только header */
  }
  
  /* Показываем кнопку закрытия в sidebar на мобильных */
  .mobile-close-btn {
    display: flex;
  }
  
  .sidebar {
    position: fixed;
    inset: 0;
    right: 0;
    left: auto;
    width: 85%;
    max-width: 380px;
    z-index: 201;
    background: var(--background);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    font-size: 0.9375rem;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  /* Анимация появления sidebar */
  @keyframes slideInFromRight {
    from {
      transform: translateX(100%);
    }
    to {
      transform: translateX(0);
    }
  }
  
  .sidebar.mobile-open {
    animation: slideInFromRight 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .mobile-overlay {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  
  .mobile-overlay.active {
    display: block;
  }
  
  /* Анимация overlay */
  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
  
  .mobile-overlay.active {
    animation: fadeIn 0.25s ease;
  }
  
  .main-content {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }
  
  .toc {
    display: none;
  }
  
  /* Оптимизация контента для мобильных */
  .content-wrapper {
    max-width: 100%;
    padding: 1.5rem 1rem;
  }
  
  /* Адаптация заголовков */
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.25rem;
  }
  
  /* ========================================
     АДАПТАЦИЯ БЛОКОВ КОДА
     ======================================== */
  pre {
    font-size: 0.8125rem;
    padding: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    max-width: 100%;
    margin: 1rem 0;
  }
  
  pre code {
    white-space: pre;
    word-break: normal;
    font-size: 0.8125rem;
    line-height: 1.6;
  }
  
  /* Inline code */
  .inline-code,
  code.param-name {
    font-size: 0.8125rem;
    padding: 0.125rem 0.375rem;
    word-break: break-word;
  }
  
  /* ========================================
     АДАПТИВНЫЕ ТАБЛИЦЫ - карточки на мобильных
     ======================================== */
  .param-table {
    border: 0;
  }
  
  .param-table thead {
    display: none; /* Скрываем заголовки */
  }
  
  .param-table tbody,
  .param-table tr,
  .param-table td {
    display: block;
  }
  
  .param-table tr {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }
  
  .param-table td {
    padding: 0.5rem 0;
    border: none;
    position: relative;
    padding-left: 130px;
    min-height: 28px;
    display: flex;
    align-items: center;
  }
  
  .param-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 120px;
  }
  
  .param-table td:first-child {
    padding-top: 0;
    font-size: 1rem;
    font-weight: 600;
  }
  
  .param-table td:last-child {
    padding-bottom: 0;
  }
  
  /* ========================================
     АДАПТАЦИЯ ENDPOINT CARDS
     ======================================== */
  .endpoint-card {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .endpoint-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .endpoint-path {
    font-size: 0.875rem;
    word-break: break-all;
    line-height: 1.5;
  }
  
  .method-badge {
    padding: 0.375rem 0.875rem;
    font-size: 0.6875rem;
  }
  
  /* ========================================
     АДАПТАЦИЯ ALERTS
     ======================================== */
  .alert {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    margin: 1rem 0;
    border-left-width: 3px;
  }
  
  .alert strong {
    font-size: 0.9375rem;
    margin-bottom: 0.375rem;
  }
  
  /* ========================================
     АДАПТАЦИЯ NAVIGATION (Previous/Next)
     ======================================== */
  .content-wrapper > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
  
  /* Previous/Next кнопки на мобильных */
  .content-wrapper a[style*="grid"] {
    min-height: 64px !important;
    padding: 0.875rem 1rem !important;
  }
  
  /* ========================================
     УЛУЧШЕНИЕ СПИСКОВ
     ======================================== */
  ol, ul {
    margin-left: 1.25rem;
  }
  
  li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
  }
  
  /* ========================================
     АДАПТАЦИЯ ЗАГОЛОВКОВ СЕКЦИЙ
     ======================================== */
  section {
    margin-bottom: 2rem;
    scroll-margin-top: 80px; /* Отступ для фиксированной шапки */
  }
  
  section h1 {
    margin-bottom: 0.5rem;
    line-height: 1.2;
  }
  
  section h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
  }
  
  section h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
  }
  
  .subtitle {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
}

/* Tablet styles */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }
  
  /* Мелкие улучшения для планшетов */
  .sidebar-header {
    padding: 1.25rem 1rem;
  }
  
  .sidebar-nav {
    padding: 1rem 0.75rem;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .mobile-header {
    padding: 0 0.75rem;
  }
  
  .mobile-logo-light,
  .mobile-logo-dark {
    width: 90px;
    height: 24px;
  }
  
  :root {
    --sidebar-width: 100vw;
  }
  
  .sidebar {
    width: 100vw;
  }
  
  .sidebar-header {
    width: 100vw;
  }
  
  .content-wrapper {
    padding: 1rem 0.75rem;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.25rem;
  }
  
  h3 {
    font-size: 1.125rem;
  }
  
  /* Кнопки на всю ширину */
  .copy-btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
  }
  
  /* Улучшение touch targets */
  .nav-item,
  .nav-toggle {
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Touch feedback для всех кнопок */
  button,
  a.nav-item,
  .mobile-menu-toggle,
  .mobile-theme-toggle,
  .mobile-home-btn,
  .mobile-close-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
  }
  
  /* Улучшенная анимация для активного состояния */
  button:active,
  a.nav-item:active {
    transition-duration: 0.1s;
  }
  
  /* ========================================
     SIDEBAR TOUCH ОПТИМИЗАЦИЯ
     ======================================== */
  .sidebar-nav {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 3rem; /* Отступ снизу для удобства */
  }
  
  /* ========================================
     СОВРЕМЕННЫЙ ДИЗАЙН НАВИГАЦИИ
     ======================================== */
  
  /* Nav items */
  .nav-item {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0.5rem;
    padding: 0.5rem;
    padding-left: calc(var(--spacing, 8px) * 6);
    text-align: start;
    color: var(--text-muted);
    overflow-wrap: anywhere;
    transition: all 0.15s;
    min-height: 44px;
    font-size: 0.9375rem;
  }
  
  .nav-item:hover {
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.08);
    color: var(--text);
  }
  
  .nav-item.active {
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.1);
    color: var(--primary);
    font-weight: 500;
  }
  
  /* Nav toggle buttons */
  .nav-toggle {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0.5rem;
    padding: 0.5rem;
    padding-left: calc(var(--spacing, 8px) * 2);
    width: 100%;
    color: var(--text-muted);
    transition: all 0.15s;
    min-height: 44px;
  }
  
  .nav-toggle:hover {
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.08);
    color: var(--text);
  }
  
  .nav-toggle .nav-toggle-icon {
    margin-left: auto;
    transition: transform 0.2s;
  }
  
  .nav-toggle.open .nav-toggle-icon {
    transform: rotate(180deg);
  }
  
  .nav-section-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    padding: 0.5rem;
    padding-left: calc(var(--spacing, 8px) * 2);
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 1.5rem;
  }
  
  .nav-section:first-child .nav-section-title {
    margin-top: 0;
  }
  
  .nav-section {
    margin-bottom: 0;
  }
  
  /* Вложенные submenu с вертикальной линией */
  .nav-submenu {
    position: relative;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .nav-submenu::before {
    content: '';
    position: absolute;
    width: 1px;
    top: 0.25rem;
    bottom: 0.25rem;
    left: calc(var(--spacing, 8px) * 2.5);
    background: var(--border);
  }
  
  /* Active item - выделение вертикальной линией */
  .nav-submenu:has(.nav-item.active)::before {
    background: var(--primary);
  }
  
  /* Кнопка закрытия - увеличенная touch область */
  .mobile-close-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }
  
  /* Улучшенный визуальный feedback */
  .nav-item:active {
    transform: scale(0.98);
  }
  
  .nav-toggle:active {
    transform: scale(0.98);
  }
  
  /* CSS переменные для spacing */
  :root {
    --spacing: 8px;
    --primary-rgb: 37, 99, 235;
  }
}

/* ========================================
   АНИМАЦИИ И ПЕРЕХОДЫ
   ======================================== */

/* Старые анимации удалены - перенесены в основной блок выше */

