/* PDF阅读器样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

#pdf_reader-app {
    max-width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.document-info {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    font-size: 0.9rem;
    opacity: 0.9;
    text-align: right;
}

.error-message {
    background-color: #ffe6e6;
    border: 1px solid #ffcccc;
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem;
    text-align: center;
    color: #d63333;
}

.error-message p {
    margin-bottom: 1rem;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 1rem;
    gap: 1rem;
}

/* 左侧目录导航 */
.sidebar {
    width: 280px;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar h3 {
    margin-bottom: 1.2rem;
    color: #4a5568;
    font-size: 1.1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.toc-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toc-item {
    display: flex;
    align-items: center;
    padding: 0.7rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.toc-item:hover {
    background-color: #f7fafc;
    border-left-color: #667eea;
}

.toc-item.level-1 {
    font-weight: 600;
    color: #2d3748;
}

.toc-item.level-2 {
    color: #4a5568;
    margin-left: 20px;
}

.toc-item.level-3 {
    color: #718096;
    margin-left: 40px;
}

.toc-title {
    flex: 1;
    font-size: 0.95rem;
}

.toc-page {
    font-size: 0.85rem;
    color: #a0aec0;
    margin-left: 0.5rem;
}

/* 右侧主要内容 */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.5rem;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.controls button {
    padding: 0.5rem 1rem;
    border: 1px solid #cbd5e0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.controls button:hover {
    background-color: #edf2f7;
    border-color: #a0aec0;
}

#page_info {
    font-weight: 500;
    color: #4a5568;
    margin: 0 0.5rem;
}

#page_jump {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    text-align: center;
}

/* PDF查看区域 */
#pdf_viewer {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1.5rem;
    overflow: auto;
    position: relative;
    background-color: #f9f9f9;
}

#pdf_image {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    transition: opacity 0.3s ease;
}

.watermark {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    color: rgba(0, 0, 0, 0.15);
    font-size: 1.2rem;
    font-weight: bold;
    pointer-events: none;
}

.pdf-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    background: linear-gradient(45deg, #f5f7fa 25%, #e4e7eb 25%, #e4e7eb 50%, #f5f7fa 50%, #f5f7fa 75%, #e4e7eb 75%);
    background-size: 20px 20px;
}

.pdf-placeholder-content {
    text-align: center;
    background: white;
    padding: 2rem 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.pdf-placeholder-content h3 {
    color: #4a5568;
    margin-bottom: 1rem;
}

.pdf-placeholder-content p {
    color: #718096;
}

/* 范围提示框 */
.range-prompt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 100;
    max-width: 400px;
    width: 90%;
}

.prompt-content h3 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.prompt-content p {
    margin-bottom: 1rem;
    color: #4a5568;
}

.prompt-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.prompt-actions button {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

#redirect_btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#redirect_btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#close_prompt {
    background-color: #e2e8f0;
    color: #4a5568;
}

#close_prompt:hover {
    background-color: #cbd5e0;
}

.hidden {
    display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        padding: 0.5rem;
    }
    
    .sidebar {
        width: 100%;
        max-height: 200px;
    }
    
    .header {
        padding: 1rem;
    }
    
    .document-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .range-prompt {
        width: 95%;
        padding: 1.5rem;
    }
    
    .prompt-actions {
        flex-direction: column;
    }
}
