/* ========================================
   半糖书屋 - 温馨书香风格主样式
   ======================================== */

/* CSS 变量定义 - 温馨书香配色 */
:root {
    /* 主色调 - 暖棕色系 */
    --primary-color: #c48b4a;
    --primary-hover: #a0522d;
    --primary-light: #fff8ee;
    --primary-dark: #8b5a2b;

    /* 辅助色 */
    --accent-warm: #d4a574;
    --accent-cream: #ffedcc;
    --accent-paper: #faf6f0;

    /* 文字色 */
    --text-color: #5a4a3a;
    --text-light: #a99a8a;
    --text-dark: #3d2e1f;
    --secondary-color: #7a6a5a;

    /* 边框和背景 */
    --border-color: rgba(210, 180, 140, 0.3);
    --border-warm: rgba(196, 139, 74, 0.4);
    --background-color: #faf8f5;
    --background-warm: #fffcf8;
    --white: #fff;

    /* 阴影 */
    --shadow: 0 2px 12px rgba(139, 90, 43, 0.08);
    --shadow-hover: 0 8px 24px rgba(139, 90, 43, 0.15);
    --shadow-card: 0 2px 8px rgba(139, 90, 43, 0.06);

    /* 动画和圆角 */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--background-color);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(255, 237, 204, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(212, 165, 116, 0.15) 0%, transparent 50%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

a:hover {
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   顶部导航栏 - 温馨书香风格
   ======================================== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(180deg, #fffcf8 0%, rgba(255, 252, 248, 0.97) 100%);
    box-shadow: 0 1px 0 rgba(210, 180, 140, 0.2), 0 4px 12px rgba(139, 90, 43, 0.06);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.site-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1180px;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(210, 180, 140, 0.3) 20%, rgba(210, 180, 140, 0.3) 80%, transparent 100%);
}

.header-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
    height: 72px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 6px 0;
    margin-right: 12px;
    position: relative;
}

.logo-img {
    height: 54px;
    width: auto;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 2px 4px rgba(139, 90, 43, 0.15));
}

.logo:hover .logo-img {
    transform: scale(1.06) rotate(-2deg);
    filter: drop-shadow(0 4px 8px rgba(139, 90, 43, 0.2));
}

/* Logo与导航之间的分隔符 */
.logo::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 28px;
    background: linear-gradient(180deg, transparent 0%, rgba(210, 180, 140, 0.5) 50%, transparent 100%);
}

/* 主导航 */
.main-nav {
    display: flex;
    align-items: center;
    flex: 1;
    padding-left: 28px;
    gap: 6px;
}

.main-nav .nav-link {
    position: relative;
    padding: 8px 14px;
    font-weight: 450;
    font-size: 16px;
    color: #5a4a3a;
    line-height: 1.5;
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.5px;
}

.main-nav .nav-link:last-child {
    margin-right: 0;
}

.main-nav .nav-link:hover {
    color: #8b5a2b;
    background: rgba(255, 235, 205, 0.6);
}

.main-nav .nav-link::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 4px;
    transform: translateX(-50%) scaleX(0);
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg, #d4a574, #c48b4a);
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.main-nav .nav-link:hover::before {
    transform: translateX(-50%) scaleX(1);
}

.main-nav .nav-link.active {
    font-weight: 600;
    color: #8b5a2b;
    background: rgba(255, 235, 205, 0.5);
}

.main-nav .nav-link.active::before {
    transform: translateX(-50%) scaleX(1);
    width: 24px;
    background: linear-gradient(90deg, #c48b4a, #a0522d);
}

/* 热门标签 */
.main-nav .nav-link.hot {
    position: relative;
    padding-right: 18px;
}

.main-nav .nav-link.hot::after {
    content: '热';
    position: absolute;
    right: -4px;
    top: 2px;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    padding: 1px 4px;
    border-radius: 6px;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(238, 90, 90, 0.3);
    animation: hotPulse 2s ease-in-out infinite;
}

@keyframes hotPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

/* 搜索框 */
.search-box {
    position: relative;
    width: 220px;
    height: 38px;
    border-radius: 100px;
    overflow: hidden;
    box-sizing: border-box;
    background: rgba(139, 90, 43, 0.06);
    border: 1px solid rgba(210, 180, 140, 0.3);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    background: #fff;
    border-color: rgba(196, 139, 74, 0.5);
    box-shadow: 0 2px 8px rgba(139, 90, 43, 0.1);
}

.search-input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 0 42px 0 18px;
    color: #5a4a3a;
    font-size: 14px;
    line-height: normal;
    box-sizing: border-box;
}

.search-input::placeholder {
    color: #a99a8a;
}

.search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: none;
    background: linear-gradient(135deg, #d4a574 0%, #c48b4a 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    padding: 0;
    z-index: 1;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: linear-gradient(135deg, #c48b4a 0%, #a0522d 100%);
    transform: translateY(-50%) scale(1.05);
}

/* 用户区域 */
.user-area {
    flex-shrink: 0;
    margin-left: 16px;
}

.vip-link {
    box-sizing: border-box;
    padding: 0 14px 0 28px;
    height: 32px;
    border: 1px solid rgba(196, 139, 74, 0.4);
    border-radius: 16px;
    display: flex;
    align-items: center;
    cursor: pointer;
    background: linear-gradient(135deg, #fff8ee 0%, #ffedcc 100%);
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(139, 90, 43, 0.08);
}

.vip-link:hover {
    background: linear-gradient(135deg, #ffedcc 0%, #ffe4b3 100%);
    border-color: rgba(196, 139, 74, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 90, 43, 0.15);
}

.vip-avatar {
    position: absolute;
    left: -1px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.vip-link span {
    height: 24px;
    line-height: 24px;
    font-size: 13px;
    color: #8b5a2b;
    margin-left: 6px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ========================================
   主体内容区域
   ======================================== */
.main-content {
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 92px 20px 20px;
    flex: 1;
}

/* ========================================
   筛选区域 - 书签卡片风格
   ======================================== */
.filter-section {
    background: linear-gradient(135deg, var(--background-warm) 0%, var(--accent-paper) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

/* 装饰性书页纹理 */
.filter-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(212, 165, 116, 0.08) 100%);
    pointer-events: none;
}

.filter-container {
    padding: 20px 24px 12px;
    position: relative;
}

.filter-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 14px;
    font-size: 14px;
}

.filter-row:last-child {
    margin-bottom: 8px;
}

.filter-label {
    display: inline-flex;
    align-items: center;
    margin-right: 12px;
    padding: 4px 12px 4px 0;
    line-height: 24px;
    color: var(--primary-dark);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    border-right: 2px solid var(--accent-warm);
    font-size: 14px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    flex: 1;
    gap: 8px;
    margin-bottom: -4px;
}

.filter-option {
    margin-bottom: 4px;
    padding: 4px 14px;
    display: inline-block;
    height: 28px;
    line-height: 20px;
    color: var(--text-color);
    box-sizing: border-box;
    cursor: pointer;
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    font-size: 13px;
    background: transparent;
    border: 1px solid transparent;
}

.filter-option:hover {
    color: var(--primary-dark);
    background: var(--accent-cream);
    border-color: var(--border-warm);
    transform: translateY(-1px);
}

.filter-option.active {
    font-weight: 600;
    color: var(--white);
    background: linear-gradient(135deg, var(--accent-warm) 0%, var(--primary-color) 100%);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(196, 139, 74, 0.3);
}

/* ========================================
   书籍列表区域 - 书架陈列风格
   ======================================== */
.book-list-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    border: 1px solid var(--border-color);
    position: relative;
}

/* 书架顶部装饰条 */
.book-list-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-warm), var(--primary-color), var(--accent-warm));
    border-radius: 0 0 3px 3px;
}

.book-list-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* 书籍卡片 - 立体书本风格 */
.book-card {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 0;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--background-warm);
    border: 1px solid transparent;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.book-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

.book-card:last-child::after {
    display: none;
}

.book-card:hover {
    background: var(--white);
    border-color: var(--border-warm);
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.book-card:hover .book-title {
    color: var(--primary-color);
}

/* 左侧区域：封面容器（带排名角标） */
.book-left {
    position: relative;
    flex-shrink: 0;
}

/* 排名数字角标 - 书签风格 */
.book-rank {
    position: absolute;
    top: -4px;
    left: -4px;
    min-width: 26px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    font-size: 14px;
    font-weight: 800;
    color: var(--white);
    background: linear-gradient(135deg, #b8a090 0%, #9a8a7a 100%);
    border-radius: 4px 4px 4px 12px;
    z-index: 10;
    line-height: 1;
    text-align: center;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    font-family: Georgia, serif;
}

/* 金银铜牌配色 */
.book-card:nth-child(1) .book-rank {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 50%, #ff9500 100%);
    box-shadow: 0 2px 8px rgba(255, 183, 0, 0.4);
}

.book-card:nth-child(2) .book-rank {
    background: linear-gradient(135deg, #e8e8e8 0%, #c0c0c0 50%, #a8a8a8 100%);
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

.book-card:nth-child(3) .book-rank {
    background: linear-gradient(135deg, #e6a86c 0%, #cd7f32 50%, #b87333 100%);
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.book-card:nth-child(n+4) .book-rank {
    background: linear-gradient(135deg, var(--accent-warm) 0%, var(--primary-color) 100%);
}

/* 书籍封面 - 立体书本效果 */
.book-cover {
    position: relative;
    flex-shrink: 0;
    width: 100px;
    height: 132px;
    border-radius: 2px 6px 6px 2px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-paper) 0%, #efe8df 100%);
    box-shadow:
        3px 3px 8px rgba(139, 90, 43, 0.2),
        -1px 0 1px rgba(139, 90, 43, 0.1);
}

/* 书脊效果 */
.book-cover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(90deg, rgba(139, 90, 43, 0.3), transparent);
    z-index: 2;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.book-card:hover .book-cover img {
    transform: scale(1.08);
}

.book-card:hover .book-cover {
    box-shadow:
        5px 5px 15px rgba(139, 90, 43, 0.25),
        -1px 0 2px rgba(139, 90, 43, 0.15);
}

/* 书籍信息 */
.book-info {
    padding-left: 16px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.book-title {
    display: inline-block;
    max-width: 100%;
    margin-bottom: 10px;
    height: 22px;
    line-height: 22px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-dark);
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.book-meta-line {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}

.book-meta-line .book-category,
.book-meta-line .book-words,
.book-meta-line .book-status {
    display: inline-block;
    height: 20px;
    line-height: 20px;
    font-weight: 400;
    font-size: 12px;
    color: var(--text-light);
}

.book-category {
    padding: 0 8px;
    background: linear-gradient(135deg, var(--accent-cream) 0%, var(--primary-light) 100%);
    border-radius: 10px;
    color: var(--primary-dark);
    font-weight: 500;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-words {
    color: var(--text-light);
}

.book-words::before {
    content: '📖 ';
    font-size: 10px;
}

.book-status {
    color: var(--text-light);
}

.status-finished {
    color: var(--text-light);
}

.status-finished::before {
    content: '✓ ';
    color: var(--primary-color);
}

.status-ongoing {
    color: var(--primary-color);
    font-weight: 500;
}

.status-ongoing::before {
    content: '● ';
    font-size: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.book-desc {
    max-width: 100%;
    height: 60px;
    font-size: 13px;
    color: var(--secondary-color);
    line-height: 20px;
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    text-overflow: ellipsis;
    word-wrap: break-word;
    word-break: break-all;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* ========================================
   分页 - 书页翻页风格
   ======================================== */
.pagination-wrapper {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
    position: relative;
}

/* 分页装饰线 */
.pagination-wrapper::before {
    content: '📚';
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    padding: 0 16px;
    font-size: 16px;
}

.pagination-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.pagination-nav .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 40px;
    height: 40px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    background: var(--background-warm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pagination-nav .page-link:hover:not(.disabled):not(.active) {
    color: var(--primary-dark);
    background: var(--accent-cream);
    border-color: var(--border-warm);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(196, 139, 74, 0.2);
}

.pagination-nav .page-link.active {
    color: var(--white);
    background: linear-gradient(135deg, var(--accent-warm) 0%, var(--primary-color) 100%);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(196, 139, 74, 0.35);
    transform: scale(1.05);
}

.pagination-nav .page-link.disabled {
    color: var(--text-light);
    background: var(--accent-paper);
    cursor: not-allowed;
    opacity: 0.5;
}

/* 上一页/下一页按钮 */
.pagination-nav .page-link.page-prev,
.pagination-nav .page-link.page-next {
    padding: 8px 18px;
    font-weight: 600;
}

.pagination-nav .page-link.page-prev:hover:not(.disabled),
.pagination-nav .page-link.page-next:hover:not(.disabled) {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-cream) 100%);
}

.page-ellipsis {
    padding: 8px 4px;
    color: var(--text-light);
    font-weight: 600;
    letter-spacing: 2px;
}

/* ========================================
   页脚 - 书卷雅韵风格
   ======================================== */
.site-footer {
    background: linear-gradient(180deg, var(--accent-paper) 0%, #f5e6d3 100%);
    border-top: 1px solid var(--border-color);
    padding: 24px 0 20px;
    margin-top: auto;
    position: relative;
}

/* 页脚顶部装饰线 */
.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-warm), transparent);
    border-radius: 2px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin-bottom: 12px;
}

.footer-links a {
    font-size: 13px;
    color: var(--text-light);
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-copyright {
    font-size: 12px;
    color: var(--text-light);
    padding-top: 12px;
    border-top: 1px solid rgba(210, 180, 140, 0.2);
}

.footer-copyright p {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.5px;
}

/* 使用优雅的分隔符替代 emoji */
.footer-copyright p::before,
.footer-copyright p::after {
    content: '—';
    color: var(--accent-warm);
    font-size: 12px;
    opacity: 0.6;
}

.footer-icp {
    margin-top: 8px !important;
}

.footer-icp a {
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition);
}

.footer-icp a:hover {
    color: var(--primary-color);
}

/* ========================================
   移动端菜单按钮（默认隐藏）
   ======================================== */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 101;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    transition: background-color 0.3s ease;
}

.mobile-menu-btn:hover {
    background: rgba(196, 139, 74, 0.1);
}

.mobile-menu-btn .menu-icon,
.mobile-menu-btn .menu-icon::before,
.mobile-menu-btn .menu-icon::after {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--primary-dark);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-btn .menu-icon {
    position: relative;
    margin: 0 auto;
}

.mobile-menu-btn .menu-icon::before,
.mobile-menu-btn .menu-icon::after {
    content: '';
    position: absolute;
    left: 0;
}

.mobile-menu-btn .menu-icon::before {
    top: -7px;
}

.mobile-menu-btn .menu-icon::after {
    top: 7px;
}

/* 菜单打开时的动画 */
.mobile-menu-btn.active .menu-icon {
    background: transparent;
}

.mobile-menu-btn.active .menu-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.mobile-menu-btn.active .menu-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

/* 移动端菜单遮罩 */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 1200px) {
    .book-list-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .header-container {
        gap: 12px;
    }

    .logo::after {
        display: none;
    }

    .main-nav {
        gap: 4px;
        padding-left: 16px;
    }

    .main-nav .nav-link {
        padding: 6px 10px;
        font-size: 15px;
    }

    .search-box {
        width: 160px;
    }

    .book-cover {
        width: 90px;
        height: 119px;
    }
}

@media (max-width: 768px) {
    /* 显示移动端菜单按钮 */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu-overlay {
        display: block;
    }

    .site-header::after {
        display: none;
    }

    .header-container {
        height: 56px;
        padding: 0 12px;
        gap: 8px;
    }

    .logo {
        margin-right: auto;
    }

    .logo-img {
        height: 38px;
    }

    .logo::after {
        display: none;
    }

    /* 主导航 - 侧边栏抽屉式 */
    .main-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        height: 100dvh; /* 动态视口高度，解决 iOS Safari 问题 */
        background: linear-gradient(180deg, #fffcf8 0%, var(--accent-paper) 100%);
        flex-direction: column;
        align-items: stretch;
        padding: 56px 0 24px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); /* 安全区域 */
        gap: 0;
        z-index: 100;
        box-shadow: 4px 0 20px rgba(139, 90, 43, 0.15);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .main-nav.active {
        transform: translateX(0);
    }

    .main-nav::before {
        content: '半糖书屋';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        display: flex;
        align-items: center;
        padding: 0 20px;
        font-size: 18px;
        font-weight: 700;
        color: var(--primary-dark);
        background: linear-gradient(180deg, #fffcf8 0%, rgba(255, 252, 248, 0.97) 100%);
        border-bottom: 1px solid var(--border-color);
        letter-spacing: 1px;
        z-index: 1;
        box-sizing: border-box;
    }

    .main-nav .nav-link {
        font-size: 15px;
        padding: 14px 24px;
        border-radius: 0;
        border-bottom: 1px solid rgba(210, 180, 140, 0.15);
        white-space: nowrap;
    }

    .main-nav .nav-link:hover {
        background: rgba(255, 235, 205, 0.4);
    }

    .main-nav .nav-link.active {
        background: linear-gradient(90deg, rgba(212, 165, 116, 0.2), transparent);
        border-left: 3px solid var(--primary-color);
        padding-left: 21px;
    }

    .main-nav .nav-link::before {
        display: none;
    }

    .main-nav .nav-link.hot::after {
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
    }

    /* 搜索框 */
    .search-box {
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        overflow: visible;
        background: rgba(139, 90, 43, 0.06);
        border: 1px solid transparent;
        transition: all 0.3s ease;
    }

    .search-box.expanded {
        position: absolute;
        top: 10px;
        left: 12px;
        right: 12px;
        width: auto;
        border-radius: 100px;
        background: #fff;
        border-color: var(--border-warm);
        box-shadow: 0 4px 16px rgba(139, 90, 43, 0.15);
        z-index: 102;
    }

    .search-input {
        opacity: 0;
        width: 0;
        padding: 0;
        transition: all 0.3s ease;
    }

    .search-box.expanded .search-input {
        opacity: 1;
        width: 100%;
        padding: 0 42px 0 16px;
    }

    .search-btn {
        position: absolute;
        right: 3px;
        top: 50%;
        transform: translateY(-50%);
        width: 30px;
        height: 30px;
    }

    .search-box:not(.expanded) .search-btn {
        position: static;
        transform: none;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        background: transparent;
        color: var(--primary-dark);
    }

    .search-box:not(.expanded) .search-btn:hover {
        background: rgba(196, 139, 74, 0.1);
    }

    /* 用户区域 */
    .user-area {
        margin-left: 4px;
    }

    .vip-link span {
        display: none;
    }

    .vip-link {
        padding: 0;
        width: 36px;
        height: 36px;
        justify-content: center;
        border-radius: 50%;
    }

    .vip-avatar {
        position: static;
        width: 32px;
        height: 32px;
    }

    /* 主内容区域 */
    .main-content {
        padding-top: 72px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .book-list-container {
        grid-template-columns: 1fr;
    }

    .book-card {
        gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
    }

    .book-card:last-child {
        border-bottom: none;
    }

    .book-cover {
        width: 85px;
        height: 113px;
    }

    .book-title {
        font-size: 15px;
    }

    .book-meta-line {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* 筛选区域响应式 */
    .filter-section::before {
        display: none;
    }

    .filter-container {
        padding: 16px;
    }

    .filter-row {
        flex-direction: column;
        gap: 10px;
    }

    .filter-label {
        width: auto;
        border-right: none;
        border-bottom: 2px solid var(--accent-warm);
        padding: 0 0 6px 0;
        margin-bottom: 4px;
    }

    .filter-options {
        gap: 6px;
    }

    .filter-option {
        padding: 4px 12px;
        font-size: 12px;
    }

    /* 页脚响应式 */
    .site-footer {
        padding: 20px 0 16px;
    }

    .footer-links {
        gap: 4px 12px;
    }

    .footer-links a {
        font-size: 12px;
    }

    .footer-copyright {
        font-size: 11px;
    }

    .footer-copyright p::before,
    .footer-copyright p::after {
        display: none;
    }

    /* 分页响应式 */
    .pagination-nav {
        flex-wrap: wrap;
        gap: 6px;
    }

    .pagination-nav .page-link {
        min-width: 36px;
        height: 36px;
        padding: 6px 10px;
        font-size: 13px;
    }

    .pagination-wrapper::before {
        font-size: 14px;
        top: -12px;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 10px;
    }

    .mobile-menu-btn {
        width: 36px;
        height: 36px;
    }

    .logo-img {
        height: 34px;
    }

    .main-nav {
        width: 260px;
    }

    .main-nav .nav-link {
        padding: 12px 20px;
        font-size: 14px;
    }

    .main-nav .nav-link.hot::after {
        font-size: 8px;
        padding: 1px 3px;
        right: 16px;
    }

    .search-box {
        width: 34px;
        height: 34px;
    }

    .vip-link {
        width: 34px;
        height: 34px;
    }

    .vip-avatar {
        width: 30px;
        height: 30px;
    }

    .main-content {
        padding-top: 68px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .book-cover {
        width: 75px;
        height: 100px;
    }

    .book-title {
        font-size: 14px;
    }

    .book-desc {
        -webkit-line-clamp: 2;
        font-size: 12px;
    }

    .book-rank {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
}

/* ========================================
   动画效果 - 书页翻动风格
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-15px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 筛选区域入场动画 */
.filter-section {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* 书籍列表区域入场动画 */
.book-list-section {
    animation: fadeInUp 0.6s ease-out 0.1s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

/* 书籍卡片入场动画 - 书架陈列效果 */
.book-card {
    --animation-base-delay: 0.04s;
    animation: fadeInUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

.book-card:nth-child(1)  { animation-delay: calc(var(--animation-base-delay) * 1); }
.book-card:nth-child(2)  { animation-delay: calc(var(--animation-base-delay) * 2); }
.book-card:nth-child(3)  { animation-delay: calc(var(--animation-base-delay) * 3); }
.book-card:nth-child(4)  { animation-delay: calc(var(--animation-base-delay) * 4); }
.book-card:nth-child(5)  { animation-delay: calc(var(--animation-base-delay) * 5); }
.book-card:nth-child(6)  { animation-delay: calc(var(--animation-base-delay) * 6); }
.book-card:nth-child(7)  { animation-delay: calc(var(--animation-base-delay) * 7); }
.book-card:nth-child(8)  { animation-delay: calc(var(--animation-base-delay) * 8); }
.book-card:nth-child(9)  { animation-delay: calc(var(--animation-base-delay) * 9); }
.book-card:nth-child(10) { animation-delay: calc(var(--animation-base-delay) * 10); }
.book-card:nth-child(11) { animation-delay: calc(var(--animation-base-delay) * 11); }
.book-card:nth-child(12) { animation-delay: calc(var(--animation-base-delay) * 12); }
.book-card:nth-child(13) { animation-delay: calc(var(--animation-base-delay) * 13); }
.book-card:nth-child(14) { animation-delay: calc(var(--animation-base-delay) * 14); }
.book-card:nth-child(15) { animation-delay: calc(var(--animation-base-delay) * 15); }
.book-card:nth-child(16) { animation-delay: calc(var(--animation-base-delay) * 16); }
.book-card:nth-child(17) { animation-delay: calc(var(--animation-base-delay) * 17); }
.book-card:nth-child(18) { animation-delay: calc(var(--animation-base-delay) * 18); }
.book-card:nth-child(19) { animation-delay: calc(var(--animation-base-delay) * 19); }
.book-card:nth-child(20) { animation-delay: calc(var(--animation-base-delay) * 20); }
.book-card:nth-child(21) { animation-delay: calc(var(--animation-base-delay) * 21); }
.book-card:nth-child(22) { animation-delay: calc(var(--animation-base-delay) * 22); }
.book-card:nth-child(23) { animation-delay: calc(var(--animation-base-delay) * 23); }
.book-card:nth-child(24) { animation-delay: calc(var(--animation-base-delay) * 24); }

/* 分页入场动画 */
.pagination-wrapper {
    animation: fadeInUp 0.5s ease-out 0.3s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

/* 页脚入场动画 */
.site-footer {
    animation: fadeInUp 0.4s ease-out;
}

/* ========================================
   滚动条美化 - 木质书架风格
   ======================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--accent-paper);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-warm) 0%, var(--primary-color) 100%);
    border-radius: 5px;
    border: 2px solid var(--accent-paper);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-hover) 100%);
}

::-webkit-scrollbar-corner {
    background: var(--accent-paper);
}

/* ========================================
   选中文字颜色 - 温馨高亮
   ======================================== */
::selection {
    background: var(--accent-cream);
    color: var(--primary-dark);
}

::-moz-selection {
    background: var(--accent-cream);
    color: var(--primary-dark);
}

/* ========================================
   加载状态
   ======================================== */
.loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid var(--accent-cream);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   工具类
   ======================================== */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

/* 温馨提示框 */
.warm-tip {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-cream) 100%);
    border: 1px solid var(--border-warm);
    border-radius: var(--radius);
    padding: 12px 16px;
    color: var(--primary-dark);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.warm-tip::before {
    content: '💡';
    font-size: 16px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state::before {
    content: '📚';
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
    margin: 0;
}

/* ========================================
   无限滚动加载
   ======================================== */
.infinite-scroll-status {
    padding: 24px 16px;
    text-align: center;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-light);
    font-size: 14px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--accent-cream);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.no-more-data {
    color: var(--text-light);
    font-size: 14px;
    padding: 16px 0;
    position: relative;
}

.no-more-data span {
    display: inline-block;
    background: var(--white);
    padding: 0 16px;
    position: relative;
    z-index: 1;
}

.no-more-data::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

/* 新加载书籍卡片的动画 */
.book-card-new {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.book-card-new.revealed {
    opacity: 1;
    transform: translateY(0);
}
