/* =============================================================================
   Smart Supply Pro Docs Theme
   - Centralized colors via CSS variables
   - Dark header + dark sidebar + readable content surface
   - Works with your classes: .topbar, .layout, .sidebar, .content, .toc, .doc-body
   ========================================================================== */

:root {
  /* Surfaces */
  --bg: #0b1220;            /* page background */
  --surface: #0f1b2d;       /* cards/content surface */
  --surface-2: #0c1626;     /* sidebar surface */
  --surface-3: rgba(9, 14, 25, 0.72); /* topbar translucent */
  --border: rgba(148, 163, 184, 0.18);

  /* Text */
  --text: #e5e7eb;
  --muted: #a7b0c0;
  --heading: #f3f4f6;

  /* Accent */
  --accent: #38bdf8;        /* cyan */
  --accent-2: #22c55e;      /* optional green for badges/success */
  --link: #7dd3fc;

  /* Code */
  --code-bg: #0b1424;
  --code-border: rgba(125, 211, 252, 0.18);

  /* Layout */
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --maxw: 1200px;
}

/* Base */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(56, 189, 248, 0.18), transparent 55%),
              radial-gradient(900px 500px at 90% 0%, rgba(34, 197, 94, 0.10), transparent 55%),
              var(--bg);
  color: var(--text);
  line-height: 1.55;
}

/* Links */
a {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }
a:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface-3);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--heading);
  text-decoration: none;
}
.logo:hover { text-decoration: none; opacity: 0.92; }

.nav {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.nav a {
  color: var(--muted);
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
}
.nav a:hover {
  color: var(--heading);
  background: rgba(148, 163, 184, 0.10);
  text-decoration: none;
}

/* Main layout */
.layout {
  max-width: var(--maxw);
  margin: 1.25rem auto 0;
  padding: 0 1.25rem 2rem;
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 1.25rem;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 74px; /* below topbar */
  align-self: start;
  max-height: calc(100vh - 90px);
  overflow: auto;

  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.sidebar h2 {
  margin: 0.25rem 0 0.75rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.sidebar li { margin: 0.25rem 0; }

.sidebar a {
  display: block;
  padding: 0.42rem 0.55rem;
  border-radius: 10px;
  color: var(--text);
}
.sidebar a:hover {
  background: rgba(56, 189, 248, 0.10);
  text-decoration: none;
}
.sidebar a:active {
  background: rgba(56, 189, 248, 0.16);
}

/* Content area */
.content {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* Optional TOC */
.toc {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.toc h2 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.toc ul { margin: 0; padding-left: 1.1rem; }
.toc a { color: var(--muted); }
.toc a:hover { color: var(--heading); text-decoration: none; }

/* Doc body card */
.doc-body {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow);
}

/* Typography */
.doc-body h1, .doc-body h2, .doc-body h3, .doc-body h4 {
  color: var(--heading);
  line-height: 1.25;
  margin-top: 1.2rem;
}
.doc-body h1 { font-size: 1.8rem; margin-top: 0.2rem; }
.doc-body h2 { font-size: 1.35rem; }
.doc-body h3 { font-size: 1.15rem; }
.doc-body p { color: var(--text); }
.doc-body li { color: var(--text); }

.doc-body hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.doc-body blockquote {
  margin: 1rem 0;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.06);
  border-radius: 10px;
  color: var(--text);
}

/* Code */
.doc-body pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  overflow: auto;
}

.doc-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: 0.12rem 0.3rem;
  border-radius: 8px;
}

.doc-body pre code {
  background: transparent;
  border: 0;
  padding: 0;
}

/* Tables */
.doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.doc-body th, .doc-body td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.doc-body th {
  color: var(--heading);
  background: rgba(255,255,255,0.05);
  font-weight: 650;
}

.doc-body tr:hover td {
  background: rgba(56, 189, 248, 0.05);
}

/* Footer */
.footer {
  max-width: var(--maxw);
  margin: 1.5rem auto 2.5rem;
  padding: 0 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    top: 0;
    max-height: none;
  }
  .topbar-inner {
    align-items: flex-start;
  }
}
/* =============================================================================
   Mermaid diagrams – improve contrast on dark background
   ========================================================================== */

.mermaid {
  background: transparent;
}

/* Main flow lines */
.mermaid .edgePath path {
  stroke: #7dd3fc !important;          /* cyan, readable */
  stroke-width: 2.2px !important;
}

/* Arrow heads */
.mermaid .arrowheadPath {
  fill: #7dd3fc !important;
  stroke: #7dd3fc !important;
}

/* Node borders */
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node ellipse,
.mermaid .node polygon {
  stroke: #38bdf8 !important;
  stroke-width: 1.8px !important;
  fill: #0f1b2d !important;             /* matches content surface */
}

/* Node labels */
.mermaid .nodeLabel {
  color: #e5e7eb !important;
  fill: #e5e7eb !important;
  font-weight: 500;
}

/* Edge labels */
.mermaid .edgeLabel {
  background-color: #0f1b2d !important;
  color: #e5e7eb !important;
  padding: 2px 6px;
  border-radius: 6px;
}

/* Subgraph (cluster) */
.mermaid .cluster rect {
  stroke: rgba(125, 211, 252, 0.6) !important;
  fill: rgba(125, 211, 252, 0.08) !important;
  stroke-dasharray: 4 3;
}

/* Sequence diagrams */
.mermaid .actor line {
  stroke: #94a3b8 !important;
}

.mermaid .messageLine0,
.mermaid .messageLine1 {
  stroke: #7dd3fc !important;
  stroke-width: 2px !important;
}

.mermaid .messageText {
  fill: #e5e7eb !important;
}

/* Notes */
.mermaid .note rect {
  fill: #0c1626 !important;
  stroke: #38bdf8 !important;
}

.mermaid .note text {
  fill: #e5e7eb !important;
}

/* =============================================================================
   Mermaid – FORCE edge/arrow visibility (covers more diagram variants)
   Put this at the VERY END of docs.css so it wins the cascade.
   ========================================================================== */

:root {
  --mermaid-edge: #7dd3fc;   /* bright cyan */
  --mermaid-edge-w: 2.6px;
}

/* Many Mermaid diagrams render edges as plain <path> or <line> without edgePath */
.mermaid svg path[stroke],
.mermaid svg line[stroke] {
  stroke: var(--mermaid-edge) !important;
  stroke-width: var(--mermaid-edge-w) !important;
}

/* Specifically hit edge classes if present */
.mermaid .edgePath path,
.mermaid .flowchart-link,
.mermaid .link {
  stroke: var(--mermaid-edge) !important;
  stroke-width: var(--mermaid-edge-w) !important;
}

/* Arrowheads across multiple Mermaid versions/types */
.mermaid svg marker path,
.mermaid .arrowheadPath,
.mermaid .arrowMarkerPath {
  fill: var(--mermaid-edge) !important;
  stroke: var(--mermaid-edge) !important;
}

/* Some render arrowheads as polygons */
.mermaid svg marker polygon {
  fill: var(--mermaid-edge) !important;
  stroke: var(--mermaid-edge) !important;
}

/* Keep node borders as you already like them (don’t let the generic stroke rule ruin them) */
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node ellipse,
.mermaid .node polygon,
.mermaid .cluster rect,
.mermaid .note rect {
  stroke-width: 1.8px !important;
}

/* If you see dashed arrows: make the dash more readable */
.mermaid .edgePath path[stroke-dasharray] {
  stroke-dasharray: 6 4 !important;
}
