/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 顶部导航栏 */
.header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: #07C160;
}

.nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    text-decoration: none;
    color: #666;
    font-weight: 500;
    transition: color 0.2s ease;
}

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

.user-actions {
    display: flex;
    gap: 12px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #f5f5f5;
    color: #333;
}

/* 主要内容区域 */
.main {
    padding: 40px 0;
}

/* 书籍信息区域 */
.book-info {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 32px;
    display: flex;
    gap: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.book-cover {
    flex-shrink: 0;
}

.cover-image {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.book-details {
    flex: 1;
}

.book-title {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
    line-height: 1.3;
}

.book-author {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
}

.book-description {
    font-size: 16px;
    color: #555;
    line-height: 1.7;
    margin-bottom: 24px;
}

.book-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.stat-item svg {
    color: #07C160;
}

.action-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.btn-primary {
    background: #07C160;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: #06AD56;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: #e8e8e8;
    transform: translateY(-1px);
}

.btn-text {
    background: none;
    border: none;
    color: #07C160;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-text:hover {
    background: rgba(7, 193, 96, 0.1);
}

/* 目录区域 */
.table-of-contents {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

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

.toc-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
}

.toc-controls {
    display: flex;
    gap: 16px;
}

.toc-content {
    max-height: 800px;
    overflow-y: auto;
}

/* 部分样式 */
.toc-part {
    margin-bottom: 24px;
}

.part-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.part-header:hover {
    background: #f8f9fa;
}

.part-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    flex: 1;
}

.chapter-count {
    font-size: 14px;
    color: #666;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 12px;
}

.expand-icon {
    transition: transform 0.2s ease;
    color: #666;
}

.part-header.expanded .expand-icon,
.chapter-header.expanded .expand-icon {
    transform: rotate(90deg);
}

/* 章节列表 */
.chapters-list {
    display: none;
    padding-left: 28px;
}

.chapters-list.expanded {
    display: block;
}

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

.chapter-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.chapter-header:hover {
    background: #f8f9fa;
}

.chapter-title {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

/* 小节列表 */
.sections-list {
    display: none;
    padding-left: 22px;
    margin-top: 8px;
}

.sections-list.expanded {
    display: block;
}

.section-link {
    display: block;
    padding: 8px 12px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

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

/* 微信群区域 */
.wechat-group {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.group-card {
    display: flex;
    align-items: center;
    gap: 32px;
}

.group-info {
    flex: 1;
}

.group-info h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.group-info p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

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

.qr-code p {
    margin-top: 8px;
    font-size: 12px;
    color: #999;
}

/* 底部 */
.footer {
    background: #fff;
    border-top: 1px solid #e5e5e5;
    padding: 24px 0;
    text-align: center;
}

.footer p {
    color: #999;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header-content {
        height: 56px;
    }
    
    .nav {
        display: none;
    }
    
    .book-info {
        flex-direction: column;
        gap: 24px;
        padding: 24px;
    }
    
    .book-title {
        font-size: 24px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .table-of-contents {
        padding: 20px;
    }
    
    .toc-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .group-card {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .main {
        padding: 20px 0;
    }
    
    .book-info {
        padding: 20px;
    }
    
    .book-title {
        font-size: 20px;
    }
    
    .table-of-contents {
        padding: 16px;
    }
    
    .wechat-group {
        padding: 20px;
    }
}

/* 滚动条样式 */
.toc-content::-webkit-scrollbar {
    width: 6px;
}

.toc-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.toc-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.toc-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

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

.chapters-list.expanded,
.sections-list.expanded {
    animation: fadeIn 0.3s ease;
}

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

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

/* 书签和收藏状态 */
.bookmarked {
    color: #07C160 !important;
}

.bookmarked svg {
    fill: #07C160;
}

/* 搜索高亮 */
.search-highlight {
    background: rgba(255, 235, 59, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
}

/* 加载状态 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #07C160;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 夜间模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .header {
        background: #2d2d2d;
        border-bottom-color: #404040;
    }
    
    .book-info,
    .table-of-contents,
    .wechat-group {
        background: #2d2d2d;
    }
    
    .book-title {
        color: #ffffff;
    }
    
    .part-header h3 {
        color: #ffffff;
    }
    
    .btn-secondary {
        background: #404040;
        color: #e0e0e0;
    }
    
    .btn-secondary:hover {
        background: #4a4a4a;
    }
    
    .section-link:hover {
        background: rgba(7, 193, 96, 0.2);
    }
}