/* INFRAX Documentation Styles */

/* ===== CSS Variables ===== */
:root {
  /* Light theme colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #868e96;
  --border-color: #dee2e6;
  --link-color: #0d6efd;
  --link-hover: #0a58ca;
  --sidebar-bg: #f8f9fa;
  --sidebar-active: #e9ecef;
  --code-bg: #f8f9fa;
  --shadow: rgba(0, 0, 0, 0.1);
  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #0dcaf0;
}

body.dark {
  /* Dark theme colors */
  --bg-primary: #1a1d23;
  --bg-secondary: #23272f;
  --bg-tertiary: #2c3038;
  --text-primary: #e9ecef;
  --text-secondary: #adb5bd;
  --text-muted: #6c757d;
  --border-color: #495057;
  --link-color: #4dabf7;
  --link-hover: #74c0fc;
  --sidebar-bg: #23272f;
  --sidebar-active: #2c3038;
  --code-bg: #2c3038;
  --shadow: rgba(0, 0, 0, 0.3);
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

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

/* Custom Scrollbar Styles */
.sidebar::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
  transition: background 0.2s;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

body.dark .sidebar::-webkit-scrollbar-thumb,
body.dark .main-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

body.dark .sidebar::-webkit-scrollbar-thumb:hover,
body.dark .main-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Firefox Scrollbar */
.sidebar,
.main-content {
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}

body.dark .sidebar,
body.dark .main-content {
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 100;
}

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

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

.logo-icon {
  font-size: 2rem;
}

.sidebar-nav {
  padding: 0.5rem 0;
}

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

.nav-section-title {
  padding: 0.3rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

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

.nav-item {
  margin: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.nav-link:hover {
  color: var(--text-primary);
  background-color: var(--sidebar-active);
}

.nav-link.active {
  color: var(--link-color);
  background-color: var(--sidebar-active);
  font-weight: 600;
}

.nav-icon {
  width: 1.25rem;
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 280px;
  transition: margin-left 0.3s ease;
}

.content-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.breadcrumb-link {
  color: var(--link-color);
  text-decoration: none;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

.btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn:hover {
  background-color: var(--bg-tertiary);
}

.btn-icon {
  width: 1rem;
  height: 1rem;
}

.content-body {
  margin: 0 auto;
  padding: 2rem;
  max-width: 1200px;
  transition: opacity 0.2s ease;
  position: relative;
}

/* Loading indicator for SPA navigation */
.content-body.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin-top: -20px;
  margin-left: -20px;
  border: 4px solid var(--border-color);
  border-top-color: var(--link-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 {
  font-size: 2.5rem;
  margin-top: 0;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

h2 {
  font-size: 2rem;
  margin-top: 2.5rem;
  padding-top: 1rem;
}

h3 {
  font-size: 1.5rem;
  margin-top: 2rem;
}

h4 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
}

h5 {
  font-size: 1.125rem;
  margin-top: 1rem;
}

h6 {
  font-size: 1rem;
  margin-top: 1rem;
}

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

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* Lists */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.5rem;
}

/* Code */
code {
  background-color: var(--code-bg);
  color: var(--danger);
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.875em;
}

pre {
  background-color: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

pre code {
  background-color: transparent;
  color: var(--text-primary);
  padding: 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  background-color: var(--bg-primary);
}

thead {
  background-color: var(--bg-secondary);
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border: 1px solid var(--border-color);
}

th {
  font-weight: 600;
  color: var(--text-primary);
}

td {
  color: var(--text-secondary);
}

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

.alert-info {
  background-color: rgba(13, 202, 240, 0.1);
  border-left-color: var(--info);
  color: var(--text-secondary);
}

.alert-success {
  background-color: rgba(25, 135, 84, 0.1);
  border-left-color: var(--success);
  color: var(--text-secondary);
}

.alert-warning {
  background-color: rgba(255, 193, 7, 0.1);
  border-left-color: var(--warning);
  color: var(--text-secondary);
}

.alert-danger {
  background-color: rgba(220, 53, 69, 0.1);
  border-left-color: var(--danger);
  color: var(--text-secondary);
}

.alert-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

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

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.card-content {
  color: var(--text-secondary);
}

/* Grid for cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Related sections */
.related-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.related-link {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.related-link:hover {
  border-color: var(--link-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.related-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.related-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.related-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* TOC (Table of Contents) */
.toc {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.toc-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.toc-list {
  list-style: none;
  padding-left: 0;
}

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

.toc-link {
  color: var(--link-color);
  text-decoration: none;
  display: block;
  padding: 0.25rem 0;
}

.toc-link:hover {
  text-decoration: underline;
}

.toc-sublist {
  list-style: none;
  padding-left: 1.5rem;
  margin-top: 0.5rem;
}

/* Footer */
.content-footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  margin-top: 3rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-nav {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.footer-link {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--link-color);
  text-decoration: none;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  transition: all 0.2s ease;
  flex: 1;
  max-width: 400px;
}

.footer-link:hover {
  border-color: var(--link-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.footer-link-prev {
  align-items: flex-start;
}

.footer-link-next {
  align-items: flex-end;
  text-align: right;
}

.footer-link-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-link-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  padding: 0.5rem;
  cursor: pointer;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .content-body {
    padding: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .related-links {
    grid-template-columns: 1fr;
  }

  .footer-nav {
    flex-direction: column;
    gap: 1rem;
  }

  .footer-link {
    max-width: 100%;
  }

  .footer-link-next {
    align-items: flex-start;
    text-align: left;
  }
}

/* Print styles */
@media print {
  .sidebar,
  .content-header,
  .menu-toggle {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  body {
    background-color: white;
    color: black;
  }
}

/* Utility classes */
.text-center {
  text-align: center;
}

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

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.d-flex {
  display: flex;
}

.gap-1 {
  gap: 0.5rem;
}

.gap-2 {
  gap: 1rem;
}

.align-center {
  align-items: center;
}

/* ===== Status and Priority Badges ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-new {
  background-color: rgba(33, 150, 243, 0.15);
  color: #2196F3;
}

body.dark .status-new {
  background-color: rgba(33, 150, 243, 0.25);
  color: #64B5F6;
}

.status-in-progress {
  background-color: rgba(255, 152, 0, 0.15);
  color: #FF9800;
}

body.dark .status-in-progress {
  background-color: rgba(255, 152, 0, 0.25);
  color: #FFB74D;
}

.status-waiting {
  background-color: rgba(156, 39, 176, 0.15);
  color: #9C27B0;
}

body.dark .status-waiting {
  background-color: rgba(156, 39, 176, 0.25);
  color: #BA68C8;
}

.status-done {
  background-color: rgba(76, 175, 80, 0.15);
  color: #4CAF50;
}

body.dark .status-done {
  background-color: rgba(76, 175, 80, 0.25);
  color: #81C784;
}

.priority-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  min-width: 90px;
  white-space: nowrap;
}

.priority-low {
  background-color: #E5E7EB;
  color: #6B7280;
  border: 1px solid #D1D5DB;
}

body.dark .priority-low {
  background-color: rgba(229, 231, 235, 0.2);
  color: #9CA3AF;
  border: 1px solid #4B5563;
}

.priority-normal {
  background-color: #3B82F6;
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

body.dark .priority-normal {
  background-color: #2563EB;
}

.priority-medium {
  background-color: #FEF3C7;
  color: #92400E;
  border: 1px solid #F59E0B;
}

body.dark .priority-medium {
  background-color: rgba(254, 243, 199, 0.2);
  color: #FCD34D;
  border: 1px solid #F59E0B;
}

.priority-high {
  background-color: #F97316;
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3);
}

body.dark .priority-high {
  background-color: #EA580C;
}

.priority-critical {
  background-color: #DC2626;
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4);
  border: 2px solid #B91C1C;
  animation: pulse-critical 2s infinite;
}

body.dark .priority-critical {
  background-color: #B91C1C;
  border: 2px solid #991B1B;
}

@keyframes pulse-critical {
  0% {
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4);
  }
  50% {
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.7), 0 0 0 2px rgba(220, 38, 38, 0.2);
  }
  100% {
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4);
  }
}

/* ===== Copy Button for Code Blocks ===== */
.code-block-with-copy {
  position: relative;
}

.code-header {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

.copy-button {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.copy-button:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--link-color);
  color: var(--link-color);
  transform: scale(1.05);
}

.copy-button:active {
  transform: scale(0.95);
}

.copy-button.copied {
  background-color: var(--success);
  border-color: var(--success);
  color: white;
}

.copy-button svg {
  width: 16px;
  height: 16px;
}

/* Добавляем отступ справа для кода, чтобы кнопка не перекрывала текст */
.code-block-with-copy code {
  padding-right: 50px;
}

/* Dark theme adjustments */
body.dark .copy-button {
  background-color: var(--bg-tertiary);
}

body.dark .copy-button:hover {
  background-color: var(--bg-secondary);
}

