/* 文件预览整体容器：PC 端居中大弹层 */
.file-preview {
    width: 86vw;
    height: 80vh;
    max-width: 1100px;
    box-sizing: border-box;
    background-color: #1c1c1c;
    overflow: hidden;
}

/* 移动端全屏：填满弹层可视区域（弹层头部约占 50px） */
.popup-fullscreen .file-preview {
    width: 100%;
    height: 100%;
    max-width: none;
}

/* 图片预览容器：禁用默认触摸手势，交由 JS 实现缩放/拖动 */
.file-preview-image-wrap {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    background-color: #1c1c1c;
}

.file-preview-image {
    max-width: 100%;
    max-height: 100%;
    transform-origin: center center;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

/* PDF 预览容器：纵向滚动浏览多页（滚动条仅出现在此内层） */
.file-preview-pdf {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: #525659;
    padding: 8px 0;
    box-sizing: border-box;
}

/* 简单预览弹窗：外层不滚动，内层 .file-preview-pdf 滚动 */
.popup.popup-file-preview:has(.file-preview-pdf) {
    max-height: 92vh;
}

.popup.popup-file-preview:has(.file-preview-pdf) .file-preview {
    height: min(80vh, calc(92vh - 48px));
    max-height: 100%;
}

.file-preview-pdf canvas {
    display: block;
    margin: 0 auto 8px;
    max-width: 100%;
    background-color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* 加载中 / 失败提示 */
.file-preview-tip {
    color: #fff;
    text-align: center;
    padding: 30px 20px;
    font-size: 14px;
    line-height: 1.6;
}