/* mobile-pdf-optimize.css - PDF移动端优化样式 */

/* 超小屏设备PDF适配 (320px-480px) */
@media screen and (max-width: 480px) {
    body.has-pdf-preview .pdf-viewer-iframe {
        height: calc(100vh - 110px) !important;
        max-height: calc(100vh - 110px) !important;
        min-height: calc(100vh - 110px) !important;
    }
    
    body.has-pdf-preview .pdf-preview-container,
    body.has-pdf-preview #pdf-preview-area,
    body.has-pdf-preview .preview-panel {
        height: calc(100vh - 110px) !important;
        max-height: calc(100vh - 110px) !important;
        min-height: calc(100vh - 110px) !important;
    }
}

/* 小屏设备PDF适配 (481px-768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    body.has-pdf-preview .pdf-viewer-iframe {
        height: calc(100vh - 120px) !important;
        max-height: calc(100vh - 120px) !important;
        min-height: calc(100vh - 120px) !important;
    }
    
    body.has-pdf-preview .pdf-preview-container,
    body.has-pdf-preview #pdf-preview-area,
    body.has-pdf-preview .preview-panel {
        height: calc(100vh - 120px) !important;
        max-height: calc(100vh - 120px) !important;
        min-height: calc(100vh - 120px) !important;
    }
}

/* 平板设备PDF适配 (769px-1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    body.has-pdf-preview .pdf-viewer-iframe {
        height: calc(100vh - 80px) !important;
        max-height: calc(100vh - 80px) !important;
        min-height: calc(100vh - 80px) !important;
    }
    
    body.has-pdf-preview .pdf-preview-container,
    body.has-pdf-preview #pdf-preview-area,
    body.has-pdf-preview .preview-panel {
        height: calc(100vh - 80px) !important;
        max-height: calc(100vh - 80px) !important;
        min-height: calc(100vh - 80px) !important;
    }
}

/* 移动端设备检测 - 只针对PDF预览时的头部优化 */
@media screen and (max-width: 768px) {
    
    /* 当PDF预览时，隐藏子比主题顶部菜单栏和导航 */
    body.has-pdf-preview .header,
    body.has-pdf-preview .navbar,
    body.has-pdf-preview .top-nav,
    body.has-pdf-preview .site-header,
    body.has-pdf-preview .main-header,
    body.has-pdf-preview .zib-header,
    body.has-pdf-preview .header-wrapper,
    body.has-pdf-preview .navigation,
    body.has-pdf-preview .menu-wrapper,
    body.has-pdf-preview .top-menu {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
    }
    
    /* 当PDF预览时，确保主体内容从顶部开始 */
    body.has-pdf-preview .main,
    body.has-pdf-preview .content,
    body.has-pdf-preview .site-content,
    body.has-pdf-preview .main-content,
    body.has-pdf-preview .zib-main {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* PDF预览时，确保滚动只在PDF区域内 */
    body.has-pdf-preview {
        overflow: hidden !important;
    }
    
    /* PDF iframe优化 - 确保可以内部滚动，为底部导航栏预留空间 */
    body.has-pdf-preview .pdf-viewer-iframe {
        width: 100% !important;
        height: calc(100vh - 120px) !important;
    max-height: calc(100vh - 120px) !important;
    min-height: calc(100vh - 120px) !important;
        border: none !important;
        overflow: auto !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        position: relative !important;
    }
    
    /* PDF预览容器优化 */
    body.has-pdf-preview .pdf-preview-container {
        width: 100% !important;
        height: calc(100vh - 120px) !important;
    max-height: calc(100vh - 120px) !important;
    min-height: calc(100vh - 120px) !important;
        overflow: hidden !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        position: relative !important;
    }
    
    /* PDF预览区域优化 */
    body.has-pdf-preview #pdf-preview-area {
        width: 100% !important;
        height: calc(100vh - 120px) !important;
    max-height: calc(100vh - 120px) !important;
    min-height: calc(100vh - 120px) !important;
        overflow: hidden !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        position: relative !important;
    }
    
    /* 保持原有布局，只优化预览面板 */
    body.has-pdf-preview .preview-panel {
        height: calc(100vh - 120px) !important;
    max-height: calc(100vh - 120px) !important;
    min-height: calc(100vh - 120px) !important;
        overflow: hidden !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        position: relative !important;
    }
}