.mermaid-wrapper {
  background: #0f172a;
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1.2rem 0;
  position: relative;
  overflow: hidden;
  border: 1px solid #1e293b;
}

.mermaid-wrapper .diagram-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--primary, #2563eb);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.mermaid-wrapper .diagram-title {
  color: #e2e8f0;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-left: 44px;
}

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

.mermaid-wrapper .zoom-controls button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.mermaid-wrapper .zoom-controls button:hover {
  background: #334155;
  color: #fff;
}

.mermaid-wrapper .mermaid {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
  transition: transform 0.2s ease;
  transform-origin: center center;
  background: #0f172a;
}

.mermaid-wrapper .mermaid svg {
  max-width: 100%;
  height: auto;
}

.mermaid-wrapper .diagram-note {
  color: #94a3b8;
  font-size: 0.8rem;
  margin-top: 0.8rem;
  padding: 0.5rem 0.8rem;
  background: rgba(148,163,184,0.08);
  border-radius: 8px;
  border-left: 3px solid var(--primary, #2563eb);
}

.mermaid-wrapper .diagram-note i {
  margin-right: 6px;
  color: var(--primary-light, #3b82f6);
}

@media print {
  .mermaid-wrapper {
    background: #fff !important;
    border: 2px solid #ccc !important;
    break-inside: avoid;
  }
  .mermaid-wrapper .diagram-badge,
  .mermaid-wrapper .zoom-controls {
    display: none !important;
  }
  .mermaid-wrapper .diagram-title {
    color: #1a2a3a !important;
  }
  .mermaid-wrapper .diagram-note {
    color: #4a5a6a !important;
    background: #f1f5f9 !important;
  }
}

@media (max-width: 768px) {
  .mermaid-wrapper {
    padding: 1rem;
    margin: 0.8rem 0;
  }
  .mermaid-wrapper .zoom-controls button {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }
}
