/* Rules Editor UI for Workflow Designer */

.rule-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.rule-editor-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rule-editor-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rule-editor-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.rule-editor-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
}

.rule-editor-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.rule-editor-section {
  margin-bottom: 20px;
}

.rule-editor-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rule-editor-section-title i {
  font-size: 16px;
}

.rule-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.rule-form-group label {
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
}

.rule-form-group input,
.rule-form-group textarea,
.rule-form-group select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  transition: border-color 0.2s;
}

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

.rule-form-group textarea {
  min-height: 60px;
  resize: vertical;
  font-size: 12px;
}

.rule-form-group .info-text {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.rule-checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rule-checkbox-group input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.rule-checkbox-group label {
  margin: 0;
  cursor: pointer;
}

.rule-priority-selector {
  display: flex;
  gap: 8px;
}

.rule-priority-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  transition: all 0.2s;
}

.rule-priority-btn:hover {
  border-color: #3b82f6;
  background: #f3f4f6;
}

.rule-priority-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

.rule-editor-footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.rule-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.rule-btn-primary {
  background: #3b82f6;
  color: white;
}

.rule-btn-primary:hover {
  background: #2563eb;
}

.rule-btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.rule-btn-secondary:hover {
  background: #e5e7eb;
}

/* Node/Edge Property Panels */

.node-properties-panel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 16px;
  margin-top: 12px;
}

.node-properties-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.node-rules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.rule-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 12px;
}

.rule-badge-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.rule-badge-label {
  font-weight: 500;
  color: #374151;
  min-width: 50px;
}

.rule-badge-code {
  font-family: 'Courier New', monospace;
  color: #6b7280;
  font-size: 11px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rule-badge-actions {
  display: flex;
  gap: 4px;
}

.rule-badge-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  color: #6b7280;
  font-size: 12px;
  transition: color 0.2s;
}

.rule-badge-btn:hover {
  color: #3b82f6;
}

.rule-badge-btn.delete:hover {
  color: #ef4444;
}

/* Edge properties specific */

.edge-properties-panel {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 16px;
  margin-top: 12px;
}

.edge-priority-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 10px;
}

.priority-badge {
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 11px;
}

.exclusive-badge {
  background: #fce7f3;
  color: #be185d;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 11px;
}

/* Visual indicators on canvas edges */

.edge-with-rule {
  stroke-width: 2.5;
  stroke: #3b82f6;
}

.edge-exclusive {
  stroke-dasharray: 5, 3;
}

.edge-label-rule {
  font-size: 10px;
  fill: #1f2937;
  background: white;
  padding: 2px 4px;
  border-radius: 2px;
}

.priority-color-1 { stroke: #ef4444; }
.priority-color-2 { stroke: #f97316; }
.priority-color-3 { stroke: #eab308; }
.priority-color-4 { stroke: #84cc16; }
.priority-color-5 { stroke: #22c55e; }
