/* ==================== 通用样式 ==================== */
.hidden {
    display: none !important;
}

/* ==================== PDF查看器样式 ==================== */
.pdf-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.pdf-toolbar {
    background: #f8fafc;
    color: #374151;
    padding: 8px 16px;
    display: none; /* 隐藏PDF工具栏 */
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid #e5e7eb;
}

.pdf-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pdf-btn {
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.pdf-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.pdf-btn:disabled {
    background: #f9fafb;
    color: #9ca3af;
    border-color: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.6;
}

.pdf-input {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 4px 8px;
    border-radius: 3px;
    width: 60px;
    text-align: center;
    font-size: 12px;
}

.pdf-info {
    color: #6b7280;
    font-size: 12px;
    margin-left: auto;
}

.pdf-viewer {
    flex: 1;
    overflow: auto;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.pdf-page-container {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin: 0 auto 20px auto;
    display: block;
    position: relative;
}

.pdf-page-container:last-child {
    margin-bottom: 0;
}

.pdf-page-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    /* 🔥 优化图像渲染质量 */
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
    /* 🔥 GPU加速 */
    transform: translateZ(0);
    will-change: transform;
    /* 平滑缩放 */
    -ms-interpolation-mode: bicubic;
}

/* 🔥 PDF渲染失败样式 */
.pdf-page-placeholder button {
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdf-page-placeholder button:hover {
    background: #fee2e2 !important;
    transform: scale(1.05);
}

.pdf-page-number {
    position: absolute;
    top: -30px;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.pdf-loading {
    color: #4a5568;
    text-align: center;
    padding: 40px;
    font-size: 16px;
}

/* PDF响应式适配 */
@media (max-width: 768px) {
    .pdf-toolbar {
        padding: 6px 12px;
        gap: 8px;
    }

    .pdf-btn {
        padding: 8px 12px;
        font-size: 11px;
    }

    .pdf-input {
        width: 50px;
        font-size: 11px;
    }

    .pdf-viewer {
        padding: 10px;
    }

    .pdf-page-container {
        margin-bottom: 15px;
    }

    .pdf-page-number {
        font-size: 11px;
        padding: 3px 6px;
    }
}

@media (max-width: 480px) {
    .pdf-toolbar {
        gap: 6px;
        flex-wrap: wrap;
    }

    .pdf-viewer {
        padding: 5px;
    }

    .pdf-page-container {
        margin-bottom: 10px;
    }
}

/* ==================== PPT查看器样式 ==================== */
.ppt-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #2d3748;
}

.ppt-toolbar {
    background: #1a202c;
    color: white;
    padding: 12px 16px;
    display: none; /* 隐藏PPT工具栏 */
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 2px solid #4a5568;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ppt-info {
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 500;
}

.ppt-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ppt-viewer {
    flex: 1;
    overflow: auto;
    background: #f7fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 20px 40px 20px;
    position: relative;
    height: 100%;
}

.ppt-loading {
    color: #4a5568;
    text-align: center;
    padding: 40px;
    font-size: 16px;
}

/* PPT幻灯片样式 */
.ppt-slides-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.ppt-slide {
    background: white;
    margin: 0 auto 30px auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.ppt-slide:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.ppt-slide-content {
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    line-height: 1.6;
    padding: 40px;
    box-sizing: border-box;
}

.ppt-slide-number {
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}

.ppt-slide-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 20px 25px 15px;
    font-size: 14px;
    font-weight: 500;
}

/* PPT导航控件 */
.ppt-nav-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #4a5568;
    padding: 8px 12px;
    border-radius: 20px;
}

.ppt-nav-btn {
    background: #2d3748;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.ppt-nav-btn:hover {
    background: #1a202c;
    transform: translateY(-1px);
}

.ppt-nav-btn:disabled {
    background: #718096;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.ppt-page-info {
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 500;
    padding: 0 8px;
}

/* PPT响应式适配 */
@media (max-width: 768px) {
    .ppt-toolbar {
        padding: 6px 12px;
        gap: 8px;
    }

    .ppt-info {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .ppt-toolbar {
        gap: 6px;
        flex-wrap: wrap;
    }
}

/* ==================== HTML预览容器样式 ==================== */
.html-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.html-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: white;
}

.html-frame {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    transition: border-radius 0.3s ease;
}

/* iframe覆盖层，用于解决事件冒泡问题（移动端+桌面端Ctrl缩放） */
.mobile-iframe-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    background: transparent;
    /* 🔥 始终显示，默认不拦截事件（事件穿透到iframe） */
    display: block;
    pointer-events: none;
}

/* 移动端侧边栏展开时启用事件拦截 */
.mobile-iframe-overlay.show {
    pointer-events: auto;
}

/* 欢迎页面专用圆角样式 */
.html-frame.welcome-page {
    border-radius: 25px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    margin-top: 8px;
}

/* 🔥 欢迎页面完全铺满屏幕（桌面端+移动端） */
body.welcome-page-active #htmlContainer {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 欢迎页面时的iframe也要铺满 */
body.welcome-page-active #htmlFrame {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* 手机端适配 - 欢迎页面圆角调整 */
@media (max-width: 768px) {
    .html-frame.welcome-page {
        margin-top: 0;
        border-radius: 15px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
}

/* ==================== 图片模态框样式 ==================== */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden;
    /* 触控优化：支持触摸操作 */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    /* 整个区域显示手部图标 */
    cursor: move;
}

.image-modal.show {
    opacity: 1;
    visibility: visible;
}

.image-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 触控优化：支持触摸操作 */
    touch-action: none;
    /* 继承父元素的手部图标 */
    cursor: move;
}

.image-modal img {
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    /* 触控优化：支持平移和缩放 */
    position: absolute;
    cursor: move;
    transition: none;
    touch-action: none;
    pointer-events: none;  /* 让鼠标事件穿透到父元素 */
}

.image-modal-title {
    color: white;
    font-size: 16px;
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
    pointer-events: none;  /* 让鼠标事件穿透 */
}

.image-modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    background: #ef4444;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    z-index: 10;
    pointer-events: auto;  /* 恢复关闭按钮的鼠标事件 */
}

.image-modal-close:hover {
    background: #dc2626;
}

/* ==================== 微信二维码模态框样式 ==================== */
.wechat-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wechat-modal.show {
    opacity: 1;
    visibility: visible;
}

.wechat-modal-content {
    position: relative;
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 90vw;
    max-height: 90vh;
}

.wechat-qr-image {
    max-width: 300px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.wechat-modal-title {
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
    margin-top: 20px;
}

.wechat-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ef4444;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    z-index: 10;
}

.wechat-modal-close:hover {
    background: #dc2626;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .wechat-modal-content {
        padding: 20px;
    }

    .wechat-qr-image {
        max-width: 250px;
    }

    .wechat-modal-title {
        font-size: 16px;
    }
}

/* ==================== 视频查看器样式 ==================== */
.video-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.video-toolbar {
    background: #f7fafc;
    color: #2d3748;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 2px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.video-info {
    color: #2d3748;
    font-size: 14px;
    font-weight: 500;
}

.video-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-viewer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    position: relative;
    min-height: 400px;
}

.video-loading {
    color: #4a5568;
    text-align: center;
    padding: 40px;
    font-size: 16px;
}

.video-player {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #000000;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* 视频响应式适配 */
@media (max-width: 768px) {
    .video-toolbar {
        padding: 6px 12px;
        gap: 8px;
    }

    .video-info {
        font-size: 12px;
    }

    .video-viewer {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .video-toolbar {
        gap: 6px;
        flex-wrap: wrap;
    }

    .video-viewer {
        min-height: 250px;
    }
}

/* ==================== 图片预览样式 ==================== */
.image-container {
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    position: relative;
}

.image-toolbar {
    background: #f7fafc;
    color: #2d3748;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 2px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.image-filename {
    color: #2d3748;
    font-size: 14px;
    font-weight: 600;
}

.image-details {
    color: #718096;
    font-size: 12px;
    opacity: 0.8;
}

.image-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.image-btn {
    background: #ffffff;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.image-btn:active {
    transform: translateY(0);
}

.image-viewer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    position: relative;
    min-height: 400px;
    overflow: hidden;
    /* 拖拽性能优化 */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    /* 整个区域显示手部图标 */
    cursor: grab;
    /* 🔥 确保viewer是Canvas的定位参考 */
}

.image-viewer:active {
    cursor: grabbing;
}

.image-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #4a5568;
    padding: 40px;
}

.image-display {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    /* 继承父元素的手部图标 */
    cursor: grab;
}

.image-element {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* 让鼠标事件穿透到父元素处理 */
    pointer-events: none;
    /* 性能优化 */
    will-change: transform;
    transform-origin: center center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* 拖拽时移除过渡效果 */
    transition: none;
}

.image-element:active {
    cursor: grabbing;
}

.image-element.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    object-fit: contain;
    padding: 20px;
    box-sizing: border-box;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

/* ==================== 批注工具栏样式 ==================== */
.annotation-toolbar {
    position: fixed;
    bottom: 3px !important; /* 🔥 底部保留3px,使用!important确保优先级 */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: stretch; /* 🔥 让所有子元素高度一致 */
    justify-content: center;
    z-index: 1000;
    background: transparent; /* 🔥 外层透明,由内部组件提供背景 */
    padding: 0; /* 🔥 移除外层padding */
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06); /* 🔥 统一阴影在外层 */
    border: none; /* 🔥 移除外层边框 */
    transition: all 0.3s ease;
    gap: 0; /* 🔥 移除间隙,让三部分紧贴 */
    /* 🔥 让鼠标事件穿透整个工具栏 */
    pointer-events: none;
}

.annotation-toolbar:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14), 0 3px 6px rgba(0, 0, 0, 0.08); /* 🔥 hover时增强阴影 */
}

/* 🔥 左侧区域 - 固定宽度，内容靠右 */
.toolbar-left-section {
    min-width: 400px; /* 固定宽度 */
    display: flex;
    justify-content: flex-end; /* 内容靠右对齐 */
    /* 🔥 让鼠标事件穿透 */
    pointer-events: none;
}

.toolbar-left-group {
    display: flex;
    align-items: center;
    gap: 8px;
    /* 🔥 统一背景,视觉上连成一体 */
    background: rgba(255, 255, 255, 0.9); /* 🔥 10%透明度 */
    padding: 4px 10px; /* 🔥 减少垂直padding,从7px改为4px */
    border-radius: 16px 0 0 16px; /* 只有左侧圆角 */
    box-shadow: none; /* 🔥 移除独立阴影 */
    border: 1px solid rgba(0, 0, 0, 0.18); /* 🔥 加深边框颜色 */
    border-right: none; /* 移除右边框,连接中间 */
    pointer-events: none;
    /* 🔥 确保内容垂直居中 */
    align-items: stretch; /* 让子元素撑满高度 */
}

/* 🔥 中间按钮 - 自然宽度 */
.view-mode-toggle-btn {
    flex-shrink: 0; /* 不缩小 */
}

/* 🔥 右侧区域 - 固定宽度，内容靠左 */
.toolbar-right-section {
    min-width: 400px; /* 与左侧相同的固定宽度 */
    display: flex;
    justify-content: flex-start; /* 内容靠左对齐 */
    /* 🔥 让鼠标事件穿透 */
    pointer-events: none;
}

.toolbar-right-group {
    display: flex;
    align-items: center;
    gap: 8px;
    /* 🔥 统一背景,视觉上连成一体 */
    background: rgba(255, 255, 255, 0.9); /* 🔥 10%透明度 */
    padding: 4px 10px; /* 🔥 减少垂直padding,从7px改为4px */
    border-radius: 0 16px 16px 0; /* 只有右侧圆角 */
    box-shadow: none; /* 🔥 移除独立阴影 */
    border: 1px solid rgba(0, 0, 0, 0.18); /* 🔥 加深边框颜色 */
    border-left: none; /* 移除左边框,连接中间 */
    pointer-events: none;
    /* 🔥 确保内容垂直居中 */
    align-items: center;
}

/* 🔥 批注模式：移除工具栏外层装饰 */
.annotation-toolbar:not(.single-button-mode) {
    background: transparent !important;
    padding: 0 !important; /* 🔥 统一为0,不添加额外padding */
    box-shadow: none !important;
    border: none !important;
}

.annotation-toolbar:not(.single-button-mode):hover {
    background: transparent !important;
    box-shadow: none !important;
}

/* 🔥 单按钮模式：只显示中间按钮，隐藏左右section */
.annotation-toolbar.single-button-mode {
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important; /* 🔥 无阴影,更低调 */
    border: none !important;
}

.annotation-toolbar.single-button-mode:hover {
    background: transparent !important;
    box-shadow: none !important; /* 🔥 hover时也无阴影 */
}

.annotation-toolbar.single-button-mode .toolbar-left-section,
.annotation-toolbar.single-button-mode .toolbar-right-section {
    display: none !important;
}

/* 🔥 单按钮模式下的"批注"按钮使用独立圆角样式 */
.annotation-toolbar.single-button-mode .view-mode-toggle-btn {
    background: rgba(255, 255, 255, 0.15) !important; /* 🔥 更高透明度,更低调 */
    color: rgba(0, 0, 0, 0.4) !important; /* 🔥 降低文字颜色 */
    border-radius: 12px !important; /* 🔥 圆角 */
    height: 38px !important; /* 🔥 减小高度,更协调 */
    padding: 0 20px !important; /* 🔥 增加水平padding,更舒适 */
    box-shadow: none !important; /* 🔥 单独按钮不需要内部阴影,外层提供 */
    border: 0.5px solid rgba(0, 0, 0, 0.1) !important; /* 🔥 更细的边框 */
}

.annotation-toolbar.single-button-mode .view-mode-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important; /* 🔥 hover时稍微明显 */
    color: rgba(0, 0, 0, 0.6) !important; /* 🔥 hover时文字稍深 */
    border-color: rgba(0, 0, 0, 0.15) !important;
}

.annotation-tools {
    display: flex;
    gap: 6px;
    align-items: center;
    /* 🔥 统一背景,无圆角,连接左右 */
    background: rgba(255, 255, 255, 0.9); /* 🔥 10%透明度 */
    padding: 4px 10px; /* 🔥 减少垂直padding,从7px改为4px */
    border-radius: 0; /* 无圆角 */
    box-shadow: none; /* 🔥 移除独立阴影 */
    border-top: 1px solid rgba(0, 0, 0, 0.18); /* 🔥 加深边框颜色 */
    border-bottom: 1px solid rgba(0, 0, 0, 0.18); /* 🔥 加深边框颜色 */
    border-left: none; /* 🔥 移除左边框 */
    border-right: none; /* 🔥 移除右边框 */
    pointer-events: none;
}

.tool-divider {
    width: 1px;
    height: 24px;
    background: rgba(0, 0, 0, 0.1);
    margin: 0 4px;
}

.annotation-btn {
    background: rgba(0, 0, 0, 0.04);
    color: #374151;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 36px;
    height: 36px; /* 🔥 固定高度,确保一致 */
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    /* 触控优化 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    /* 🔥 恢复按钮的鼠标事件(父元素都是pointer-events:none) */
    pointer-events: auto;
}

.annotation-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.annotation-btn.active {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
}

/* 橡皮擦图标在选中时的颜色调整 */
.annotation-btn.active[data-tool="eraser"] rect {
    fill: #f97316;
}

.annotation-btn.active[data-tool="eraser"] circle {
    fill: rgba(59, 130, 246, 0.4);
}

.annotation-colors {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 0; /* 🔥 移除padding,由外层统一控制 */
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    padding-left: 8px; /* 🔥 只保留左侧间距,用于分隔线 */
    /* 🔥 让鼠标事件穿透 */
    pointer-events: none;
}

.color-btn {
    width: 28px; /* 🔥 缩小以更紧凑 */
    height: 28px; /* 🔥 缩小以更紧凑 */
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15), 0 0 0 0 rgba(59, 130, 246, 0);
    /* 触控优化 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    /* 🔥 恢复颜色按钮的鼠标事件(父元素都是pointer-events:none) */
    pointer-events: auto;
    /* 🔥 确保垂直居中 */
    flex-shrink: 0;
}

.color-btn:hover {
    transform: translateY(-1px) scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.color-btn.active {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    transform: scale(1.08);
}

/* 🔥 关闭按钮（×） - 使用默认按钮样式，只调整×符号显示 */
.toggle-mode-btn #modeText {
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
}

/* 🔥 查看模式切换按钮 - 使用box-sizing确保精确高度 */
.view-mode-toggle-btn {
    /* 继承 .annotation-btn 的所有样式 */
    background: rgba(255, 255, 255, 0.9) !important; /* 🔥 10%透明度 */
    padding: 0 16px !important; /* 🔥 只保留水平padding,高度由height控制 */
    height: 46px !important; /* 🔥 46px = 36px(按钮高度) + 4px(容器上padding) + 4px(容器下padding) + 2px(边框) */
    box-shadow: none !important; /* 🔥 移除独立阴影 */
    border-top: 1px solid rgba(0, 0, 0, 0.18) !important; /* 🔥 加深边框颜色 */
    border-bottom: 1px solid rgba(0, 0, 0, 0.18) !important; /* 🔥 加深边框颜色 */
    border-left: none !important;
    border-right: none !important;
    border-radius: 0 !important; /* 无圆角,视觉连接 */
    pointer-events: auto !important;
    box-sizing: border-box !important; /* 🔥 确保border计入总高度 */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s ease, opacity 0.2s ease !important; /* 🔥 平滑过渡 */
}

.view-mode-toggle-btn:hover {
    background: rgba(240, 242, 245, 0.85) !important; /* 🔥 hover时背景稍微变暗 */
    box-shadow: none !important;
    transform: none !important; /* 🔥 禁止位移,保持对齐 */
}

.view-mode-toggle-btn:active {
    background: rgba(230, 232, 235, 0.9) !important; /* 🔥 点击时更暗 */
    transform: none !important;
}

.view-mode-toggle-btn .view-mode-text {
    /* 与工具栏其他文字按钮保持一致的样式 */
}

/* 🔥 清除按钮 - 使用默认按钮样式 */
.clear-btn {
    /* 继承 .annotation-btn 的所有样式 */
}

/* ==================== 批注画布样式 ==================== */
.annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
    pointer-events: auto;
    z-index: 10;
    /* 🔥 Canvas覆盖整个image-viewer区域，而非仅图片区域 */
    /* 触控优化 */
    -webkit-user-select: none;
    user-select: none;
}

/* Markdown批注Canvas */
.markdown-annotation-canvas,
.pdf-annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10;
    cursor: default;
    touch-action: pan-y pan-x; /* 允许滚动 */
    display: none; /* 默认隐藏 */
}

/* PDF批注Canvas - 添加在PDF页面容器上 */
#pdfPagesContainer {
    position: relative; /* 确保Canvas可以相对定位 */
}

/* 🔥 批注模式下只禁用文本选择，保持滚动功能 */
#content.annotation-active,
#pdfPagesContainer.annotation-active {
    user-select: none;
    /* 移除 pointer-events: none; 以允许滚动 */
}

.image-display {
    position: relative;
}

.image-element {
    transform-origin: center center;
}

/* 图片响应式适配 */
@media (max-width: 768px) {
    .image-toolbar {
        padding: 8px 12px;
        gap: 8px;
    }

    .image-filename {
        font-size: 12px;
    }

    .image-details {
        font-size: 10px;
    }

    .image-btn {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 32px;
    }

    .image-viewer {
        min-height: 300px;
    }

    .image-display {
        padding: 10px;
    }

    .annotation-toolbar {
        bottom: 3px !important; /* 🔥 移动端也保持底部3px,使用!important */
        padding: 0; /* 🔥 保持外层无padding */
        gap: 0; /* 🔥 保持无间隙 */
        max-width: calc(100% - 20px);
    }

    .annotation-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 40px;
    }

    .annotation-colors {
        padding: 0 8px;
        gap: 8px;
    }

    .color-btn {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .image-toolbar {
        gap: 6px;
        flex-wrap: wrap;
    }

    .image-controls {
        gap: 4px;
    }

    .image-btn {
        padding: 4px 6px;
        font-size: 11px;
        min-width: 28px;
    }

    .image-viewer {
        min-height: 250px;
    }

    .annotation-toolbar {
        bottom: 3px !important; /* 🔥 小屏幕也保持底部3px,使用!important */
        padding: 0; /* 🔥 保持外层无padding */
        gap: 0; /* 🔥 保持无间隙 */
        border-radius: 16px;
        max-width: calc(100% - 16px);
    }

    .annotation-tools {
        gap: 6px;
    }

    .annotation-btn {
        padding: 7px 10px;
        font-size: 11px;
        min-width: 36px;
        border-radius: 10px;
    }

    .annotation-colors {
        gap: 6px;
        padding: 0 6px;
    }

    .color-btn {
        width: 28px;
        height: 28px;
        border-width: 2px;
    }

    .clear-btn {
        padding: 7px 10px;
        font-size: 11px;
    }

    .tool-divider {
        height: 24px;
    }
}

/* ==================== 触控设备优化 ==================== */
/* 针对主要使用触控操作的设备（如触控屏、平板） */
@media (hover: none) and (pointer: coarse) {
    /* 按钮触控反馈 */
    .annotation-btn:active,
    .color-btn:active {
        transform: scale(0.95);
        opacity: 0.8;
    }

    /* 禁用hover效果，避免触控时的不自然交互 */
    .annotation-btn:hover,
    .color-btn:hover {
        transform: none;
    }

    /* 增大按钮尺寸，方便手指点击 */
    .annotation-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 10px 12px;
    }

    .color-btn {
        width: 36px;
        height: 36px;
    }

    /* 工具栏增大间距 */
    .annotation-toolbar {
        gap: 12px;
        padding: 12px 18px;
    }

    .annotation-tools {
        gap: 8px;
    }
}

/* 平板设备优化（768-1024px） */
@media (min-width: 769px) and (max-width: 1024px) {
    .annotation-btn {
        min-width: 42px;
        min-height: 42px;
        padding: 9px 11px;
    }

    .color-btn {
        width: 34px;
        height: 34px;
    }
}

/* ==================== Word文档查看器样式 ==================== */
.word-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.word-toolbar {
    background: #f8fafc;
    color: #374151;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid #e5e7eb;
}

.word-info {
    color: #6b7280;
    font-size: 12px;
    flex: 1;
}

.word-viewer {
    flex: 1;
    overflow: auto;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.word-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 16px;
    color: #6b7280;
}

.word-content {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #1f2937;
}

/* Word 文档内容样式 */
.word-content h1 {
    font-size: 28px;
    font-weight: bold;
    margin: 24px 0 16px 0;
    color: #111827;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
}

.word-content h2 {
    font-size: 24px;
    font-weight: bold;
    margin: 20px 0 12px 0;
    color: #1f2937;
}

.word-content h3 {
    font-size: 20px;
    font-weight: bold;
    margin: 16px 0 10px 0;
    color: #374151;
}

.word-content p {
    margin: 12px 0;
    text-align: justify;
}

.word-content ul, .word-content ol {
    margin: 12px 0;
    padding-left: 30px;
}

.word-content li {
    margin: 6px 0;
}

.word-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.word-content table td, .word-content table th {
    border: 1px solid #d1d5db;
    padding: 8px 12px;
}

.word-content table th {
    background: #f3f4f6;
    font-weight: bold;
}

.word-content img {
    max-width: 100%;
    height: auto;
    margin: 16px 0;
    display: block;
}

/* docx-preview 图片样式支持 */
.docx img {
    max-width: 100%;
    height: auto;
    display: inline-block;
    vertical-align: middle;
}

.docx-wrapper img {
    max-width: 100%;
    height: auto;
}

/* 确保图片容器正确显示 */
.docx .docx-image-wrapper,
.docx .docx-drawing-wrapper {
    display: inline-block;
    max-width: 100%;
}

.docx .docx-image,
.docx .docx-drawing {
    max-width: 100%;
    height: auto;
}

.word-content strong {
    font-weight: bold;
}

.word-content em {
    font-style: italic;
}

.word-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.word-content pre {
    background: #f3f4f6;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 12px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .word-content {
        padding: 20px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .word-viewer {
        padding: 10px;
    }

    .word-content {
        padding: 15px;
    }

    .word-content h1 {
        font-size: 24px;
    }

    .word-content h2 {
        font-size: 20px;
    }

    .word-content h3 {
        font-size: 18px;
    }
}

/* ==================== 音频播放器样式 ==================== */
.audio-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    overflow: auto;
}

.audio-viewer {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    box-sizing: border-box;
    min-height: calc(100vh - 48px);
}

.audio-loading {
    color: #374151;
    font-size: 18px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.audio-player-wrapper {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 48px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 15px rgba(0, 0, 0, 0.03);
    max-width: 700px;
    width: 100%;
    transition: box-shadow 0.3s ease;
}

.audio-player-wrapper:hover {
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.08), 0 16px 24px rgba(0, 0, 0, 0.05);
}

.audio-info {
    text-align: center;
    margin-bottom: 32px;
}

.audio-title {
    font-size: 28px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 16px;
    word-wrap: break-word;
    line-height: 1.4;
}

.audio-title::before {
    content: "🎵 ";
    font-size: 32px;
    margin-right: 8px;
    vertical-align: middle;
}

.audio-details {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.8;
    padding: 12px 20px;
    background: #f9fafb;
    border-radius: 8px;
    display: inline-block;
}

.audio-player {
    width: 100%;
    height: 64px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border: 1px solid #e5e7eb;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.audio-player::-webkit-media-controls-panel {
    background: transparent;
    border-radius: 12px;
}

.audio-player:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* 动态音频波形可视化 */
.audio-visualizer {
    width: 100%;
    height: 180px;
    margin-bottom: 32px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    display: block;
}

/* 音符动画容器 */
.audio-notes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 10;
}

.audio-note {
    position: absolute;
    font-size: 32px;
    animation: floatNote 6s ease-in-out infinite;
    opacity: 0;
    color: #8b5cf6;
}

.audio-note:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
}

.audio-note:nth-child(2) {
    left: 30%;
    animation-delay: 1s;
}

.audio-note:nth-child(3) {
    left: 50%;
    animation-delay: 2s;
}

.audio-note:nth-child(4) {
    left: 70%;
    animation-delay: 3s;
}

.audio-note:nth-child(5) {
    left: 90%;
    animation-delay: 0.5s;
}

@keyframes floatNote {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* 播放时的脉动效果 */
.audio-player-wrapper.playing {
    animation: gentlePulse 2s ease-in-out infinite;
}

@keyframes gentlePulse {
    0%, 100% {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 15px rgba(0, 0, 0, 0.03);
    }
    50% {
        box-shadow: 0 6px 10px rgba(59, 130, 246, 0.1), 0 12px 20px rgba(139, 92, 246, 0.08);
    }
}

/* 装饰性音符（静态） */
.audio-info::before {
    content: "♪";
    position: absolute;
    font-size: 80px;
    color: #e0e7ff;
    left: -40px;
    top: -20px;
    transform: rotate(-15deg);
    z-index: -1;
}

.audio-info::after {
    content: "♫";
    position: absolute;
    font-size: 60px;
    color: #fce7f3;
    right: -30px;
    bottom: -10px;
    transform: rotate(15deg);
    z-index: -1;
}

.audio-info {
    position: relative;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .audio-viewer {
        padding: 40px 16px;
    }

    .audio-player-wrapper {
        padding: 32px 24px;
        border-radius: 12px;
    }

    .audio-title {
        font-size: 22px;
    }

    .audio-title::before {
        font-size: 26px;
    }

    .audio-details {
        font-size: 14px;
        padding: 10px 16px;
    }

    .audio-player {
        height: 56px;
    }
}

@media (max-width: 480px) {
    .audio-viewer {
        padding: 30px 12px;
    }

    .audio-player-wrapper {
        padding: 24px 20px;
    }

    .audio-title {
        font-size: 20px;
    }

    .audio-details {
        font-size: 13px;
    }

    .audio-player {
        height: 52px;
    }
}

/* 🔥 桌面端：侧边栏展开时，批注工具栏跟随内容区域居中 */
@media (min-width: 481px) {
    body.sidebar-open .annotation-toolbar {
        /* 页面中心50% + 侧边栏宽度一半150px = 内容区域中心 */
        left: calc(50% + 150px) !important;
    }
}

/* ==================== 白板样式 ==================== */
.whiteboard-container {
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    position: relative;
}

.whiteboard-viewer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    position: relative;
    min-height: 400px;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: crosshair;
}

.whiteboard-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    touch-action: none;
    cursor: crosshair;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .whiteboard-viewer {
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .whiteboard-viewer {
        min-height: 250px;
    }
}
