﻿/* ============================================
   全局重置与基础设置
   ============================================ */

/* 重置所有元素的默认边距和内边距，统一盒模型为border-box */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 页面整体样式设置 */
body {
    font-family: 
    /* 1. Web字体（优先加载） */
    'Source Han Serif SC',
    'Noto Serif SC',
    
    /* 2. 苹果系统 */
    'PingFang SC', 
    'STSong',
    
    /* 3. Windows系统 */
    'SimSun', 
    'Microsoft YaHei',
    
    /* 4. Linux系统 */
    'WenQuanYi Zen Hei',
    
    /* 5. 通用回退 */
    serif;
    
    background-color: #f5f1e8;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M0,0 L100,100 M100,0 L0,100" stroke="%23d4c9a6" stroke-width="0.5" opacity="0.3"/></svg>');
    color: #3d2c1e;
    min-height: 100vh;
    padding: 20px;
}

/* 主容器样式 */
.container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

/* ============================================
   LOGO区域样式
   ============================================ */
.logo-container {
    text-align: center;
    margin: 40px 0 40px;
    position: relative;
}

.logo-bg {
    display: inline-block;
    background-color: transparent;
    padding: 0;
    position: relative;
}

/* 去掉两侧装饰圆点 */
.logo-bg::before,
.logo-bg::after {
    display: none;
}

/* LOGO图片样式 */
.site-logo {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

.logo-subtitle {
    font-size: 1.2rem;
    color: #6b5c43;
    margin-top: 15px;
    letter-spacing: 8px;
    font-style: italic;
    font-family: 'STKaiti', 'KaiTi', serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* ============================================
   导航栏样式
   ============================================ */
.nav-container {
    text-align: center;
    margin: 30px 0 40px;
    position: relative;
}

.main-nav {
    display: inline-flex;
    background-color: #fff;
    border: 2px solid #8b7355;
    border-radius: 50px;
    padding: 5px;
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.15);
    position: relative;
    overflow: hidden;
}

/* 导航栏内层边框装饰 */
.main-nav::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid #d4c9a6;
    border-radius: 50px;
    pointer-events: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    text-decoration: none;
    color: #6b5c43;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    border-radius: 40px;
    margin: 0 5px;
    min-width: 100px;
    position: relative;
    z-index: 1;
}

.nav-item i {
    font-size: 1.5rem;
    margin-bottom: 6px;
    color: #8b7355;
    transition: all 0.3s ease;
}

.nav-item span {
    font-family: 'STKaiti', 'KaiTi', serif;
    font-weight: bold;
    letter-spacing: 1px;
}

/* 导航项悬停效果 */
.nav-item:hover {
    color: #5d4a2e;
    background-color: #f9f5ec;
}

.nav-item:hover i {
    transform: translateY(-2px);
    color: #5d4a2e;
}

/* 导航项选中效果 */
.nav-item.active {
    background: linear-gradient(145deg, #8b7355, #6b5c43);
    color: #f9f5ec;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nav-item.active i {
    color: #f9f5ec;
}

/* 导航项之间的分隔线 */
.nav-item:not(:last-child)::after {
    content: "";
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 30px;
    background: linear-gradient(to bottom, transparent, #d4c9a6, transparent);
}

/* ============================================
   分类区域样式
   ============================================ */
.categories-section {
    margin-top: 40px;
}

.section-title {
    text-align: center;
    font-size: 1.8rem;
    color: #5d4a2e;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 15px;
}

/* 分类标题下方的装饰线 */
.section-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #8b7355, transparent);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.category-card {
    background: linear-gradient(145deg, #f9f5ec, #f0ead8);
    border-radius: 10px;
    padding: 25px 20px;
    text-decoration: none;
    color: #3d2c1e;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid #d4c9a6;
    position: relative;
    overflow: hidden;
}

/* 分类卡片悬停效果 */
.category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
    border-color: #8b7355;
}

/* 分类卡片顶部装饰条 */
.category-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #8b7355, #d4c9a6);
}

.category-icon {
    font-size: 2.8rem;
    color: #8b7355;
    margin-bottom: 15px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-name {
    font-size: 1.6rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #5d4a2e;
    font-family: 'STKaiti', 'KaiTi', serif;
}

/* ============================================
   底部样式
   ============================================ */
.footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px dashed #d4c9a6;
    color: #6b5c43;
    font-size: 0.9rem;
}

/* ============================================
   书籍列表区域样式
   ============================================ */
.books-section {
    margin-top: 60px;
    padding: 30px;
    background-color: #fcfaf5;
    border-radius: 12px;
    border: 1px solid #d4c9a6;
    box-shadow: 0 8px 20px rgba(139, 115, 85, 0.1);
}

.books-section .section-title {
    color: #5d4a2e;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.books-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 修改后的核心：将.book-item和.book-title合并 */
.book-title {
    display: flex;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(145deg, #fff, #f9f5ec);
    border-radius: 8px;
    border: 1px solid #e8dfd0;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    font-size: 1.5rem;
    color: #3d2c1e;
    flex-grow: 1;
    font-weight: normal;
}

/* 书籍项目悬停效果 */
.book-title:hover {
    transform: translateX(8px);
    border-color: #8b7355;
    box-shadow: 0 6px 15px rgba(139, 115, 85, 0.15);
    background: linear-gradient(145deg, #f9f5ec, #f0ead8);
}

/* 为每本书左侧添加一条装饰竖线 */
.book-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10%;
    height: 80%;
    width: 4px;
    background: linear-gradient(to bottom, #8b7355, #d4c9a6);
    border-radius: 2px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.book-title:hover::before {
    opacity: 1;
}

/* ============================================
   【新增】分类卡片图片图标与横向布局样式
   这是将图标放在文字左侧的核心样式
   ============================================ */

/* 分类卡片整体布局：横向排列，图标在左，文字在右 */
.category-card {
    display: flex;
    align-items: center; /* 垂直居中对齐 */
    justify-content: flex-start; /* 从左开始排列 */
    padding: 20px; /* 根据实际需要调整 */
    text-align: left; /* 文字左对齐，与图标排列一致 */
}

/* 图标容器样式调整：设定固定大小并设置与文字的间距 */
.category-icon {
    margin-right: 20px; /* 图标与文字之间的间距 */
    margin-bottom: 0; /* 取消原有底部边距 */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px; /* 图标容器宽度 */
    height: 60px; /* 图标容器高度 */
    flex-shrink: 0; /* 防止图标容器被压缩 */
}

/* 图标图片样式：确保图片适应容器 */
.category-icon-img {
    max-width: 100%; /* 确保图片不超出容器宽度 */
    max-height: 100%; /* 确保图片不超出容器高度 */
    object-fit: contain; /* 保持图片比例，完整显示 */
    display: block; /* 消除图片底部的间隙 */
}

/* 分类名称样式：取消原有下边距，调整字体大小和左间距 */
.category-name {
    margin: 0; /* 移除默认的上下边距 */
    font-size: 1.5rem; /* 可以根据需要调整字体大小 */
    flex-grow: 1; /* 让文字部分占据剩余空间 */
}

/* ============================================
   响应式设计 - 平板设备（最大宽度768px）
   ============================================ */
@media (max-width: 768px) {
    .main-nav {
        flex-wrap: wrap;
        border-radius: 15px;
        max-width: 500px;
    }
    
    .main-nav::before {
        border-radius: 15px;
    }
    
    .nav-item {
        min-width: 45%;
        margin: 5px;
        padding: 10px 15px;
        border-radius: 10px;
    }
    
    .nav-item:not(:last-child)::after {
        display: none;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .logo {
        font-size: 2.5rem;
    }
    
    .logo-subtitle {
        font-size: 1rem;
        letter-spacing: 5px;
    }
    
    .books-section {
        padding: 20px;
        margin-top: 40px;
    }
 
    .book-title {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        font-size: 1.4rem;
    }

    /* 移动端取消悬停平移效果，改为阴影变化 */
    .book-title:hover {
        transform: none;
        box-shadow: 0 4px 12px rgba(139, 115, 85, 0.2);
    }
    
    .book-title::before {
        width: 100%;
        height: 3px;
        top: 0;
        left: 0;
        background: linear-gradient(90deg, #8b7355, #d4c9a6);
    }
    
    /* 【新增】平板端分类卡片响应式 */
    .category-card {
        padding: 15px;
    }
    
    .category-icon {
        width: 50px;
        height: 50px;
        margin-right: 15px;
    }
    
    .category-name {
        font-size: 1.4rem;
    }
}

/* ============================================
   响应式设计 - 手机设备（最大宽度480px）
   ============================================ */
@media (max-width: 480px) {
    .main-nav {
        width: 100%;
        border-radius: 10px;
    }
    
    .main-nav::before {
        border-radius: 10px;
    }
    
    .nav-item {
        min-width: calc(50% - 10px);
        margin: 5px;
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .nav-item i {
        font-size: 1.3rem;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .category-name {
        font-size: 1.4rem;
    }
    
    body {
        padding: 10px;
    }
    
    /* 【新增】手机端分类卡片响应式 */
    .category-card {
        padding: 12px;
        flex-direction: row; /* 保持横向排列 */
    }
    
    .category-icon {
        width: 45px;
        height: 45px;
        margin-right: 12px;
    }
    
    .category-name {
        font-size: 1.3rem;
    }
}