/* ===== 书架样式 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f5f5;
  color: #222;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* 顶栏 */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 按钮 */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary {
  background: #4A90E2;
  color: white;
}

.btn-primary:active {
  background: #357ABD;
  transform: scale(0.96);
}

.btn-ghost {
  background: transparent;
  color: #666;
  font-size: 20px;
  padding: 8px 12px;
}

.btn-danger {
  background: #ff4757;
  color: white;
  width: 100%;
  margin-top: 8px;
}

.btn-danger:active { background: #e63946; }

.btn-close {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
}

/* 书架网格 */
.shelf {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

/* 空状态 */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: #888;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h2 {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 12px;
  color: #555;
}

.empty-state p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}

.empty-state .hint {
  font-size: 12px;
  color: #aaa;
  margin-top: 16px;
}

/* 书籍卡片 */
.book-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.book-card:active {
  transform: scale(0.97);
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
}

.book-cover {
  width: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, #4A90E2, #7B68EE);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 48px;
  position: relative;
  overflow: hidden;
}

.book-cover.has-image {
  background-size: cover;
  background-position: center;
}

.book-cover .format-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.book-info {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.book-title {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  min-height: 36px;
}

.book-progress {
  font-size: 11px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-mini {
  flex: 1;
  height: 3px;
  background: #e0e0e0;
  border-radius: 2px;
  overflow: hidden;
}

.progress-mini-fill {
  height: 100%;
  background: #4A90E2;
  transition: width 0.3s;
}

.book-meta {
  font-size: 11px;
  color: #aaa;
}

/* 模态框 */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal.hidden { display: none; }

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-content h3 {
  font-size: 18px;
  font-weight: 600;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.setting-row label {
  font-size: 14px;
  color: #333;
}

.setting-row select {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  background: white;
}

.setting-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

.setting-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #666;
}

.setting-section p {
  font-size: 13px;
  color: #555;
  margin-bottom: 4px;
}

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  margin: 16px 0 8px;
}

.progress-fill {
  height: 100%;
  background: #4A90E2;
  width: 0%;
  transition: width 0.3s;
}

.hint {
  font-size: 12px;
  color: #888;
}

/* 响应式：移动端 */
@media (max-width: 640px) {
  .topbar {
    padding: 12px 16px;
  }
  .topbar h1 {
    font-size: 18px;
  }
  .btn {
    padding: 6px 12px;
    font-size: 13px;
  }
  .shelf {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    padding: 12px;
  }
}
