/* 证书设计弹窗样式 */
.certificate-design-dialog {
  border-radius: 8px;
}

.certificate-design-dialog .el-dialog {
  margin-top: 1vh !important;
  margin-bottom: 1vh !important;
  height: 98vh;
  max-height: 98vh;
  display: flex;
  flex-direction: column;
}

.certificate-design-dialog .el-dialog__body {
  flex: 1;
  padding: 0;
  overflow: hidden;
}

/* 自定义头部样式 */
.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #ebeef5;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.dialog-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #303133;
  letter-spacing: 0.5px;
}

.close-button {
  font-size: 22px;
  color: #909399;
  padding: 8px;
  background: none;
  border: none;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.close-button:hover {
  color: #409eff;
  background: #f0f9ff;
}

/* 文字样式工具栏 */
.text-style-toolbar {
  margin-bottom: 8px;
  padding: 0 12px;
  flex-shrink: 0;
}

/* 内容区域样式 */
.dialog-content {
  height: 100%;
  background: #f5f7fa;
}

.editor-container {
  height: 100%;
  display: flex;
  flex-direction: row;
}

.editor-main-panel {
  flex: 3;
  background: #fff;
  border-right: 1px solid #ebeef5;
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

.empty-state {
  text-align: center;
  color: #909399;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 16px;
  display: block;
  color: #c0c4cc;
}

.empty-state-title {
  margin: 0 0 12px 0;
  font-size: 20px;
  font-weight: 500;
  color: #606266;
}

.empty-state-subtitle {
  margin: 0;
  font-size: 14px;
  color: #909399;
  line-height: 1.5;
}

.certificate-canvas {
  width: 98%;
  height: 98%;
  max-width: 1000px;
  max-height: 800px;
  background: #fafafa;
  border: 2px dashed #dcdfe6;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

/* 证书背景区域 */
.certificate-background {
  width: 100%;
  height: 100%;
  background: #ffffff;
  position: relative;
  margin: 20px;
  width: calc(100% - 40px);
  height: calc(100% - 40px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

/* 证书元素样式 */
.certificate-element {
  position: absolute;
  border: 2px dashed #409eff;
  background: rgba(64, 158, 255, 0.05);
  cursor: move;
  user-select: none;
  transition: all 0.2s ease;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.certificate-element:hover {
  border: 2px dashed #66b1ff;
  background: rgba(64, 158, 255, 0.1);
  box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
}

.certificate-element.dragging {
  border: 2px dashed #409eff;
  background: rgba(64, 158, 255, 0.15);
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.4);
  z-index: 1000;
}

/* 元素内容样式 */
.element-content {
  font-size: 14px;
  color: #606266;
  font-weight: 500;
  text-align: center;
  padding: 4px 8px;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 文字元素特定样式 */
.text-element {
  border: 2px solid #909399;
  background: rgba(144, 147, 153, 0.05);
  min-height: 30px;
  position: relative;
}

.text-element:hover {
  border-color: #409eff;
  background: rgba(64, 158, 255, 0.1);
}

.text-element.editing {
  border-color: #67c23a;
  background: rgba(103, 194, 58, 0.1);
}

.text-element.selected {
  border-color: #409eff;
  background: rgba(64, 158, 255, 0.15);
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.3);
}

/* 文字内容样式 */
.text-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.text-display {
  color: inherit;
  font-style: normal;
  user-select: none;
  cursor: text;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: inherit;
}

.text-input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  text-align: center;
  font-size: 14px;
  color: #303133;
  font-weight: 500;
}

/* 删除按钮样式 */
.delete-button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: #f56c6c;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.certificate-element:hover .delete-button {
  opacity: 1;
}

.delete-button:hover {
  background: #f78989;
  transform: scale(1.1);
}

/* 预设字段特殊样式 */
.preset-field {
  border: 2px solid #409eff !important;
  background: rgba(64, 158, 255, 0.05) !important;
}

.preset-field:hover {
  border-color: #66b1ff !important;
  background: rgba(64, 158, 255, 0.1) !important;
}

.preset-field.editing {
  border-color: #67c23a !important;
  background: rgba(103, 194, 58, 0.1) !important;
  box-shadow: 0 0 0 2px rgba(103, 194, 58, 0.3) !important;
}

/* 预设字段输入框样式 */
.preset-field .text-input {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: inherit;
  color: inherit;
  font-weight: inherit;
  text-align: inherit;
}

.preset-field .text-input:focus {
  border-color: #409eff;
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
}

/* 右侧配置面板 */
.editor-aside-panel {
  flex: 1;
  background: #fff;
  padding: 24px 16px;
  overflow-y: auto;
}

.config-panel {
  height: 100%;
}

.config-section {
  margin-bottom: 24px;
}

.template-selector {
  text-align: center;
}

.upload-placeholder {
  width: 100%;
  height: 120px;
  border: 2px dashed #dcdfe6;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: #909399;
  font-size: 14px;
}

.button-group {
  display: flex;
  flex-direction: row;
  gap: 8px;
  justify-content: flex-end;
}

.button-group .el-button {
  width: auto;
}

/* 字段配置区域 */
.field-collapse {
  border: none;
}

.field-collapse .el-collapse-item__header {
  background: #f8f9fa;
  border: 1px solid #ebeef5;
  border-radius: 4px;
  padding: 0 16px;
  margin-bottom: 8px;
  font-weight: 500;
}

.field-collapse .el-collapse-item__content {
  padding: 16px 0;
  border: none;
}

.header-icon {
  margin-right: 8px;
  color: #409eff;
}

.help-icon {
  margin-left: 4px;
  color: #c0c4cc;
  font-size: 12px;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox-group .el-checkbox {
  margin: 0;
}

/* 通用元素按钮 */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.full-width-btn {
  width: 100%;
}

.half-width-btns {
  display: flex;
  gap: 8px;
}

.half-width-btns .el-button {
  flex: 1;
}

/* 底部操作栏样式 */
.dialog-footer {
  padding: 20px 24px;
  border-top: 1px solid #ebeef5;
  background: #fff;
  text-align: center;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

.dialog-footer .el-button {
  min-width: 120px;
  height: 40px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 6px;
}

/* 响应式适配 */
@media (max-width: 1400px) {
  .certificate-design-dialog .el-dialog {
    width: 95% !important;
    height: 80vh;
  }
}

/* 自定义证书上传样式 */
.custom-certificate-input {
  display: none !important;
}

.custom-certificate-button {
  position: relative;
  overflow: hidden;
}

.custom-certificate-button:hover {
  background-color: #66b1ff;
  border-color: #66b1ff;
}

/* 自定义证书画布样式 */
.custom-certificate-canvas {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  position: relative;
}

.custom-certificate-canvas::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
  z-index: 1;
}

/* 自定义证书加载状态 */
.custom-certificate-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: #909399;
  font-size: 14px;
}

.custom-certificate-loading .el-icon-loading {
  margin-right: 8px;
  font-size: 16px;
}

/* 自定义证书提示信息 */
.custom-certificate-tip {
  padding: 12px 16px;
  background: #f4f4f5;
  border: 1px solid #e9e9eb;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #606266;
  line-height: 1.5;
}

.custom-certificate-tip .el-icon-info {
  color: #409eff;
  margin-right: 6px;
}

/* 证书预览缩略图样式 */
.upload-placeholder {
  transition: all 0.3s ease;
}

.upload-placeholder.has-image {
  padding: 0;
  border: 2px solid #409eff;
  background: #fff;
}

.current-certificate-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.certificate-thumbnail {
  width: 100%;
  max-width: 120px;
  height: auto;
  max-height: 80px;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* start.png 特殊样式 - 缩放到50% */
.certificate-thumbnail[src*="start.png"] {
  max-width: 60px;
  max-height: 40px;
}

.placeholder-text {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #c0c4cc;
  font-size: 14px;
}

@media (max-width: 768px) {
  .certificate-design-dialog .el-dialog {
    width: 100% !important;
    height: 100vh;
    margin: 0 !important;
    border-radius: 0;
  }
  
  .editor-container {
    flex-direction: column;
  }
  
  .editor-aside-panel {
    width: 100% !important;
    max-height: 300px;
  }
  
  .custom-certificate-tip {
    font-size: 12px;
    padding: 10px 12px;
  }
}/* Force cache refresh */