/* Documentation Page Styles - Shared between Admin and User GUIs */

body.docs-page {
  overflow: hidden;
  height: 100%;
}

body.docs-page .app-content {
  overflow: hidden;
}

.docs-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  padding: 0;
}

.docs-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Docs Layout - Sidebar + Content */
.docs-wrapper {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.docs-sidebar {
  width: 220px;
  min-width: 220px;
  padding: 20px;
  overflow-y: auto;
  background: rgba(17, 24, 39, 0.8);
  border-right: 1px solid rgba(56, 189, 248, 0.18);
}

.docs-sidebar h4 {
  color: #7dd3fc;
  margin-bottom: 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.docs-sidebar a {
  display: block;
  color: #cbd5e1;
  text-decoration: none;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 4px;
  margin-bottom: 2px;
  transition: all 0.2s;
}

.docs-sidebar a:hover {
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
}

.docs-sidebar a.active {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  font-weight: 600;
  border-left: 3px solid #7dd3fc;
  padding-left: 9px;
}

.docs-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 20px 40px;
  max-width: 1540px;
  margin: 0 auto;
}
.docs-content::-webkit-scrollbar { display: none; }

/* Docs Section */
.docs-section {
  background: linear-gradient(180deg, rgba(24, 32, 48, 0.8) 0%, rgba(12, 18, 28, 0.9) 100%);
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 24px;
  border: 1px solid rgba(56, 189, 248, 0.12);
}

.docs-section h2 {
  color: #7dd3fc;
  margin-bottom: 16px;
  font-size: 24px;
  border-bottom: 2px solid rgba(125, 211, 252, 0.2);
  padding-bottom: 8px;
}

.docs-section h3 {
  color: #e2e8f0;
  margin: 20px 0 12px 0;
  font-size: 18px;
}

.docs-section h4 {
  color: #94a3b8;
  margin: 16px 0 8px 0;
  font-size: 16px;
}

.docs-section p,
.docs-section li {
  color: #cbd5e1;
  line-height: 1.7;
  margin-bottom: 12px;
}

.docs-section ul,
.docs-section ol {
  margin-left: 24px;
  margin-bottom: 16px;
}

.docs-section code {
  background: rgba(14, 116, 144, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #7dd3fc;
}

.docs-section pre {
  background: #0b1220;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid rgba(56, 189, 248, 0.12);
}

.docs-section pre code {
  background: transparent;
  padding: 0;
  color: #e2e8f0;
}

/* Tables */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 13px;
}

.docs-table th,
.docs-table td {
  padding: 12px;
  text-align: left;
  border: 1px solid rgba(56, 189, 248, 0.12);
}

.docs-table thead th {
  background: rgba(14, 116, 144, 0.2);
  color: #7dd3fc;
  font-weight: 600;
  border-color: rgba(56, 189, 248, 0.2);
}

/* Highlight Boxes */
.highlight-box {
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.2), rgba(56, 189, 248, 0.12));
  border-left: 4px solid #7dd3fc;
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin: 16px 0;
}

.highlight-box.warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(239, 68, 68, 0.15));
  border-left-color: #f59e0b;
}

.highlight-box.success {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(239, 68, 68, 0.15));
  border-left-color: #f59e0b;
}

/* Feature Grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.feature-card {
  background: rgba(15, 23, 42, 0.6);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(125, 211, 252, 0.12);
}

.feature-card h4 {
  color: #e2e8f0;
  margin-top: 0;
}

/* Protocol Titles */
.protocol-title {
  margin-top: 0;
}

.protocol-title.protocol-http {
  color: #f59e0b;
}

.protocol-title.protocol-https {
  color: #06b6d4;
}

.protocol-title.protocol-ssh {
  color: #8b5cf6;
}

.protocol-title.protocol-tcp {
  color: #f59e0b;
}

.protocol-title.protocol-udp {
  color: #ef4444;
}

/* Compact list spacing */
.docs-list-compact {
  margin: 10px 0 0 20px;
  padding-left: 20px;
}

/* Screenshot Grid */
.docs-screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.docs-screenshot {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(139, 156, 255, 0.12);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  margin: 16px 0;
}

.docs-screenshot img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid rgba(139, 156, 255, 0.18);
  display: block;
  margin: 0 auto;
}

.docs-screenshot figcaption {
  margin-top: 10px;
  text-align: center;
  color: #a5b4fc;
  font-size: 13px;
  letter-spacing: 0.2px;
}

/* Architecture diagram - inline SVG */
.docs-screenshot.architecture-diagram {
  padding: 28px;
  background: rgba(15, 23, 42, 0.8);
  max-width: none;
}

.docs-screenshot.architecture-diagram .ab-arch-svg {
  width: 100%;
  display: block;
  overflow: visible;
  margin: 0 auto;
}

/* Step Numbers */
.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #0ea5e9, #22d3ee);
  color: white;
  border-radius: 50%;
  font-weight: bold;
  font-size: 14px;
  margin-right: 12px;
  flex-shrink: 0;
}

.step {
  display: flex;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
}

.donate-panel {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.step-content {
  flex: 1;
}

.step-content h4 {
  margin-top: 0;
}

/* Syntax highlighting for code blocks */
.hl-comment  { color: #6a9955; font-style: italic; }
.hl-string   { color: #e6a352; }
.hl-keyword  { color: #61afef; font-weight: 600; }
.hl-flag     { color: #e5c07b; }
.hl-variable { color: #56d6db; }
.hl-key      { color: #c678dd; }
.hl-number   { color: #d19a66; }
.hl-bool     { color: #d19a66; font-weight: 600; }
.hl-bracket  { color: #e5c07b; }
.hl-url      { color: #61afef; text-decoration: underline; }

/* ─── Mobile nav toggle (shared with api-docs) ─── */
.docs-nav-toggle {
  display: none;  /* hidden on desktop, shown via media query */
}

/* ─── Mobile ─── */
@media (max-width: 800px) {
  /* Unlock ALL scroll-blocking ancestors.
     .app-content is position:fixed in base.css — must undo that on mobile
     so the page becomes a normal scrolling document. */
  html, body, body.docs-page, body.public-page, body.public-page.docs-page {
    overflow: auto !important;
    height: auto !important;
    min-height: 0 !important;
    position: static !important;
  }
  body.docs-page .app-content,
  body.public-page.docs-page .app-content {
    position: static !important;
    overflow: visible !important;
    height: auto !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
  }
  .public-shell, .docs-container, .docs-main,
  body.docs-page .container,
  body.public-page.docs-page .container {
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
    position: static !important;
  }
  .docs-wrapper {
    flex-direction: column;
    height: auto !important;
    overflow: visible !important;
    /* Header (fixed) + nav bar (fixed) sit above the content */
    padding-top: calc(var(--app-header-height, 52px) + 48px);
  }

  /* Sidebar → fixed dropdown bar pinned below the header */
  .docs-sidebar {
    width: 100%;
    min-width: 100%;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid rgba(56, 189, 248, 0.15);
    background: rgba(8, 12, 24, 0.97);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow: visible;
    display: block;
    position: fixed !important;
    top: var(--app-header-height, 52px);
    left: 0;
    right: 0;
    z-index: 99;
  }
  .docs-sidebar h4 { display: none; }

  /* Toggle button */
  .docs-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 18px;
    background: transparent;
    border: none;
    color: #7dd3fc;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
  }
  .docs-nav-toggle .nav-arrow {
    font-size: 9px;
    color: #475569;
    transition: transform 0.2s;
  }
  .docs-nav-toggle.open .nav-arrow {
    transform: rotate(180deg);
  }

  /* Links list — full-width stacked rows, not pills */
  .docs-nav-links {
    display: none;
    border-top: 1px solid rgba(56, 189, 248, 0.08);
    max-height: 60vh;
    overflow-y: auto;
  }
  .docs-nav-links.open {
    display: block;
  }

  .docs-sidebar a {
    display: block;
    margin: 0;
    padding: 12px 20px;
    border-radius: 0;
    font-size: 14px;
    line-height: 1.3;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    background: transparent;
    border-left: 3px solid transparent;
  }
  .docs-sidebar a:hover {
    background: rgba(56, 189, 248, 0.06);
    color: #e2e8f0;
  }
  .docs-sidebar a.active {
    background: rgba(56, 189, 248, 0.10);
    color: #7dd3fc;
    font-weight: 600;
    border-left: 3px solid #7dd3fc;
    padding-left: 17px;
  }

  .docs-content {
    padding: 16px;
    max-width: 100%;
    overflow: visible !important;
  }
}
