/* MicroSim Library Routing Table - layout and styling
   Fixed-height column: title row with the Next Request button, the request
   bar, Mermaid diagram, shared infobox panel. The height of <main> must equal
   the CANVAS_HEIGHT comment in microsim-library-routing-table.js. */

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
}

main {
    box-sizing: border-box;
    height: 535px;
    display: flex;
    flex-direction: column;
    background-color: aliceblue;
    border: 1px solid silver;
    overflow: hidden;
}

.sim-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 8px 14px 0 14px;
}

.sim-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: normal;
    color: #111;
}

.stepper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stepper button {
    font-size: 15px;
    padding: 3px 12px;
    cursor: pointer;
}

.step-label {
    font-size: 15px;
    color: #1f2937;
}

/* The request the reader has to route */
.request-bar {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 8px 14px 0 14px;
    padding: 6px 10px;
    background-color: white;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.3;
    color: #111;
}

.request-bar .label {
    font-weight: bold;
    flex: 0 0 auto;
}

mark {
    background-color: #b2dfdb;
    padding: 0 2px;
    border-radius: 2px;
}

/* Mermaid diagram: scales down with the container */
.diagram {
    flex: 0 0 auto;
    padding: 6px 10px 6px 10px;
    text-align: center;
}

.diagram svg {
    max-height: 300px;
}

.diagram .node {
    cursor: pointer;
    transition: opacity 0.15s;
}

.diagram .node:hover rect,
.diagram .node:hover polygon {
    filter: brightness(1.08);
}

.diagram .node:focus {
    outline: none;
}

/* The selected node gets a dark halo. (Mermaid writes each node's own stroke
   as an inline !important style, so the highlight is a filter, not a stroke.) */
.diagram .node.selected,
.diagram .node:focus-visible {
    filter: drop-shadow(0 0 1px #111) drop-shadow(0 0 3px #111);
}

/* Libraries, edges, and edge labels that are not on the matched route */
.diagram .dimmed {
    opacity: 0.45;
}

/* Shared infobox panel below the diagram */
.infobox {
    flex: 1 1 auto;
    padding: 9px 14px;
    background-color: white;
    border-top: 1px solid silver;
    font-size: 15px;
    line-height: 1.35;
    color: #1f2937;
    overflow: hidden;
}

.infobox h2 {
    margin: 0 0 4px 0;
    font-size: 18px;
    color: #00695c;
}

.infobox h2.warn {
    color: #b45309;
}

.infobox p {
    margin: 0 0 5px 0;
}

.infobox .label {
    font-weight: bold;
}

.infobox .note {
    color: #475569;
}

.infobox .kw {
    font-style: italic;
}

/* Narrow iframes */
@media (max-width: 620px) {
    .sim-header h1 {
        font-size: 18px;
    }
    .stepper button,
    .step-label {
        font-size: 13px;
    }
    .request-bar {
        font-size: 14px;
        margin: 6px 10px 0 10px;
        padding: 4px 8px;
    }
    .infobox {
        font-size: 13px;
        line-height: 1.3;
        padding: 7px 10px;
    }
    .infobox h2 {
        font-size: 16px;
    }
    .infobox p {
        margin-bottom: 4px;
    }
}
