/* 设计模式 v2 - 白色浅色主题 */

.design-mode-v2 {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f5f5f7;
    display: flex;
    flex-direction: column;
    z-index: 100;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.design-canvas-v2 {
    flex: 1;
    position: relative;
    overflow: auto;
    background: #f5f5f7;
    background-image:
        radial-gradient(circle, #d0d0d0 1px, transparent 1px);
    background-size: 20px 20px;
}

.design-canvas-v2 svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

/* 节点样式 - Input */
.design-node-input {
    position: absolute;
    width: 320px;
    min-width: 240px;
    min-height: 200px;
    max-width: 600px;
    max-height: 500px;
    background: #ffffff;
    border: 2px solid #007aff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 10;
    overflow: visible;
}

.design-node-input .node-header-v2 {
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.design-node-input .node-title-v2 {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.design-node-input .node-body-v2 {
    padding: 12px 16px;
    overflow: hidden;
}

.design-node-input .upload-area {
    width: 100%;
    min-height: 80px;
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
    margin-bottom: 12px;
}

.design-node-input .upload-area:hover {
    border-color: #007aff;
    background: #f0f7ff;
}

.design-node-input .upload-area .upload-icon {
    font-size: 24px;
    color: #999;
    margin-bottom: 4px;
}

.design-node-input .upload-area .upload-text {
    font-size: 11px;
    color: #999;
}

.design-node-input .upload-area img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.design-node-input textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    color: #333;
    font-size: 12px;
    resize: none;
    font-family: inherit;
    box-sizing: border-box;
}

.design-node-input textarea:focus {
    outline: none;
    border-color: #007aff;
    background: #fff;
}

/* 节点样式 - Image Output */
.design-node-image {
    position: absolute;
    width: 280px;
    min-width: 220px;
    min-height: 180px;
    max-width: 500px;
    max-height: 450px;
    background: #ffffff;
    border: 2px solid #34c759;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 10;
    overflow: visible;
}

.design-node-image .node-header-v2 {
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.design-node-image .node-title-v2 {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.design-node-image .node-body-v2 {
    padding: 12px 16px;
    overflow: hidden;
}

.design-node-image .options-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.design-node-image .options-row select {
    flex: 1;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
    color: #333;
    font-size: 11px;
}

.design-node-image .output-preview {
    width: 100%;
    min-height: 120px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.design-node-image .output-preview img {
    width: 100%;
    border-radius: 8px;
}

.design-node-image .output-preview .placeholder {
    font-size: 12px;
    color: #999;
}

/* 节点调整大小手柄 */
.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 2px solid #007aff;
    border-radius: 3px;
    z-index: 20;
}

.resize-handle.corner-nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.resize-handle.corner-ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.resize-handle.corner-sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.resize-handle.corner-se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

.design-node-image .resize-handle {
    border-color: #34c759;
}

.resize-handle:hover {
    transform: scale(1.2);
}

/* 节点通用 */
.design-node-v2 {
    cursor: move;
    user-select: none;
}

.design-node-v2.selected {
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0,122,255,0.2);
}

.design-node-v2 .node-delete-v2 {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
}

.design-node-v2:hover .node-delete-v2 {
    opacity: 1;
}

.design-node-v2 .node-delete-v2:hover {
    background: #ff3b30;
    color: white;
}

/* 连接线 */
.design-connection {
    fill: none;
    stroke: #007aff;
    stroke-width: 3;
    pointer-events: stroke;
    cursor: pointer;
    transition: stroke 0.2s;
    z-index: 0;
}

.design-connection:hover {
    stroke: #ff3b30;
    stroke-width: 4;
}

.design-connection.temp {
    stroke: #007aff;
    stroke-dasharray: 8 4;
    opacity: 0.8;
}

/* 端口样式 */
.port-v2 {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    cursor: crosshair;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.port-v2:hover {
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

/* Run 按钮 - 胶囊固定底部 */
.design-run-btn {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 40px;
    background: linear-gradient(135deg, #007aff 0%, #0056cc 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,122,255,0.4);
    transition: all 0.2s;
    z-index: 1000;
}

.design-run-btn:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 6px 24px rgba(0,122,255,0.5);
}

.design-run-btn:active {
    transform: translateX(-50%) scale(0.98);
}

.design-run-btn:disabled {
    background: #ccc;
    box-shadow: none;
    cursor: not-allowed;
}

/* 添加节点按钮 */
.design-add-nodes {
    position: fixed;
    top: 60px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

.design-add-btn {
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.design-add-btn:hover {
    background: #007aff;
    color: white;
    border-color: #007aff;
}

.design-add-btn .icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
}
