/* ============================================
   公版书籍下载站 - 样式表
   ============================================ */

/* CSS变量 */
:root {
    --primary: #2d8a3e;
    --primary-dark: #236b30;
    --primary-light: #e8f5e9;
    --secondary: #5c6bc0;
    --text: #333;
    --text-light: #666;
    --text-muted: #999;
    --bg: #f5f7fa;
    --bg-white: #fff;
    --border: #e4e7eb;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: all 0.3s ease;
}

/* 字体图标 */
@font-face {
    font-family: 'iconfont';
    src: url('//at.alicdn.com/t/font_1234567_iconfont.woff2') format('woff2');
}

.iconfont {
    font-family: 'iconfont' !important;
    font-style: normal;
}

/* 基础重置 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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;
}

/* ============================================
   头部
   ============================================ */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    height: 64px;
    gap: 30px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.logo-icon {
    font-size: 28px;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: var(--text);
    font-size: 15px;
}

.nav-link:hover {
    color: var(--primary);
}

.header-search {
    display: flex;
    margin-left: auto;
    gap: 0;
}

.header-search input {
    width: 220px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.header-search input:focus {
    border-color: var(--primary);
}

.header-search button {
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.header-search button:hover {
    background: var(--primary-dark);
}

/* ============================================
   主内容区
   ============================================ */
.main {
    flex: 1;
    padding: 40px 0;
}

/* ============================================
   首页 - 搜索区域
   ============================================ */
.hero {
    text-align: center;
    padding: 60px 0 40px;
}

.hero h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.hero-sub {
    font-size: 18px;
    color: var(--text-light);
    margin-bottom: 40px;
}

.search-box {
    max-width: 640px;
    margin: 0 auto;
}

.search-form {
    display: flex;
    gap: 0;
    box-shadow: var(--shadow-hover);
    border-radius: var(--radius);
    overflow: hidden;
}

.search-form input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid var(--primary);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 16px;
    outline: none;
}

.search-form input:focus {
    border-color: var(--primary-dark);
}

.search-form button {
    padding: 16px 32px;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0 var(--radius) var(--radius) 0;
    transition: var(--transition);
}

.search-form button:hover {
    background: var(--primary-dark);
}

/* 热门标签 */
.hot-tags {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.hot-tag {
    padding: 6px 14px;
    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-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   公版徽章
   ============================================ */
.public-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.public-badge.public {
    background: #e8f5e9;
    color: #2d8a3e;
}

.public-badge.public::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
}

.public-badge.non-public {
    background: #ffebee;
    color: #c62828;
}

.public-badge.non-public::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #f44336;
    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, #e8f5e9, #c8e6c9);
    border: 1px solid #a5d6a7;
}

.public-notice.public .notice-icon {
    color: #2d8a3e;
}

.public-notice.non-public {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border: 1px solid #ef9a9a;
}

.public-notice.non-public .notice-icon {
    color: #c62828;
}

.notice-icon {
    font-size: 28px;
}

.notice-text h3 {
    font-size: 16px;
    margin-bottom: 2px;
}

.notice-text p {
    font-size: 14px;
    opacity: 0.8;
}

/* ============================================
   书籍卡片
   ============================================ */
.section {
    margin-top: 50px;
}

.section-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--primary);
    border-radius: 2px;
}

.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);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.book-cover {
    position: relative;
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    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: #a5d6a7;
}

.book-cover .badge {
    position: absolute;
    top: 8px;
    right: 8px;
}

.book-info {
    padding: 12px;
}

.book-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-meta {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.book-author {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   搜索结果页
   ============================================ */
.search-header {
    background: var(--bg-white);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.search-header h2 {
    font-size: 18px;
    margin-bottom: 12px;
}

.search-header h2 span {
    color: var(--primary);
    font-weight: 700;
}

.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.filter-btn {
    padding: 6px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.book-item {
    display: flex;
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.book-item:hover {
    box-shadow: var(--shadow-hover);
}

.book-item-cover {
    width: 120px;
    min-height: 160px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    flex-shrink: 0;
}

.book-item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-item-content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.book-item-title {
    font-size: 18px;
    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);
}

.book-item-actions {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.has-resource {
    font-size: 13px;
    color: var(--primary);
}

/* ============================================
   书籍详情页
   ============================================ */
.book-detail {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.breadcrumb {
    padding: 12px 20px;
    background: var(--bg);
    font-size: 14px;
    color: var(--text-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-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.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);
    box-shadow: var(--shadow);
    padding: 30px;
    margin-top: 30px;
}

.netdisk-section h3 {
    font-size: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 网盘按钮组（横向并排） */
.netdisk-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.netdisk-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(45, 138, 62, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.netdisk-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(45, 138, 62, 0.4);
    color: #fff;
}

.netdisk-btn-icon {
    font-size: 20px;
}

.netdisk-list {
    display: grid;
    gap: 12px;
}

.netdisk-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg);
    border-radius: var(--radius);
    gap: 16px;
    transition: var(--transition);
}

.netdisk-item:hover {
    background: var(--primary-light);
}

.netdisk-icon {
    font-size: 28px;
    color: var(--primary);
}

.netdisk-name {
    flex: 1;
    font-weight: 500;
}

.netdisk-btn {
    padding: 8px 20px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: var(--transition);
}

.netdisk-btn:hover {
    background: var(--primary-dark);
}

.no-resource {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.no-resource-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ============================================
   搜索结果 - 网盘标签
   ============================================ */
.netdisk-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.netdisk-tags-label {
    font-size: 13px;
    color: var(--text-muted);
}

.netdisk-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

/* ============================================
   分页
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
}

.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-sm);
    font-size: 14px;
    color: var(--text);
    transition: var(--transition);
}

.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;
}

/* ============================================
   页脚
   ============================================ */
.footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    padding: 30px 0;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

.footer-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 20px;
        gap: 12px;
    }
    
    .header-search {
        margin-left: 0;
        order: 3;
        width: 100%;
    }
    
    .header-search input {
        width: 100%;
    }
    
    .hero h1 {
        font-size: 26px;
    }
    
    .hero-sub {
        font-size: 15px;
    }
    
    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
    }
    
    .book-detail-main {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }
    
    .book-detail-cover {
        width: 150px;
        margin: 0 auto;
    }
    
    .book-detail-title {
        font-size: 22px;
    }
    
    .book-detail-meta {
        grid-template-columns: 1fr;
    }
    
    .book-item {
        flex-direction: column;
    }
    
    .book-item-cover {
        width: 100%;
        height: 200px;
    }
}

/* ============================================
   空状态
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    color: var(--border);
    margin-bottom: 16px;
}

.empty-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-desc {
    color: var(--text-light);
}
