/* ==========================================
   节点参数配置 - 样式
   ========================================== */

/* 参数指示器样式 */
.params-indicator {
    position: absolute;
    top: -5px;
    left: -5px;
    background: #FF6B6B;
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    pointer-events: auto;
    z-index: 10;
    box-shadow: none;
    border: none;
    cursor: help;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.params-indicator:hover {
    background: #FF5252;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 参数配置对话框样式 */
/* 确保dialog元素默认隐藏 */
dialog#nodeParamsDialog {
    display: none;
}

/* 当dialog打开时显示 */
dialog#nodeParamsDialog[open] {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 750px;
    max-height: 80vh;
    background: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

dialog#nodeParamsDialog[open]::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

/* 对话框头部 */
.node-params-dialog .dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e8e8e8;
    background: linear-gradient(to right, #f8f9fa, #ffffff);
}

.node-params-dialog .dialog-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.node-params-dialog .close-btn {
    background: none;
    border: none;
    outline: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.node-params-dialog .close-btn:hover {
    background: #e8e8e8;
    color: #2c3e50;
}

.node-params-dialog .close-btn:focus {
    outline: none;
    border: none;
    box-shadow: none;
}

/* 对话框内容 */
.node-params-dialog .dialog-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.params-list-container {
    padding: 16px;
}

.params-header {
    display: grid;
    grid-template-columns: 150px 100px 200px 1fr 80px;
    gap: 12px;
    padding: 12px 16px;
    background: #f0f2f5;
    border-radius: 6px;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 12px;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.params-header > div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.params-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.params-list::-webkit-scrollbar {
    width: 6px;
}

.params-list::-webkit-scrollbar-track {
    background: transparent;
}

.params-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.params-list::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 14px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px dashed #dee2e6;
}

/* 参数行样式 */
.param-row {
    display: grid;
    grid-template-columns: 150px 100px 200px 1fr 80px;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.param-row:hover {
    background: #f8f9fa;
    border-color: #d0d8e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 参数输入框样式 */
.param-row input[type="text"],
.param-row input[type="number"],
.param-row select,
.param-row textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d0d8e0;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Segoe UI', Roboto, sans-serif;
    transition: all 0.2s ease;
    background: white;
}

.param-row input[type="text"]:focus,
.param-row input[type="number"]:focus,
.param-row select:focus,
.param-row textarea:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    background: #f8fbff;
}

.param-row input[type="text"]::placeholder,
.param-row input[type="number"]::placeholder {
    color: #a0aec0;
}

.param-row textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
    font-size: 12px;
    font-family: 'Monaco', 'Courier New', monospace;
    line-height: 1.5;
    padding: 8px 10px;
}

.param-row select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 18px;
    padding-right: 32px;
}

.param-name-input,
.param-description-input {
    font-size: 13px;
    color: #2c3e50;
}

.param-type-select,
.param-value-select {
    font-size: 13px;
}

.param-value-textarea {
    font-size: 12px;
}

/* 删除按钮 */
.delete-param-btn {
    background: #fee;
    color: #c41c3b;
    padding: 6px 10px;
    border: 1px solid #f0a0b0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
    justify-self: center;
}

.delete-param-btn:hover {
    background: #f0a0b0;
    color: white;
    border-color: #c41c3b;
}

.delete-param-btn:active {
    transform: scale(0.95);
}

/* 添加参数按钮 */
.add-param-section {
    padding: 16px;
    border-top: 1px solid #e8e8e8;
    background: #f8f9fa;
}

.add-param-btn {
    width: 100%;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.add-param-btn:hover {
    background: linear-gradient(135deg, #20c997, #17a2b8);
    box-shadow: 0 4px 12px rgba(32, 201, 151, 0.3);
    transform: translateY(-1px);
}

.add-param-btn:active {
    transform: translateY(0);
}

/* 对话框底部 */
.node-params-dialog .dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e8e8e8;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.node-params-dialog .cancel-btn,
.node-params-dialog .save-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 80px;
}

.node-params-dialog .cancel-btn {
    background: #e8e8e8;
    color: #495057;
    border: 1px solid #d0d8e0;
}

.node-params-dialog .cancel-btn:hover {
    background: #d0d8e0;
    border-color: #a0aec0;
}

.node-params-dialog .save-btn {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border: none;
}

.node-params-dialog .save-btn:hover {
    background: linear-gradient(135deg, #357abd, #265a8d);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    transform: translateY(-1px);
}

.node-params-dialog .save-btn:active {
    transform: translateY(0);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    #nodeParamsDialog {
        width: 90vw;
        max-width: 750px;
    }

    .params-header,
    .param-row {
        grid-template-columns: 130px 90px 180px 1fr 70px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    #nodeParamsDialog {
        width: 95vw;
        max-height: 90vh;
    }

    .params-header,
    .param-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .params-header {
        display: none;
    }

    .param-row {
        padding: 12px;
    }

    .param-row > * {
        width: 100%;
    }

    .param-row > *:before {
        content: attr(data-label);
        font-weight: 600;
        color: #495057;
        font-size: 12px;
        display: block;
        margin-bottom: 4px;
    }

    .delete-param-btn {
        justify-self: auto;
        width: 100%;
    }

    .node-params-dialog .dialog-footer {
        flex-direction: column-reverse;
    }

    .node-params-dialog .cancel-btn,
    .node-params-dialog .save-btn {
        width: 100%;
    }
}

/* 动画 */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

dialog#nodeParamsDialog[open] {
    animation: slideInDown 0.3s ease-out;
}

/* 禁用状态 */
.param-row input:disabled,
.param-row select:disabled,
.param-row textarea:disabled {
    background: #f0f2f5;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #dee2e6;
}

/* ==========================================
   脚本参数样式
   ========================================== */

/* 脚本参数行 */
.param-row.script-defined-param {
    border-left: 3px solid #17a2b8;
    background: linear-gradient(to right, #f0f8ff, white);
}

.param-row.script-defined-param::before {
    content: " ";
    display: inline;
    margin-right: 4px;
    font-size: 12px;
    color: #17a2b8;
}

/* 脚本参数信息提示 */
.script-params-info {
    padding: 12px 16px;
    background: linear-gradient(to right, #e3f2fd, #f0f8ff);
    border-left: 3px solid #17a2b8;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #0d47a1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.script-params-info::before {
    content: "ℹ";
    font-size: 14px;
    flex-shrink: 0;
}

/* 脚本参数行悬停效果 */
.param-row.script-defined-param:hover {
    background: linear-gradient(to right, #e3f2fd, #f8fbff);
    border-left-color: #0d47a1;
}

/* 参数名输入框中的脚本参数标记 */
.script-defined-param .param-name-input {
    color: #0d47a1;
    font-weight: 500;
}

/* 响应式设计 - 脚本参数 */
@media (max-width: 768px) {
    .script-params-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .param-row.script-defined-param::before {
        content: "";
        display: block;
        margin-bottom: 4px;
    }
}
