/* Graph Editor with Live Validation
 * ==================================
 * Full-height editable network canvas with the vis-network manipulation
 * toolbar, plus an overlay validation panel and node/edge property editor.
 */

/* ===========================================
   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;
}

/* Style the vis-network manipulation toolbar so it clears the title */
div.vis-network div.vis-manipulation {
    top: 34px;
    border-bottom: 1px solid #ccc;
    background: rgba(255, 255, 255, 0.9);
}

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

/* ===========================================
   LEGEND (Upper Left, below toolbar)
   =========================================== */
.legend {
    position: absolute;
    top: 84px;
    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 #333;
    flex-shrink: 0;
}

.color-foundation { background-color: #a5d6a7; }
.color-term       { background-color: #97c2fc; }
.color-goal       { background-color: #ffcc80; }
.color-orphan     { background-color: #ef9a9a; }

/* ===========================================
   RIGHT PANEL
   =========================================== */
.right-panel {
    position: absolute;
    top: 44px;
    right: 10px;
    width: 290px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 11;
    max-height: calc(100% - 54px);
    overflow-y: auto;
}

/* ===========================================
   FILE CONTROLS
   =========================================== */
.file-controls {
    background-color: rgba(255, 255, 255, 0.97);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-row {
    display: flex;
    gap: 6px;
}

.file-row .btn {
    flex: 1;
}

.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: #607d8b;
    color: white;
}

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

.btn-link {
    background: none;
    color: #1565c0;
    text-decoration: underline;
    font-weight: normal;
    font-size: 12px;
    padding: 2px;
    text-align: left;
}

.btn-link:hover {
    color: #0d47a1;
}

/* ===========================================
   VALIDATION PANEL
   =========================================== */
.validation-panel {
    background-color: rgba(255, 255, 255, 0.97);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.val-header {
    margin-bottom: 8px;
}

.val-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: bold;
    padding: 3px 10px;
    border-radius: 12px;
    color: white;
    background-color: #9e9e9e;
}

.val-badge.valid {
    background-color: #43a047;
}

.val-badge.invalid {
    background-color: #e53935;
}

.val-section {
    margin-top: 8px;
}

.val-section-title {
    font-size: 12px;
    font-weight: bold;
    color: #444;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.count-pill {
    display: inline-block;
    min-width: 18px;
    text-align: center;
    font-size: 11px;
    padding: 0 5px;
    border-radius: 9px;
    background-color: #eceff1;
    color: #555;
}

.count-pill.has-issues {
    background-color: #e53935;
    color: white;
}

.val-list {
    list-style: none;
    font-size: 11px;
    line-height: 1.5;
}

.val-list li {
    padding: 2px 0 2px 4px;
}

.val-list li.val-issue {
    color: #c62828;
    border-left: 3px solid #e53935;
    padding-left: 6px;
    margin: 2px 0;
}

.val-list li.val-ok {
    color: #2e7d32;
    font-style: italic;
}

/* ===========================================
   PROPERTY EDITOR
   =========================================== */
.prop-editor {
    background-color: rgba(255, 255, 255, 0.98);
    border: 2px solid #2196f3;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

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

.prop-fields label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: #444;
    margin: 6px 0 2px;
}

.prop-fields input,
.prop-fields select {
    width: 100%;
    padding: 6px;
    font-size: 12px;
    border: 1px solid #bbb;
    border-radius: 4px;
}

.prop-buttons {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.prop-buttons .btn {
    flex: 1;
}

/* ===========================================
   HELP PANEL
   =========================================== */
.help-panel {
    background-color: rgba(255, 255, 255, 0.97);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.help-title {
    font-weight: bold;
    font-size: 12px;
    color: #333;
    margin-bottom: 4px;
}

.help-panel ul {
    margin-left: 16px;
    font-size: 11px;
    line-height: 1.5;
    color: #333;
}

.help-panel li {
    margin-bottom: 4px;
}

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

    .right-panel {
        width: 220px;
    }

    .legend {
        max-width: 150px;
    }
}
