/* bookshelf.css */

/* ── ヘッダー ── */
.shelf-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 1.2rem;
  gap: .8rem;
  box-shadow: var(--shadow);
}

.shelf-header .logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-primary);
  flex: 1;
}

.shelf-header .user-name {
  font-size: .82rem;
  color: var(--color-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── メインコンテンツ ── */
.shelf-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.shelf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}
.shelf-toolbar h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

/* ── ローディング ── */
#loading {
  display: flex;
  justify-content: center;
  padding: 3rem;
}

/* ── 空状態 ── */
#emptyState {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--color-muted);
}
#emptyState svg { margin: 0 auto 1rem; opacity: .4; }
#emptyState p { font-size: 1rem; margin-bottom: 1rem; }

/* ── 本棚グリッド ── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.2rem;
}

@media (max-width: 480px) {
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .8rem; }
}

/* ── 本カード ── */
.book-card {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 24px rgba(0,0,0,.14);
}

.book-cover {
  aspect-ratio: 2/3;
  background: var(--color-border);
  overflow: hidden;
}
.book-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.book-card:hover .book-cover img { transform: scale(1.04); }

.progress-badge {
  position: absolute;
  bottom: .4rem;
  right: .4rem;
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 99px;
}

.book-info {
  padding: .6rem .7rem .7rem;
}
.book-title {
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-author {
  font-size: .75rem;
  color: var(--color-muted);
  margin-top: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-bar {
  height: 3px;
  background: var(--color-border);
  border-radius: 2px;
  margin-top: .5rem;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width .4s ease;
}

/* ── 削除ボタン ── */
.book-delete {
  position: absolute;
  top: .4rem;
  right: .4rem;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}
.book-card:hover .book-delete { opacity: 1; }
