* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  padding: 20px;
  background-color: #f8f9fa;
}

.main-container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  height: 600px;
}

/* 左侧编辑器区域 */
.editor-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.editor-header {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 15px 20px;
  background: #2c3e50;
  border-radius: 8px 8px 0 0;
  color: white;
}

.editor-title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
}

.editor-actions {
  display: flex;
  gap: 8px;
}

/* 右侧图片预览区域 */
.preview-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.preview-header {
  padding: 15px 20px;
  background: #2c3e50;
  border-radius: 8px 8px 0 0;
  color: white;
  font-size: 18px;
  font-weight: 600;
}

.preview-content {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 0 0 8px 8px;
  background: rgba(248, 249, 250, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  /* 新增：为loading定位做准备 */
}

#previewImage {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.empty-preview {
  color: #999;
  font-size: 16px;
  text-align: center;
  padding: 20px;
}

/* ========== 核心新增：Loading 样式 ========== */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  display: none;
  /* 默认隐藏 */
}

/* 加载动画 */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  color: #333;
  font-size: 16px;
  font-weight: 500;
}

/* 按钮和选择框样式 */
button,
select {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

button {
  background: #3498db;
  color: white;
}

button:hover {
  background: #2980b9;
}

button.secondary {
  background: #95a5a6;
}

button.secondary:hover {
  background: #7f8c8d;
}

button.danger {
  background: #e74c3c;
}

button.danger:hover {
  background: #c0392b;
}

button.generate-btn {
  background: #27ae60;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
}

button.generate-btn:hover {
  background: #219653;
}

select {
  background: white;
  border: 1px solid #ddd;
  color: #333;
}

/* 核心修改：缩小编辑器顶部的按钮 */
.editor-actions button {
  padding: 4px 10px;
  /* 从 8px 16px 缩小到 4px 10px */
  font-size: 12px;
  /* 从 14px 缩小到 12px */
  border-radius: 3px;
  /* 轻微缩小圆角 */
}

#jsoneditor {
  width: 100%;
  height: 480px;
  border: 1px solid #ddd;
  border-radius: 0 0 8px 8px;
}

.status-bar {
  padding: 10px 20px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
}

.success {
  color: #27ae60;
}

.error {
  color: #e74c3c;
}

/* 底部操作区 */
.bottom-actions {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.template-label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

/* 新增：用于复制降级方案的隐藏文本域 */
#copyTextarea {
  position: absolute;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  z-index: -1;
}