/* System Diagram Styles */

#system-diagram-container {
    /* Full width, breaking out of content wrapper */
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    margin-top: 0;
    /* No top margin */
    margin-bottom: 0;
    background: transparent;
    /* Transparent to show page background */
    padding: 0 1rem 0 1rem;
    /* No top padding */
    border-radius: 0;
    /* No border radius for full width */
    border: none;
    /* No border on outer container */
    box-shadow: none;
    /* No shadow on outer container */
    height: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Wrapper to hold specific pixel dimensions */
#diagram-inner {
    position: relative;
    width: 1200px;
    height: 800px;
    margin: 0 auto;
    /* Center within container */
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 3px solid #2C3E50;
    transform: scale(0.85);
    transform-origin: center center;
}

/* SVG Layer */
.diagram-svg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    /* Lines below components so components can be interacted with */
    pointer-events: all;
    /* Allow line hovers */
}

/* Connection Lines */
.connection-line {
    cursor: pointer;
    stroke-width: 20;
    /* Wide for easy clicking */
    opacity: 0;
    /* Invisible hit area */
}

.connection-visible {
    pointer-events: none;
    /* Don't interfere with hit area */
    stroke-width: 4;
    opacity: 1;
}


/* Components */
.sys-component {
    position: absolute;
    width: 130px;
    /* Slightly wider */
    height: 110px;
    cursor: pointer;
    z-index: 10;
    pointer-events: auto;
    /* Re-enable events since container is none */
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: rotate(-1deg);
}

.sys-component:nth-of-type(even) {
    transform: rotate(1deg);
}

.sys-component:hover {
    transform: scale(1.1) rotate(0deg);
    z-index: 20;
}

.sys-comp-box {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 12px;
    border: 3px solid #2C3E50;
    box-shadow: 5px 5px 0px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    pointer-events: none;
    /* Let clicks pass to parent */
}

.sys-comp-icon {
    width: 40px;
    height: 40px;
    background: #f1f3f5;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.sys-comp-img {
    max-width: 100%;
    max-height: 60px;
    object-fit: contain;
    margin-bottom: 0.5rem;
    display: block;
}

.sys-comp-label {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #2C3E50;
    text-align: center;
    line-height: 1.2;
}

/* Color Variants */
/* Color Variants matching site theme */
.sys-component.color-yellow .sys-comp-box {
    border-color: #FFC038;
}

.sys-component.color-red .sys-comp-box {
    border-color: #FF6B6B;
}

.sys-component.color-blue .sys-comp-box {
    border-color: #5A7C9E;
}

.sys-component.color-green .sys-comp-box {
    border-color: #66BB6A;
}

.sys-component.color-purple .sys-comp-box {
    border-color: #9B7EDE;
}

/* Tooltips */
.diagram-tooltip {
    position: absolute;
    background: #2C3E50;
    color: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 100;
    width: 300px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1rem;
    pointer-events: none;
    /* Prevent tooltip from interfering with hover detection */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    visibility: hidden;
}

.diagram-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.tooltip-desc {
    margin-bottom: 0.8rem;
    line-height: 1.5;
    color: #ecf0f1;
}

.tooltip-input {
    width: 100%;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
}

/* Legend */
.diagram-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    border: 3px solid #2C3E50;
    z-index: 30;
    font-family: 'Quicksand', sans-serif;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 0.8rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.legend-color {
    width: 50px;
    height: 6px;
    border-radius: 3px;
}