/* ── 鑫囍探索旅行 電子書系統 核心設計系統 ── */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@300;400;700&family=DM+Mono:wght@300;400&family=Playfair+Display:ital,wght@0,700;1,400&display=swap');

:root {
  --ink: #1a1208;
  --paper: #f5f0e8;
  --warm: #c8a96e;
  --cream: #faf6ef;
  --sidebar-w: 260px;
  --toolbar-h: 52px;
  --page-w: 400px;
  --page-h: 533px;
  --transition: .8s cubic-bezier(.4, 0, .2, 1);
  --shadow: 0 10px 30px rgba(0,0,0,0.3);
  --bg: #0e0c08;
  --panel: #14110c;
  --card: #1c1810;
  --border: rgba(255, 255, 255, 0.08);
  --red: #e74c3c;
  --green: #27ae60;
  --orange: #e67e22;
}

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

body {
  font-family: 'Noto Serif TC', serif;
  background: #12100a;
  color: var(--paper);
  line-height: 1.6;
}

/* 滾動條優化 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--warm);
}

/* 通用組件：Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(30, 26, 16, 0.95);
  border: 1px solid var(--warm);
  color: var(--warm);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.9rem;
  z-index: 1000;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast.ok {
  border-color: #2ecc71;
  color: #2ecc71;
  background: rgba(46, 204, 113, 0.1);
}
.toast.er {
  border-color: #e74c3c;
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}

/* 通用組件：按鈕基礎 */
.btn-primary {
  background: linear-gradient(135deg, var(--warm), #a07840);
  color: #1a1208;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(200, 169, 110, 0.3);
}

/* 背景裝飾顆粒 */
.grain-overlay::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='3' height='3'%3E%3Ccircle cx='1' cy='1' r='.4' fill='%23fff' fill-opacity='.025'/%3E%3C/svg%3E");
}

/* 工具類 */
.hidden { display: none !important; }
.text-warm { color: var(--warm); }
.serif { font-family: 'Noto Serif TC', serif; }
.mono { font-family: 'DM Mono', monospace; }

/* 書籍卡片網格 (Grid) */
#shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.book-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  display: flex;
  flex-direction: column;
}
.book-card:hover {
  transform: translateY(-5px);
  border-color: var(--warm);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.card-cover {
  aspect-ratio: 3/4;
  position: relative;
  overflow: hidden;
  background: #1a1510;
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.book-card:hover .card-cover img {
  transform: scale(1.05);
}

.card-info {
  padding: 12px;
  flex: 1;
}
.card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--paper);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.3);
  display: flex;
  justify-content: space-between;
}

.card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  color: var(--warm);
  border: 1px solid rgba(200, 169, 110, 0.3);
}

.card-status {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.card-status.pub { background: #27ae60; color: #fff; }
.card-status.unp { background: #555; color: #fff; }
.card-status.sched { background: #e67e22; color: #fff; }
.card-status.exp { background: #7f8c8d; color: #fff; }
