/* Custom styles for Mermaid diagrams - GitHub Pages compatible */
.mermaid {
    text-align: center;
    margin: 2em 0;
    background-color: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* Ensure diagrams are properly sized */
.mermaid svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* GitHub-compatible styling for diagram elements */
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node ellipse,
.mermaid .node polygon {
    fill: #f6f8fa !important;
    stroke: #586069 !important;
    stroke-width: 1.5px !important;
}

.mermaid .node .label,
.mermaid text {
    fill: #24292e !important;
    color: #24292e !important;
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif !important;
    font-size: 14px !important;
}

.mermaid .edgePath .path {
    stroke: #586069 !important;
    stroke-width: 1.5px !important;
}

.mermaid .edgeLabel {
    background-color: #ffffff !important;
    border-radius: 3px !important;
    padding: 2px 4px !important;
}

/* Flowchart specific styling */
.mermaid .flowchart-link {
    stroke: #586069 !important;
    fill: none !important;
}

.mermaid .marker {
    fill: #586069 !important;
}

/* Decision nodes (diamonds) */
.mermaid .node.decision rect,
.mermaid .node.decision polygon {
    fill: #fff3cd !important;
    stroke: #856404 !important;
}

/* Start/End nodes */
.mermaid .node.start rect,
.mermaid .node.end rect {
    fill: #d4edda !important;
    stroke: #155724 !important;
}

/* Process nodes */
.mermaid .node.process rect {
    fill: #f6f8fa !important;
    stroke: #586069 !important;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .mermaid {
        padding: 12px;
        margin: 1em 0;
        font-size: 12px;
    }
    
    .mermaid svg {
        max-height: 400px;
    }
}

/* Print styles */
@media print {
    .mermaid {
        border: 1px solid #000;
        background: #fff;
        break-inside: avoid;
    }
}

/* Loading state */
.mermaid[data-processed="false"] {
    position: relative;
    min-height: 100px;
}

.mermaid[data-processed="false"]:before {
    content: "📊 Loading diagram...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #586069;
    font-size: 14px;
}