/* PDF和Word在线阅读插件 - 前端样式 */

/* 内嵌阅读器容器 */
.pwv-embed {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #fafafa;
    box-sizing: border-box;
}

/* 加载中提示 */
.pwv-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
    font-size: 14px;
}

.pwv-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 3px solid #ddd;
    border-top-color: #0078d4;
    border-radius: 50%;
    animation: pwv-spin 0.8s linear infinite;
}

@keyframes pwv-spin {
    to { transform: rotate(360deg); }
}

/* 错误提示 */
.pwv-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #d32f2f;
    font-size: 14px;
    background: #fff5f5;
}

/* PDF阅读器工具栏 */
.pwv-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    font-size: 13px;
    flex-wrap: wrap;
    box-sizing: border-box;
}

.pwv-toolbar button {
    padding: 4px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.5;
    transition: background 0.2s;
}

.pwv-toolbar button:hover {
    background: #e8e8e8;
}

.pwv-toolbar button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pwv-toolbar .pwv-page-info {
    margin-left: 8px;
    color: #555;
}

.pwv-toolbar .pwv-zoom-info {
    color: #555;
    min-width: 50px;
    text-align: center;
}

/* PDF画布容器（高度自适应，不限制max-height） */
.pwv-pdf-container {
    overflow-x: auto;
    overflow-y: hidden;
    background: #525659;
    text-align: center;
    padding: 10px;
    height: auto;
}

/* 单个PDF页面canvas */
.pwv-pdf-container canvas,
.pwv-pdf-page {
    display: block;
    margin: 0 auto 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* 工具栏分隔符 */
.pwv-sep {
    color: #bbb;
    margin: 0 2px;
    user-select: none;
}

/* 激活状态按钮 */
.pwv-toolbar button.pwv-active {
    background: #0078d4;
    color: #fff;
    border-color: #0078d4;
}

.pwv-toolbar button.pwv-active:hover {
    background: #106ebe;
}

/* Word文档渲染容器（高度自适应） */
.pwv-doc-container {
    overflow: auto;
    background: #fff;
    padding: 20px 30px;
    line-height: 1.8;
    font-size: 14px;
    color: #333;
    height: auto;
}

.pwv-doc-container h1,
.pwv-doc-container h2,
.pwv-doc-container h3 {
    margin: 16px 0 8px;
    color: #222;
}

.pwv-doc-container p {
    margin: 8px 0;
}

.pwv-doc-container table {
    border-collapse: collapse;
    margin: 10px 0;
}

.pwv-doc-container table td,
.pwv-doc-container table th {
    border: 1px solid #ddd;
    padding: 6px 10px;
}

.pwv-doc-container img {
    max-width: 100%;
    height: auto;
}

/* 在线阅读按钮 */
.pwv-btn {
    display: inline-block;
    padding: 3px 12px;
    margin-left: 8px;
    border: 1px solid #0078d4;
    border-radius: 3px;
    background: #0078d4;
    color: #fff !important;
    font-size: 12px;
    line-height: 1.5;
    cursor: pointer;
    text-decoration: none;
    vertical-align: middle;
    transition: background 0.2s, opacity 0.2s;
}

.pwv-btn:hover {
    background: #106ebe;
    color: #fff !important;
    text-decoration: none;
}

/* 弹窗遮罩 */
.pwv-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pwv-fadein 0.2s ease;
}

@keyframes pwv-fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 弹窗容器 */
.pwv-modal {
    position: relative;
    width: 90%;
    max-width: 1000px;
    height: 90%;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* 弹窗头部 */
.pwv-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.pwv-modal-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

.pwv-modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    border-radius: 3px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwv-modal-close:hover {
    background: #ddd;
    color: #333;
}

/* 弹窗内容区 */
.pwv-modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 弹窗内：容器撑满弹窗并滚动（弹窗有固定高度） */
.pwv-modal-body .pwv-pdf-container,
.pwv-modal-body .pwv-doc-container {
    max-height: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
}

/* 响应式 */
@media (max-width: 768px) {
    .pwv-modal {
        width: 95%;
        height: 95%;
    }

    .pwv-toolbar {
        gap: 4px;
        padding: 6px 8px;
    }

    .pwv-toolbar button {
        padding: 4px 8px;
        font-size: 12px;
    }

    .pwv-btn {
        font-size: 11px;
        padding: 2px 8px;
    }
}