/* source/css/library.css */

/* 容器防崩坏 */
#library-app {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 20px auto;
  max-width: 100%;
  color: #333;
}
.lib-loading { text-align: center; padding: 40px; color: #999; }

/* --- 1. 顶部 Tab 分区 (iOS 风格) --- */
.lib-tabs {
  display: flex;
  background: #f2f2f7;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 20px;
  position: sticky;
  top: 10px;
  z-index: 99;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
.lib-tab-item {
  flex: 1;
  text-align: center;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #8e8e93;
  cursor: pointer;
  border-radius: 9px;
  transition: all 0.2s;
}
.lib-tab-item.active {
  background: #fff;
  color: #000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* --- 2. 控制面板 (搜索+筛选) --- */
.lib-panel {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

/* 搜索框 */
.lib-search-box { margin-bottom: 15px; position: relative; }
.lib-search-input {
  width: 100%;
  padding: 12px 15px 12px 40px; /* 左边留空给图标 */
  border: 1px solid #e1e4e8;
  border-radius: 10px;
  background: #f9f9f9;
  font-size: 15px;
  outline: none;
  box-sizing: border-box; /* 关键：防止宽度溢出 */
}
.lib-search-input:focus { background: #fff; border-color: #49b1f5; }
.search-icon { position: absolute; left: 12px; top: 12px; opacity: 0.4; }

/* 筛选标签行 */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #f0f0f0;
}
.filter-label {
  font-size: 12px;
  color: #999;
  margin-right: 10px;
  min-width: 30px;
}
.tag-btn {
  font-size: 13px;
  padding: 4px 12px;
  margin: 3px;
  border-radius: 20px;
  background: #f5f5f5;
  color: #666;
  cursor: pointer;
  transition: 0.2s;
  user-select: none;
}
.tag-btn:hover { background: #e0e0e0; }

/* 选中状态 */
.tag-btn.active { background: #e3f2fd; color: #1976d2; font-weight: bold; }
/* 二战模式选中色 */
.ww2-mode .tag-btn.active { background: #eceff1; color: #455a64; }

/* 统计栏 */
.lib-stat-bar {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #aaa;
  margin-top: 8px;
}

/* --- 3. 书籍列表 Grid --- */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* 自动适应列宽 */
  gap: 16px;
}
/* 手机端强制单列，防止太挤 */
@media (max-width: 600px) {
  .lib-grid { grid-template-columns: 1fr; }
}

.lib-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #f0f0f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  transition: transform 0.2s;
  position: relative;
  overflow: hidden;
}
.lib-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }

/* 左侧彩色条 */
.lib-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.lib-card.type-novel::before { background: #49b1f5; }
.lib-card.type-book::before { background: #66bb6a; }
.lib-card.type-media::before { background: #ff9800; }
.lib-card.is-ww2::before { background: #546e7a !important; }

.card-title {
  display: block; font-size: 16px; font-weight: bold; color: #333;
  margin-bottom: 4px; text-decoration: none;
}
.card-meta { font-size: 12px; color: #999; margin-bottom: 8px; }

.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.mini-tag {
  font-size: 12px; padding: 2px 6px; border-radius: 4px; background: #f5f5f5; color: #666;
}
.mini-tag.hl { background: #e3f2fd; color: #1565c0; }

.card-comment {
  font-size: 13px; color: #555; background: #fafafa; padding: 10px; border-radius: 8px;
  line-height: 1.5; font-style: italic;
}

/* 底部加载 */
.load-more-box { text-align: center; margin-top: 30px; padding-bottom: 20px; }
.load-btn {
  background: #fff; border: 1px solid #ddd; padding: 10px 30px; border-radius: 20px;
  color: #666; cursor: pointer;
}
.load-btn:hover { border-color: #49b1f5; color: #49b1f5; }
.hidden { display: none; }