:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #f1f5f9;
    --secondary-hover: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --bg-dark: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', 'Noto Serif SC', serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.8;
    transition: all 0.3s ease;
}

body.dark-mode {
    background-color: #0f172a;
    color: #e2e8f0;
    --bg-white: #1e293b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-color: #334155;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: 300px;
    background-color: var(--bg-white);
    border-right: 1px solid var(--border-color);
    transition: all 0.3s ease;
    overflow-y: auto;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

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

.book-info {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.book-cover {
    width: 60px;
    height: 80px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 8px;
    margin: 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.5rem;
    box-shadow: var(--shadow);
}

.book-title {
    position: absolute;
    right: 10px;
    top: 5px;
    float: right;
    width: 70%;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--text-primary);
}

.book-author {
    position: absolute;
    right: 10px;
    top: 50px;
    float: right;
    width: 60%;
    color: var(--text-secondary);
    font-size: 1rem;
}

.chapters-nav {
    padding: 20px;
}

.chapters-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chapters-list {
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.chapter-item {
    padding: 12px 15px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.chapter-item:hover {
    background-color: var(--secondary-color);
}

.chapter-item.active {
    background-color: rgba(79, 70, 229, 0.1);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.chapter-number {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.chapter-title {
    font-size: 0.95rem;
}

.sub-chapter {
    margin-left: 20px;
    font-size: 0.9rem;
}

/* 主内容区域样式 */
.main-content {
    flex: 1;
    margin-left: 300px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content.expanded {
    margin-left: 0;
}

/* 顶部工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

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

.btn {
    padding: 8px 12px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--secondary-color);
    color: var(--text-secondary);
}

.btn:hover {
    background-color: var(--secondary-hover);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

/* 阅读区域 */
.reading-area {
    flex: 1;
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.chapter-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.chapter-number-display {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.chapter-title-display {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 15px;
}

.chapter-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.chapter-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.chapter-content h2 {
    font-size: 1.5rem;
    margin: 30px 0 15px;
    color: var(--text-primary);
}

.chapter-content h3 {
    font-size: 1.3rem;
    margin: 25px 0 12px;
    color: var(--text-primary);
}

.chapter-content p {
    margin-bottom: 20px;
    text-align: justify;
}

.chapter-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 25px 0;
    font-style: italic;
    color: var(--text-secondary);
}

.chapter-content pre {
    background-color: var(--secondary-color);
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 25px 0;
    font-family: 'Courier New', monospace;
}

.chapter-content code {
    background-color: var(--secondary-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* 底部导航 */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 40px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-white);
}

.nav-btn {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--secondary-color);
    color: var(--text-secondary);
}

.nav-btn:hover {
    background-color: var(--secondary-hover);
}

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

/* 阅读设置面板 */
.settings-panel {
    position: fixed;
    right: -300px;
    top: 0;
    width: 300px;
    height: 100vh;
    background-color: var(--bg-white);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 200;
    padding: 25px;
    overflow-y: auto;
}

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

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.settings-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.close-settings {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-secondary);
}

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

.setting-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text-primary);
}

.font-size-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.font-size-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--secondary-color);
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.font-size-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.theme-options {
    display: flex;
    gap: 10px;
}

.theme-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius);
    border: 2px solid var(--border-color);
    background-color: var(--bg-white);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.theme-btn.active {
    border-color: var(--primary-color);
}

.theme-light {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.theme-dark {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
}

.theme-sepia {
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
}

/* 响应式设计 */
@media (max-width: 992px) {
    .sidebar {
        width: 250px;
    }

    .main-content {
        margin-left: 250px;
    }

    .reading-area {
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .reading-area {
        padding: 20px;
    }

    .chapter-title-display {
        font-size: 1.6rem;
    }

    .toolbar {
        padding: 12px 15px;
    }

    .chapter-nav {
        padding: 20px;
    }
}

@media (max-width: 576px) {
    .reading-area {
        padding: 15px;
    }

    .chapter-title-display {
        font-size: 1.4rem;
    }

    .chapter-content {
        font-size: 1rem;
    }

    .toolbar-left, .toolbar-right {
        gap: 10px;
    }

    .btn span {
        display: none;
    }

    .nav-btn span {
        display: none;
    }
}