/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #f5f5f5;
}

/* Layout Structure */
.toolbox-layout {
    display: flex;
    gap: 20px;
    height: 85vh;
}

.left-col {
    width: 320px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    overflow-y: auto;
}

.network-container {
    flex: 1;
    background: white;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    min-height: 600px;
}

.right-col {
    width: 280px;
    background: white;
    padding: 15px;
    border-radius: 8px;
}

/* Network Visualization */
.network-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.network-node {
    position: absolute;
    background: white;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 8px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
    min-width: 90px;
    max-width: 140px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.network-node:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Node Types */
.network-node.management {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.network-node.system {
    background: #f3e5f5;
    border-color: #9c27b0;
    color: #6a1b9a;
}

.network-node.output {
    background: #fff3e0;
    border-color: #ff9800;
    color: #e65100;
}

/* Node States */
.network-node.selected {
    border-color: #ff4444;
    border-width: 3px;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.7);
}

.network-node.affected {
    border-color: #2196f3;
    border-width: 3px;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
}

/* Health Display */
.health-display {
    margin-top: 6px;
    display: flex;
    justify-content: center;
    gap: 2px;
}

.health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    transition: background 0.3s;
}

.health-dot.filled {
    background: linear-gradient(45deg, #4caf50, #8bc34a);
}

.health-score {
    font-size: 9px;
    color: #666;
    margin-top: 2px;
}

/* Connection Lines */
.connection-line {
    stroke: #ccc;
    stroke-width: 2;
    fill: none;
    opacity: 0.3;
    transition: all 0.3s;
}

.connection-line.positive {
    stroke: #4caf50;
    stroke-dasharray: none;
}

.connection-line.negative {
    stroke: #f44336;
    stroke-dasharray: 8, 4;
}

.connection-line.active {
    opacity: 1;
    stroke-width: 3;
}

.connection-line.flow {
    animation: flow 1s ease-in-out;
}

.connection-arrow {
    fill: #ccc;
    transition: all 0.3s;
}

.connection-arrow.positive {
    fill: #4caf50;
}

.connection-arrow.negative {
    fill: #f44336;
}

.connection-arrow.active {
    opacity: 1;
}

/* PDF Link */
.pdf-link {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: #4caf50;
    border-radius: 50%;
    color: white;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.pdf-link:hover {
    opacity: 1;
    background: #2e7d32;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

th {
    background: #f0f0f0;
    font-weight: bold;
}

/* Options and Labels */
.option-label {
    display: block;
    margin: 4px 0;
    font-size: 12px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.option-label:hover {
    background: #f9f9f9;
}

.option-label.selected {
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
}

.goal-link {
    color: #4caf50;
    text-decoration: none;
    font-weight: bold;
}

.management-label {
    font-weight: bold;
    background: #f8f8f8;
}

/* Impact Display */
.impact-row {
    display: flex;
    align-items: center;
    margin: 10px 0;
}

.impact-label {
    width: 120px;
    font-size: 12px;
}

.impact-bar {
    flex: 1;
    height: 18px;
    background: linear-gradient(to right, #f44336, #ff9800, #4caf50);
    border-radius: 9px;
    position: relative;
    margin-left: 8px;
}

.impact-marker {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 14px;
    background: #333;
    border-radius: 2px;
    transition: left 0.5s ease;
}

.impact-value {
    font-size: 11px;
    color: #666;
    margin-left: 8px;
    width: 25px;
}

.overall-label {
    font-weight: bold;
    font-size: 13px;
}

/* Typography */
h1, h2 {
    color: #333;
    margin-top: 0;
}

.header-title {
    text-align: center;
    margin-bottom: 20px;
}

.green-text {
    color: #4caf50;
}

/* Legend */
.legend {
    margin-top: 20px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    font-size: 11px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 5px 0;
}

.legend-box {
    width: 20px;
    height: 15px;
    border-radius: 3px;
    margin-right: 8px;
}

.legend-line {
    width: 20px;
    height: 2px;
    margin-right: 8px;
}

/* PDF Note */
.pdf-note {
    font-size: 10px;
    color: #666;
    margin-top: 10px;
    padding: 8px;
    background: #f0f0f0;
    border-radius: 4px;
}

/* Buttons */
.reset-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.reset-btn:hover {
    background: #d32f2f;
}

/* Animations */
@keyframes flow {
    0% {
        stroke-dasharray: 0, 20;
    }
    50% {
        stroke-dasharray: 10, 10;
    }
    100% {
        stroke-dasharray: 20, 0;
    }
}