/* Hover Tooltip Explorer - vis-network MicroSim
 * =============================================
 * Full-width network canvas with absolute-positioned overlays
 * (title, legend, right-side control + status panel). Overlays are
 * siblings of #network because vis-network erases the canvas innerHTML.
 * Total height is 520px, 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: 520px;
}

#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;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Swatch showing a node WITH a tooltip: dotted outline indicator. */
.has-tip-swatch {
    background-color: #add8e6;
    border: 2px dotted #1565c0;
}

/* Swatch showing a node WITHOUT a tooltip: plain solid border. */
.no-tip-swatch {
    background-color: #add8e6;
    border: 2px solid #4a90b8;
}

/* ===========================================
   RIGHT PANEL (Controls + Hover Status)
   =========================================== */
.right-panel {
    position: absolute;
    top: 44px;
    right: 8px;
    width: 260px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.controls {
    background-color: rgba(255, 255, 255, 0.97);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.check-row input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

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

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

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

.status-panel {
    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);
}

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

/* The live hover readout, updated by hoverNode / blurNode. */
.status-readout {
    font-size: 14px;
    font-weight: bold;
    color: #222;
    background-color: #f4f8fc;
    border-radius: 4px;
    padding: 8px 10px;
    min-height: 38px;
    display: flex;
    align-items: center;
    word-break: break-word;
}

.status-readout.active {
    background-color: #fff8e1;
    color: #8a6d00;
}

.status-help {
    font-size: 12px;
    line-height: 1.5;
    color: #444;
    margin-top: 8px;
}

/* ===========================================
   NATIVE VIS-NETWORK TOOLTIP (rendered near cursor)
   The .vis-tooltip wrapper is created by vis-network; we style the
   HTML content we injected via each node's `title` element.
   =========================================== */
div.vis-tooltip {
    background-color: #ffffff !important;
    border: 2px solid #1565c0 !important;
    border-radius: 6px !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25) !important;
    padding: 0 !important;
    font-family: Arial, Helvetica, sans-serif !important;
    max-width: 240px;
    white-space: normal !important;
}

.vn-tooltip {
    padding: 8px 10px;
}

.vn-tip-label {
    font-weight: bold;
    font-size: 13px;
    color: #1565c0;
    margin-bottom: 4px;
}

.vn-tip-body {
    font-size: 12px;
    line-height: 1.45;
    color: #222;
}

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

    .right-panel {
        top: 74px;
        width: 190px;
    }

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

    .check-row {
        font-size: 11px;
    }

    .status-readout {
        font-size: 12px;
    }
}
