/* ===== NODES ===== */
.node {
    position: absolute;
    min-width: 200px;
    border-radius: var(--radius-lg);
    background: rgba(20, 20, 28, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        inset 0 0 20px rgba(255, 255, 255, 0.015);
    user-select: none;
}

.node:hover {
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.node.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow), 0 8px 32px rgba(0, 0, 0, 0.3);
}

.node.dragging {
    z-index: 999;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Header */
.node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    cursor: move;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.node-header i { font-size: 16px; opacity: 0.7; }

.node-header .node-title {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.node-header .node-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.node:hover .node-actions { opacity: 1; }

.node-actions button {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
}

.node-actions button:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

/* Color accent stripe — removida, destaque agora é opcional via lateral */
.node[data-color] .node-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Destaque lateral colorido (só aparece quando node tem highlight ativo) */
.node.highlighted::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 0;
    width: 3px;
    background: var(--node-highlight, var(--accent));
    border-radius: 0 3px 3px 0;
}

/* Nó marcado como início do fluxo */
.node.flow-start {
    border-color: var(--accent);
}

.node.flow-start::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 16px;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    border: 3px solid var(--bg-canvas);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Body */
.node-body {
    padding: 16px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    max-height: 400px;
    overflow-y: auto;
}

.node-body::-webkit-scrollbar { width: 4px; }
.node-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Markdown rendered */
.node-body h1, .node-body h2, .node-body h3 { color: var(--text-primary); margin: 12px 0 8px; }
.node-body h1 { font-size: 18px; }
.node-body h2 { font-size: 16px; }
.node-body h3 { font-size: 14px; }
.node-body p { margin: 8px 0; }
.node-body code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; font-size: 12px; font-family: 'SF Mono', 'Fira Code', monospace; }
.node-body pre { background: rgba(0,0,0,0.3); padding: 12px; border-radius: 8px; overflow-x: auto; margin: 8px 0; }
.node-body pre code { background: none; padding: 0; }
.node-body ul, .node-body ol { padding-left: 20px; margin: 8px 0; }
.node-body blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--text-muted); margin: 8px 0; }
.node-body a { color: var(--accent); text-decoration: none; }
.node-body table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12px; }
.node-body th, .node-body td { padding: 6px 10px; border: 1px solid rgba(255,255,255,0.08); text-align: left; }
.node-body th { background: rgba(255,255,255,0.04); font-weight: 600; }

/* Connection points */
.connection-point {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border: 2px solid var(--bg-canvas);
    border-radius: 50%;
    cursor: crosshair;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10;
}

.node:hover .connection-point,
.node.selected .connection-point,
.tool-connect .connection-point { opacity: 1; }
.node.connect-source { outline: 2px solid var(--accent); outline-offset: 3px; }
.connection-point:hover { transform: scale(1.4); }

.connection-point.top { top: -6px; left: 50%; margin-left: -6px; }
.connection-point.bottom { bottom: -6px; left: 50%; margin-left: -6px; }
.connection-point.left { left: -6px; top: 50%; margin-top: -6px; }
.connection-point.right { right: -6px; top: 50%; margin-top: -6px; }

/* Resize handle */
.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    opacity: 0;
    transition: opacity 0.2s;
}

.node:hover .resize-handle { opacity: 0.5; }

.resize-handle::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    border-radius: 0 0 2px 0;
}

/* ===== KANBAN ===== */
.node-kanban { min-width: 280px; max-width: 320px; }

.kanban-column { padding: 8px; }

.kanban-column-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 4px 8px 8px;
}

.kanban-card {
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: grab;
    transition: all 0.15s;
}

.kanban-card:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.1); }
.kanban-card.dragging { opacity: 0.5; }

.kanban-add {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px dashed rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    width: 100%;
    transition: all 0.15s;
}

.kanban-add:hover { border-color: rgba(255,255,255,0.2); color: var(--text-secondary); }

/* ===== LIST ===== */
.node-list { min-width: 250px; }

.list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 13px;
}

.list-item:last-child { border-bottom: none; }

.list-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.list-checkbox.checked { background: var(--accent); border-color: var(--accent); }
.list-checkbox.checked::after { content: '✓'; color: white; font-size: 11px; font-weight: 700; }
.list-item-text { flex: 1; color: var(--text-secondary); }
.list-item.completed .list-item-text { text-decoration: line-through; opacity: 0.5; }

.list-add {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    width: 100%;
    transition: color 0.15s;
}

.list-add:hover { color: var(--text-secondary); }

/* ===== FLOWCHART ===== */
.node-flowchart .node-body {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 500;
}

/* ===== ENTITY SHAPES ===== */
.node-flowchart.shape-rounded { border-radius: 50px; }
.node-flowchart.shape-diamond {
    border-radius: var(--radius-sm);
    min-width: 160px;
}
.node-flowchart.shape-circle {
    border-radius: 50%;
    min-width: 120px;
    min-height: 120px;
    aspect-ratio: 1;
}
.node-flowchart.shape-hexagon {
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    border-radius: 0;
    min-width: 160px;
    min-height: 140px;
    border: none;
}
.node-flowchart.shape-parallelogram {
    transform: skewX(-5deg);
    border-radius: var(--radius-sm);
}
.node-flowchart.shape-parallelogram .node-body { transform: skewX(5deg); }
.node-flowchart.shape-parallelogram .node-header { transform: skewX(5deg); }

/* ===== TYPE SWITCH MENU (hover) ===== */
.node-type-switcher {
    position: absolute;
    top: -36px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 2px;
    padding: 4px 6px;
    background: rgba(20, 20, 30, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    z-index: 20;
}

.node:hover .node-type-switcher { display: flex; }

.node-type-switcher button {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.1s;
}

.node-type-switcher button:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.node-type-switcher button.active {
    color: var(--accent);
}

/* ===== GROUPS ===== */
.node-group {
    min-width: 300px;
    min-height: 200px;
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(255, 255, 255, 0.12);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

.node-group:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
    box-shadow: none;
    transform: none;
}

.node-group .node-header {
    background: transparent;
    padding: 10px 14px;
    border-bottom: none;
}

.node-group .node-header .node-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.node-group .node-body { display: none; }
