/* Ancient Books Library - 全局样式 */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #faf6f0; color: #3a3226; min-height: 100vh;
    display: flex; flex-direction: column;
}

/* 页头 */
.site-header {
    background: linear-gradient(135deg, #4A3728 0%, #6B4C3B 100%);
    color: #f0e6d3; padding: 14px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.header-content {
    max-width: 1400px; margin: 0 auto;
    display: flex; align-items: center; gap: 16px;
}
.logo {
    font-size: 1.3em; font-weight: bold;
    color: #f0e6d3; text-decoration: none;
}
.subtitle { font-size: 0.85em; opacity: 0.7; }

/* 主内容 */
.main-content {
    flex: 1; max-width: 1400px; width: 100%;
    margin: 0 auto; padding: 24px;
}

/* 分页头部 */
.page-header {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.page-header h1 { font-size: 1.5em; color: #4A3728; }
.total-hint { font-size: 0.9em; color: #999; }

/* 搜索 */
.search-form {
    display: flex; gap: 8px; margin-bottom: 24px;
}
.search-input {
    flex: 1; padding: 10px 16px; border: 2px solid #d4c5a9;
    border-radius: 6px; font-size: 15px; background: #fff; max-width: 400px;
}
.search-input:focus { outline: none; border-color: #8B4513; }
.btn-search {
    padding: 10px 20px; background: #8B4513; color: #fff;
    border: none; border-radius: 6px; cursor: pointer; font-size: 15px;
}
.btn-search:hover { background: #A0522D; }
.btn-clear {
    padding: 10px 16px; color: #8B4513; text-decoration: none;
    font-size: 14px; display: flex; align-items: center;
}

/* 书籍网格 */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

/* 书籍卡片 */
.book-card {
    display: flex; gap: 14px; padding: 14px;
    background: #fff; border: 1px solid #e8ddd0;
    border-radius: 10px; text-decoration: none; color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}
.book-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

/* 封面 */
.card-cover {
    flex-shrink: 0; width: 80px; height: 110px;
    border-radius: 6px; overflow: hidden; background: #f5f0e8;
    border: 1px solid #e8ddd0; display: flex; align-items: center; justify-content: center;
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { font-size: 2.5em; color: #c4a87c; }
.cover-placeholder.has-pages { color: #8B4513; }

/* 卡片内容 */
.card-body { flex: 1; min-width: 0; }
.card-title {
    font-size: 15px; font-weight: 600; color: #4A3728;
    line-height: 1.4; margin-bottom: 4px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-author {
    font-size: 12px; color: #888; margin-bottom: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tag {
    display: inline-block; padding: 2px 8px; border-radius: 3px;
    font-size: 11px; font-weight: 500;
}
.tag-edition { background: #e8f5e9; color: #2e7d32; }
.tag-era { background: #e3f2fd; color: #1565c0; }
.tag-category { background: #fff3e0; color: #e65100; }
.card-footer {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 11px; color: #aaa;
}
.collection { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.page-badge { color: #8B4513; flex-shrink: 0; }

/* 分页 */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 6px; margin-top: 32px; flex-wrap: wrap;
}
.page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 12px;
    background: #fff; color: #4A3728; text-decoration: none;
    border: 1px solid #d4c5a9; border-radius: 6px; font-size: 14px;
    transition: all 0.2s;
}
.page-btn:hover { background: #f0e6d3; border-color: #8B4513; }
.page-btn.active { background: #8B4513; color: #fff; border-color: #6B3410; }
.page-dots { color: #999; padding: 0 4px; }

/* 空状态 */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-icon { font-size: 4em; margin-bottom: 16px; }
.cmd-hint {
    display: inline-block; background: #f0e6d3;
    padding: 8px 16px; border-radius: 6px; margin-top: 12px;
    font-size: 13px; color: #6B4C3B;
}
.btn-back {
    display: inline-block; margin-top: 16px;
    color: #8B4513; text-decoration: none;
}
.notice {
    margin-top: 20px; padding: 12px 16px; background: #fffbe6;
    border: 1px solid #ffe58f; border-radius: 8px; font-size: 13px; color: #8c6d00;
}
.notice code { background: #fff3cd; padding: 1px 4px; border-radius: 3px; }

/* 页脚 */
.site-footer {
    text-align: center; padding: 16px;
    background: #4A3728; color: #f0e6d3;
    font-size: 0.8em; opacity: 0.7;
}

/* 响应式 */
@media (max-width: 640px) {
    .book-grid { grid-template-columns: 1fr; }
    .main-content { padding: 12px; }
    .card-cover { width: 60px; height: 85px; }
}
