/* 小说阅读专用页面样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.novel-read-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    transition: background 0.3s, color 0.3s;
}

/* 主题样式 */
.theme-light {
    background: #fafafa;
    color: #333;
}

.theme-dark {
    background: #1a1a1a;
    color: #b3b3b3;
}

.theme-sepia {
    background: #f4ecd8;
    color: #5b4636;
}

.theme-green {
    background: #e8f5e9;
    color: #2e7d32;
}

/* 顶部导航 */
.novel-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.theme-dark .novel-header {
    background: #2a2a2a;
}

.theme-sepia .novel-header {
    background: #f5e6d3;
}

.theme-green .novel-header {
    background: #c8e6c9;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.novel-title-sm {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(0,0,0,0.05);
}

.theme-dark .icon-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* 侧边栏 */
.novel-sidebar {
    position: fixed;
    top: 56px;
    left: -320px;
    width: 320px;
    height: calc(100vh - 56px);
    background: #fff;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s;
    z-index: 999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.theme-dark .novel-sidebar {
    background: #2a2a2a;
}

.novel-sidebar.show {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.theme-dark .sidebar-header {
    border-bottom-color: #444;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: #333;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.novel-info {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.theme-dark .novel-info {
    border-bottom-color: #444;
}

.novel-info h3 {
    font-size: 18px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.novel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.novel-meta span {
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 12px;
    font-size: 12px;
}

.theme-dark .novel-meta span {
    background: #444;
}

.novel-summary {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.theme-dark .novel-summary {
    color: #999;
}

.chapter-list {
    padding: 10px;
}

.chapter-item {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.chapter-item:hover {
    background: #f5f5f5;
}

.theme-dark .chapter-item:hover {
    background: #444;
}

.chapter-item.active {
    background: #007bff;
    color: #fff;
}

.chapter-num {
    color: #999;
    font-size: 13px;
    min-width: 70px;
    flex-shrink: 0;
}

.chapter-item.active .chapter-num {
    color: rgba(255,255,255,0.8);
}

.chapter-title {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-section {
    padding: 16px;
    border-top: 1px solid #eee;
}

.theme-dark .bookmark-section {
    border-top-color: #444;
}

.bookmark-section h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #666;
}

.theme-dark .bookmark-section h4 {
    color: #999;
}

.bookmark-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bookmark-item {
    padding: 6px 12px;
    background: #f0f0f0;
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.bookmark-item:hover {
    background: #e0e0e0;
}

.theme-dark .bookmark-item {
    background: #444;
}

.theme-dark .bookmark-item:hover {
    background: #555;
}

/* 主阅读区 */
.novel-main {
    max-width: 800px;
    margin: 56px auto 0;
    padding: 40px 20px;
    min-height: calc(100vh - 56px);
}

.novel-reader-content {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.theme-dark .novel-reader-content {
    background: #2a2a2a;
}

.theme-sepia .novel-reader-content {
    background: #f9f2e4;
}

.theme-green .novel-reader-content {
    background: #f1f8f3;
}

.chapter-title {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin: 0 0 30px 0;
    line-height: 1.4;
}

.chapter-content {
    font-size: 16px;
    line-height: 1.8;
    text-align: justify;
    text-indent: 2em;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

/* 章节导航 */
.chapter-nav {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 20px 0;
}

.nav-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    background: #007bff;
    color: #fff;
}

.nav-btn:hover:not(.disabled) {
    background: #0056b3;
    transform: translateY(-1px);
}

.nav-btn.disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 设置面板 */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 2000;
    width: 90%;
    max-width: 400px;
    overflow: hidden;
}

.theme-dark .settings-panel {
    background: #2a2a2a;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.theme-dark .settings-header {
    border-bottom-color: #444;
}

.settings-header h3 {
    font-size: 18px;
}

.settings-content {
    padding: 20px;
}

.setting-group {
    margin-bottom: 24px;
}

.setting-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

.setting-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.setting-controls button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.setting-controls button:hover {
    background: #f5f5f5;
}

.setting-controls span {
    min-width: 60px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.theme-btn {
    aspect-ratio: 1;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 28px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    transform: scale(1.05);
}

.theme-btn.active {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.2);
}

.theme-btn.light { background: #fafafa; }
.theme-btn.dark { background: #1a1a1a; }
.theme-btn.sepia { background: #f4ecd8; }
.theme-btn.green { background: #e8f5e9; }

/* 底部 */
.novel-footer {
    max-width: 800px;
    margin: 0 auto 40px;
    padding: 20px;
    text-align: center;
    border-top: 1px solid #eee;
}

.theme-dark .novel-footer {
    border-top-color: #444;
}

.novel-footer a {
    color: #666;
    text-decoration: none;
    margin: 0 16px;
    transition: color 0.2s;
}

.novel-footer a:hover {
    color: #007bff;
}

.theme-dark .novel-footer a {
    color: #999;
}

/* 响应式 */
@media (max-width: 768px) {
    .novel-title-sm {
        max-width: 150px;
        font-size: 14px;
    }

    .novel-sidebar {
        width: 85%;
        max-width: 320px;
    }

    .novel-main {
        padding: 20px 16px;
    }

    .novel-reader-content {
        padding: 24px 16px;
    }

    .chapter-title {
        font-size: 20px;
        margin-bottom: 24px;
    }

    .chapter-nav {
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
    }

    .theme-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .novel-header {
        padding: 0 12px;
    }

    .novel-title-sm {
        max-width: 100px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .novel-reader-content {
        padding: 20px 12px;
    }

    .chapter-title {
        font-size: 18px;
    }

    .chapter-content {
        font-size: 15px;
    }
}
