/* ==================== 动态表单弹窗样式 ==================== */

.dynamic-form-container {
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 600px;
  max-width: 95%;
  max-height: 90vh;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: slideUp 0.3s ease;
}

.dynamic-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.dynamic-form-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: #fff;
}

.dynamic-form-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #fff;
  font-size: 28px;
  font-weight: 300;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.dynamic-form-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.dynamic-form-body {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  background: #f8fafc;
}

.dynamic-form-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #94a3b8;
}

.dynamic-form-loading .loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

.dynamic-form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 4px;
}

.required-mark {
  color: #ef4444;
}

.form-input,
.form-textarea,
.form-select {
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
  background: #fff;
}

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

.form-input.error,
.form-textarea.error,
.form-select.error {
  border-color: #ef4444;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' 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 12px center;
  padding-right: 40px;
}

.form-error {
  font-size: 12px;
  color: #ef4444;
  display: none;
}

.form-error.show {
  display: block;
}

.form-field-group {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  background: #fff;
}

.group-title {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

/* 图片上传样式 */
.image-upload-wrapper,
.file-upload-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.image-url-input,
.file-url-input {
  flex: 1;
}

.image-upload-actions,
.file-upload-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.image-preview,
.file-preview {
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.image-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.upload-btn .loading-text {
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 多选框样式 */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: all 0.2s;
  user-select: none;
}

.checkbox-label:hover {
  border-color: #3b82f6;
  background: #f0f9ff;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #3b82f6;
}

.checkbox-label input[type="checkbox"]:checked + span {
  color: #3b82f6;
  font-weight: 500;
}

/* 表单空状态 */
.form-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #94a3b8;
  text-align: center;
}

.form-empty-state svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.form-empty-state p {
  font-size: 15px;
  margin: 0;
}

/* 表单底部 */
.dynamic-form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 32px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

/* 响应式适配 */
@media (max-width: 640px) {
  .dynamic-form-container {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .dynamic-form-header {
    padding: 20px 24px;
  }
  
  .dynamic-form-body {
    padding: 24px;
  }
  
  .dynamic-form-footer {
    padding: 16px 24px;
    flex-direction: column;
  }
  
  .dynamic-form-footer .btn {
    width: 100%;
  }
  
  .checkbox-group {
    flex-direction: column;
  }
  
  .checkbox-label {
    width: 100%;
  }
}

/* ==================== JSON展示弹窗样式 ==================== */

.json-modal-container {
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 700px;
  max-width: 95%;
  max-height: 85vh;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: slideUp 0.3s ease;
}

.json-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.json-modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: #fff;
}

.json-modal-close {
  color: #fff;
  font-size: 26px;
  font-weight: 300;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.json-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.json-modal-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: #f8fafc;
}

.json-content {
  margin: 0;
  padding: 20px;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.json-content .string { color: #22c55e; }
.json-content .number { color: #f59e0b; }
.json-content .boolean { color: #8b5cf6; }
.json-content .null { color: #6b7280; }
.json-content .key { color: #38bdf8; }

.json-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

/* JSON弹窗响应式 */
@media (max-width: 640px) {
  .json-modal-container {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .json-modal-header {
    padding: 18px 20px;
  }
  
  .json-modal-body {
    padding: 16px;
  }
  
  .json-modal-footer {
    padding: 16px 20px;
    flex-direction: column;
  }
  
  .json-modal-footer .btn {
    width: 100%;
  }
}
