* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px;
}

.header {
    text-align: center;
    padding: 10px;
    background-color: #2c3e50;
    color: white;
    border-radius: 8px 8px 0 0;
}

.header h1 {
    font-size: 1.4em;
    margin: 0;
}

.diagram-description {
    text-align: center;
    padding: 10px;
    background-color: #ecf0f1;
    font-size: 0.9em;
    color: #555;
}

#network {
    width: 100%;
    height: 450px;
    border: 1px solid #ddd;
    background-color: white;
}

.details-panel {
    background-color: #fff;
    border: 1px solid #ddd;
    border-top: none;
    padding: 15px;
    min-height: 100px;
}

.details-panel h3 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 1.1em;
}

.details-content {
    font-size: 0.9em;
    line-height: 1.5;
}

.details-content h4 {
    color: #2c3e50;
    margin: 10px 0 5px 0;
}

.details-content .label {
    font-weight: bold;
    color: #555;
}

.loop-info {
    margin: 8px 0;
    padding: 8px;
    border-radius: 4px;
}

.loop-info.reinforcing {
    background-color: #ffe6e6;
    border-left: 3px solid #dc3545;
}

.loop-info.balancing {
    background-color: #e6ffe6;
    border-left: 3px solid #28a745;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px;
    background-color: #ecf0f1;
    border-radius: 0 0 8px 8px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85em;
}

.legend-color {
    width: 30px;
    height: 4px;
    border-radius: 2px;
}

.legend-color.positive {
    background-color: #28a745;
}

.legend-color.negative {
    background-color: #dc3545;
}

.legend-loop {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.legend-loop.reinforcing {
    background-color: #dc3545;
}

.legend-loop.balancing {
    background-color: #28a745;
}

.error {
    color: #dc3545;
    padding: 10px;
    background-color: #ffe6e6;
    border-radius: 4px;
}

/* Hide header and details for iframe embedding */
body.menu-hidden .header,
body.menu-hidden .diagram-description,
body.menu-hidden .details-panel {
    display: none;
}

body.menu-hidden #network {
    height: 500px;
    border-radius: 8px;
}

body.menu-hidden .legend {
    border-radius: 8px;
}
