/* PDF 预览组件样式 */

/* 组件根容器 - 全屏遮罩，定位最上层 */
.pdf-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #fafafa;
    z-index: 9999;
    display: none;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.pdf-preview-overlay.active {
    display: flex;
}

.pdf-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.pdf-toolbar {
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 60px 8px 16px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.toolbar-title {
    flex-shrink: 0;
    max-width: 40%;
    margin-right: 16px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;
}

.toolbar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.close-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    transition: background-color 0.15s ease;
}

.close-btn:hover {
    background-color: rgba(0, 0, 0, 0.06);
}

.close-btn:active {
    background-color: rgba(0, 0, 0, 0.1);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: #e0e0e0;
    margin: 0 4px;
}

.btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #5f6368;
}

.btn:hover:not(:disabled) {
    background-color: rgba(0, 0, 0, 0.06);
}

.btn:active:not(:disabled) {
    background-color: rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    opacity: 0.38;
    cursor: default;
}

.page-info {
    font-size: 13px;
    color: #5f6368;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-separator {
    opacity: 0.5;
}

.zoom-value {
    font-size: 13px;
    color: #5f6368;
    min-width: 45px;
    text-align: center;
    font-weight: 500;
}

.pdf-canvas-wrapper {
    flex: 1;
    background-color: #fafafa;
    overflow: auto;
    display: block;
    padding: 24px;
    position: relative;
}

.pdf-canvas-wrapper canvas {
    display: block;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    background-color: #ffffff;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4080ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    color: #ff4d4f;
    font-size: 14px;
    text-align: center;
    padding: 20px;
    display: none;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .pdf-toolbar {
        padding: 6px 52px 6px 12px;
    }

    .toolbar-title {
        max-width: 35%;
        font-size: 13px;
        margin-right: 12px;
    }

    .toolbar-center {
        gap: 4px;
    }

    .btn {
        width: 40px;
        height: 40px;
        border-radius: 8px;
    }

    .btn svg {
        width: 24px;
        height: 24px;
    }

    .page-info {
        font-size: 14px;
    }

    .zoom-value {
        font-size: 14px;
        min-width: 50px;
    }

    .toolbar-divider {
        height: 28px;
    }

    .pdf-canvas-wrapper {
        padding: 8px;
    }

    .close-btn {
        right: 12px;
    }
}

@media (max-width: 480px) {
    .pdf-toolbar {
        padding: 4px 48px 4px 8px;
    }

    .toolbar-title {
        max-width: 30%;
        font-size: 12px;
        margin-right: 8px;
    }

    .page-info {
        font-size: 13px;
    }

    .pdf-canvas-wrapper {
        padding: 4px;
    }

    .btn {
        width: 36px;
        height: 36px;
    }
}
