/* 模板选择弹窗样式 */
.template-selection-dialog {
  border-radius: 8px;
}

.template-selection-dialog .el-dialog {
  margin-top: 5vh !important;
  margin-bottom: 5vh !important;
  z-index: 2010 !important; /* 确保在主弹窗之上但不会过高 */
  position: relative !important;
}

/* 确保弹窗遮罩层不会阻止主弹窗的操作 */
.template-selection-dialog .el-dialog__wrapper {
  z-index: 2010 !important;
  position: absolute !important;
}

.template-selection-dialog .el-dialog__body {
  padding: 20px 24px;
  max-height: 70vh;
  overflow-y: auto;
}

/* Tab样式 */
.template-selection-dialog .el-tabs__header {
  margin-bottom: 20px;
}

.template-selection-dialog .el-tabs__item {
  font-size: 16px;
  font-weight: 500;
}

.template-selection-dialog .el-tabs__content {
  min-height: 400px;
}

/* 模板网格布局 */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding: 10px 0;
}

/* 模板项样式 */
.template-item {
  border: 2px solid #e4e7ed;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.template-item:hover {
  border-color: #409eff;
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
  transform: translateY(-2px);
}

.template-item.selected {
  border-color: #409eff;
  background: #f0f9ff;
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.25);
}

/* 模板预览区域 */
.template-preview {
  width: 100%;
  height: 120px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
  background: #f5f7fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.template-item:hover .template-preview img {
  transform: scale(1.05);
}

/* 模板信息 */
.template-info {
  text-align: center;
}

.template-info h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #303133;
  line-height: 1.4;
}

.template-info p {
  margin: 0;
  font-size: 12px;
  color: #909399;
  line-height: 1.4;
}

.template-item.selected .template-info h4 {
  color: #409eff;
}

/* 底部操作栏 */
.template-selection-dialog .dialog-footer {
  text-align: right;
  padding: 16px 0 0 0;
  border-top: 1px solid #ebeef5;
  margin-top: 20px;
}

.template-selection-dialog .dialog-footer .el-button {
  min-width: 80px;
  margin-left: 12px;
}

/* 空状态 */
.template-grid:empty::after {
  content: '暂无模板';
  display: block;
  text-align: center;
  color: #909399;
  font-size: 14px;
  padding: 40px 0;
  grid-column: 1 / -1;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .template-selection-dialog {
    width: 95% !important;
    margin: 2vh auto !important;
  }
  
  .template-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }
  
  .template-preview {
    height: 100px;
  }
  
  .template-info h4 {
    font-size: 13px;
  }
  
  .template-info p {
    font-size: 11px;
  }
}

/* 加载状态 */
.template-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #909399;
}

/* 选中状态指示器 */
.template-item.selected::before {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: #409eff;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.template-item {
  position: relative;
}