/* ==========================================================================
   业务样式：拖拽、缩略图网格、对比视图、首页卡片
   ========================================================================== */

/* ---------- 首页功能卡片 ---------- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.feature-card {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,21,41,0.08);
    padding: 24px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border-top: 3px solid transparent;
}
.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,21,41,0.12);
    border-top-color: #409EFF;
}
.feature-card__icon {
    width: 56px; height: 56px;
    line-height: 56px;
    text-align: center;
    background: #ecf5ff;
    color: #409EFF;
    border-radius: 8px;
    font-size: 28px;
    margin-bottom: 16px;
}
.feature-card__title {
    font-size: 16px;
    font-weight: 600;
    color: #303133;
    margin-bottom: 6px;
}
.feature-card__desc {
    font-size: 13px;
    color: #909399;
    line-height: 1.6;
}

/* ---------- 通用工具栏 ---------- */
.toolbar {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 10px;
    flex-wrap: wrap;
}
.toolbar__title {
    font-size: 15px;
    font-weight: 600;
    color: #303133;
    margin-right: auto;
}
.toolbar .info {
    font-size: 12px;
    color: #909399;
    margin-left: 8px;
}

/* ---------- 侧边栏底部上传区（暗色主题，3 行垂直布局） ---------- */
.sidebar-upload {
    margin: 8px;
    padding: 18px 12px;
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 240px;  /* 拉高，让所有 hint 完整显示 */
    color: #fff;
    text-align: center;
}
.sidebar-upload:hover {
    background: rgba(64,158,255,0.12);
    border-color: rgba(64,158,255,0.6);
}
.sidebar-upload.is-dragover {
    background: rgba(64,158,255,0.2);
    border-color: #409EFF;
}
.sidebar-upload .dropzone__icon {
    font-size: 30px;
    color: rgba(255,255,255,0.85);
    line-height: 1;
}
.sidebar-upload.is-dragover .dropzone__icon { color: #409EFF; }
.sidebar-upload__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    width: 100%;
    flex: 1;            /* 占满中间空间 */
    justify-content: center;  /* 文字块本身垂直居中 */
}
.sidebar-upload .dropzone__text {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
}
.sidebar-upload .dropzone__hint {
    color: rgba(255,255,255,0.65);
    font-size: 11px;
    line-height: 1.4;
    /* 不截断，让 hint 全部显示 */
    word-break: break-word;
    white-space: normal;
}
.sidebar-upload .dropzone__btn {
    margin-top: auto;
    background: #409EFF;
    color: #fff;
    border: 0;
    padding: 9px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;  /* 文字在按钮内居中 */
    transition: background 0.15s;
}
.sidebar-upload .dropzone__btn:hover { background: #66b1ff; }
.sidebar-upload .dropzone__btn:active { background: #3a8ee6; }

/* ---------- 拖拽上传区（横排 + 内嵌「上传」按钮） ---------- */
.dropzone {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 6px 6px 18px;
    border: 2px dashed #c0c4cc;
    border-radius: 6px;
    background: #fafbfc;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    color: #606266;
    flex-wrap: wrap;
    min-height: 56px;
}
.dropzone:hover { border-color: #409EFF; background: #ecf5ff; }
.dropzone.is-dragover { border-color: #409EFF; background: #ecf5ff; color: #409EFF; }
.dropzone__icon {
    font-size: 24px;
    color: #c0c4cc;
    line-height: 1;
    flex-shrink: 0;
}
.dropzone.is-dragover .dropzone__icon { color: #409EFF; }
.dropzone__text { font-size: 14px; font-weight: 500; }
.dropzone__hint { font-size: 12px; color: #909399; flex: 1; min-width: 0; }
.dropzone__input { display: none; }
.dropzone__btn {
    margin-left: auto;
    background: #409EFF;
    color: #fff;
    border: 0;
    padding: 9px 22px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
    transition: background 0.15s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.dropzone__btn:hover { background: #66b1ff; }
.dropzone__btn:active { background: #3a8ee6; }

/* ---------- 缩略图网格（编辑器） ---------- */
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    padding: 16px;
    background: #fff;
    border-radius: 4px;
    min-height: 160px;
}
.thumb-cell {
    position: relative;
    background: #fafbfc;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: grab;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
}
.thumb-cell:hover { border-color: #b3d8ff; box-shadow: 0 2px 8px rgba(64,158,255,0.15); }
.thumb-cell.is-dragging { opacity: 0.4; }
.thumb-cell.sortable-ghost { background: #ecf5ff; border-color: #409EFF; }
.thumb-cell__img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: contain;
    background: #fff;
    border-bottom: 1px solid #ebeef5;
    pointer-events: none;
}
.thumb-cell__footer {
    padding: 4px 8px;
    display: flex;
    align-items: center;
    background: #fff;
}
.thumb-cell__index {
    font-size: 12px;
    color: #606266;
    font-weight: 600;
    flex: 1;
}
.thumb-cell__src {
    font-size: 10px;
    color: #c0c4cc;
    margin-right: 4px;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.thumb-cell__del {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #f56c6c;
    color: #fff;
    border: 0;
    width: 22px; height: 22px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: background 0.15s;
}
.thumb-cell__del:hover { background: #f78989; }
.thumb-cell.is-active { border-color: #409EFF; box-shadow: 0 0 0 2px rgba(64,158,255,0.2); }

/* 选中态（合并后用于编辑器多选） */
.thumb-cell.is-selected {
    border-color: #409EFF;
    background: #ecf5ff;
    box-shadow: 0 0 0 2px rgba(64,158,255,0.25);
}
.thumb-cell.is-selected .thumb-cell__img { opacity: 0.85; }
.thumb-cell__check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    background: #409EFF;
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: none;
    z-index: 2;
    pointer-events: none; /* 让 click 透传到 cell */
}
.thumb-cell.is-selected .thumb-cell__check { display: block; }
/* 整个 cell 可点击切换选中 */
.thumb-cell { cursor: pointer; }

/* 编辑器追加区（缩略图列表后面） */
.thumb-append {
    grid-column: 1 / -1;
    border: 2px dashed #c0c4cc;
    border-radius: 4px;
    padding: 8px 16px;
    color: #909399;
    cursor: pointer;
    background: #fafbfc;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    flex-wrap: wrap;
}
.thumb-append:hover { border-color: #409EFF; color: #409EFF; background: #ecf5ff; }
.thumb-append.is-dragover { border-color: #409EFF; color: #409EFF; background: #ecf5ff; }
.thumb-append__icon { font-size: 20px; line-height: 1; }
.thumb-append__text { font-size: 13px; font-weight: 500; }
.thumb-append__hint { font-size: 11px; color: #c0c4cc; }

/* ---------- 大图预览 ---------- */
.preview-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1f2d3d;
    min-height: 60vh;
    padding: 20px;
}
.preview-body img {
    max-width: 100%;
    max-height: 80vh;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    background: #fff;
}

/* ---------- OCR 对比视图 ---------- */
.ocr-layout {
    display: flex;
    gap: 16px;
    height: calc(100vh - 200px);
    min-height: 500px;
}
.ocr-pane {
    flex: 1;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,21,41,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ocr-pane__head {
    padding: 10px 16px;
    border-bottom: 1px solid #ebeef5;
    font-weight: 600;
    color: #303133;
    background: #fafbfc;
    display: flex;
    align-items: center;
}
.ocr-pane__head .info { margin-left: auto; font-weight: 400; color: #909399; font-size: 12px; }
.ocr-pane__body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    padding: 16px;
}
.ocr-pane__body img { max-width: 100%; max-height: 100%; box-shadow: 0 2px 8px rgba(0,0,0,0.1); background: #fff; }
.ocr-pane__body--text {
    background: #fff;
    align-items: stretch;
    justify-content: flex-start;
    padding: 20px;
}
.ocr-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14px;
    line-height: 1.8;
    color: #303133;
    width: 100%;
}

/* OCR 缩略图条 */
.ocr-thumbs {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-radius: 4px;
    margin-bottom: 16px;
    overflow-x: auto;
}
.ocr-thumb {
    flex-shrink: 0;
    width: 80px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s;
}
.ocr-thumb:hover { border-color: #b3d8ff; }
.ocr-thumb.is-active { border-color: #409EFF; }
.ocr-thumb img { width: 100%; aspect-ratio: 3/4; object-fit: contain; background: #fff; }
.ocr-thumb__label {
    text-align: center;
    font-size: 11px;
    color: #606266;
    padding: 2px 0;
    background: #fafbfc;
    border-top: 1px solid #ebeef5;
}

/* OCR 进度遮罩 */
.ocr-progress {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 5;
}
.ocr-progress.is-visible { display: flex; }
.ocr-progress__text { margin-bottom: 12px; color: #606266; font-size: 13px; }
.ocr-progress__bar { width: 200px; }

/* ---------- 合并页文件列表 ---------- */
.merge-list {
    background: #fff;
    border-radius: 4px;
    padding: 16px;
    min-height: 200px;
}
.merge-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #ebeef5;
    border-radius: 4px;
    margin-bottom: 8px;
    background: #fafbfc;
    transition: all 0.15s;
    cursor: grab;
    gap: 12px;
}
.merge-item:hover { background: #ecf5ff; border-color: #b3d8ff; }
.merge-item.sortable-ghost { opacity: 0.4; background: #ecf5ff; }
.merge-item__thumb {
    width: 48px; height: 64px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #ebeef5;
    border-radius: 3px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #c0c4cc;
}
.merge-item__thumb img { width: 100%; height: 100%; object-fit: contain; }
.merge-item__info { flex: 1; min-width: 0; }
.merge-item__name {
    font-size: 14px;
    color: #303133;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.merge-item__meta { font-size: 12px; color: #909399; margin-top: 2px; }
.merge-item__drag { color: #c0c4cc; cursor: grab; }
.merge-item__del {
    background: transparent;
    border: 0;
    color: #f56c6c;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
}
.merge-item__del:hover { color: #f78989; }

/* ---------- 输出文件列表 ---------- */
.output-list {
    background: #fff;
    border-radius: 4px;
}
.output-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #ebeef5;
    gap: 12px;
}
.output-item:last-child { border-bottom: 0; }
.output-item__name { flex: 1; color: #303133; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.output-item__size { color: #909399; font-size: 12px; }

/* ---------- 状态色块 ---------- */
.muted { color: #909399; }

/* ---------- 首页"今天的任务"列表 ---------- */
.output-tasks {
    background: #fff;
    border-radius: 4px;
}
.output-tasks__row {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1fr 1.2fr 0.8fr;
    gap: 12px;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #ebeef5;
}
.output-tasks__row:last-child { border-bottom: 0; }
.output-tasks__row--head {
    background: #fafbfc;
    font-size: 12px;
    color: #909399;
    font-weight: 600;
}
.output-tasks__name {
    color: #303133;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.output-tasks__user {
    color: #303133;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.output-tasks__time {
    color: #606266;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* ---------- 首页"清理倒计时"进度条 ---------- */
.cleanup-progress {
    background: #fafbfc;
    border-radius: 4px;
    padding: 10px 12px;
    border: 1px solid #ebeef5;
}
.cleanup-progress__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.cleanup-progress__label {
    font-size: 12px;
    color: #606266;
}
.cleanup-progress__bar {
    width: 100%;
    height: 6px;
    background: #ebeef5;
    border-radius: 3px;
    overflow: hidden;
}
.cleanup-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, #409EFF 0%, #67c23a 100%);
    transition: width 0.3s linear;
    width: 0;
}
.text-primary { color: #409EFF; }
.text-success { color: #67c23a; }
.text-danger { color: #f56c6c; }
.text-warning { color: #e6a23c; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ---------- 上传进度条（暗色 + 浅色两套） ---------- */
.upload-progress {
    width: 100%;
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.3;
}
.upload-progress__bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: hidden;
}
.upload-progress__fill {
    height: 100%;
    background: #67c23a;
    transition: width 0.15s linear;
    width: 0;
}
.upload-progress__text {
    margin-top: 4px;
    opacity: 0.85;
}
/* 浅色主题（白底页面用） */
.upload-progress--light {
    color: #606266;
}
.upload-progress--light .upload-progress__bar {
    background: #ebeef5;
}

/* ---------- 创建 PDF 页：上传文件预览网格 ---------- */
.subsection {
    /* 子区容器，让"上传文件预览"小标题与下方内容有清晰分隔 */
}
.subsection__title {
    font-size: 13px;
    font-weight: 600;
    color: #303133;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.subsection__title::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 14px;
    background: #409EFF;
    border-radius: 2px;
}
.preview-grid {
    display: grid;
    /* 撑满视口：减掉页头(60) + 创建说明卡(~120) + 本批次任务header(50) + 边距(60) ≈ 300 */
    height: calc(100vh - 300px);
    min-height: 400px;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    grid-auto-rows: 1fr;          /* 每行等高，预览图撑满 */
    gap: 14px;
    align-content: start;
}
.preview-tile {
    position: relative;
    background: #fafbfc;
    border: 1px solid #ebeef5;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.preview-tile:hover {
    border-color: #b3d8ff;
    box-shadow: 0 2px 8px rgba(64,158,255,0.12);
}
.preview-tile__thumb {
    width: 100%;
    flex: 1;                      /* 撑满 tile 剩余高度 */
    min-height: 0;                /* 关键：让 embed/iframe 正确缩到容器内 */
    background: #fff;
    border-bottom: 1px solid #ebeef5;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.preview-tile__thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.preview-tile__thumb embed,
.preview-tile__thumb iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
    display: block;
}
.preview-tile__icon {
    font-size: 48px;
    color: #c0c4cc;
    line-height: 1;
}
.preview-tile__body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;               /* 防止被压缩 */
    background: #fafbfc;
}
.preview-tile__name {
    font-size: 13px;
    color: #303133;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.preview-tile__meta {
    font-size: 12px;
    color: #909399;
}
.preview-tile__error {
    font-size: 12px;
    color: #f56c6c;
    word-break: break-word;
    line-height: 1.4;
}
.preview-tile__actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.preview-tile__loading {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}
