/* Network Architecture Diagram */
.homelab-diagram {
    width: 100%;
    margin-top: 4rem;
    position: relative;
}

.diagram-container {
    width: 100%;
    height: 600px; /* Specific height for the viewport */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    cursor: grab;
    touch-action: none; /* Prevent default touch actions like scroll */
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
}

.diagram-container:active {
    cursor: grabbing;
}

.diagram-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through if not on button */
}

.diagram-controls button {
    pointer-events: auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 30, 40, 0.8);
    color: var(--text-color, #fff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.diagram-controls button:hover {
    background: var(--primary-color, #3b82f6);
    color: white;
    transform: translateY(-2px);
}

#architecture-diagram {
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
    will-change: transform;
    transition: transform 0.1s ease-out; /* Smooth movement */
}

/* SVG Elements */
.connector-line {
    fill: none;
    stroke: var(--primary-color, #3b82f6);
    stroke-width: 2px;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: dash 3s ease-out forwards;
    opacity: 0.6;
    transition: stroke-width 0.3s ease, opacity 0.3s ease;
}

.connector-line:hover {
    stroke-width: 3px;
    opacity: 1;
    filter: drop-shadow(0 0 5px var(--primary-color, #3b82f6));
}

@keyframes dash {
    to {
        stroke-dashoffset: 0;
    }
}

.node-rect {
    fill: rgba(30, 41, 59, 0.8);
    stroke: var(--primary-color, #3b82f6);
    stroke-width: 2px;
    transition: all 0.3s ease;
}

.node-circle {
    fill: rgba(30, 41, 59, 0.8);
    stroke: var(--primary-color, #3b82f6);
    stroke-width: 2px;
    transition: all 0.3s ease;
}

.diagram-container svg text {
    fill: var(--text-color, #e2e8f0);
    font-family: inherit;
    pointer-events: none; /* Let clicks pass through text */
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    dominant-baseline: middle;
    text-anchor: middle;
}

.node-text--bold {
    font-weight: 700;
    font-size: 14px;
    fill: #fff !important;
}

.node-list-text {
    font-size: 12px;
    fill: #cbd5e1 !important;
    text-anchor: start !important;
    dominant-baseline: auto !important;
    text-shadow: none;
}

.node-list-sub {
    font-size: 11px;
    fill: #94a3b8 !important;
    text-anchor: start !important;
    dominant-baseline: auto !important;
    font-style: italic;
    text-shadow: none;
}

/* Hover effects for nodes */
g:hover > .node-rect,
g:hover > .node-circle {
    fill: rgba(59, 130, 246, 0.1);
    filter: drop-shadow(0 0 8px var(--primary-color, #3b82f6));
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .diagram-container {
        height: 450px;
    }
    
    .diagram-controls button {
        width: 35px;
        height: 35px;
    }

    /* Initial scale might need adjustment via JS for mobile */
}
