/* 安全PDF查看器样式 */

/* 基础容器样式 */
.secure-viewer {
    margin: 0 auto 40px auto;
    max-width: 100%;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e9ecef;
}

/* PDF头部样式 */
.pdf-header {
    background: linear-gradient(135deg, #8B0000 0%, #660000 100%);
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.pdf-header h4 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    color: white;
}

.pdf-header h4 .fas {
    color: white;
    margin-right: 12px;
    font-size: 1.4rem;
}

/* 按钮中的图标样式 */
.pdf-controls .btn .fas {
    color: white; /* 按钮中的图标设为白色 */
    font-size: 1rem;
}

/* PDF控制按钮样式 */
.pdf-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pdf-controls .btn {
    border: none;
    background: transparent; /* 透明背景 */
    color: white; /* 白色文字 */
    transition: all 0.3s ease;
    backdrop-filter: none; /* 移除背景模糊效果 */
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
}

.pdf-controls .btn:hover {
    background: rgba(255, 255, 255, 0.1); /* 悬停时轻微白色背景 */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pdf-controls .btn:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.2); /* 点击时稍微明显的背景 */
}

/* PDF查看器容器 */
.pdf-viewer {
    position: relative;
    min-height: 600px;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* 加载状态 */
.pdf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #6c757d;
    z-index: 10;
}

.pdf-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

.pdf-loading p {
    margin-top: 15px;
    font-size: 1.1rem;
    font-weight: 500;
}

/* 错误状态 */
.pdf-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #856404;
    background: #fff3cd;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #ffeaa7;
    z-index: 10;
}

.pdf-error p {
    margin: 10px 0 0 0;
    font-size: 1.1rem;
}

.pdf-error .text-muted {
    color: #6c757d !important;
    font-size: 0.9rem;
}

/* PDF容器 */
.pdf-container {
    padding: 15px; /* 减少内边距 */
    text-align: center;
}

/* PDF页面容器 */
.pdf-pages-container {
    text-align: center;
    width: 100%;
    max-height: 800px; /* 限制最大高度，大约一页A4纸的高度 */
    overflow: auto; /* 允许垂直和水平滚动 */
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px; /* 减少内边距 */
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
    -webkit-overflow-scrolling: touch; /* 移动端平滑滚动 */
    min-width: 100%; /* 确保容器至少和父容器一样宽 */
}

/* 自定义滚动条样式 */
.pdf-pages-container::-webkit-scrollbar {
    width: 8px;
}

.pdf-pages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.pdf-pages-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.pdf-pages-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* PDF画布 */
.pdf-canvas {
    max-width: none; /* 移除最大宽度限制，允许超出容器 */
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    background: white;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    margin-bottom: 15px; /* 减少页面间距 */
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* PDF信息 */
.pdf-info {
    margin-top: 20px;
    text-align: center;
}



/* 页面信息 */
.page-info {
    background: #e9ecef;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    color: #495057;
    min-width: 120px;
    text-align: center;
}

.page-info .current-page {
    color: #007bff;
    font-weight: 600;
}

.page-info .total-pages {
    color: #6c757d;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .pdf-header {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pdf-header h4 {
        font-size: 1.1rem;
    }
    
    .pdf-controls {
        width: 100%;
        justify-content: center;
    }
    
    .pdf-viewer {
        min-height: 400px;
    }
    
    .pdf-container {
        padding: 10px; /* 移动端更紧凑 */
    }
    
    .pdf-pages-container {
        max-height: 600px; /* 移动端减少高度 */
        padding: 10px; /* 移动端减少内边距 */
    }
    
    .pdf-canvas {
        margin-bottom: 10px; /* 移动端减少页面间距 */
    }
    
    .pdf-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .page-info {
        order: -1;
        margin-bottom: 10px;
    }
}

/* 平板端响应式设计 */
@media (min-width: 769px) and (max-width: 1024px) {
    .pdf-pages-container {
        max-height: 700px; /* 平板端适中高度 */
        padding: 12px; /* 平板端适中内边距 */
    }
    
    .pdf-canvas {
        margin-bottom: 12px; /* 平板端适中页面间距 */
    }
}

@media (max-width: 576px) {
    .secure-viewer {
        margin: 0 auto 20px auto;
        border-radius: 8px;
    }
    
    .pdf-header {
        padding: 12px;
        border-radius: 8px 8px 0 0;
    }
    
    .pdf-header h4 {
        font-size: 1rem;
    }
    
    .pdf-controls .btn {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    .pdf-viewer {
        min-height: 300px;
        border-radius: 0 0 8px 8px;
    }
    
    .pdf-container {
        padding: 8px; /* 小屏幕更紧凑 */
    }
    
    .pdf-pages-container {
        max-height: 500px; /* 小屏幕更小高度 */
        padding: 8px; /* 小屏幕更小内边距 */
    }
    
    .pdf-canvas {
        margin-bottom: 8px; /* 小屏幕更小页面间距 */
    }
}

/* 大屏幕优化 */
@media (min-width: 1200px) {
    .pdf-viewer {
        min-height: 700px;
    }
    
    .pdf-container {
        padding: 20px; /* 大屏幕适中的内边距 */
    }
}

@media (min-width: 1600px) {
    .pdf-viewer {
        min-height: 800px;
    }
}

/* 全屏模式样式 */
.secure-viewer:fullscreen {
    border-radius: 0;
    margin: 0;
    max-width: none;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.secure-viewer:fullscreen .pdf-header {
    flex-shrink: 0;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.secure-viewer:fullscreen .pdf-viewer {
    flex: 1;
    height: calc(100vh - 80px);
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.secure-viewer:fullscreen .pdf-container {
    flex: 1;
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.secure-viewer:fullscreen .pdf-pages-container {
    flex: 1;
    max-height: none;
    height: 100%;
    overflow: auto;
}

/* 打印样式 */
@media print {
    .secure-viewer {
        box-shadow: none;
        border: 1px solid #000;
        margin: 20px 0;
    }
    
    .pdf-header {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000;
    }
    
    .pdf-controls {
        display: none;
    }
    
    .pdf-viewer {
        min-height: auto;
        background: #fff;
    }
    
    .pdf-container {
        padding: 20px;
    }
}

/* 动画效果 */
.secure-viewer {
    transition: all 0.3s ease;
}

.secure-viewer:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* 无障碍支持 */
.pdf-canvas:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .secure-viewer {
        border: 2px solid #000;
    }
    
    .pdf-header {
        background: #000;
        color: #fff;
    }
    
    .pdf-controls .btn {
        border-color: #fff;
        background: #000;
        color: #fff;
    }
}

/* 缩放指示器样式 */
.zoom-indicator {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 全屏模式操作提示 */
.fullscreen-tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    line-height: 1.4;
    min-width: 300px;
    max-width: 400px;
}

.fullscreen-tooltip.show {
    opacity: 1;
}

/* 移动端退出提示 */
.mobile-exit-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    line-height: 1.5;
    min-width: 280px;
    max-width: 320px;
    animation: mobileHintFadeIn 0.3s ease;
}

@keyframes mobileHintFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .secure-viewer,
    .pdf-controls .btn,
    .pdf-navigation .btn {
        transition: none;
    }
    
    .secure-viewer:hover {
        transform: none;
    }
    
    .pdf-controls .btn:hover {
        transform: none;
    }
    
    .pdf-navigation .btn:hover:not(:disabled) {
        transform: none;
    }
    
    .zoom-indicator {
        transition: none;
    }
    
    .fullscreen-tooltip {
        transition: none;
    }
}
