/* ═══════════════════════════════════════════════════════════
   Agent MCP Warehouse - Help Documentation Stylesheet
   Light document style, independent from main site dark theme
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #ffffff;
  --sidebar-bg: #f8f9fb;
  --sidebar-width: 260px;
  --sidebar-border: #e2e5ea;
  --text: #1a1a2e;
  --text-secondary: #555;
  --text-dim: #8b8fa3;
  --link: #1a56db;
  --link-hover: #0f3fa3;
  --blue: #1a56db;
  --blue-light: #ebf0fa;
  --border: #e2e5ea;
  --code-bg: #f5f6f8;
  --card-bg: #f8f9fb;
  --card-hover-bg: #f0f2f5;
  --green: #10b981;
  --green-light: #ecfdf5;
  --orange: #f59e0b;
  --orange-light: #fffbeb;
  --cyan: #06b6d4;
  --cyan-light: #ecfeff;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "Fira Code", "Consolas", "JetBrains Mono", monospace;
  --max-content: 900px;
}

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  font-size: 15px;
}

/* ════════════════════ Layout ════════════════════ */

.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-title {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 8px;
}

.sidebar-title a {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
}

.sidebar-title .sub {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
  margin-top: 2px;
}

.sidebar-nav {
  list-style: none;
  padding: 4px 0;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  padding: 7px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.sidebar-nav li a:hover {
  color: var(--text);
  background: rgba(0,0,0,0.03);
}

.sidebar-nav li a:focus {
  outline: none;
  background: transparent;
}

.sidebar-nav li a:focus-visible {
  outline: none;
}

.sidebar-nav li a.active:focus {
  background: var(--blue-light);
}

.sidebar-nav li a.active {
  color: var(--blue);
  background: var(--blue-light);
  border-left-color: var(--blue);
  font-weight: 600;
}

.sidebar-nav .nav-section {
  padding: 16px 20px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav .sub-item a {
  padding-left: 36px;
  font-size: 13px;
}

/* ── Main Content ──────────────────────── */

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  max-width: calc(100vw - var(--sidebar-width));
}

/* ── Home layout (full-width cards, no flowchart) ── */

.home-content {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 48px 40px;
}

.home-content h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.home-content .subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.home-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.home-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 24px 0 12px;
}

.home-content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.home-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
}

.home-content th {
  background: var(--sidebar-bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.home-content td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.home-content ul, .home-content ol {
  margin: 12px 0 20px 24px;
  color: var(--text-secondary);
}

.home-content li {
  margin-bottom: 6px;
}

/* ── Agent cards (home page & overview pages) ── */

.agent-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.agent-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
}

.agent-card:hover {
  background: var(--card-hover-bg);
  border-color: #c8cdd5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.agent-card .card-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.agent-card.ba .card-badge {
  background: var(--green-light);
  color: #065f46;
}

.agent-card.pm .card-badge {
  background: var(--orange-light);
  color: #92400e;
}

.agent-card.sa .card-badge {
  background: var(--cyan-light);
  color: #155e75;
}

.agent-card .card-name {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.agent-card .card-role {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.agent-card .card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Task cards (agent overview pages) ── */

.task-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.task-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.task-card:hover {
  background: var(--card-hover-bg);
  border-color: #c8cdd5;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}

.task-card .task-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.task-card .task-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}

.task-card .task-arrow {
  font-size: 13px;
  color: var(--link);
  margin-top: 8px;
  font-weight: 600;
}

/* ── Task page layout (flowchart + content) ── */

.task-page {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 40px;
}

.task-page h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.task-page .skill-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.task-page h2 {
  margin-top: 40px;
  margin-bottom: 16px;
}

.task-page p {
  margin-bottom: 20px;
}

.task-page .mermaid-container {
  margin-top: 24px;
  margin-bottom: 24px;
}

/* Mermaid container - sticky */
.mermaid-container {
  position: sticky;
  top: 0;
  background: #fff;
  padding: 20px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  z-index: 10;
  max-height: 45vh;
  overflow-y: auto;
}

.mermaid-container .mermaid-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.mermaid-container .mermaid-hint span {
  color: var(--link);
  cursor: pointer;
}

.mermaid-container .mermaid {
  text-align: center;
}

.mermaid-container .mermaid svg {
  max-width: 100%;
}

/* Stage table */
.stage-summary {
  margin-bottom: 32px;
  overflow-x: auto;
}

.stage-summary table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stage-summary th {
  background: var(--sidebar-bg);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.stage-summary td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}

.stage-summary td:first-child {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--blue);
  white-space: nowrap;
}

/* Stage detail sections */
.stage-section {
  margin-bottom: 36px;
  padding-top: 20px;
}

.stage-section h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.stage-section h3 .stage-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  background: var(--code-bg);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-secondary);
  margin-right: 8px;
}

.stage-section h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 16px 0 8px;
}

.stage-section p {
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.stage-section ul, .stage-section ol {
  margin: 8px 0 16px 24px;
  color: var(--text-secondary);
}

.stage-section li {
  margin-bottom: 4px;
}

.stage-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 16px;
  font-size: 13px;
}

.stage-section th {
  background: var(--sidebar-bg);
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.stage-section td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.stage-section blockquote {
  border-left: 3px solid var(--blue);
  padding: 8px 16px;
  margin: 12px 0;
  background: var(--blue-light);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.stage-section code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  color: #c7254e;
}

.stage-section pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  margin: 12px 0 16px;
  font-size: 13px;
  line-height: 1.6;
}

.stage-section pre code {
  background: none;
  padding: 0;
  color: var(--text);
}

.stage-section hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ── Code blocks with copy ── */

.code-wrapper {
  position: relative;
  margin: 12px 0 16px;
}

.code-wrapper pre {
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--font);
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.copy-btn:hover {
  color: var(--link);
  border-color: var(--link);
}

.copy-btn.copied {
  color: var(--green);
  border-color: var(--green);
}

/* ── Install page tabs ── */

.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-secondary);
  margin-bottom: -2px;
  transition: all 0.15s;
}

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

.tab-btn.active {
  color: var(--link);
  border-bottom-color: var(--link);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── Screenshot placeholder ── */

.screenshot-placeholder {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  margin: 16px 0;
  background: var(--sidebar-bg);
  font-size: 14px;
}

.screenshot-placeholder .icon {
  font-size: 32px;
  margin-bottom: 8px;
  display: block;
}

/* ── Download cards ── */

.download-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin: 16px 0 24px;
}

.download-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.download-card .dc-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.download-card .dc-file {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
  font-family: var(--mono);
}

.download-card .dc-btn {
  display: inline-block;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s;
}

.download-card .dc-btn:hover {
  background: var(--link-hover);
}

/* ── Mobile (hamburger sidebar) ── */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s;
  }

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

  .main {
    margin-left: 0;
  }

  .hamburger {
    display: flex !important;
  }

  .home-content {
    padding: 24px 20px;
  }

  .task-page {
    padding: 24px 20px;
  }

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

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

  .mermaid-container {
    max-height: none;
    position: relative;
  }
}

.hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
}

/* ── Sidebar overlay for mobile ── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
}

.sidebar-overlay.visible {
  display: block;
}

/* ── Footer ── */

.page-footer {
  max-width: var(--max-content);
  margin: 40px auto 0;
  padding: 24px 40px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

/* ── Print ── */

@media print {
  .sidebar, .hamburger, .sidebar-overlay {
    display: none !important;
  }
  .main {
    margin-left: 0;
  }
  .mermaid-container {
    position: relative;
    max-height: none;
    page-break-inside: avoid;
  }
}
