/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 移动设备触摸优化 */
@media (hover: none) and (pointer: coarse) {
    .control-btn, .upload-drop-zone, .select-upload-file {
        -webkit-tap-highlight-color: rgba(0, 123, 255, 0.2);
        touch-action: manipulation;
        cursor: pointer;
    }
    
    .control-btn:active, .upload-drop-zone:active, .select-upload-file:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

/* 朗读内容显示框样式 */
.reading-content-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 650px;
    height: 1100px;
    max-width: 90vw;
    max-height: 90vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    border: none;
    z-index: 1000;
    display: none;
    overflow: hidden;
    backdrop-filter: blur(10px);
    animation: slideIn 0.3s ease-out;
}

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

.reading-panel-header {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    cursor: move;
    user-select: none;
    position: relative;
}

.reading-panel-header:hover {
    background: rgba(255, 255, 255, 0.15);
}

.reading-panel-header.dragging {
    background: rgba(255, 255, 255, 0.2);
    cursor: grabbing;
}

.reading-panel-header::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    box-shadow: 0 6px 0 rgba(255, 255, 255, 0.3), 0 -6px 0 rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

.reading-panel-title {
    font-weight: 700;
    font-size: 1.1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reading-panel-title::before {
    content: "🎧";
    font-size: 1.2rem;
}

.reading-panel-controls {
    display: flex;
    gap: 0.5rem;
}

.minimize-reading-panel,
.close-reading-panel {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.close-reading-panel:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.reading-panel-body {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    height: calc(100% - 80px);
    overflow: hidden;
}

.reading-text {
    font-size: 1.6rem;
    line-height: 1.8;
    color: #2c3e50;
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    white-space: pre-wrap;
    word-wrap: break-word;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: 'Georgia', serif;
    font-weight: 500;
}

.reading-text::-webkit-scrollbar {
    width: 8px;
}

.reading-text::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.reading-text::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 4px;
}

.reading-text::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #5a67d8, #6b46c1);
}

.reading-progress {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.7);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.reading-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: #4a5568;
    font-weight: 600;
}

.reading-progress-info span:first-child {
    color: #667eea;
}

.reading-progress-info span:last-child {
    color: #718096;
}

.reading-progress-bar {
    height: 8px;
    background: linear-gradient(90deg, #e2e8f0, #cbd5e0);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.reading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
    position: relative;
}

.reading-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* TTS加载指示器样式 */
.tts-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 1rem;
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 2px solid #fdcb6e;
    animation: ttsLoadingPulse 2s infinite;
}

@keyframes ttsLoadingPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(253, 203, 110, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(253, 203, 110, 0);
    }
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-hourglass {
    font-size: 1.5rem;
    animation: spin 1.5s linear infinite;
}

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

.loading-text {
    font-size: 1rem;
    font-weight: 600;
    color: #d68910;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 浮标加载状态 */
.floating-widget-loading {
    animation: pulseFloat 1.5s infinite;
}

@keyframes pulseFloat {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 12px 30px rgba(255, 234, 167, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .reading-content-panel {
        width: 90vw;
        height: 80vh;
    }
    
    .reading-panel-body {
        padding: 1.5rem;
    }
    
    .reading-text {
        font-size: 1.4rem;
        padding: 1.2rem;
    }
    
    .reading-progress {
        padding: 0.8rem;
    }
}

@media (max-width: 480px) {
    .reading-content-panel {
        width: 95vw;
        height: 85vh;
    }
    
    .reading-panel-header {
        padding: 1.2rem;
    }
    
    .reading-panel-title {
        font-size: 1rem;
    }
    
    .reading-panel-body {
        padding: 1.2rem;
    }
    
    .reading-text {
        font-size: 1.3rem;
        padding: 1rem;
        line-height: 1.6;
    }
    
    .reading-progress {
        padding: 0.8rem;
    }
    
    .reading-progress-info {
        font-size: 0.9rem;
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: #333;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #ffffff;
    border-radius: 0;
}

/* 头部样式 */
.header {
    background: #f8f9fa;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Logo样式 */
.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.logo-icon:hover {
    transform: scale(1.05);
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    letter-spacing: -0.02em;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.zoom-slider-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
}

.zoom-slider {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e9ecef;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s ease;
}

.zoom-slider::-webkit-slider-thumb:hover {
    background: #0056b3;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.zoom-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s ease;
}

.zoom-slider::-moz-range-thumb:hover {
    background: #0056b3;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* 语言切换开关样式 */
.language-switch-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.language-switch-container:hover {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.language-switch-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6c757d;
    opacity: 0.7;
    transition: all 0.3s ease;
    min-width: 30px;
    text-align: center;
}

.language-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.language-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.language-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    transition: 0.3s ease;
    border-radius: 24px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.language-switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: white;
    transition: 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.language-switch input:checked + .language-switch-slider {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
}

.language-switch input:checked + .language-switch-slider:before {
    transform: translateX(20px);
}

.language-switch-slider:hover {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 8px rgba(0, 123, 255, 0.3);
}

.language-switch input:checked + .language-switch-slider:hover {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 8px rgba(40, 167, 69, 0.3);
}

/* 激活状态的标签样式 */
.language-switch-container[data-active="zh"] .language-switch-label:first-child,
.language-switch-container[data-active="en"] .language-switch-label:last-child {
    opacity: 1;
    color: #495057;
    font-weight: 700;
    text-shadow: none;
}

/* 阅读记忆恢复通知 */
.restore-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
    z-index: 10000;
    animation: slideInRight 0.3s ease-out;
    font-size: 14px;
    max-width: 300px;
}

.restore-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.restore-icon {
    font-size: 18px;
}

.restore-text {
    font-weight: 500;
    line-height: 1.4;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* PDF恢复通知样式 */
.restore-pdf-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
    z-index: 10000;
    animation: slideIn 0.3s ease-out;
    font-size: 14px;
    max-width: 400px;
    min-width: 350px;
}

.restore-pdf-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.restore-pdf-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.restore-pdf-info {
    flex: 1;
}

.restore-pdf-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.restore-pdf-name {
    font-size: 14px;
    opacity: 0.9;
    word-break: break-all;
}

.restore-pdf-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.restore-pdf-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.restore-pdf-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.restore-pdf-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.restore-pdf-close:hover {
    opacity: 1;
}

.control-btn {
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    box-sizing: border-box;
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    line-height: 1.2;
}

.control-btn:hover {
    transform: translateY(-1px);
}

#homeBtn {
    background: #28a745;
    border-color: #28a745;
    font-size: 1.2rem;
}

#readAloudBtn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-color: #f093fb;
    font-size: 1.2rem !important;
    position: relative;
    padding: 0.5rem 1rem !important;
    min-width: auto !important;
    width: auto !important;
    height: auto !important;
}

#readAloudBtn:hover {
    background: linear-gradient(135deg, #ed7fe9 0%, #f3495a 100%);
    border-color: #ed7fe9;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.4);
}

#readAloudBtn.reading {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-color: #dc3545;
    animation: pulse 1.5s ease-in-out infinite;
}

#readAloudBtn.reading:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    border-color: #bd2130;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

#readAloudBtn.paused {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    border-color: #ffc107;
    animation: none;
}

#readAloudBtn.paused:hover {
    background: linear-gradient(135deg, #e0a800 0%, #d39e00 100%);
    border-color: #d39e00;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

#readAloudBtn.reading.paused {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
    border-color: #ffc107 !important;
    animation: none !important;
}

#readAloudBtn.reading.paused:hover {
    background: linear-gradient(135deg, #e0a800 0%, #d39e00 100%) !important;
    border-color: #d39e00 !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

#stopReadingBtn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-color: #dc3545;
    font-size: 1.2rem !important;
    opacity: 0.6;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem !important;
    min-width: auto !important;
    width: auto !important;
    height: auto !important;
}

#stopReadingBtn:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    border-color: #c82333;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    opacity: 1;
}

#stopReadingBtn.active {
    opacity: 1;
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    border-color: #c82333;
}

#stopReadingBtn.active:hover {
    background: linear-gradient(135deg, #a71e2a 0%, #8b1a21 100%);
    border-color: #a71e2a;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(167, 30, 42, 0.4);
}

#goToReadingPageBtn {
    background: #28a745;
    border-color: #28a745;
    font-size: 1.2rem;
    position: relative;
    transition: all 0.3s ease;
}

#goToReadingPageBtn:hover {
    background: #218838;
    border-color: #1e7e34;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

#goToReadingPageBtn.pulse {
    animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

#homeBtn:hover {
    background: #218838;
    border-color: #218838;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

#uploadBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    font-size: 1.2rem;
}

#uploadBtn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    border-color: #5a6fd8;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.zlib-link {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-color: #ff6b6b;
    font-size: 1.2rem;
    text-decoration: none;
    display: inline-block;
    color: white !important;
}

.zlib-link:hover {
    background: linear-gradient(135deg, #ff5252 0%, #e55100 100%);
    border-color: #ff5252;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    text-decoration: none;
    color: white !important;
}

#zoomLevel {
    color: #333;
    font-weight: 500;
    min-width: 50px;
    text-align: center;
}

/* 主内容区域 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: 250px;
    min-width: 200px;
    max-width: 400px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    padding: 1rem;
    overflow-y: auto;
    transition: transform 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

/* 拖拽手柄 */
.resize-handle {
    position: absolute;
    top: 0;
    right: -2px;
    width: 4px;
    height: 100%;
    background: transparent;
    cursor: col-resize;
    z-index: 100;
    border-radius: 2px;
    transition: background-color 0.2s ease;
}

.resize-handle:hover {
    background: rgba(0, 123, 255, 0.5);
}

.resize-handle.resizing {
    background: rgba(0, 123, 255, 0.8);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
}

.thumbnail-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.thumbnail-item {
    background: #ffffff;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e9ecef;
    text-align: center;
}

.thumbnail-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.thumbnail-item.active {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.1);
}

.thumbnail-canvas {
    width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.thumbnail-info {
    color: #333;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 0.5rem;
}

/* 查看器容器 */
.viewer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* 拖拽区域 */
.drop-zone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    margin: 2rem;
    transition: all 0.3s ease;
}

.drop-zone.dragover {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.05);
    transform: scale(1.02);
}

.drop-zone-content {
    text-align: center;
    color: #6c757d;
    padding: 2rem;
}

.upload-icon {
    margin-bottom: 1rem;
    opacity: 0.7;
}

.drop-zone-content h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 300;
}

.drop-zone-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.select-file-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.select-file-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.5);
}

/* PDF查看器 */
.pdf-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    margin: 1rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.pdf-content-container {
    flex: 1;
    overflow: auto;
}

.pdf-controls {
    background: #f8f9fa;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.nav-btn {
    background: #007bff;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #007bff;
}

.nav-btn:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#pageInfo {
    color: #333;
    font-weight: 500;
    margin: 0 1rem;
}

.pdf-canvas {
    display: block;
    margin: 2rem auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background: white;
    transition: opacity 0.12s ease-in-out;
    opacity: 1;
}

.pdf-canvas.fade-out {
    opacity: 0;
}

.pdf-canvas.fade-in {
    opacity: 1;
}

/* 加载遮罩 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.loading-overlay p {
    color: #333;
    font-size: 1.1rem;
}

/* 进度条样式 */
.simple-progress {
    width: 150px;
    height: 8px;
    background-color: #ddd;
    border-radius: 10px;
    margin-left: 15px;
    display: inline-block;
    overflow: hidden;
}

.simple-progress-fill {
    height: 100%;
    background-color: #007bff;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

/* 上传弹框样式 */
.upload-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.upload-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.upload-modal-header {
    padding: 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.3rem;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.upload-modal-body {
    padding: 2rem;
}

.upload-drop-zone {
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-drop-zone:hover {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.05);
}

.upload-drop-zone.dragover {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.1);
    transform: scale(1.02);
}

.upload-drop-content {
    color: #6c757d;
}

.upload-drop-content .upload-icon {
    margin-bottom: 1rem;
    color: #007bff;
}

.upload-drop-content h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.2rem;
}

.upload-drop-content p {
    margin: 0 0 1.5rem 0;
    color: #6c757d;
}

.upload-select-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.upload-select-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 250px;
    }
    
    .header {
        padding: 0.5rem 1rem;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .controls {
        gap: 0.5rem;
    }
    
    .control-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    #readAloudBtn, #stopReadingBtn {
        font-size: 1.1rem !important;
        padding: 0.5rem 1rem !important;
    }
    
    .drop-zone {
        margin: 1rem;
    }
    
    .drop-zone-content h2 {
        font-size: 1.4rem;
    }
    
    .drop-zone-content p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .thumbnail-container {
        flex-direction: row;
        overflow-x: auto;
        gap: 0.5rem;
    }
    
    .thumbnail-item {
        min-width: 120px;
    }
    
    #readAloudBtn, #stopReadingBtn {
        font-size: 1rem !important;
        padding: 0.5rem 1rem !important;
    }
}

/* 缩放和侧边栏按钮样式 */
#zoomOut {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    border-color: #6c757d;
    font-size: 1.2rem;
}

#zoomOut:hover {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    border-color: #495057;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

#zoomIn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    border-color: #6c757d;
    font-size: 1.2rem;
}

#zoomIn:hover {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    border-color: #495057;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

#toggleSidebar {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    border-color: #17a2b8;
    font-size: 1.2rem;
}

#toggleSidebar:hover {
    background: linear-gradient(135deg, #138496 0%, #0f6674 100%);
    border-color: #138496;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

#fitToWidth {
    background: linear-gradient(135deg, #fd7e14 0%, #e55d00 100%);
    border-color: #fd7e14;
    font-size: 1.2rem;
}

#fitToWidth:hover {
    background: linear-gradient(135deg, #e55d00 0%, #cc5500 100%);
    border-color: #e55d00;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(253, 126, 20, 0.4);
}

/* 朗读浮标样式 */
.reading-floating-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 280px;
    height: 70px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 35px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 999;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    animation: slideInFromRight 0.3s ease-out;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(300px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.reading-floating-widget:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.reading-floating-widget:active {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.floating-widget-content {
    display: flex;
    align-items: center;
    padding: 0 15px;
    height: 100%;
    gap: 12px;
}

.floating-widget-icon {
    font-size: 1.8rem;
    color: white;
    min-width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-widget-text {
    flex: 1;
    color: white;
    min-width: 0;
}

.floating-widget-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.floating-widget-progress {
    font-size: 0.75rem;
    opacity: 0.9;
    display: flex;
    gap: 8px;
}

.floating-widget-controls {
    display: flex;
    gap: 4px;
}

.expand-reading-panel,
.close-floating-widget {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.expand-reading-panel:hover,
.close-floating-widget:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.minimize-reading-panel:hover,
.close-reading-panel:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 时间统计浮标样式 */
.time-tracking-widget {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 280px;
    height: 70px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 35px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 998;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    animation: slideInFromRight 0.3s ease-out;
}

.time-tracking-widget:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.time-tracking-widget:active {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.minimize-time-widget,
.reset-usage-time,
.expand-time-widget {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.minimize-time-widget:hover,
.reset-usage-time:hover,
.expand-time-widget:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* 时间统计最小化浮标样式 */
.time-tracking-mini-widget {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 120px;
    height: 50px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 25px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 998;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    animation: slideInFromRight 0.3s ease-out;
}

.time-tracking-mini-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.mini-widget-content {
    display: flex;
    align-items: center;
    padding: 0 10px;
    height: 100%;
    gap: 8px;
}

.mini-widget-icon {
    font-size: 1.2rem;
    color: white;
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-widget-text {
    flex: 1;
    color: white;
    min-width: 0;
    font-size: 0.7rem;
    line-height: 1.2;
}

.mini-widget-time {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.mini-widget-usage {
    opacity: 0.9;
    font-size: 0.65rem;
}

/* Beta v2.9 - PDF文本高亮样式 */
.pdf-text-layer {
    pointer-events: none;
    z-index: 10 !important;
}

.pdf-highlight-overlay {
    pointer-events: none;
    z-index: 11 !important;
}

.pdf-text-highlight {
    background-color: rgba(255, 255, 0, 0.5) !important;
    z-index: 12 !important;
}