/* Edge Styling Property Playground
 * ===============================
 * Full-width vis-network canvas on the left with a scrolling control panel +
 * live JSON preview overlaid on the right. On narrow screens the panel drops
 * to the lower portion. All overlays are siblings of #network.
 */

* {
    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: 100vh;
}

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

/* ===========================================
   TITLE
   =========================================== */
.title {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 19px;
    font-weight: bold;
    color: #0d3b66;
    background-color: aliceblue;
    padding: 4px 12px;
    white-space: nowrap;
    z-index: 10;
}

/* ===========================================
   LEGEND (Upper Left)
   =========================================== */
.legend {
    position: absolute;
    top: 44px;
    left: 10px;
    padding: 8px 10px;
    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;
    max-width: 210px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 4px 0;
    font-size: 11px;
    line-height: 1.3;
}

.legend-swatch {
    flex: 0 0 auto;
    width: 20px;
    height: 4px;
    margin-right: 6px;
    border-radius: 2px;
}

.swatch-styled {
    background-color: #2f6fb0;
    height: 6px;
}

.swatch-plain {
    background-color: #b0bdca;
}

/* ===========================================
   RIGHT CONTROL PANEL (45% width feel, capped)
   =========================================== */
.right-panel {
    position: absolute;
    top: 44px;
    right: 10px;
    bottom: 10px;
    width: 300px;
    z-index: 10;
}

.panel-scroll {
    max-height: 100%;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.97);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ctl {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.ctl-row {
    display: flex;
    gap: 10px;
}

.ctl label {
    font-size: 12px;
    font-weight: bold;
    color: #1c2b3a;
}

.ctl input[type="text"],
.ctl select {
    width: 100%;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid #b0c4d4;
    border-radius: 6px;
    background-color: #ffffff;
    color: #1c2b3a;
}

.ctl select {
    cursor: pointer;
}

.ctl input[type="range"] {
    width: 100%;
    cursor: pointer;
    accent-color: #2f6fb0;
}

.ctl input[type="color"] {
    width: 100%;
    height: 30px;
    padding: 2px;
    border: 1px solid #b0c4d4;
    border-radius: 6px;
    background-color: #ffffff;
    cursor: pointer;
}

/* Dashes checkbox + secondary pattern input */
.ctl-check {
    flex-direction: row;
    align-items: flex-end;
    gap: 12px;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: bold;
    color: #1c2b3a;
    cursor: pointer;
    white-space: nowrap;
}

.inline-check input {
    cursor: pointer;
}

.dash-pattern {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

/* Disabled controls: dimmed, non-interactive, tooltip explains why */
.ctl.disabled,
.dash-pattern.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ===========================================
   JSON PREVIEW PANEL
   =========================================== */
.json-panel {
    margin-top: 4px;
    border-top: 1px solid #dbe4ec;
    padding-top: 8px;
}

.json-title {
    font-size: 12px;
    font-weight: bold;
    color: #17456f;
    margin-bottom: 5px;
}

#json-preview {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.4;
    color: #1c2b3a;
    background-color: #f2f6fa;
    border: 1px solid #dbe4ec;
    border-radius: 6px;
    padding: 8px 10px;
    white-space: pre;
    overflow-x: auto;
    max-height: 190px;
    overflow-y: auto;
}

code {
    font-family: 'Courier New', monospace;
    background-color: #eef3f8;
    color: #17456f;
    padding: 1px 4px;
    border-radius: 3px;
}

/* ===========================================
   RESPONSIVE: panel drops below on narrow screens
   =========================================== */
@media (max-width: 720px) {
    .title {
        font-size: 15px;
    }
    .right-panel {
        top: auto;
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
        max-height: 52%;
    }
    .legend {
        max-width: 160px;
        font-size: 10px;
    }
    #json-preview {
        max-height: 120px;
    }
}
