/* 工序逻辑管理页面样式 */

.logic-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.section-head h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e40af;
  margin: 0;
}

.help-note {
  font-size: 12px;
  color: #6b7280;
  margin: 4px 0 16px;
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}

/* 工序卡片 */
.step-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px;
  background: #fafbfc;
}

.step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  border-bottom: 1px dashed #e5e7eb;
  padding-bottom: 10px;
}
.step-num {
  font-size: 14px;
  font-weight: 700;
  color: #1e40af;
}
.step-head-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  max-width: 70%;
  justify-content: flex-end;
}
.step-name-input {
  flex: 1;
  min-width: 120px;
  max-width: 300px;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.step-name-input:focus { border-color: #3b82f6; }

.step-color-select {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
  background: #fff;
}

.step-del {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #dc2626;
}
.step-del:hover { background: #fee2e2; }

/* 表单选择行 */
.step-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #374151;
}
.step-form-row select {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #fff;
}

/* 条件列表 */
.step-conditions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  background: #f0faf3;
  border-radius: 8px;
  border: 1px solid #e6f5ea;
}

.condition-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cond-label {
  font-size: 12px;
  font-weight: 600;
  color: #166534;
  min-width: 30px;
}
.cond-and { color: #d97706; }

.cond-field,
.cond-op {
  padding: 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
  background: #fff;
}
.cond-field { min-width: 140px; flex: 1; max-width: 220px; }
.cond-op { width: 90px; }

.cond-value {
  padding: 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
  min-width: 100px;
  flex: 1;
  max-width: 160px;
}

.cond-del {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #dc2626;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.add-cond-btn {
  padding: 5px 12px;
  background: #fff;
  border: 1px dashed #93c5fd;
  color: #1e40af;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  align-self: flex-start;
}
.add-cond-btn:hover { background: #eff6ff; }

/* 预览 */
.step-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e5e7eb;
}
.preview-label {
  font-size: 12px;
  color: #6b7280;
}

.add-step-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: #eff6ff;
  border: 1px dashed #93c5fd;
  color: #1e40af;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 12px;
}
.add-step-btn:hover { background: #dbeafe; }

.save-btn {
  padding: 8px 20px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.save-btn:hover { background: #2563eb; }
.save-btn:disabled { background: #9ca3af; cursor: not-allowed; }

/* 功能开关 */
.flags-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.flag-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #fafbfc;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}
.flag-label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}
.flag-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: #d1d5db;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.flag-switch.on {
  background: #10b981;
}
.flag-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.flag-switch.on .flag-knob {
  transform: translateX(20px);
}

/* 移动端 */
@media (max-width: 640px) {
  .step-head { flex-direction: column; align-items: stretch; }
  .step-head-right {
    max-width: 100%;
    flex-wrap: wrap;
  }
  .step-name-input { max-width: none; flex-basis: 100%; }
  .cond-field, .cond-op, .cond-value {
    max-width: none;
    flex: 1;
    min-width: 80px;
  }
}
