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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    background-color: #f5f7fa;
    line-height: 1.6;
}

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

/* ==================== 导航栏 ==================== */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.logo-icon {
    font-size: 32px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 1px;
}

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

.nav-menu a {
    color: white;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: opacity 0.3s ease;
    position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
    opacity: 0.8;
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: white;
}

/* ==================== 英雄区域 ==================== */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.hero-content h2 {
    font-size: 42px;
    margin-bottom: 15px;
    font-weight: 700;
}

.hero-content p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.95;
}

.search-bar {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    gap: 5px;
    background: white;
    border-radius: 50px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 20px;
    font-size: 15px;
    border-radius: 50px;
}

.search-bar button {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

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

/* ==================== 分类标签 ==================== */
.categories {
    background: white;
    padding: 40px 0;
    border-bottom: 1px solid #eee;
}

.categories h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
}

.category-tags {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 10px 20px;
    background: #f0f2f5;
    border: 1px solid #ddd;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.tag:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
}

/* ==================== 图书展示区域 ==================== */
.books-section {
    padding: 60px 0;
}

.books-section h3 {
    font-size: 24px;
    margin-bottom: 30px;
    color: #333;
    font-weight: 700;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
}

.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.book-card-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    background: #f0f2f5;
}

.book-card-content {
    padding: 15px;
}

.book-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.book-card-author {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.book-card-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
}

.stars {
    color: #ff9a44;
}

/* ==================== 图书详情页面 ==================== */
.breadcrumb {
    background: white;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.breadcrumb span {
    color: #999;
    margin: 0 10px;
}

.book-detail {
    padding: 40px 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    background: white;
    padding: 40px;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.detail-left {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.book-cover {
    width: 100%;
    max-width: 300px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

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

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.detail-right {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

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

.book-meta {
    margin-bottom: 30px;
}

.meta-item {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #f0f2f5;
    font-size: 14px;
}

.meta-item .label {
    font-weight: 600;
    color: #666;
    min-width: 80px;
}

.meta-item span:not(.label) {
    color: #333;
    flex: 1;
}

.rating {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rating .stars {
    color: #ff9a44;
    font-size: 16px;
}

.rating .score {
    color: #666;
}

.price-section {
    padding: 20px;
    background: #fff8f0;
    border-radius: 8px;
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 20px;
}

.price-label {
    font-weight: 600;
    color: #666;
}

.price {
    font-size: 28px;
    font-weight: 700;
    color: #ff6b6b;
}

/* ==================== 详细内容 ==================== */
.detail-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.content-tabs {
    display: flex;
    gap: 30px;
    border-bottom: 2px solid #f0f2f5;
    margin-bottom: 30px;
}

.tab-btn {
    padding: 15px 0;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn.active {
    color: #667eea;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #667eea;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-pane h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
}

.tab-pane p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 15px;
    text-align: justify;
}

.book-catalog {
    list-style: none;
}

.book-catalog li {
    padding: 10px 0;
    color: #666;
    border-bottom: 1px solid #f0f2f5;
    padding-left: 30px;
    position: relative;
}

.book-catalog li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #667eea;
}

.book-catalog li:last-child {
    border-bottom: none;
}

/* ==================== 返回按钮 ==================== */
.back-button {
    margin: 40px 0;
    text-align: center;
}

.btn-back {
    display: inline-block;
    padding: 12px 30px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: #667eea;
    color: white;
    transform: translateX(-5px);
}

/* ==================== 相关推荐 ==================== */
.related-books {
    background: white;
    padding: 60px 0;
    border-top: 1px solid #eee;
}

.related-books h3 {
    font-size: 24px;
    margin-bottom: 30px;
    color: #333;
    font-weight: 700;
}

/* ==================== 底部 ==================== */
.footer {
    background: #2c3e50;
    color: white;
    padding: 40px 0;
    text-align: center;
    margin-top: 60px;
}

.footer p {
    opacity: 0.8;
    font-size: 14px;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .nav-menu {
        gap: 15px;
    }

    .hero-content h2 {
        font-size: 28px;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-bar button {
        width: 100%;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .book-title {
        font-size: 24px;
    }

    .content-tabs {
        gap: 15px;
    }

    .tab-btn {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 18px;
    }

    .hero-content h2 {
        font-size: 20px;
    }

    .hero-content p {
        font-size: 14px;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .detail-grid {
        padding: 20px;
    }

    .book-title {
        font-size: 20px;
    }

    .price {
        font-size: 22px;
    }
}
