/* --- Mermaid diagrams: wide layout + click to expand --- */

/* Mermaid diagrams: proper sizing */
.mermaid {
  overflow: auto;
  max-width: 100%;
  position: relative;
  text-align: center;
}

.mermaid svg {
  display: block;
  margin: 0 auto;
}

/* When zoom is bound: show cursor + border + hint */
.mermaid[data-zoom-bound] {
  cursor: zoom-in !important;
  border: 1px dashed rgba(100, 140, 255, 0.25);
  border-radius: 6px;
  padding: 4px;
}

.mermaid[data-zoom-bound]:hover {
  border-color: rgba(100, 140, 255, 0.6);
  background: rgba(100, 140, 255, 0.03);
}

/* Expand icon badge - always visible */
.mermaid[data-zoom-bound]::before {
  content: "\2922";  /* ⤢ expand arrows unicode */
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(100, 140, 255, 0.85);
  color: #fff;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 4px;
  font-size: 16px;
  z-index: 3;
  pointer-events: none;
}

/* Hover hint text */
.mermaid[data-zoom-bound]::after {
  content: "Click to expand";
  position: absolute;
  top: 8px;
  right: 42px;
  background: rgba(0, 0, 0, 0.75);
  color: #ddd;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.72rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 3;
  white-space: nowrap;
}

.mermaid[data-zoom-bound]:hover::after {
  opacity: 1;
}

/* --- Fullscreen overlay --- */

#mermaid-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 10, 20, 0.95);
  cursor: zoom-out;
  overflow: auto;
  justify-content: center;
  align-items: center;
}

#mermaid-overlay.active {
  display: flex;
}

/* Controls hint bar */
.mermaid-overlay-hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: rgba(255, 255, 255, 0.6);
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.75rem;
  z-index: 10000;
  pointer-events: none;
  white-space: nowrap;
}

/* Grab cursor for pan */
#mermaid-overlay .mermaid-overlay-content {
  cursor: grab;
}

#mermaid-overlay .mermaid-overlay-content:active {
  cursor: grabbing;
}

.mermaid-overlay-content {
  width: fit-content;
  max-width: calc(100vw - 64px);
  max-height: calc(100vh - 160px);
  overflow: visible;
  padding: 20px;
  background: #1e1e2e;
  border-radius: 8px;
}

.mermaid-overlay-content svg {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: calc(100vh - 192px) !important;
}
