/* Graph Anatomy Explorer - vis-network MicroSim
 * =============================================
 * Layout: full-width network canvas with absolute-positioned overlays
 * (title, legend, controls, and a side infobox). Overlays are siblings
 * of #network in the DOM because vis-network erases the canvas innerHTML.
 * Total height is 500px, matching CANVAS_HEIGHT in the JS.
 */

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

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: aliceblue;
}

/* ===========================================
   CONTAINER & NETWORK CANVAS
   =========================================== */
.container {
    position: relative;
    width: 100%;
    height: 500px;
}

#network {
    width: 100%;
    height: 100%;
    background-color: aliceblue;
}

/* ===========================================
   TITLE (Top Center)
   =========================================== */
.title {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: bold;
    color: black;
    background-color: rgba(240, 248, 255, 0.85);
    padding: 2px 12px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 10;
}

/* ===========================================
   LEGEND (Upper Left)
   =========================================== */
.legend {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 6px 8px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    z-index: 10;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 3px 0;
    font-size: 11px;
}

.legend-color {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.node-swatch {
    background-color: #add8e6;
    border: 2px solid #4a90b8;
    border-radius: 50%;
}

.edge-swatch {
    color: #000000;
    font-weight: bold;
    font-size: 16px;
}

.select-swatch {
    background-color: #ffd700;
    border: 2px solid #e6a800;
    border-radius: 50%;
}

/* ===========================================
   CONTROLS (Top Right, above infobox)
   =========================================== */
.controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.btn {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #2196f3;
    color: white;
}

.btn-primary:hover {
    background-color: #1976d2;
}

.btn-secondary {
    background-color: #757575;
    color: white;
}

.btn-secondary:hover {
    background-color: #616161;
}

/* ===========================================
   SIDE INFOBOX (Right, opens on click)
   =========================================== */
.infobox {
    position: absolute;
    top: 52px;
    right: 8px;
    width: 260px;
    max-height: calc(100% - 64px);
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.97);
    border: 2px solid #2196f3;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.stats {
    font-size: 11px;
    font-weight: bold;
    color: #555;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
}

.infobox-title {
    font-weight: bold;
    font-size: 14px;
    color: #1976d2;
    margin-bottom: 6px;
}

.infobox-content {
    font-size: 12px;
    line-height: 1.5;
    color: #222;
}

.infobox-content p {
    margin-bottom: 7px;
}

.infobox-content ul {
    margin: 4px 0 4px 16px;
}

.infobox-content li {
    margin-bottom: 4px;
}

.infobox-content .ib-lead {
    font-weight: bold;
}

.infobox-content .ib-def {
    font-style: italic;
    color: #444;
    background-color: #f4f8fc;
    padding: 6px 8px;
    border-radius: 4px;
}

/* Type chips */
.chip {
    display: inline-block;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 10px;
    color: white;
}

.chip-node {
    background-color: #4a90b8;
}

.chip-edge {
    background-color: #333333;
}

/* ===========================================
   RESPONSIVE STYLES
   =========================================== */
@media (max-width: 640px) {
    .title {
        font-size: 14px;
        top: 6px;
    }

    .controls {
        top: 40px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .infobox {
        top: 78px;
        width: 190px;
        max-height: calc(100% - 90px);
    }

    .legend-item {
        font-size: 10px;
    }
}
