/* Docs Page Styles */
/* Import common styles */
@import url('/common.css');

/* Light theme overrides for docs content */
:root {
  --docs-bg: #f5f5f5;
  --docs-bg2: #ffffff;
  --docs-bg3: #f1f5f9;
  --docs-text: #1a1a1a;
  --docs-text2: #666666;
  --docs-border: #e0e0e0;
}

body {
  background: var(--docs-bg);
  color: var(--docs-text);
}

/* Sidebar navigation */
.sidebar {
  background: var(--docs-bg2);
  border-color: var(--docs-border);
}
.sidebar nav a {
  display: block;
  padding: 8px 12px;
  color: var(--docs-text2);
  text-decoration: none;
  border-radius: 6px;
  margin-bottom: 4px;
  transition: all 0.2s;
}
.sidebar nav a:hover {
  background: var(--docs-bg3);
  color: var(--accent);
}
.sidebar nav a.active {
  background: var(--accent);
  color: white;
}

.nav-group {
  margin-bottom: 16px;
}
.nav-group-title {
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--docs-text2);
  letter-spacing: 1px;
  display: block;
  padding: 8px 0 4px;
  margin-bottom: 4px;
}
.nav-subitems {
  margin-left: 0;
  border-left: none;
  padding-left: 0;
}
.nav-subitems a {
  font-size: 12px;
}

/* Content Area */
.content-area {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.content {
  background: var(--docs-bg2);
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  /* Keep vertical scrolling on .content-area so sticky works correctly */
  overflow-x: visible;
  max-width: 100%;
}

/* Typography */
.content h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 20px;
  border-bottom: 3px solid var(--accent);
  padding-bottom: 10px;
  letter-spacing: -0.5px;
}

.content h2 {
  font-size: 20px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 14px;
  color: var(--docs-text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--docs-border);
}

.content h3 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 10px;
  color: var(--docs-text);
}

.content h4 {
  font-size: 14px;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--docs-text2);
}

.content p {
  margin-bottom: 12px;
  line-height: 1.6;
}

/* Code */
.content code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 13px;
  color: #0f172a;
  border: 1px solid #e2e8f0;
}

.content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.5;
}

.content pre.mermaid {
  /* Mermaid is rendered into SVG; don't treat it like a code block */
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  overflow: visible;
  margin: 0;
}

.content pre.mermaid code {
  background: none;
  padding: 0;
  border: none;
  color: inherit;
}

.content pre code {
  background: none;
  padding: 0;
  color: inherit;
  border: none;
  font-size: inherit;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: 8px;
  border: 1px solid var(--docs-border);
}

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

.content th,
.content td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--docs-border);
  text-align: left;
}

.content td {
  max-width: 500px;
  vertical-align: middle;
  word-break: break-all;
}

.content th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--docs-text2);
}

.content tr:hover td {
  background: #f8fafc;
}

/* Blockquote */
.content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  margin: 12px 0;
  background: #f8fafc;
  border-radius: 0 6px 6px 0;
  color: var(--docs-text2);
  font-size: 14px;
}

/* Lists */
.content ul,
.content ol {
  margin: 10px 0;
  padding-left: 20px;
}
.content li {
  margin-bottom: 6px;
  line-height: 1.5;
}

/* Links */
.content a {
  color: var(--accent);
  text-decoration: none;
}
.content a:hover {
  text-decoration: underline;
}

/* HR */
.content hr {
  border: none;
  border-top: 1px solid var(--docs-border);
  margin: 16px 0;
}

/* GraphQL Operations */
.gql-ops-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.ops-group {
  border: 1px solid var(--docs-border);
  background: var(--docs-bg3);
  border-radius: 10px;
  margin: 10px 0;
  overflow: hidden;
}
.ops-group > summary {
  list-style: none;
}
.ops-group > summary::-webkit-details-marker {
  display: none;
}
.ops-group > summary::marker {
  content: '';
}
.ops-group__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  color: var(--docs-text);
  /* Top-level row: keep most prominent within the group */
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.1px;
}
.ops-group__summary:hover {
  background: rgba(59, 130, 246, 0.08);
}
.ops-group__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ops-group__title::before {
  content: '';
  /* Smaller chevron */
  width: 6px;
  height: 6px;
  border-right: 1px solid rgba(102, 102, 102, 0.85);
  border-bottom: 1px solid rgba(102, 102, 102, 0.85);
  transform: rotate(-45deg);
  transform-origin: 50% 50%;
  transition: transform 0.15s ease;
}
.ops-group[open] .ops-group__title::before {
  transform: rotate(45deg);
}
.ops-group__count {
  font-size: 11px;
  font-weight: 650;
  color: var(--docs-text2);
  background: rgba(148, 163, 184, 0.25);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
}
.ops-group .gql-ops-list {
  margin: 8px 12px 12px;
}
.ops-group p {
  margin: 8px 12px 0;
}
.ops-group p strong {
  margin: 0;
}

/* Toggle filters for operation groups */
.dataflow-page-flows {
  position: relative;
}
.ops-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.12);
  border-radius: 10px;
  position: sticky;
  top: 0;
  z-index: 6;
  backdrop-filter: blur(6px);
}
.ops-filters__label {
  font-size: 12px;
  font-weight: 650;
  color: var(--docs-text2);
  margin-right: 2px;
}
.ops-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--docs-text);
  user-select: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.6);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}
.ops-toggle:hover {
  border-color: rgba(59, 130, 246, 0.45);
}
.ops-toggle.is-on {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.55);
  color: var(--docs-text);
}
.ops-toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

/* Secondary labels inside groups (Queries/Mutations) */
.ops-group strong {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--docs-text2);
}
.gql-ops-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0;
}

.gql-op {
  cursor: pointer;
  padding: 2px 8px;
  background: #dbeafe;
  border-radius: 4px;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  font-weight: 500;
  transition: all 0.15s;
  display: inline-block;
  margin: 2px;
}
.gql-op:hover {
  background: #bfdbfe;
  border-color: #60a5fa;
}
.gql-op.mutation {
  background: #fce7f3;
  border-color: #f9a8d4;
  color: #be185d;
}
.gql-op.mutation:hover {
  background: #fbcfe8;
  border-color: #f472b6;
}

/* Component References */
.gql-ref {
  cursor: pointer;
  padding: 2px 8px;
  background: #f0fdf4;
  border-radius: 4px;
  border: 1px solid #86efac;
  color: #166534;
  font-weight: 500;
  transition: all 0.15s;
  display: inline-block;
  margin: 2px;
}
.gql-ref:hover {
  background: #dcfce7;
  border-color: #4ade80;
}
.gql-ref.mutation {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

/* More Button */
.gql-more {
  cursor: pointer;
  padding: 2px 8px;
  background: #e2e8f0;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-weight: 500;
  transition: all 0.15s;
  display: inline-block;
  margin: 2px;
}
.gql-more:hover {
  background: #cbd5e1;
}
.gql-more.mutation {
  background: #fce7f3;
  border-color: #f9a8d4;
  color: #be185d;
}

/* Mermaid Diagrams */
.mermaid-container {
  position: relative;
  background: var(--docs-bg3);
  border-radius: 8px;
  margin: 16px 0;
  overflow: hidden;
}

.mermaid-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 10;
}

.mermaid-controls-spacer {
  flex: 1;
}

.mermaid-iconbtn {
  width: 34px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid var(--docs-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  color: #1a1a1a;
}
.mermaid-iconbtn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.mermaid-iconbtn.is-ok {
  background: #22c55e;
  border-color: #22c55e;
  color: white;
}
.mermaid-iconbtn.is-fail {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
}
.mermaid-iconbtn svg {
  display: block;
}

/* Legacy button styles (kept for any non-icon controls) */
.mermaid-controls button:not(.mermaid-iconbtn) {
  background: #ffffff;
  border: 1px solid var(--docs-border);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  color: #1a1a1a;
}
.mermaid-controls button:not(.mermaid-iconbtn):hover {
  background: var(--accent);
  color: white;
}

.mermaid-wrapper {
  overflow: hidden;
  padding: 24px;
  min-height: 360px;
  cursor: grab;
  position: relative;
}
.mermaid-wrapper.dragging {
  cursor: grabbing;
}

.mermaid-inner {
  transform-origin: 0 0;
  transition: none;
  display: inline-block;
}
.mermaid {
  display: inline-block;
}

.mermaid .node rect,
.mermaid .node circle,
.mermaid .node ellipse,
.mermaid .node polygon {
  cursor: pointer;
  transition: all 0.2s;
}
.mermaid .node:hover rect,
.mermaid .node:hover circle {
  filter: brightness(1.1);
  stroke-width: 3px;
}

/* Detail Modal (docs specific) */
.detail-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.detail-modal.open {
  display: flex;
}

.detail-modal-content {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  color: #1a1a1a;
}

.detail-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--docs-border);
  word-break: break-all;
  gap: 8px;
}

.detail-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--docs-text2);
}

.detail-section {
  margin-bottom: 16px;
}
.detail-section h4 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--docs-text2);
  margin-bottom: 6px;
}
.detail-section p {
  margin: 0;
  padding: 8px 12px;
  background: var(--docs-bg3);
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 13px;
}

.detail-badges {
  padding: 8px 12px;
  background: var(--docs-bg3);
  border-radius: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.detail-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  margin-right: 6px;
}

.detail-badges .detail-badge {
  margin-right: 0;
}
.detail-badge.query {
  background: #dbeafe;
  color: #1d4ed8;
}
.detail-badge.mutation {
  background: #fce7f3;
  color: #be185d;
}
.detail-badge.context {
  background: #d1fae5;
  color: #047857;
}
.detail-badge.fragment {
  background: #e0e7ff;
  color: #4338ca;
}
.detail-badge.component {
  background: #f0fdf4;
  color: #166534;
}
.detail-badge.operation {
  background: #f1f5f9;
  color: #475569;
}

.detail-badge.confidence {
  cursor: help;
  color: #fff;
}
.detail-badge.confidence.likely {
  background: #f59e0b;
}

/* Regenerate Button */
.regenerate-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 24px;
}
.regenerate-btn:hover {
  background: #0052a3;
}
