/* ============================================================
   0. 全站护眼变量
   ============================================================ */
:root {
    --bg-body: #f4f0e6; /* 网页底色 */
    --bg-container: #faf7f0; /* 内容区背景 */
    --primary-color: #8b572a; /* 主题色：沉稳咖 */
    --hover-red: #ff0000; /* 悬停时的鲜红色 */
    --text-main: #3e332a; /* 主文字颜色 */
    --text-muted: #8d8071; /* 次要文字颜色 */
    --border-color: #e2d7c5; /* 边框颜色 */
    --header-bg: #4a4036; /* 导航栏背景色 */
}

/* ============================================================
   1. 基础公共样式及全局超链接动效
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-body);
    /*font-family: "Microsoft YaHei", STHeiti, sans-serif;*/
    color: var(--text-main);
    line-height: 1.5;
}

/* 全局超链接控制 */
a {
    text-decoration: none !important;
    color: inherit;
    display: inline-block;
    transition: all 0.2s ease;
    transform-origin: left center;
}

/* 鼠标移动上去的效果 */
a:hover {
    text-decoration: none !important;
    color: var(--hover-red) !important;
    transform: scale(1.08);
}

ul {
    list-style: none;
}

.container {
    width: 1024px;
    margin: 70px auto 0; /* 这里的 70px 对应 header 高度 */
    background-color: var(--bg-container);
    min-height: 100vh;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
}

header {
    background-color: var(--header-bg);
    color: #f1ede4;
    height: 70px;
    border-bottom: 3px solid var(--primary-color);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    /* 移除原有 header 里的 display: flex 等，交给 inner 处理 */
}

/* 新增 header-inner 控制居中 */
.header-inner {
    width: 1024px;      /* 与 container 宽度一致 */
    height: 100%;
    margin: 0 auto;     /* 居中核心 */
    display: flex;      /* 内部元素依然水平排列 */
    align-items: center;
    padding: 0 20px;    /* 保持左右内边距 */
}

.logo-area {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-right: 25px;
    flex-shrink: 0;
}

/* 特殊修正：Logo 和 搜索按钮 不参与放大缩放，防止 Header 抖动 */
.logo-area:hover,
.search-bar button:hover {
    transform: none !important;
}

.logo-title {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    line-height: 1.2;
}

.logo-url {
    font-size: 11px;
    color: #b5a99a;
    letter-spacing: 1px;
}

/* 导航容器：增加动画支持 */
.nav-list {
    display: flex;
    flex: 1;
    justify-content: flex-start;
    gap: 12px;
    transition: all 0.4s ease; /* 当搜索框挤压时平滑过渡 */
    overflow: hidden;
}

.nav-list li {
    flex-shrink: 0;
}

.nav-list li a {
    font-size: 14px;
    font-weight: 500;
    padding: 10px 4px;
    white-space: nowrap;
}

.nav-list li a:hover {
    color: #fff !important;
}

/* 动态搜索框逻辑 */
.search-bar {
    margin-left: 15px;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.search-bar form {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2px 2px 2px 12px;
    width: 160px; /* 初始宽度 */
    transition: width 0.4s ease;
}

/* 激活态：搜索框向左横移 50px 并加宽 */
.search-bar:focus-within {
    transform: translateX(-5px);
}

.search-bar:focus-within form {
    width: 220px; /* 展开后的宽度 */
    background: rgba(255, 255, 255, 0.25);
    border-color: var(--primary-color);
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 13px;
    width: 100%;
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-bar button {
    background-color: var(--primary-color);
    color: #fff !important;
    border: none;
    padding: 5px 18px;
    border-radius: 18px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ============================================================
   3. 栏目及列表通用布局
   ============================================================ */
.section-title {
    font-size: 18px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.section-title a {
    font-weight: bold;
}

.section-title a::before {
    content: "";
    width: 4px;
    height: 18px;
    background: var(--primary-color);
    margin-right: 10px;
    display: inline-block;
}

.book-name {
    font-size: 14px;
}

.author-info {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 8px;
}

footer {
    text-align: center;
    padding: 40px;
    background: var(--bg-body);
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border-color);
}

footer p {
    /*margin-top: 5px; opacity: 0.6;*/
    margin-top: 5px;
}

/* index.html 3列布局 */
.section {
    padding: 25px 20px; /*border-bottom: 1px solid var(--border-color); */
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 35px;
}

.book-item {
    height: 32px;
    line-height: 32px;
    border-bottom: 1px dashed var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* cateIndex.html 双列布局 */
.category-wrapper {
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.category-row {
    display: flex;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.category-box {
    width: 480px;
    margin: 20px 0;
}

.book-list-mini li {
    height: 30px;
    line-height: 30px;
    border-bottom: 1px dashed var(--border-color);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/*.category-box {*/
/*    width: calc(50% - 10px); !* 核心：每个盒子占一半宽度（减去间距） *!*/
/*    box-sizing: border-box;*/
/*}*/

/* ============================================================
   4. 书籍详情与列表 (list/info)
   ============================================================ */
.list-container, .info-container {
    padding: 20px;
}

.breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.list-header {
    display: flex;
    align-items: baseline;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.category-name {
    font-size: 24px;
    margin-right: 15px;
}

.book-card {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.book-card:hover {
    background-color: rgba(139, 87, 42, 0.03);
}

.list-book-name {
    font-size: 18px;
    font-weight: bold;
    margin-right: 15px;
}

.book-intro {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 12px;
}

/* 按钮不参与缩放 */
.read-btn, .btn-read-now, .nav-btn, .btn-add-shelf {
    transform: none !important;
    display: inline-block;
}

.read-btn, .btn-read-now {
    background-color: var(--primary-color);
    color: #fff !important;
    padding: 5px 15px;
    border-radius: 3px;
}

.read-btn:hover, .btn-read-now:hover {
    opacity: 0.9;
    color: #fff !important;
}

/* 分页 */
.pagination {
    padding: 40px 0;
    text-align: center;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 8px 16px;
    margin: 0 5px;
    border: 1px solid var(--border-color);
    background: var(--bg-container);
}

.pagination .current {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* 书籍详情 */
.book-detail-header {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.book-cover img {
    width: 165px;
    height: 220px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.book-title-main {
    font-size: 28px;
    margin-bottom: 20px;
}

.meta-item {
    font-size: 16px;
    margin-bottom: 18px;
    color: var(--text-main);
}

.info-section-title {
    font-size: 18px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.info-content {
    white-space: pre-line;
    line-height: 1.5;
}

.chapter-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px 30px;
}

.chapter-list li {
    border-bottom: 1px dashed var(--border-color);
    padding: 8px 0;
}
.view-all { text-align: center; padding: 20px 0 10px; }
.view-all a { color: #999; font-size: 14px; }
.view-all a:hover { color: #4a90e2; }

/* ============================================================
   5. 阅读页 (Chapter) - 特殊保护
   ============================================================ */
.read-page-body {
    background-color: #dcd3be;
}

.read-container {
    width: 900px !important;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

.read-header {
    height: 60px;
    background-color: var(--header-bg);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}


.read-main {
    padding: 40px 60px;
    background-color: #f7f1e5;
}

.chapter-title {
    font-size: 28px;
    text-align: center;
    color: #4a3c31;
    margin-bottom: 20px;
}

.read-content {
    font-size: 18px;
    line-height: 1.5;
    color: #2c241d;
    white-space: pre-wrap;
    word-break: break-all;
}

.read-control-bottom {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}


.nav-btn {
    background-color: #d2c1a3;
    color: #543;
    padding: 10px 30px;
    border-radius: 4px;
    font-weight: bold;
}

.next-chapter {
    background-color: var(--primary-color);
    color: #fff !important;
}

/*go top*/
/* ============================================================
   6. 极简右侧固定返回顶部 (纯 CSS 绘制)
   ============================================================ */

/* 按钮主体 */
.btn-top {
    position: fixed;
    /* 计算位置：容器1024px，放置在右侧边缘 */
    left: calc(50% + 512px + 10px);
    bottom: 50px;
    z-index: 999;

    width: 40px;
    height: 40px;
    background-color: var(--bg-container);
    border: 1px solid var(--border-color);
    border-radius: 4px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
}

/* 适配窄屏幕：当窗口宽度不足以显示在右侧时，强制靠边 */
@media (max-width: 1100px) {
    .btn-top {
        left: auto;
        right: 10px;
    }
}

/* 纯 CSS 绘制向上箭头：利用边框旋转 */
.btn-top .arrow {
    width: 8px;
    height: 8px;
    border-top: 2px solid var(--text-muted);
    border-left: 2px solid var(--text-muted);
    transform: rotate(45deg); /* 旋转 45 度形成向上箭头 */
    margin-top: 4px;
    margin-bottom: 2px;
}

/* 按钮文字 */
.btn-top .txt {
    font-size: 10px;
    line-height: 1;
    color: var(--text-muted);
}

/* 鼠标悬停：颜色变为你的主题色，且关闭全局缩放动画防止晃动 */
.btn-top:hover {
    transform: none !important;
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.btn-top:hover .arrow {
    border-color: #fff !important;
}

.btn-top:hover .txt {
    color: #fff !important;
}
