/* 全局样式 */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f5f5;
  color: #333;
}

/* 主容器布局 */
.container {
  display: flex;
  height: 100vh;
}

/* 左侧面板样式 */
.left-panel {
  width: 300px;
  background-color: #fff;
  padding: 20px;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.left-panel h2 {
  margin-top: 0;
  border-bottom: 1px solid #eee;
}

/* 通用标题样式 */
.section-title {
  padding: 30px 0 27px;
  text-align: left;
  font-size: 24px;
  margin: 20px 0 30px;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #eee;
}

/* 右侧面板样式 */
.right-panel {
  flex: 1;
  padding: 20px;
  background-color: #f9f9f9;
  overflow-y: auto;
}

.right-panel h2 {
  margin-top: 0;
}

.preview-title {
  padding: 30px 0 20px;
  text-align: center;
  font-size: 30px;
  margin: 20px 0 15px;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #eee;
}

/* 工具选择器 */
.tool-selector {
  margin-bottom: 20px;
}

.tool-selector select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  background-color: #fff;
}

/* 上传区域 */
.upload-area {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 上传按钮样式 */
.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 50px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin: 15px 0 30px;
  font-size: 18px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.5;
  transition: background-color 0.2s;
  min-width: fit-content;
}

/* 悬停状态 */
.upload-button:hover:not(:disabled) {
  background-color: #0069d9;
}

/* 禁用状态 */
.upload-button:disabled {
  background-color: #cccccc !important;
  cursor: not-allowed;
  opacity: 0.7;
}

#image-upload {
  display: none;
}

/* 画布容器 */
.canvas-container {
  width: var(--container-width, 1024px); /* 默认宽度 */
  position: relative; /* 相对定位 */
  overflow: hidden; /* 隐藏超出部分 */
  background-color: #f0f0f0; /* 背景颜色 */
  display: flex; /* 使用flex布局 */
  justify-content: center; /* 水平居中 */
  align-items: center; /* 垂直居中 */
}

.canvas-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fff; /* 背景颜色 */
  z-index: -1; /* 确保背景在canvas之下 */
}

#image-canvas {
  width: 100%; /* 确保canvas宽度与容器一致 */
  height: 100%; /* 确保canvas高度与容器一致 */
  display: block; /* 消除canvas默认的inline间隙 */
}

/* 工具内容区域 - 三个工具共用样式 */
#tool-container {
  flex: 1;
  overflow-y: auto;
}

.tool-section {
  background-color: #fff;
  border-radius: 6px;
  padding: 15px;
  margin-top: 15px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tool-section h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #333;
  font-size: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

/* 滑块组样式 */
.slider-group {
  margin-bottom: 12px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 14px;
  color: #555;
}

.slider-label span:first-child {
  font-weight: bold;
}

.slider-value {
  color: #555;
  min-width: 40px;
  text-align: right;
}

.slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: #e0e0e0;
  outline: none;
  border-radius: 4px;
  margin: 5px 0;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #007bff;
  cursor: pointer;
  transition: background 0.2s;
}

.slider:disabled {
  opacity: 0.6;
}

.slider:disabled::-webkit-slider-thumb {
  background: #999;
  cursor: not-allowed;
}

/* 按钮组基础样式 */
.button-group {
  display: flex;
  gap: 10px;
  margin: 15px 0;
}

/* 所有按钮基础样式 */
.button-group button {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
}

/* 默认按钮颜色 */
.button-group
  button:not(.import-button):not(.reset-button):not(.export-button) {
  background-color: #007bff;
}

/* 默认按钮悬停 */
.button-group
  button:not(.import-button):not(.reset-button):not(.export-button):hover:not(
    :disabled
  ) {
  background-color: #0069d9;
}

/* 导入按钮颜色 */
.button-group button.import-button {
  background-color: #007bff;
}

/* 导入按钮悬停 */
.button-group button.import-button:hover:not(:disabled) {
  background-color: #0069d9;
}

/* 重置按钮颜色 */
.button-group button.reset-button {
  background-color: #007bff;
}

/* 重置按钮悬停 */
.button-group button.reset-button:hover:not(:disabled) {
  background-color: #0069d9;
}

/* 导出按钮颜色 */
.button-group button.export-button {
  background-color: #007bff;
}

/* 导出按钮悬停 */
.button-group button.export-button:hover:not(:disabled) {
  background-color: #0069d9;
}

/* 禁用状态 - 覆盖所有按钮类型 */
.button-group button:disabled {
  background-color: #cccccc !important;
  cursor: not-allowed;
  opacity: 0.7;
}

/* 单选按钮组样式 */
.radio-group {
  display: flex;
  flex-direction: column; /* 改为垂直排列 */
  gap: 10px;
  margin: 15px 0;
}

.radio-group label {
  display: flex;
  align-items: center;
  font-size: 14px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 4px;
  background-color: #f0f0f0;
  transition: background-color 0.2s;
  width: fit-content; /* 让标签宽度适应内容 */
}

.radio-group label:hover {
  background-color: #e0e0e0;
}

.radio-group input[type="radio"] {
  margin-right: 5px;
}

.radio-group:disabled label {
  color: #999;
  cursor: not-allowed;
  background-color: #f5f5f5;
}

/* 默认工具禁用状态 */
.tool-section.disabled {
  background-color: #f9f9f9;
}

.tool-section.disabled .slider-label,
.tool-section.disabled .radio-group label {
  color: #999;
}

.tool-section.disabled .slider-value {
  color: #999;
}

/* 隐藏的矩阵表格样式 */
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
}

.matrix-table caption {
  font-weight: bold;
  margin-bottom: 5px;
  text-align: left;
  font-size: 13px;
}

.matrix-table td {
  padding: 5px;
  border: 1px solid #ddd;
  text-align: center;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    height: auto;
  }

  .left-panel {
    width: 100%;
    box-shadow: none;
    border-bottom: 1px solid #ddd;
  }

  .right-panel {
    padding: 15px;
  }
}
