/* Force-Directed Layout Explorer
 * ===============================
 * Full-height network canvas with overlay title, legend, settling
 * indicator, and a right-side physics control panel.
 */

/* ===========================================
   RESET & BASE
   =========================================== */
* {
    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 (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: 4px 12px;
    white-space: nowrap;
    z-index: 10;
}

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

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

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 6px;
    border: 2px solid #2b7ce9;
    flex-shrink: 0;
}

.color-node { background-color: #97c2fc; }

.legend-line {
    width: 20px;
    height: 0;
    border-top: 2px solid #848484;
    margin-right: 6px;
    flex-shrink: 0;
}

/* ===========================================
   SETTLING INDICATOR (bottom-left of canvas)
   =========================================== */
.settling-indicator {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    font-size: 12px;
    color: #1976d2;
    font-weight: bold;
    z-index: 11;
}

.settling-indicator.active {
    display: flex;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 3px solid #cfe3fb;
    border-top-color: #2196f3;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===========================================
   RIGHT CONTROL PANEL
   =========================================== */
.right-panel {
    position: absolute;
    top: 44px;
    right: 10px;
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

.control-block {
    background-color: rgba(255, 255, 255, 0.97);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 2px;
}

.control-row:first-child {
    margin-top: 0;
}

.control-row label {
    font-size: 12px;
    font-weight: bold;
    color: #333;
}

.value-badge {
    font-size: 12px;
    font-family: "Courier New", monospace;
    background-color: #e3f2fd;
    color: #1565c0;
    padding: 1px 6px;
    border-radius: 4px;
    min-width: 52px;
    text-align: center;
}

input[type="range"] {
    width: 100%;
    accent-color: #2196f3;
    cursor: pointer;
}

.button-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.btn {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 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;
}

/* ===========================================
   INFOBOX
   =========================================== */
.infobox {
    background-color: rgba(255, 255, 255, 0.97);
    border-left: 4px solid #2196f3;
    border-radius: 6px;
    padding: 10px 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

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

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

    .right-panel {
        width: 200px;
    }

    .legend {
        max-width: 160px;
    }

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