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

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #6B46C1 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

/* 头部样式 */
.header {
    text-align: center;
    padding: 60px 0;
    color: white;
    position: relative;
}

.header-bg {
    position: relative;
    z-index: 2;
}

.main-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #ffffff, #e0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sub-title {
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    opacity: 0.9;
}

.description {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto;
}

/* 介绍文本区域 */
.intro-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    margin: 40px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.intro-text p {
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.8;
    color: #4a5568;
}

/* 筛选和搜索区域 */
.filter-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 30px;
    margin: 30px 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.keyword-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-color: #f59e0b;
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.search-box {
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 100%;
}

.search-box input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
}

.search-box button {
    padding: 12px 20px;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

/* 图书展示区域 */
.books-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    margin: 40px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

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

.section-title {
    font-size: 2rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.view-options {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.book-count {
    color: #718096;
    font-size: 1rem;
}

.sort-options select {
    padding: 8px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s ease;
}

.sort-options select:focus {
    border-color: #667eea;
}

/* 加载动画 */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #718096;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* 图书网格布局 - 每行5本书 */
.books-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 25px;
    margin: 30px 0;
}

/* 图书卡片样式 - 京东风格 */
.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border: 1px solid #f0f0f0;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #e2e8f0;
}

.book-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #f0f0f0;
    background: #f8f9fa;
}

.book-info {
    padding: 15px;
}

.book-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2d3748;
    line-height: 1.4;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.book-author {
    color: #718096;
    font-size: 0.85rem;
    margin-bottom: 8px;
    height: 1.2em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.book-publisher {
    color: #a0aec0;
    font-size: 0.8rem;
    margin-bottom: 10px;
    height: 1em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.book-sales {
    color: #718096;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.book-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.current-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #e53e3e;
}

.price-symbol {
    font-size: 0.9rem;
    margin-right: 2px;
}

.buy-btn {
    background: linear-gradient(135deg, #e53e3e, #c53030);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.buy-btn:hover {
    background: linear-gradient(135deg, #c53030, #9c2626);
    transform: scale(1.05);
}

/* 关键词标签 */
.keyword-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    z-index: 1;
}

/* 无结果提示 */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #4a5568;
}

/* 统计信息区域 */
.stats-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    margin: 40px 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

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

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* 页脚 */
.footer {
    background: rgba(0, 0, 0, 0.1);
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
    backdrop-filter: blur(10px);
}

.footer-content p {
    margin-bottom: 5px;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    transform: scale(1);
}

.back-to-top:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
    transform: scale(1.1);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .books-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 992px) {
    .books-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .view-options {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .main-title {
        font-size: 2.5rem;
    }
    
    .sub-title {
        font-size: 1.5rem;
    }
    
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .filter-controls {
        gap: 15px;
    }
    
    .keyword-filters {
        gap: 8px;
    }
    
    .filter-btn {
        padding: 8px 15px;
        font-size: 0.8rem;
    }
    
    .intro-section,
    .books-section,
    .filter-section,
    .stats-section {
        padding: 25px;
        margin: 20px 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 2rem;
    }
    
    .sub-title {
        font-size: 1.3rem;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .keyword-filters {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-btn {
        width: 100%;
        text-align: center;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .intro-section,
    .books-section,
    .filter-section,
    .stats-section {
        padding: 20px;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .view-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* 图片懒加载效果 */
.book-cover[data-src] {
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
    background-size: 400% 400%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 过渡动画 */
.books-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

.book-card {
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 为不同索引的卡片添加延迟动画 */
.book-card:nth-child(1) { animation-delay: 0.1s; }
.book-card:nth-child(2) { animation-delay: 0.2s; }
.book-card:nth-child(3) { animation-delay: 0.3s; }
.book-card:nth-child(4) { animation-delay: 0.4s; }
.book-card:nth-child(5) { animation-delay: 0.5s; }
.book-card:nth-child(n+6) { animation-delay: 0.6s; }