/**
 * 公版书籍系统 - 全局设计系统
 * 整合蓝星世界观视觉风格
 * 
 * 视觉风格：
 * - 主色：墨绿 #418060 - 古籍、墨香
 * - 强调：朱砂红 #C73E3A - 印章、权威
 * - 背景：宣纸米 #F5F0E6 - 古籍质感
 * - 深色：墨黑 #1a1a2e - 深邃、学问
 */

/* ============================================
   Google Fonts - 中文镜像
   ============================================ */
@import url('https://fonts.googleapis.cnpmjs.org/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

/* ============================================
   CSS 变量定义
   ============================================ */
:root {
    /* 主色调 - 墨绿 */
    --primary: #418060;
    --primary-dark: #2d5944;
    --primary-light: #5aa07a;
    --primary-bg: #e8f5ed;
    
    /* 强调色 - 朱砂红 */
    --accent: #C73E3A;
    --accent-dark: #a32e2a;
    --accent-light: #e05854;
    --accent-bg: #fce8e7;
    
    /* 背景色 - 宣纸米 */
    --bg: #F5F0E6;
    --bg-paper: #faf6ed;
    --bg-dark: #e8e0d0;
    --bg-white: #fff;
    
    /* 文字色 */
    --text: #1a1a2e;
    --text-light: #4a4a5a;
    --text-muted: #7a7a8a;
    
    /* 特殊色 */
    --gold: #d4a84b;
    --gold-dark: #b8923d;
    --ink: #2c2c3c;
    --water: #6b98b3;
    --wood: #7ba37b;
    --fire: #c97365;
    --earth: #a39578;
    
    /* 稀有度色 */
    --rarity-common: #9a9a9a;
    --rarity-rare: #4a90d9;
    --rarity-epic: #a855f7;
    --rarity-legendary: #f59e0b;
    --rarity-divine: #ef4444;
    
    /* 边框和阴影 */
    --border: #e4e0d8;
    --border-light: #f0ebe3;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    
    /* 圆角 */
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* 间距 */
    --section-padding: 60px 0;
    
    /* 字体 */
    --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'SimSun', serif;
    --font-sans: 'Noto Sans SC', 'Source Han Sans SC', 'Microsoft YaHei', sans-serif;
    
    /* 过渡 */
    --transition: all 0.3s ease;
}

/* ============================================
   基础重置
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 宣纸纹理背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(ellipse at 20% 30%, rgba(65, 128, 96, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(199, 62, 58, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   容器
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   主内容区
   ============================================ */
.main {
    flex: 1;
    padding: 40px 0;
}

/* ============================================
   通用卡片组件
   ============================================ */
.world-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-light);
}

.world-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.world-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.world-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.world-card-icon.primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; }
.world-card-icon.accent { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: white; }
.world-card-icon.gold { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: white; }
.world-card-icon.ink { background: linear-gradient(135deg, var(--ink), #3a3a4e); color: white; }

.world-card-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.world-card-content {
    color: var(--text-light);
    line-height: 1.8;
}

/* ============================================
   通用章节
   ============================================ */
.world-section {
    padding: var(--section-padding);
    position: relative;
}

.world-section:nth-child(even) {
    background: var(--bg-white);
}

.world-section-header {
    text-align: center;
    margin-bottom: 48px;
}

.world-section-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--text);
    margin-bottom: 16px;
    position: relative;
    display: inline-block;
}

/* 标题装饰线 */
.world-section-title::before,
.world-section-title::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 50px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--primary));
}

.world-section-title::before {
    right: calc(100% + 16px);
}

.world-section-title::after {
    left: calc(100% + 16px);
    background: linear-gradient(to left, transparent, var(--primary));
}

.world-section-desc {
    color: var(--text-light);
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.8;
}

/* ============================================
   滚动动画
   ============================================ */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }

/* ============================================
   叙事文本（卷轴风格）
   ============================================ */
.narrative-text {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    line-height: 2;
    color: var(--text);
    text-align: justify;
    padding: 40px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    position: relative;
}

.narrative-text::before,
.narrative-text::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 16px;
    background-size: 100% 100%;
}

.narrative-text::before {
    top: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 16'%3E%3Cdefs%3E%3ClinearGradient id='grad1' x1='0%25' y1='0%25' x2='0%25' y2='100%25'%3E%3Cstop offset='0%25' style='stop-color:%23d4a84b;stop-opacity:1'/%3E%3Cstop offset='100%25' style='stop-color:%23b8923d;stop-opacity:1'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='100' height='16' fill='url(%23grad1)'/%3E%3Ccircle cx='0' cy='8' r='8' fill='url(%23grad1)'/%3E%3Ccircle cx='100' cy='8' r='8' fill='url(%23grad1)'/%3E%3C/svg%3E");
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.narrative-text::after {
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 16'%3E%3Cdefs%3E%3ClinearGradient id='grad2' x1='0%25' y1='0%25' x2='0%25' y2='100%25'%3E%3Cstop offset='0%25' style='stop-color:%23b8923d;stop-opacity:1'/%3E%3Cstop offset='100%25' style='stop-color:%23d4a84b;stop-opacity:1'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='100' height='16' fill='url(%23grad2)'/%3E%3Ccircle cx='0' cy='8' r='8' fill='url(%23grad2)'/%3E%3Ccircle cx='100' cy='8' r='8' fill='url(%23grad2)'/%3E%3C/svg%3E");
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.narrative-quote {
    border-left: 4px solid var(--primary);
    padding-left: 20px;
    margin: 24px 0;
    font-style: italic;
    color: var(--text-light);
}

.narrative-highlight {
    background: linear-gradient(transparent 60%, rgba(65, 128, 96, 0.2) 60%);
    padding: 0 4px;
}

/* ============================================
   印章效果
   ============================================ */
.seal-stamp {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    border: 3px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    font-family: var(--font-serif);
    font-weight: 700;
    text-align: center;
    padding: 8px;
    transform: rotate(-5deg);
    position: relative;
    opacity: 0.85;
}

.seal-stamp-text {
    font-size: 1rem;
    line-height: 1.2;
}

.seal-stamp-year {
    font-size: 0.65rem;
    margin-top: 4px;
    opacity: 0.8;
}

/* ============================================
   公版徽章
   ============================================ */
.public-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.public-badge.public {
    background: var(--primary-bg);
    color: var(--primary);
}

.public-badge.public::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.public-badge.non-public {
    background: var(--accent-bg);
    color: var(--accent);
}

.public-badge.non-public::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
}

.public-badge.unknown {
    background: #fff8e1;
    color: #f57c00;
}

.public-badge.unknown::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #ff9800;
    border-radius: 50%;
}

/* 公版提示条 */
.public-notice {
    padding: 16px 20px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.public-notice.public {
    background: linear-gradient(135deg, var(--primary-bg), #d4edd9);
    border: 1px solid var(--primary);
}

.public-notice.non-public {
    background: linear-gradient(135deg, var(--accent-bg), #fad7d6);
    border: 1px solid var(--accent);
}

.notice-icon {
    font-size: 28px;
}

.notice-text h3 {
    font-size: 16px;
    margin-bottom: 2px;
}

.notice-text p {
    font-size: 14px;
    opacity: 0.8;
}

/* ============================================
   书籍卡片
   ============================================ */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
}

.book-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.book-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.book-cover {
    position: relative;
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, var(--primary-bg), var(--bg-dark));
    overflow: hidden;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-cover .placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--primary);
    opacity: 0.5;
}

.book-cover .badge {
    position: absolute;
    top: 8px;
    right: 8px;
}

.book-info {
    padding: 14px;
}

.book-title {
    font-family: var(--font-serif);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.book-meta {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.book-author {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   书籍详情页
   ============================================ */
.book-detail {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.breadcrumb {
    padding: 14px 24px;
    background: var(--bg);
    font-size: 14px;
    color: var(--text-light);
    border-bottom: 1px solid var(--border-light);
}

.breadcrumb a {
    color: var(--text-light);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb span {
    margin: 0 8px;
}

.book-detail-main {
    display: flex;
    padding: 30px;
    gap: 40px;
}

.book-detail-cover {
    width: 200px;
    flex-shrink: 0;
}

.book-detail-cover img {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.book-detail-info {
    flex: 1;
}

.book-detail-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.book-detail-oe {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.book-detail-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    gap: 8px;
}

.meta-label {
    color: var(--text-muted);
    flex-shrink: 0;
}

.meta-value {
    color: var(--text);
}

/* ============================================
   网盘资源下载
   ============================================ */
.netdisk-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-top: 24px;
}

.netdisk-section h3 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-serif);
}

.netdisk-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.netdisk-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(65, 128, 96, 0.3);
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

.netdisk-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(65, 128, 96, 0.4);
    color: #fff;
}

.netdisk-btn-icon {
    font-size: 20px;
}

.netdisk-price {
    font-size: 13px;
    opacity: 0.9;
}

.no-resource {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

.no-resource-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* 登录墙 */
.netdisk-login-wall {
    text-align: center;
    padding: 48px 24px;
    background: linear-gradient(135deg, var(--bg-paper), var(--primary-bg));
    border: 2px dashed var(--primary);
    border-radius: var(--radius-lg);
}

.login-wall-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.login-wall-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.login-wall-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.login-wall-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   按钮
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(65, 128, 96, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(65, 128, 96, 0.4);
    color: #fff;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(199, 62, 58, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(199, 62, 58, 0.4);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-bg);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* ============================================
   搜索相关
   ============================================ */
.search-box {
    max-width: 640px;
    margin: 0 auto;
}

.search-form {
    display: flex;
    gap: 0;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.search-form input {
    flex: 1;
    padding: 16px 24px;
    border: 2px solid var(--primary);
    border-right: none;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    font-size: 16px;
    outline: none;
    background: var(--bg-white);
}

.search-form input:focus {
    border-color: var(--primary-dark);
}

.search-form button {
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    transition: var(--transition);
}

.search-form button:hover {
    background: var(--primary-dark);
}

.hot-tags {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hot-tag {
    padding: 8px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
}

.hot-tag:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
}

/* 搜索结果页 */
.search-header {
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.search-header h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.search-header h2 span {
    color: var(--primary);
    font-weight: 700;
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.book-item {
    display: flex;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.book-item:hover {
    box-shadow: var(--shadow-hover);
}

.book-item-cover {
    width: 120px;
    min-height: 160px;
    background: linear-gradient(135deg, var(--primary-bg), var(--bg-dark));
    flex-shrink: 0;
}

.book-item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-item-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.book-item-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.book-item-title a {
    color: var(--text);
}

.book-item-title a:hover {
    color: var(--primary);
}

.book-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.book-item-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.book-item-author {
    font-size: 14px;
    color: var(--text-muted);
}

/* ============================================
   分页
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
}

.page-btn,
.page-num {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    transition: var(--transition);
    cursor: pointer;
}

.page-btn:hover:not(.disabled),
.page-num:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.page-num.current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   空状态
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    color: var(--border);
    margin-bottom: 16px;
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-desc {
    color: var(--text-light);
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .world-section-title {
        font-size: 1.5rem;
    }
    
    .world-section-title::before,
    .world-section-title::after {
        display: none;
    }
    
    .book-detail-main {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }
    
    .book-detail-cover {
        width: 150px;
        margin: 0 auto;
    }
    
    .book-detail-title {
        font-size: 1.5rem;
    }
    
    .book-detail-meta {
        grid-template-columns: 1fr;
    }
    
    .book-item {
        flex-direction: column;
    }
    
    .book-item-cover {
        width: 100%;
        height: 200px;
    }
    
    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
    }
    
    .narrative-text {
        padding: 24px;
        font-size: 1rem;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-form input {
        border-radius: var(--radius-lg);
        border-right: 2px solid var(--primary);
    }
    
    .search-form button {
        border-radius: var(--radius-lg);
    }
}
