.file-preview-pop-container {
  display: inline-block;
}

.file-preview-pop.no-border .el-dialog {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-top: 0px !important;
  top: 50%;
  transform: translateY(-50%);
}

.file-preview-pop.no-border .el-dialog__header {
  padding: 0;
  margin: 0;
  border-bottom: none;
}

.file-preview-pop.no-border .el-dialog__body {
  padding: 0;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #f9f9fa;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.preview-title {
  font-size: 16px;
  font-weight: 500;
  color: #000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 20px;
  font-weight: bold;
}

.preview-header .left {
  display: flex;
  align-items: center;
}
.preview-header .left .el-icon-document {
  font-size: 20px;
  color: rgb(0, 110, 171);
  background: #fff;
  padding: 6px;
  border-radius: 4px;
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.08);
  margin-right: 10px;
  font-weight: bold;
}

.preview-header .right {
  display: flex;
  align-items: center;
}
.preview-header .right .el-button {
  background: #006eab;
  color: #fff;
  font-size: 13px;
  border-radius: 6px;
  margin-right: 10px;
}
.preview-header .right .el-button:hover {
  scale: 1.05;
}

.close-btn {
  padding: 0px !important;
  border: none !important;
  font-size: 20px;
  color: rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: color 0.3s;
}

.close-btn:hover {
  color: #006eab;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  gap: 8px;
}

.preview-toolbar .el-button {
  padding: 6px 12px;
  color: rgba(0, 0, 0, 0.65);
  font-size: 14px;
}

.preview-toolbar .el-button:hover {
  color: #006eab;
}

.preview-toolbar .el-button.is-disabled {
  color: rgba(0, 0, 0, 0.25);
  cursor: not-allowed;
}

.preview-toolbar .el-button--primary {
  background: #006eab;
  border-color: #006eab;
  color: #fff;
}

.preview-toolbar .el-button--primary:hover {
  background: #0088cc;
  border-color: #0088cc;
}

.preview-toolbar .el-divider {
  margin: 0 8px;
}

.page-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px;
  color: rgba(0, 0, 0, 0.65);
  font-size: 14px;
}

.page-info .el-input-number {
  width: 60px;
}

.page-info .el-input-number .el-input__inner {
  text-align: center;
}

.search-info {
  margin-left: 8px;
  color: #006eab;
  font-size: 14px;
}

.file-type-label {
  padding: 6px 12px;
  color: rgba(0, 0, 0, 0.65);
  font-size: 14px;
}

.toolbar-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.toolbar-right .el-button {
  color: #006eab;
}

.toolbar-right .el-button:hover {
  color: #0088cc;
}

.preview-content {
  position: relative;
  background: #f5f5f5;
  overflow: hidden;
}

.preview-content.has-scroll {
  overflow: auto;
}

.preview-content.excel-content {
  display: flex;
  flex-direction: column;
}

.error-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  min-height: 300px;
  color: rgba(0, 0, 0, 0.45);
}

.error-container i {
  font-size: 48px;
  margin-bottom: 16px;
}

.error-container p {
  margin-bottom: 20px;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.65);
}

.image-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  overflow: auto;
  background: #f5f5f5;
}

.image-preview .el-image {
  max-width: 100%;
  max-height: 100%;
}

.image-preview .el-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.image-error-slot,
.image-loading-slot {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  min-height: 200px;
  color: rgba(0, 0, 0, 0.45);
}

.image-error-slot i,
.image-loading-slot i {
  font-size: 48px;
  margin-bottom: 12px;
}

.image-error-slot span,
.image-loading-slot span {
  font-size: 14px;
}

.pdf-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  overflow: auto;
  background: #525659;
  min-height: 100%;
}

.pdf-page-container {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  margin-bottom: 20px;
  position: relative;
}

.pdf-page-container.search-highlight-active {
  box-shadow:
    0 0 0 3px #006eab,
    0 2px 8px rgba(0, 0, 0, 0.3);
}

.pdf-search-highlight {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
}

.pdf-search-highlight .highlight-badge {
  background: #006eab;
  color: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.pdf-canvas {
  display: block;
}

.pdf-preview .textLayer {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  opacity: 1;
  line-height: 1;
}

.pdf-preview .textLayer > span,
.pdf-preview .textLayer .text-highlight-container {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0 0;
}

.pdf-preview .textLayer ::selection {
  background: rgba(0, 110, 171, 0.3);
}

.pdf-preview .textLayer .text-highlight-container {
  display: inline;
}

.pdf-preview .textLayer .text-highlight-container > span {
  color: transparent;
}

.pdf-preview .textLayer .search-highlight {
  background: rgba(255, 235, 59, 0.7);
  color: transparent;
  border-radius: 2px;
  padding: 0 1px;
  margin: 0 -1px;
}

.pdf-preview .textLayer .search-highlight-current {
  background: rgba(255, 152, 0, 0.9);
  color: transparent;
  border-radius: 2px;
  padding: 0 1px;
  margin: 0 -1px;
  box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.4);
}

.pdf-preview canvas {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  background: #fff;
}

.word-preview,
.excel-preview {
  height: 100%;
  overflow: auto;
  background: #e8e8e8;
}

.excel-preview {
  display: flex;
  flex-direction: column;
}

#excel-preview-container {
  flex: 1;
  min-height: 400px;
  height: 100%;
  background: #fff;
  position: relative;
}

#excel-preview-container.luckysheet {
  width: 100% !important;
  height: 100% !important;
  min-height: 400px;
}

#excel-preview-container .luckysheet-sheet-container {
  height: calc(100% - 35px) !important;
  overflow: auto;
}

#excel-preview-container .luckysheet-tab-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 35px;
  z-index: 100;
  background: #fff;
  border-top: 1px solid #e0e0e0;
}

#excel-preview-container .luckysheet-tab-pane-container {
  height: 35px;
}

.word-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px;
}

.docx-preview-wrapper {
  width: 100%;
  background: transparent;
}

.docx-preview-wrapper .docx-wrapper {
  background: #fff;
  padding: 20px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

.docx-preview-wrapper .docx-wrapper > section.docx {
  background: #fff;
  min-height: auto;
  width: auto;
  position: relative;
  padding: 0 40px;
  box-sizing: border-box;
}

/* doc 旧版格式 iframe 预览 */
.doc-iframe-preview {
  width: 100%;
  height: 100%;
  min-height: 400px;
  border: none;
  background: #fff;
}

.docx-preview-wrapper .docx-wrapper > section.docx:not(:last-child) {
  border-bottom: 1px dashed #ccc;
  padding-bottom: 30px;
  margin-bottom: 30px;
}

.excel-content {
  padding: 20px;
}

.excel-content table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.excel-content table td,
.excel-content table th {
  border: 1px solid #d0d0d0;
  padding: 6px 12px;
  text-align: left;
}

.excel-content table th {
  background: #f5f5f5;
  font-weight: 500;
  color: #000;
}

.excel-content tr:hover {
  background: #fafafa;
}

.excel-content tr:nth-child(even) {
  background: #fafafa;
}

.loading-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  min-height: 300px;
}

.loading-container .el-loading-spinner {
  margin-top: 0;
}

.loading-container .el-loading-text {
  margin-top: 12px;
  color: rgba(0, 0, 0, 0.45);
}

@media print {
  .page-break {
    page-break-after: always; /* 在一个页面的内容之后强制分页 */
  }
}
/* 为每个段落添加潜在分页点 */
.docx-preview-wrapper [style*="mso-element"] {
  break-after: page;
  page-break-after: always;
}

/* 表格强制分页 */
.docx-preview-wrapper table {
  break-inside: avoid;
  page-break-inside: avoid;
}

/* 标题后分页 */
.docx-preview-wrapper h1,
.docx-preview-wrapper h2,
.docx-preview-wrapper h3 {
  break-after: page;
  page-break-after: avoid;
}
@media print {
  .preview-toolbar,
  .preview-header {
    display: none !important;
  }

  .preview-content {
    height: auto !important;
    overflow: visible !important;
  }

  .image-preview img {
    max-width: 100% !important;
    max-height: none !important;
  }

  .excel-preview {
    min-height: 300px;
  }
}

@media screen and (max-width: 768px) {
  .excel-preview {
    min-height: 250px;
  }

  #excel-preview-container {
    min-height: 250px;
  }

  #excel-preview-container.luckysheet {
    min-height: 250px;
  }
}
