/* Zoom overlay — covers entire viewport */
#mermaid-zoom-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.88);
  z-index: 99999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Toolbar */
.mermaid-zoom-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  margin: 16px 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  user-select: none;
  z-index: 100000;
}

.mermaid-zoom-toolbar button {
  width: 36px;
  height: 36px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mermaid-zoom-toolbar button:hover {
  background: #e0e0e0;
}

#mzm-level {
  min-width: 48px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}

/* Scroll container — fills available space; produces scrollbars when the
   wrapper grows past the viewport (i.e. when zoom * SVG size exceeds box). */
#mzm-box {
  flex: 1;
  width: 100%;
  overflow: auto;
}

/* Wrapper — at least viewport-sized so flex centering keeps small SVGs in
   the middle; grows beyond viewport when SVG style.width/height exceeds it. */
#mzm-wrap {
  min-width: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

/* SVG — sized via JS-set style.width/height (vector re-render at every step).
   flex-shrink:0 prevents the flex container from squashing it back to fit. */
#mzm-wrap svg {
  background: white;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  cursor: grab;
  flex-shrink: 0;
}

/* Fix black node labels: Material theme CSS bleeds into mermaid's
   <foreignObject> HTML content inside SVGs. Reset backgrounds so
   node labels are visible against the themed rect fills. */
.mermaid svg foreignObject > * {
  background: transparent !important;
  background-color: transparent !important;
  color-scheme: light !important;
}

.mermaid svg .nodeLabel,
.mermaid svg .edgeLabel,
.mermaid svg .label {
  background: transparent !important;
  background-color: transparent !important;
}

/* Clickable hint on diagrams */
div.mermaid[data-zoomable] {
  cursor: pointer;
  transition: outline 0.15s;
}

div.mermaid[data-zoomable]:hover {
  outline: 2px solid #4CAF50;
  outline-offset: 4px;
  border-radius: 4px;
}
