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

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

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

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

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

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

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

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

.api-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;
}

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

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

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

/* API Section */
.api-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);
}

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

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

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

.base-url,
.auth-header {
  color: #cbd5e1;
  font-size: 14px;
  margin-bottom: 12px;
}

.base-url strong {
  color: #e2e8f0;
}

/* Endpoint Card */
.endpoint {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid rgba(125, 211, 252, 0.12);
  overflow: hidden;
}

.endpoint-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
  gap: 12px;
}

.endpoint-header:hover {
  background: rgba(56, 189, 248, 0.08);
}

.endpoint-body {
  padding: 16px;
  border-top: 1px solid rgba(56, 189, 248, 0.12);
  display: none;
}

.endpoint-body.show {
  display: block;
}

/* HTTP Method Badges */
.method {
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  min-width: 60px;
  text-align: center;
}

.method.get { background: #10b981; color: white; }
.method.post { background: #3b82f6; color: white; }
.method.put { background: #f59e0b; color: white; }
.method.delete { background: #ef4444; color: white; }
.method.patch { background: #8b5cf6; color: white; }

.endpoint-path {
  font-family: 'Courier New', monospace;
  color: #e2e8f0;
  font-size: 14px;
  flex: 1;
}

.endpoint-desc {
  color: #94a3b8;
  font-size: 13px;
}

.expand-icon {
  color: #64748b;
  font-size: 10px;
  transition: transform 0.2s;
}

.endpoint-header.expanded .expand-icon {
  transform: rotate(90deg);
}

/* Parameter Table */
.param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.param-table th,
.param-table td {
  padding: 10px 12px;
  text-align: left;
  border: 1px solid rgba(139, 156, 255, 0.1);
}

.param-table th {
  background: rgba(139, 156, 255, 0.1);
  color: #a5b4fc;
  font-weight: 600;
}

.param-table td {
  color: #cbd5e1;
}

.param-required {
  color: #ef4444;
  margin-left: 2px;
}

/* Code Blocks */
.code-block {
  background: #0d1117;
  border-radius: 6px;
  margin: 12px 0;
  border: 1px solid rgba(139, 156, 255, 0.1);
  overflow: hidden;
}

.code-block pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  color: #e2e8f0;
}

.api-section pre {
  background: #0d1117;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid rgba(139, 156, 255, 0.1);
}

.api-section code {
  background: rgba(139, 156, 255, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #f0abfc;
}

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

/* Response Codes */
.response-code {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 8px;
}

.response-code.success { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.response-code.error { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.response-code.warning { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }

/* Notes */
.api-note {
  background: rgba(99, 102, 241, 0.12);
  border-left: 3px solid #8b5cf6;
  padding: 10px 12px;
  margin: 12px 0;
  color: #cbd5e1;
}

/* Protocol Labels */
.protocol-label {
  font-weight: 600;
}

.protocol-label.protocol-http { color: #10b981; }
.protocol-label.protocol-https { color: #06b6d4; }
.protocol-label.protocol-ssh { color: #8b5cf6; }
.protocol-label.protocol-tcp { color: #f59e0b; }
.protocol-label.protocol-udp { color: #ef4444; }

/* 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 ─── */
@media (max-width: 800px) {
  /* Unlock ALL scroll-blocking ancestors.
     .app-content is position:fixed in base.css — must undo on mobile. */
  html, body, body.api-page, body.public-page, body.public-page.api-page {
    overflow: auto !important;
    height: auto !important;
    min-height: 0 !important;
    position: static !important;
  }
  body.api-page .app-content,
  body.public-page.api-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, .api-container, .api-main,
  body.api-page .container,
  body.public-page.api-page .container {
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
    position: static !important;
  }
  .api-wrapper {
    flex-direction: column;
    height: auto !important;
    overflow: visible !important;
    padding-top: calc(var(--app-header-height, 52px) + 48px);
  }

  /* Sidebar → fixed dropdown bar pinned below the header */
  .api-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;
  }
  .api-sidebar h4 { display: none; }

  /* Toggle button (shared class with docs) */
  .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 */
  .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;
  }

  .api-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;
    white-space: normal;
  }
  .api-sidebar a:hover {
    background: rgba(56, 189, 248, 0.06);
    color: #e2e8f0;
  }
  .api-sidebar a.active {
    background: rgba(56, 189, 248, 0.10);
    color: #7dd3fc;
    font-weight: 600;
    border-left: 3px solid #7dd3fc;
    padding-left: 17px;
  }

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

  /* Content overflow fixes — keep section/menu layout untouched */
  .api-section { overflow-wrap: break-word; word-wrap: break-word; min-width: 0; }
  .param-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .code-block pre, .api-section pre {
    white-space: pre;
    -webkit-overflow-scrolling: touch;
  }
  .endpoint-header { flex-wrap: wrap; }
  .endpoint-path { flex-basis: 100%; word-break: break-all; }
  .endpoint-desc { flex-basis: 100%; }
}
