/* 多媒体预览样式 */

.media-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

/* 预览窗口内的导航按钮 */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 15;
    opacity: 0.8;
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

.nav-btn span {
    display: block;
    line-height: 1;
}

.media-preview-container {
    background: white;
    border-radius: 12px;
    width: 90vw;
    height: 90vh;
    max-width: 1500px;
    max-height: 1000px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    position: relative; /* 确保内部绝对定位元素相对于此容器定位 */
}

.media-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.media-preview-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    margin-right: 16px;
}

.media-preview-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #409EFF;
    color: white;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #337ecc;
    transform: scale(1.05);
}

.close-btn {
    background: #f56c6c;
}

.close-btn:hover {
    background: #f23030;
}

.media-preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
}

/* 图片预览样式 */
.image-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    padding: 20px;
    user-select: none;
}

.image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    transform-origin: center center;
}

/* 图片内部控制栏 */
.image-controls-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    opacity: 0.8;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.image-container:hover .image-controls-overlay {
    opacity: 1;
}

.zoom-btn-overlay {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zoom-btn-overlay:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.zoom-btn-overlay:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.zoom-info-overlay {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: white;
    font-size: 14px;
}

/* 视频预览样式 */
.video-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-container {
    position: relative;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: calc(100% - 40px);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.enhanced-video {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 200px);
    border-radius: 12px;
    background: #000;
}

.video-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 20px;
    color: white;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.video-container:hover .video-info-overlay {
    transform: translateY(0);
}

.video-title-overlay {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-stats {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.video-duration,
.video-size {
    display: flex;
    align-items: center;
    gap: 5px;
}

.video-preview video {
    max-width: 100%;
    max-height: calc(100% - 40px);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.video-info {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
    text-align: center;
}

/* 音频预览样式 */
.audio-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 30px;
}

.audio-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.audio-icon {
    font-size: 64px;
    color: #409EFF;
}

.audio-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    max-width: 400px;
    word-break: break-all;
    line-height: 1.4;
}

.audio-duration {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

.audio-size {
    font-size: 14px;
    color: #999;
    margin-top: 3px;
}

.audio-preview audio {
    width: 100%;
    max-width: 500px;
    height: 54px;
}

/* 不支持的文件类型样式 */
.unsupported-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: #666;
    padding: 40px;
    text-align: center;
}

.unsupported-icon {
    font-size: 64px;
    color: #ccc;
}

.unsupported-text {
    font-size: 18px;
    color: #999;
}

.file-info {
    font-size: 16px;
    color: #666;
    max-width: 400px;
    word-break: break-all;
    line-height: 1.4;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .media-preview-container {
        width: 95vw;
        height: 95vh;
        max-width: none;
        max-height: none;
    }
    
    .media-preview-header {
        padding: 12px 16px;
    }
    
    .media-preview-title {
        font-size: 14px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    /* 移动端导航按钮调整 */
    .nav-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .prev-btn {
        left: 15px;
    }
    
    .next-btn {
        right: 15px;
    }
    
    /* 移动端图片控制栏调整 */
    .image-controls-overlay {
        padding: 6px 12px;
        gap: 10px;
    }
    
    .zoom-btn-overlay {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .zoom-info-overlay {
        font-size: 12px;
        min-width: 40px;
    }
    
    .image-preview,
    .video-preview {
        padding: 15px;
    }
    
    .audio-preview {
        padding: 20px;
        gap: 20px;
    }
    
    .audio-icon {
        font-size: 48px;
    }
    
    .audio-name {
        font-size: 16px;
    }
    
    .unsupported-icon {
        font-size: 48px;
    }
    
    .unsupported-text {
        font-size: 16px;
    }
    
    .file-info {
        font-size: 14px;
    }
}

/* 更小屏幕的适配 */
@media (max-width: 480px) {
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .prev-btn {
        left: 10px;
    }
    
    .next-btn {
        right: 10px;
    }
    
    .image-controls-overlay {
        bottom: 15px;
        padding: 5px 10px;
        gap: 8px;
    }
    
    .zoom-btn-overlay {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999;
    font-size: 16px;
}

/* 错误状态 */
.error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #e74c3c;
    padding: 40px;
    text-align: center;
}

.error-icon {
    font-size: 48px;
}

.error-text {
    font-size: 16px;
}

.error-message {
    background: #ffeaa7;
    color: #d63031;
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 14px;
    text-align: center;
    border: 1px solid #fdcb6e;
}

/* =========================== */
/* 新增预览功能样式 */
/* =========================== */

/* 增强的音频播放器样式 */
.audio-player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 500px;
}

.large-play-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.large-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.large-audio-player {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 100;
    min-width: 400px;
    max-width: 80vw;
}

.large-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.large-player-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.close-large-player {
    background: #f56c6c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-large-player:hover {
    background: #f23030;
    transform: scale(1.1);
}

.large-audio-controls {
    width: 100%;
    height: 60px;
    border-radius: 30px;
}

/* PDF预览样式 */
.pdf-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
}

.pdf-container {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pdf-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    color: #666;
    background: #fafafa;
    margin: 0;
    border-radius: 0;
    border: none;
    height: 100%;
}

.pdf-notice p {
    margin: 8px 0;
    font-size: 14px;
}

.pdf-options {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.load-pdf-btn {
    background: linear-gradient(135deg, #f56c6c 0%, #e74c3c 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 108, 108, 0.3);
}

.load-pdf-btn:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 108, 108, 0.4);
}

.pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    flex: 1;
    background: white;
}

/* TXT文本预览样式 */
.txt-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.txt-content {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #fafafa;
    height: 100%;
}

.txt-text {
    margin: 0;
    padding: 20px;
    background: #fff;
    border: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    height: 100%;
    min-height: calc(100vh - 200px);
}

.loading-text {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 16px;
}

.load-text-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #409EFF;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-text-btn:hover {
    background: #337ecc;
    transform: translate(-50%, -50%) translateY(-2px);
}

/* Office文档预览样式 */
.office-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.office-container {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
}

.office-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

.fallback-options {
    margin-top: 15px;
    text-align: center;
}

.fallback-btn {
    background: #67c23a;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fallback-btn:hover {
    background: #85ce61;
    transform: translateY(-1px);
}

/* HTML文件预览样式 */
.html-preview {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.html-preview .txt-content {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #fafafa;
    height: 100%;
}

.html-preview .txt-text {
    margin: 0;
    padding: 20px;
    background: #fff;
    border: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    height: 100%;
    min-height: calc(100vh - 200px);
}

/* 响应式设计增强 */
@media (max-width: 768px) {
    .large-audio-player {
        min-width: 300px;
        padding: 20px;
    }
    
    .large-player-header h3 {
        font-size: 16px;
        max-width: 200px;
    }
    
    .txt-header,
    .html-mode-switcher {
        padding: 10px 15px;
        flex-wrap: wrap;
    }
    
    .txt-title {
        font-size: 14px;
    }
    
    .txt-text,
    .html-text {
        padding: 15px;
        font-size: 13px;
    }
    
    .txt-btn,
    .mode-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .large-audio-player {
        min-width: 250px;
        padding: 15px;
    }
    
    .audio-player-container {
        gap: 10px;
    }
    
    .large-play-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .txt-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .html-mode-switcher {
        flex-direction: column;
        gap: 5px;
    }
}