/* ============================================================
   docview：正文文档块（Word/Excel/PDF）按原版式预览
   与后台 UEditor docimport 插入的 <div class="pb-doc"> 配合
   ============================================================ */

/* ---------- 兜底：编辑器占位卡片若意外原样输出也能辨识 ---------- */
.pb-doc {
    margin: 18px 0;
}

.pb-doc-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 18px;
    border: 1px dashed #cfd4dc;
    border-radius: 8px;
    background: #f7f8fa;
}

.pb-doc-ico {
    flex: 0 0 auto;
    display: inline-block;
    min-width: 46px;
    padding: 5px 9px;
    box-sizing: border-box;
    border-radius: 5px;
    background: #eef1f6;
    color: #5b6472;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pb-doc-ico-docx, .pb-doc-ico-doc { background: #2b579a; color: #fff; }
.pb-doc-ico-xlsx, .pb-doc-ico-xls { background: #217346; color: #fff; }
.pb-doc-ico-pdf { background: #c43832; color: #fff; }
.pb-doc-ico-file { background: #6a7280; color: #fff; }

.pb-doc-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.pb-doc-tip {
    width: 100%;
    font-size: 12px;
    color: #999;
}

/* ---------- 文档查看器 ---------- */
.pdv {
    margin: 26px 0;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.pdv-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 11px 18px;
    background: #f7f9fb;
    border-bottom: 1px solid #e8ebf0;
}

.pdv-toolbar .pdv-fname {
    font-size: 14px;
    font-weight: 600;
    color: #2a2f36;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 55%;
}

.pdv-toolbar .pdv-state {
    font-size: 12px;
    color: #8a919f;
}

.pdv-toolbar .pdv-dl {
    margin-left: auto;
    flex: 0 0 auto;
    padding: 5px 14px;
    border: 1px solid #cdd4dd;
    border-radius: 6px;
    background: #fff;
    color: #46505c;
    font-size: 13px;
    text-decoration: none;
    transition: all .25s;
}

.pdv-toolbar .pdv-dl:hover {
    border-color: var(--brand, #9a6b4f);
    color: var(--brand, #9a6b4f);
}

.pdv-body {
    background: #eceef1;
    overflow-x: auto;
    max-height: 74vh;
    overflow-y: auto;
}

.pdv-loading,
.pdv-error,
.pdv-fallback {
    padding: 46px 20px;
    text-align: center;
    color: #8a919f;
    font-size: 14px;
    line-height: 1.9;
}

.pdv-error strong,
.pdv-fallback strong {
    display: block;
    color: #c0392b;
    margin-bottom: 6px;
}

/* ---------- PDF 分页 ---------- */
.pdv-body .pdv-page {
    margin: 10px auto;
    max-width: 100%;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.pdv-body .pdv-page canvas {
    display: block;
    margin: 0 auto;
}

/* ---------- docx（docx-preview 输出） ---------- */
.pdv-body.docx-wrap {
    background: #e5e7eb;
    padding: 12px 0;
}

.pdv-body .docx-wrapper {
    margin: 0 auto;
    max-width: 100%;
    overflow: visible;
}

.pdv-body .docx-wrapper section.docx {
    margin: 0 auto 12px;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.16);
}

.pdv-body .docx-wrapper img {
    max-width: 100%;
}

/* ---------- xlsx ---------- */
.pdv-xlsx-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
    background: #f2f4f7;
    border-bottom: 1px solid #e4e7ec;
    position: sticky;
    top: 0;
    z-index: 3;
}

.pdv-xlsx-tabs button {
    padding: 4px 14px;
    border: 1px solid #cdd4dd;
    border-radius: 14px;
    background: #fff;
    font-size: 12px;
    color: #555;
    cursor: pointer;
}

.pdv-xlsx-tabs button.active {
    background: var(--brand, #9a6b4f);
    border-color: var(--brand, #9a6b4f);
    color: #fff;
}

.pdv-xlsx-sheet {
    padding: 14px;
    background: #fff;
}

.pdv-xlsx-sheet table {
    border-collapse: collapse;
    font-size: 13px;
}

.pdv-xlsx-sheet table td,
.pdv-xlsx-sheet table th {
    border: 1px solid #ccd0d6;
    padding: 4px 8px;
    white-space: nowrap;
}

/* 窄屏适配 */
@media (max-width: 720px) {
    .pdv-toolbar .pdv-fname { max-width: 100%; }
    .pdv-toolbar .pdv-dl { margin-left: 0; }
}
