/* 阅读页面专用样式 */

/* 阅读模式基础样式 */
.reader-mode {
    background-color: #ffffff;
    color: #333;
    font-size: 16px;
    line-height: 1.6;
}

/* 阅读进度条 */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(7, 193, 96, 0.2);
    z-index: 1000;
}

.reading-progress-bar {
    height: 100%;
    background: #07C160;
    width: 0%;
    transition: width 0.3s ease;
}

/* 阅读器头部 */
.reader-header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.reader-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 20px;
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-center {
    flex: 1;
    text-align: center;
}

.nav-center .book-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
    margin-left: 12px;
}

.separator {
    color: #ccc;
}

/* 主要阅读区域 */
.reader-main {
    padding-top: 20px;
}

.reader-layout {
    display: flex;
    gap: 32px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 侧边栏 */
.reader-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    height: fit-content;
    position: sticky;
    top: 80px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.sidebar-toggle {
    display: none;
}

.sidebar-content {
    padding: 16px 0;
    max-height: 600px;
    overflow-y: auto;
}

.chapter-nav .chapter-item {
    margin-bottom: 16px;
}

.chapter-nav .chapter-item h4 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    padding: 0 20px;
}

.chapter-nav .chapter-item.active h4 {
    color: #07C160;
}

.sections-nav {
    padding-left: 20px;
}

.section-nav-link {
    display: block;
    padding: 8px 20px;
    color: #666;
    text-decoration: none;
    font-size: 13px;
    border-radius: 0 20px 20px 0;
    margin-right: 20px;
    transition: all 0.2s ease;
}

.section-nav-link:hover {
    background: #f0f8f4;
    color: #07C160;
}

.section-nav-link.active {
    background: #07C160;
    color: white;
    font-weight: 500;
}

/* 阅读内容区域 */
.reader-content {
    flex: 1;
    min-width: 0;
}

.content-article {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.article-header {
    padding: 32px 40px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.article-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px 0;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    gap: 24px;
    font-size: 14px;
    color: #666;
}

.article-body {
    padding: 32px 40px;
    font-size: 16px;
    line-height: 1.8;
    color: #333;
}

.article-body .lead {
    font-size: 18px;
    font-weight: 500;
    color: #555;
    margin-bottom: 32px;
    line-height: 1.6;
}

.article-body h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 40px 0 16px 0;
    line-height: 1.4;
}

.article-body h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 32px 0 12px 0;
}

.article-body h4 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 24px 0 8px 0;
}

.article-body p {
    margin-bottom: 16px;
    text-align: justify;
}

.article-body ul,
.article-body ol {
    margin: 16px 0;
    padding-left: 24px;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body blockquote {
    margin: 24px 0;
    padding: 20px 24px;
    background: #f8f9fa;
    border-left: 4px solid #07C160;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #555;
}

.article-body blockquote p {
    margin: 0;
}

/* 信息框 */
.info-box {
    background: #f0f8f4;
    border: 1px solid #d4edda;
    border-radius: 8px;
    padding: 24px;
    margin: 24px 0;
}

.info-box h3 {
    color: #07C160;
    margin-top: 0;
    margin-bottom: 16px;
}

/* 对比表格 */
.comparison-table {
    margin: 24px 0;
    overflow-x: auto;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comparison-table th,
.comparison-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.comparison-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

/* 时间线 */
.timeline {
    margin: 32px 0;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e5e5;
}

.timeline-item {
    position: relative;
    margin-bottom: 32px;
    padding-left: 60px;
}

.timeline-marker {
    position: absolute;
    left: 12px;
    top: 8px;
    width: 16px;
    height: 16px;
    background: #07C160;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #07C160;
}

.timeline-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: #07C160;
    margin: 0 0 8px 0;
}

.timeline-content p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* 章节导航 */
.chapter-navigation {
    display: flex;
    justify-content: space-between;
    padding: 24px 40px 32px;
    border-top: 1px solid #f0f0f0;
}

.nav-item {
    flex: 1;
}

.nav-item.next {
    text-align: right;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
    background: #07C160;
    border-color: #07C160;
    color: white;
    transform: translateY(-1px);
}

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

/* 阅读设置面板 */
.settings-panel {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transition: right 0.3s ease;
}

.settings-panel.open {
    right: 0;
}

.settings-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.settings-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.settings-body {
    flex: 1;
    padding: 24px 20px;
    overflow-y: auto;
}

.setting-group {
    margin-bottom: 32px;
}

.setting-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.font-size-controls,
.theme-controls {
    display: flex;
    gap: 8px;
}

.size-btn,
.theme-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #e5e5e5;
    background: #fff;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-btn:hover,
.theme-btn:hover {
    border-color: #07C160;
}

.size-btn.active,
.theme-btn.active {
    background: #07C160;
    border-color: #07C160;
    color: white;
}

.line-height-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.line-height-controls input[type="range"] {
    flex: 1;
    height: 6px;
    background: #e5e5e5;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.line-height-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #07C160;
    border-radius: 50%;
    cursor: pointer;
}

.line-height-controls span {
    font-size: 14px;
    color: #666;
    min-width: 30px;
    text-align: center;
}

/* 微信浮动按钮 */
.floating-wechat {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.wechat-btn {
    width: 56px;
    height: 56px;
    background: #07C160;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(7, 193, 96, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wechat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(7, 193, 96, 0.4);
}

.wechat-qr {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.floating-wechat:hover .wechat-qr {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.qr-content {
    text-align: center;
}

.qr-content p {
    margin: 12px 0 0 0;
    font-size: 12px;
    color: #666;
}

/* 主题样式 */
.reader-mode.dark {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

.reader-mode.dark .reader-header,
.reader-mode.dark .reader-sidebar,
.reader-mode.dark .content-article,
.reader-mode.dark .settings-panel {
    background: #2d2d2d;
    border-color: #404040;
}

.reader-mode.dark .article-header h1,
.reader-mode.dark .article-body h2,
.reader-mode.dark .article-body h3,
.reader-mode.dark .article-body h4 {
    color: #ffffff;
}

.reader-mode.dark .article-body blockquote {
    background: #333;
    border-left-color: #07C160;
}

.reader-mode.dark .info-box {
    background: #2a3f2a;
    border-color: #4a6b4a;
}

.reader-mode.sepia {
    background-color: #f7f3e9;
    color: #5c4b37;
}

.reader-mode.sepia .reader-header,
.reader-mode.sepia .reader-sidebar,
.reader-mode.sepia .content-article {
    background: #f4f0e6;
}

.reader-mode.sepia .article-body blockquote {
    background: #ede8dc;
}

/* 字体大小变体 */
.reader-mode.font-small {
    font-size: 14px;
}

.reader-mode.font-small .article-header h1 {
    font-size: 24px;
}

.reader-mode.font-small .article-body h2 {
    font-size: 20px;
}

.reader-mode.font-large {
    font-size: 18px;
}

.reader-mode.font-large .article-header h1 {
    font-size: 32px;
}

.reader-mode.font-large .article-body h2 {
    font-size: 26px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .reader-layout {
        flex-direction: column;
        gap: 20px;
    }
    
    .reader-sidebar {
        width: 100%;
        position: static;
        order: 2;
    }
    
    .sidebar-header {
        cursor: pointer;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .sidebar-content {
        display: none;
    }
    
    .sidebar-content.expanded {
        display: block;
    }
}

@media (max-width: 768px) {
    .reader-nav {
        padding: 0 16px;
    }
    
    .nav-center .book-title {
        font-size: 16px;
    }
    
    .reader-layout {
        padding: 0 16px;
    }
    
    .article-header,
    .article-body,
    .chapter-navigation {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .article-header h1 {
        font-size: 24px;
    }
    
    .article-body {
        font-size: 15px;
    }
    
    .settings-panel {
        width: 100%;
        right: -100%;
    }
    
    .floating-wechat {
        bottom: 20px;
        right: 20px;
    }
    
    .wechat-btn {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .reader-nav {
        height: 56px;
    }
    
    .breadcrumb {
        display: none;
    }
    
    .article-header,
    .article-body,
    .chapter-navigation {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .article-header {
        padding-top: 24px;
        padding-bottom: 16px;
    }
    
    .article-body {
        padding-top: 20px;
        padding-bottom: 20px;
    }
    
    .chapter-navigation {
        flex-direction: column;
        gap: 12px;
    }
    
    .nav-item.next {
        text-align: left;
    }
}

/* 全屏模式 */
.reader-mode.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    overflow: auto;
}

.reader-mode.fullscreen .reader-sidebar {
    display: none;
}

.reader-mode.fullscreen .reader-content {
    max-width: 800px;
    margin: 0 auto;
}

/* 滚动条样式 */
.sidebar-content::-webkit-scrollbar,
.settings-body::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track,
.settings-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb,
.settings-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover,
.settings-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-article {
    animation: fadeInUp 0.5s ease;
}

/* 打印样式 */
@media print {
    .reader-header,
    .reader-sidebar,
    .chapter-navigation,
    .settings-panel,
    .floating-wechat,
    .reading-progress {
        display: none !important;
    }
    
    .reader-content {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .content-article {
        box-shadow: none !important;
        border-radius: 0 !important;
    }
    
    .article-body {
        font-size: 12pt !important;
        line-height: 1.5 !important;
    }
}