/*
SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
SPDX-License-Identifier: MIT
*/

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Noto Sans', sans-serif;
  font-size: 16px;
}

body {
  font-family: 'Noto Sans', sans-serif;
  background: #f5f8fb;
  min-height: 100vh;
  overflow-x: auto;
}

#canvas {
  position: relative;
  min-height: 100vh;
  padding: 40px;
}

.node {
  position: absolute;
  background: #fff;
  border: 1px solid #9ca3af;
  padding: 3px 10px;
  width: 6em;
  cursor: grab;
  transition: box-shadow 0.2s, border-color 0.2s;
  z-index: 2;
}

.node:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: #1f2937;
}

.node.selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.node.dragging {
  opacity: 0.8;
  z-index: 100;
  cursor: grabbing;
}

.node.drop-target {
  background: #dcfce7;
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.4);
}

.node-text {
  color: #374151;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-actions {
  position: absolute;
  top: -12px;
  right: -12px;
  display: none;
  gap: 4px;
}

.node:hover .node-actions,
.node.selected .node-actions {
  display: flex;
}

.node-btn {
  width: 20px;
  height: 20px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  line-height: 1;
  transition: transform 0.15s;
}

.node-btn:hover {
  transform: scale(1.1);
}

.node-btn-add {
  background: #22c55e;
  color: #fff;
}

.node-btn-add:hover {
  background: #16a34a;
}

.node-btn-delete {
  background: #ef4444;
  color: #fff;
}

.node-btn-delete:hover {
  background: #dc2626;
}

.node-btn-edit {
  background: #3b82f6;
  color: #fff;
}

.node-btn-edit:hover {
  background: #2563eb;
}

.node-input {
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  background: transparent;
}

.connection {
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

.connection line {
  stroke: #9ca3af;
  stroke-width: 2;
}

.node.leaf .node-text {
  color: darkred;
}

.node-fold {
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 1px solid #9ca3af;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #374151;
}

.node-fold:hover {
  background: #f3f4f6;
}
