/* 基础样式 */
.btn-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    min-width: 160px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 流程图样式 */
.flowchart-container {
    position: relative;
    margin: 2rem auto;
    overflow: visible;
}

.node {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 14px;
    transition: all 0.3s ease;
    z-index: 2;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 10px;
    font-weight: bold;
}

.node[data-type="start"] {
    border-radius: 30px;
}

/*.node[data-type="decision"] {*/
/*    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);*/
/*}*/

/* 对决策节点的内层文本容器应用反向旋转 */
.node[data-type="decision"] .node-text {
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    padding: 10px; /
    box-sizing: border-box;
}

/* 确保所有节点的 transform-origin 在中心 */
.node {
    transform-origin: center;
}

.node[data-type="process"] {
    border-radius: 10px;
}

.connection-text {
    position: absolute;
    background-color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 3;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* SVG样式 */
.flowchart-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: visible;
    pointer-events: none;
}

.flowchart-path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-radius: 50%;
    border-top: 3px solid #3498db;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 文本框样式 */
.resize-textarea {
    resize: vertical;
    min-height: 100px;
    max-height: 400px;
    width: 100%;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.resize-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 错误提示样式 */
.error-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: #fee2e2;
    color: #dc2626;
    display: none;
}

.error-message.visible {
    display: block;
}

/* 响应式设计 */
@media (max-width: 640px) {
    .btn {
        min-width: 120px;
        padding: 0.5rem 1rem;
    }
    
    .flowchart-container {
        margin: 1rem auto;
    }
}

.flowchart-container {
    position: relative;
    margin: 20px auto;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: visible;
}

.node {
    position: absolute;
    z-index: 2;
}

.flowchart-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: visible;
}

.connection-text {
    position: absolute;
    z-index: 3;
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.node {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}

.node:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}

/* 开始节点 */
.node[data-type="start"] {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
}

/* 结束节点 */
.node[data-type="end"] {
  background: linear-gradient(135deg, #F44336, #e53935);
  color: white;
}

/* 处理节点 */ 
.node[data-type="process"] {
  background: linear-gradient(135deg, #2196F3, #1e88e5);
  color: white;
}

/* 决策节点 */
.node[data-type="decision"] {
  background: linear-gradient(135deg, #FFC107, #ffb300);
  color: #333;
}

.flowchart-container {
    min-height: 400px;
    border: 1px solid #ccc;
    margin-top: 20px;
    position: relative;
}

.node {
    min-width: 100px;
    text-align: center;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.connection-label {
    background-color: white;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 12px;
}

.jtk-endpoint {
    z-index: 3;
}

.flowchart-toolbar {
    margin: 10px 0;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
}

.flowchart-toolbar button {
    margin-right: 10px;
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}

.flowchart-toolbar button:hover {
    background: #eee;
}