/* ============================================================
   阅读器样式 - 增强版
   ============================================================ */

.reader-body { background: #f5f0e8; }

/* 顶部栏 */
.reader-header { position: fixed; top: 0; left: 0; right: 0; background: #fff; border-bottom: 1px solid #e8e8e8; z-index: 100; transition: transform 0.3s; }
.reader-header.hidden { transform: translateY(-100%); }
.reader-header-inner { display: flex; align-items: center; padding: 10px 20px; gap: 15px; }
.reader-back { color: #e65540; font-size: 14px; flex-shrink: 0; text-decoration: none; }
.reader-book-title { font-size: 14px; color: #666; flex-shrink: 0; }
.reader-chapter-title { flex: 1; font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-tools { display: flex; gap: 10px; flex-shrink: 0; }
.tool-btn { padding: 5px 12px; border: 1px solid #e0e0e0; border-radius: 15px; background: #fff; font-size: 13px; cursor: pointer; transition: all 0.2s; }
.tool-btn:hover { border-color: #e65540; color: #e65540; }

/* 设置面板 */
.reader-settings { position: fixed; bottom: 0; left: 0; right: 0; z-index: 200; display: none; }
.reader-settings.show { display: block; }
.settings-panel { background: #fff; border-radius: 16px 16px 0 0; padding: 20px; box-shadow: 0 -4px 20px rgba(0,0,0,0.1); position: relative; max-height: 70vh; overflow-y: auto; }
.settings-panel h4 { font-size: 16px; margin-bottom: 15px; }
.setting-group { margin-bottom: 15px; }
.setting-group label { display: block; font-size: 14px; color: #666; margin-bottom: 8px; }
.setting-options { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* 字体大小按钮 */
.size-btn, .font-btn, .lh-btn, .flip-btn { padding: 6px 16px; border: 1px solid #e0e0e0; border-radius: 15px; background: #fff; cursor: pointer; font-size: 13px; transition: all 0.2s; }
.size-btn.active, .font-btn.active, .lh-btn.active, .flip-btn.active { background: #e65540; color: #fff; border-color: #e65540; }
.size-btn:hover, .font-btn:hover, .lh-btn:hover, .flip-btn:hover { border-color: #e65540; }

/* 背景色按钮 */
.bg-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #e0e0e0; cursor: pointer; transition: all 0.2s; }
.bg-btn.active { border-color: #e65540; box-shadow: 0 0 0 2px rgba(230,85,64,0.3); }
.bg-white { background: #ffffff; }
.bg-cream { background: #f5f0e8; }
.bg-green { background: #e8f5e9; }
.bg-pink { background: #fce4ec; }
.bg-blue { background: #e3f2fd; }
.bg-dark { background: #263238; }

/* 亮度调节 */
.brightness-control { display: flex; align-items: center; gap: 10px; }
.brightness-slider { flex: 1; height: 6px; -webkit-appearance: none; appearance: none; background: linear-gradient(to right, #333, #fff); border-radius: 3px; outline: none; cursor: pointer; }
.brightness-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #e65540; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.2); cursor: pointer; }
.brightness-slider::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #e65540; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.2); cursor: pointer; }
.brightness-icon { font-size: 16px; }
.brightness-value { font-size: 12px; color: #999; min-width: 36px; }

.settings-close { position: absolute; top: 15px; right: 15px; background: none; border: none; font-size: 14px; cursor: pointer; color: #999; padding: 5px 10px; border-radius: 15px; }
.settings-close:hover { background: #f5f5f5; color: #333; }

/* 目录面板 */
.reader-catalog { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 200; display: none; background: rgba(0,0,0,0.3); }
.reader-catalog.show { display: flex; }
.catalog-panel { width: 350px; max-width: 90vw; background: #fff; height: 100%; overflow-y: auto; box-shadow: 4px 0 20px rgba(0,0,0,0.1); }
.catalog-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid #e8e8e8; position: sticky; top: 0; background: #fff; z-index: 1; }
.catalog-header h4 { font-size: 16px; }
.catalog-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #999; }
.catalog-list { padding: 10px 0; }
.catalog-item { display: block; padding: 12px 20px; font-size: 14px; color: #666; border-bottom: 1px solid #f5f5f5; transition: background 0.2s; position: relative; text-decoration: none; }
.catalog-item:hover { background: #f8f8f8; }
.catalog-item.active { background: #fff0ed; color: #e65540; font-weight: 500; }
.catalog-item .vip-badge { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); background: #ff9900; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 8px; }

/* 阅读内容 */
.reader-content { max-width: 800px; margin: 0 auto; padding: 70px 20px 100px; }
.reader-container { background: #fff; border-radius: 12px; padding: 40px; min-height: 60vh; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.chapter-title { font-size: 24px; font-weight: bold; margin-bottom: 15px; text-align: center; color: #333; }

/* 章节信息栏 */
.chapter-meta { display: flex; justify-content: center; gap: 20px; font-size: 13px; color: #999; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid #f0f0f0; }

/* 章节正文 */
.chapter-body { font-size: 18px; line-height: 2; color: #333; }

/* 段落样式（支持段评交互） */
.content-paragraph { margin-bottom: 1em; text-indent: 2em; position: relative; cursor: pointer; padding: 2px 4px; border-radius: 4px; transition: background 0.2s; }
.content-paragraph:hover { background: rgba(230,85,64,0.05); }
.content-paragraph:active { background: rgba(230,85,64,0.1); }

/* 段落评论图标 */
.paragraph-comment-icon { display: inline-block; font-size: 12px; color: #e65540; cursor: pointer; margin-left: 4px; vertical-align: super; opacity: 0.7; transition: opacity 0.2s; }
.paragraph-comment-icon:hover { opacity: 1; }

.author-say { margin-top: 30px; padding: 20px; background: #f8f8f8; border-radius: 8px; border-left: 3px solid #e65540; }
.author-say h4 { font-size: 15px; margin-bottom: 8px; color: #e65540; }
.author-say p { font-size: 14px; color: #666; line-height: 1.7; }

/* 章节互动栏 */
.chapter-actions { display: flex; justify-content: center; gap: 20px; margin: 30px 0; padding: 20px 0; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; }
.action-btn { display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; padding: 10px 20px; border-radius: 8px; transition: background 0.2s; }
.action-btn:hover { background: #f5f5f5; }
.action-icon { font-size: 24px; }
.action-text { font-size: 12px; color: #666; }

/* 页脚导航 */
.chapter-nav { display: flex; justify-content: space-between; margin-top: 40px; padding-top: 20px; border-top: 1px solid #e8e8e8; gap: 10px; }
.nav-btn { padding: 10px 20px; border: 1px solid #e0e0e0; border-radius: 8px; font-size: 14px; color: #666; transition: all 0.2s; text-decoration: none; flex: 1; text-align: center; }
.nav-btn:hover { border-color: #e65540; color: #e65540; }
.nav-btn.disabled { color: #ccc; cursor: not-allowed; }
.nav-btn.disabled:hover { border-color: #e0e0e0; color: #ccc; }
.nav-catalog { background: #e65540; color: #fff; border-color: #e65540; }
.nav-catalog:hover { background: #d44a35; color: #fff; }

/* ==================== 段评弹出面板 ==================== */
.segment-popup { position: absolute; z-index: 300; background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); padding: 15px; min-width: 300px; max-width: 500px; }
.segment-popup-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #f0f0f0; }
.segment-popup-title { font-size: 15px; font-weight: 600; color: #333; }
.segment-popup-quote { font-size: 12px; color: #999; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.segment-popup-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #999; padding: 2px 6px; }
.segment-popup-close:hover { color: #333; }

.segment-popup-list { max-height: 300px; overflow-y: auto; margin-bottom: 12px; }
.segment-loading, .segment-empty { text-align: center; padding: 20px; color: #999; font-size: 14px; }

.segment-comment-item { padding: 10px 0; border-bottom: 1px solid #f5f5f5; }
.segment-comment-item:last-child { border-bottom: none; }
.sc-header { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.sc-user { font-size: 13px; color: #e65540; font-weight: 500; }
.sc-time { font-size: 11px; color: #bbb; }
.sc-content { font-size: 14px; color: #333; line-height: 1.6; margin-bottom: 5px; }
.sc-footer { display: flex; gap: 15px; }
.sc-like, .sc-reply { font-size: 12px; color: #999; cursor: pointer; transition: color 0.2s; }
.sc-like:hover, .sc-reply:hover { color: #e65540; }
.sc-like.liked { color: #e65540; }

.segment-popup-input { display: flex; gap: 8px; align-items: flex-end; }
.segment-popup-input textarea { flex: 1; border: 1px solid #e0e0e0; border-radius: 8px; padding: 8px 12px; font-size: 13px; resize: none; outline: none; }
.segment-popup-input textarea:focus { border-color: #e65540; }
.segment-popup-input .btn-sm { padding: 6px 14px; font-size: 13px; white-space: nowrap; }

.segment-popup-login { text-align: center; padding: 10px; font-size: 13px; color: #999; }
.segment-popup-login a { color: #e65540; }

/* 书评 */
.reader-comments { margin-top: 30px; padding-top: 20px; border-top: 1px solid #e8e8e8; }
.comment-title { font-size: 16px; margin-bottom: 15px; }
.comment-input-box { margin-bottom: 20px; }
.comment-input-box textarea { width: 100%; border: 1px solid #e0e0e0; border-radius: 8px; padding: 12px; font-size: 14px; resize: vertical; outline: none; min-height: 80px; box-sizing: border-box; }
.comment-input-box textarea:focus { border-color: #e65540; }
.comment-submit-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.comment-tip { font-size: 12px; color: #bbb; }
.comment-login-tip { text-align: center; padding: 15px; color: #999; font-size: 14px; }
.comment-login-tip a { color: #e65540; }

.comment-item { padding: 15px 0; border-bottom: 1px solid #f5f5f5; }
.comment-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-user { font-size: 14px; color: #e65540; font-weight: 500; }
.comment-time { font-size: 12px; color: #bbb; }
.comment-content { font-size: 14px; color: #333; line-height: 1.7; margin-bottom: 8px; }
.comment-footer { display: flex; gap: 15px; }
.comment-action { font-size: 12px; color: #999; cursor: pointer; transition: color 0.2s; }
.comment-action:hover { color: #e65540; }

/* 底部栏 */
.reader-footer { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid #e8e8e8; z-index: 100; transition: transform 0.3s; }
.reader-footer.hidden { transform: translateY(100%); }
.reader-footer-inner { display: flex; justify-content: space-around; padding: 10px 20px; }
.footer-nav-btn { font-size: 14px; color: #666; padding: 5px 15px; text-decoration: none; }
.footer-nav-btn:hover { color: #e65540; }

/* 阅读进度浮层 */
.reading-progress-float { position: fixed; right: 20px; bottom: 60px; background: rgba(0,0,0,0.6); color: #fff; padding: 4px 10px; border-radius: 12px; font-size: 12px; z-index: 99; transition: opacity 0.3s; }

/* 夜间模式 */
.reader-body.night-mode { background: #1a1a1a; }
.reader-body.night-mode .reader-header { background: #263238; border-color: #37474f; }
.reader-body.night-mode .reader-header-inner { color: #fff; }
.reader-body.night-mode .reader-back { color: #ff7a66; }
.reader-body.night-mode .reader-container { background: #263238; }
.reader-body.night-mode .chapter-title { color: #e0e0e0; }
.reader-body.night-mode .chapter-meta { color: #666; border-color: #37474f; }
.reader-body.night-mode .chapter-body { color: #bbb; }
.reader-body.night-mode .content-paragraph:hover { background: rgba(255,255,255,0.03); }
.reader-body.night-mode .author-say { background: #1e2a30; border-color: #ff7a66; }
.reader-body.night-mode .author-say h4 { color: #ff7a66; }
.reader-body.night-mode .author-say p { color: #999; }
.reader-body.night-mode .chapter-actions { border-color: #37474f; }
.reader-body.night-mode .action-text { color: #999; }
.reader-body.night-mode .action-btn:hover { background: #37474f; }
.reader-body.night-mode .reader-footer { background: #263238; border-color: #37474f; }
.reader-body.night-mode .footer-nav-btn { color: #aaa; }
.reader-body.night-mode .nav-btn { border-color: #37474f; color: #aaa; }
.reader-body.night-mode .nav-catalog { background: #e65540; color: #fff; border-color: #e65540; }
.reader-body.night-mode .settings-panel { background: #263238; color: #e0e0e0; }
.reader-body.night-mode .settings-panel h4 { color: #e0e0e0; }
.reader-body.night-mode .setting-group label { color: #999; }
.reader-body.night-mode .size-btn, .reader-body.night-mode .font-btn, .reader-body.night-mode .lh-btn, .reader-body.night-mode .flip-btn { background: #37474f; border-color: #455a64; color: #ccc; }
.reader-body.night-mode .catalog-panel { background: #263238; }
.reader-body.night-mode .catalog-header { background: #263238; border-color: #37474f; }
.reader-body.night-mode .catalog-header h4 { color: #e0e0e0; }
.reader-body.night-mode .catalog-item { color: #bbb; border-color: #37474f; }
.reader-body.night-mode .catalog-item:hover { background: #37474f; }
.reader-body.night-mode .catalog-item.active { background: #37474f; color: #ff7a66; }
.reader-body.night-mode .segment-popup { background: #263238; }
.reader-body.night-mode .segment-popup-header { border-color: #37474f; }
.reader-body.night-mode .segment-popup-title { color: #e0e0e0; }
.reader-body.night-mode .sc-content { color: #bbb; }
.reader-body.night-mode .comment-content { color: #bbb; }
.reader-body.night-mode .comment-input-box textarea { background: #37474f; border-color: #455a64; color: #e0e0e0; }
.reader-body.night-mode .reader-comments { border-color: #37474f; }
.reader-body.night-mode .comment-item { border-color: #37474f; }
.reader-body.night-mode .segment-comment-item { border-color: #37474f; }
.reader-body.night-mode .segment-popup-input textarea { background: #37474f; border-color: #455a64; color: #e0e0e0; }

/* 响应式 */
@media (max-width: 768px) {
    .reader-content { padding: 60px 15px 80px; }
    .reader-container { padding: 25px 15px; }
    .chapter-title { font-size: 20px; }
    .chapter-body { font-size: 16px; }
    .chapter-nav { flex-direction: column; gap: 8px; }
    .nav-btn { text-align: center; }
    .reader-tools { gap: 5px; }
    .tool-btn { padding: 5px 8px; font-size: 12px; }
    .reader-chapter-title { display: none; }
    .chapter-actions { gap: 10px; }
    .action-btn { padding: 8px 12px; }
    .action-icon { font-size: 20px; }
    .segment-popup { min-width: 260px; max-width: calc(100vw - 30px); left: 15px !important; right: 15px !important; }
    .chapter-meta { flex-wrap: wrap; gap: 10px; }
}

/* 阅读进度条 */
#readingProgressBar { position: fixed; bottom: 0; left: 0; right: 0; height: 3px; background: rgba(0,0,0,0.1); z-index: 999; }
#readingProgressBar .progress-fill { height: 100%; background: #e65540; width: 0%; transition: width 0.1s; }

/* 夜间模式进度条 */
.reader-body.night-mode #readingProgressBar { background: rgba(255,255,255,0.1); }
