/* 全局样式 */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body { 
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; 
    background: #f8f9fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 80px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-title {
    font-size: 36px;
    color: #333;
    margin-bottom: 15px;
}

.section-subtitle {
    color: #666;
    font-size: 18px;
    max-width: 600px;
    margin: 0 auto;
}

/* 导航栏样式 */
.navbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-menu a {
    color: #555;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    padding: 5px 0;
    position: relative;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s;
}

.nav-menu a:hover::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-block;
    cursor: pointer;
    border: none;
    text-align: center;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-outline {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

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

/* 英雄区域 */
.hero {
    background: var(--primary-gradient);
    color: white;
    padding: 80px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0,0 L100,0 L100,100 Z" fill="white" opacity="0.1"/></svg>');
    background-size: cover;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 48px;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero p {
    font-size: 20px;
    opacity: 0.9;
    margin-bottom: 30px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 50px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.8;
}

/* 书籍网格 */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.book-cover {
    height: 180px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-cover .default-cover {
    font-size: 48px;
    color: rgba(0,0,0,0.2);
}

.book-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.book-description {
    color: #777;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.chapter-count {
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    color: #666;
}

.book-category {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
}

/* 分类区域 */
.category-section {
    margin-bottom: 60px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.category-title {
    font-size: 24px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.category-card {
    display: block;
    background: white;
    border-radius: 12px;
    padding: 25px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
    height: 100%;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    border-color: var(--primary-color);
}

.category-card-btn {
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s;
}

.category-card:hover .category-card-btn {
    opacity: 1;
    transform: translateY(0);
}

.subcategories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.subcategory-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-decoration: none;
    color: inherit;
    border: 1px solid #eaeaea;
    transition: all 0.3s;
    display: block;
    height: 100%;
}

.subcategory-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

/* 搜索框 */
.search-box {
    max-width: 600px;
    margin: 40px auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 18px 60px 18px 25px;
    border: 2px solid #e1e1e1;
    border-radius: 50px;
    font-size: 16px;
    transition: all 0.3s;
    background: white;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-button {
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
}

.search-button:hover {
    transform: scale(1.05);
}

/* 面包屑导航 */
.breadcrumb {
    background: white;
    padding: 15px 25px;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.breadcrumb a {
    color: #666;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.breadcrumb span {
    margin: 0 8px;
    color: #ccc;
}

/* 分类信息卡片 */
.category-info-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.category-info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.category-icon {
    width: 70px;
    height: 70px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    flex-shrink: 0;
}

.category-meta {
    color: #666;
    font-size: 14px;
}

.category-stats {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* 阅读页面样式 */
.reading-container {
    max-width: 800px;
    margin: 40px auto;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.book-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eaeaea;
}

.book-title {
    font-size: 24px;
    color: #2c3e50;
    font-weight: bold;
    margin-bottom: 10px;
}

.book-title a {
    color: inherit;
    text-decoration: none;
}

.book-title a:hover {
    color: var(--primary-color);
}

.chapter-header {
    text-align: center;
    margin-bottom: 40px;
}

.chapter-title {
    font-size: 32px;
    color: #2c3e50;
    font-weight: bold;
    margin-bottom: 15px;
    line-height: 1.4;
}

.chapter-meta {
    color: #7f8c8d;
    font-size: 14px;
}

.chapter-content {
    font-size: 18px;
    margin-bottom: 50px;
    text-align: justify;
    line-height: 1.8;
}

.chapter-content p {
    margin-bottom: 1.2em;
    text-indent: 2em;
}

.chapter-content p:empty {
    display: none;
}

.chapter-content p:first-of-type {
    text-indent: 2em;
}

.chapter-content h1,
.chapter-content h2,
.chapter-content h3,
.chapter-content h4,
.chapter-content h5,
.chapter-content h6 {
    margin: 1.5em 0 0.8em 0;
    color: #2c3e50;
    line-height: 1.4;
    font-weight: bold;
    text-indent: 0;
}

.chapter-content h1 { font-size: 1.8em; }
.chapter-content h2 { font-size: 1.6em; }
.chapter-content h3 { font-size: 1.4em; }
.chapter-content h4 { font-size: 1.2em; }
.chapter-content h5 { font-size: 1.1em; }
.chapter-content h6 { font-size: 1em; }

.chapter-content blockquote {
    border-left: 4px solid var(--primary-color);
    margin: 1.5em 0;
    padding: 0.5em 0 0.5em 1.5em;
    background: #f8f9fa;
    color: #555;
    font-style: italic;
}

.chapter-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 50px 0 30px 0;
    padding: 25px 0;
    border-top: 1px solid #eaeaea;
    border-bottom: 1px solid #eaeaea;
}

.nav-btn {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(41, 128, 185, 0.3);
}

.nav-btn.disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

.nav-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

.toc-btn {
    background: #2c3e50;
}

.toc-btn:hover {
    background: #1a252f;
}

.reading-settings {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.setting-group {
    display: inline-flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.setting-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.setting-btn:hover {
    background: #f0f0f0;
}

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

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

.font-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 1px solid #ddd;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chapter-footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
    color: #7f8c8d;
    font-size: 14px;
}

.chapter-footer a {
    color: #7f8c8d;
    text-decoration: none;
    margin: 0 10px;
}

.chapter-footer a:hover {
    color: var(--primary-color);
}

/* 搜索页面样式 */
.search-header {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin: 20px 0 30px 0;
    text-align: center;
}

.search-form {
    max-width: 600px;
    margin: 20px auto 0 auto;
    position: relative;
    height: 50px;
}

.search-results-info {
    text-align: center;
    margin: 20px 0;
    color: #666;
}

.search-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.tab {
    padding: 12px 25px;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

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

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.results-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.book-result,
.chapter-result {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s;
}

.book-result:hover,
.chapter-result:hover {
    background: #f8f9fa;
    border-radius: 8px;
    transform: translateY(-2px);
}

.result-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.result-title a {
    color: #333;
    text-decoration: none;
}

.result-title a:hover {
    color: var(--primary-color);
}

.result-meta {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.result-excerpt {
    color: #555;
    line-height: 1.6;
    font-size: 14px;
}

.highlight {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.page-link {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.page-link:hover {
    background: #f8f9fa;
    border-color: #ccc;
}

.page-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 空状态样式 */
.empty-state,
.no-results,
.empty-search-prompt {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
    color: #999;
}

.empty-icon,
.no-results-icon,
.empty-search-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

/* 调试信息 */
.debug-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    font-family: monospace;
    font-size: 12px;
    color: #666;
    border: 1px solid #eaeaea;
}

.debug-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

/* 页脚 */
.footer {
    background: #2c3e50;
    color: white;
    padding: 60px 0 30px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
}

.footer-logo {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    color: white;
}

.footer-description {
    color: #bdc3c7;
    line-height: 1.8;
    margin-bottom: 20px;
}

.footer-title {
    font-size: 18px;
    margin-bottom: 20px;
    color: white;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
}

.social-icon:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    margin-top: 50px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #95a5a6;
    font-size: 14px;
}

/* 暗色模式 */
body.dark-mode {
    background: #2c3e50;
    color: #ecf0f1;
}

body.dark-mode .navbar {
    background: #34495e;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

body.dark-mode .nav-menu a {
    color: #bdc3c7;
}

body.dark-mode .nav-menu a:hover {
    color: white;
}

body.dark-mode .btn-outline {
    border-color: #ecf0f1;
    color: #ecf0f1;
}

body.dark-mode .reading-container,
body.dark-mode .category-info-card,
body.dark-mode .search-header,
body.dark-mode .results-section,
body.dark-mode .book-card,
body.dark-mode .category-card,
body.dark-mode .subcategory-card {
    background: #34495e;
    color: #ecf0f1;
}

body.dark-mode .chapter-content {
    color: #ecf0f1;
}

body.dark-mode .chapter-content blockquote {
    background: #3d566e;
    color: #bdc3c7;
}

body.dark-mode .reading-settings {
    background: #3d566e;
}

body.dark-mode .setting-btn {
    background: #2c3e50;
    color: #ecf0f1;
    border-color: #4a6572;
}

body.dark-mode .setting-btn:hover {
    background: #3d566e;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 15px;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 15px;
        margin: 20px 0;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 32px;
    }
    
    .hero p {
        font-size: 16px;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .section-title {
        font-size: 28px;
    }
    
    .books-grid,
    .categories-grid,
    .subcategories-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .reading-container,
    .toc-container {
        padding: 20px;
        margin: 20px auto;
    }
    
    .chapter-title {
        font-size: 24px;
    }
    
    .chapter-content {
        font-size: 16px;
    }
    
    .chapter-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .setting-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .result-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .search-tabs {
        flex-wrap: wrap;
    }
    
    .tab {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
    
    .page-link {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .chapter-navigation .nav-btn {
        font-size: 14px;
        padding: 10px 15px;
    }
}