/* ── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a1a;
  background: #f8f6f3;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
/* L-7/L-8: height:auto so width/height attrs don't distort aspect ratio */
img { max-width: 100%; display: block; height: auto; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, select, textarea {
  font: inherit;
  border: 1px solid #d4cfc9;
  border-radius: 6px;
  padding: 8px 12px;
  width: 100%;
  background: #fff;
  color: #1a1a1a;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #6b5e4e; box-shadow: 0 0 0 3px rgba(107,94,78,0.1); }
textarea { resize: vertical; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Header / Nav ───────────────────────────────────────────────────────── */
header {
  position: sticky; top: 0; z-index: 200;
  background: #fff;
  border-bottom: 1px solid #e8e3dc;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.header-inner {
  display: flex; align-items: center; gap: 16px;
  max-width: 1200px; margin: 0 auto; padding: 0 20px; height: 60px;
}
.logo {
  font-size: 1.2rem; font-weight: 700; color: #3d2f23;
  flex-shrink: 0; letter-spacing: -0.02em;
}
nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav-link {
  padding: 6px 12px; border-radius: 6px;
  font-size: 0.9rem; color: #5a4f46; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: #f0ebe4; text-decoration: none; }
.nav-link.active { background: #3d2f23; color: #fff; }
.header-actions { display: flex; gap: 8px; flex-shrink: 0; margin-left: auto; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; border: 1px solid #e8e3dc; background: #fff;
  position: relative; transition: background 0.15s;
}
.icon-btn:hover { background: #f0ebe4; }
.icon-btn.authed { border-color: #4a7c59; background: #f0f8f3; }
.badge-pill {
  position: absolute; top: -4px; right: -4px;
  background: #c0392b; color: #fff;
  border-radius: 10px; padding: 1px 5px;
  font-size: 0.65rem; font-weight: 700;
  min-width: 16px; height: 16px;
  display: none; align-items: center; justify-content: center;
}

/* ── Main ───────────────────────────────────────────────────────────────── */
main { min-height: calc(100vh - 60px - 60px); padding: 32px 20px; max-width: 1200px; margin: 0 auto; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer {
  background: #3d2f23; color: #c8bfb5;
  padding: 20px; text-align: center;
  font-size: 0.85rem;
}
footer a { color: #e0d4c8; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px; border: 3px solid #e8e3dc;
  border-top-color: #6b5e4e; border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 60px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 7px;
  font-size: 0.9rem; font-weight: 500;
  transition: background 0.15s, opacity 0.15s;
  cursor: pointer; border: 1px solid transparent;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary   { background: #3d2f23; color: #fff; }
.btn-primary:hover { background: #2d2018; text-decoration: none; }
.btn-secondary { background: #fff; color: #3d2f23; border-color: #d4cfc9; }
.btn-secondary:hover { background: #f0ebe4; text-decoration: none; }
.btn-ghost     { background: transparent; color: #5a4f46; border-color: #e0dbd4; }
.btn-ghost:hover { background: #f0ebe4; text-decoration: none; }
.btn-danger    { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a93226; text-decoration: none; }
.btn-sm  { padding: 5px 12px; font-size: 0.82rem; }
.btn-xs  { padding: 3px 8px;  font-size: 0.78rem; }
.btn-lg  { padding: 12px 24px; font-size: 1rem; }
.btn-block, .btn-full { width: 100%; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 0.75rem; font-weight: 500;
  background: #e8e3dc; color: #5a4f46;
}
.badge-green  { background: #d4edda; color: #1e6e3a; }
.badge-red    { background: #fde8e6; color: #8b2318; }
.badge-yellow { background: #fff3cd; color: #856404; }
.badge-blue   { background: #d1ecf1; color: #0c5460; }
.badge-purple { background: #e8d5f5; color: #5a2d82; }

/* ── Error / success boxes ───────────────────────────────────────────────── */
.error-box {
  background: #fde8e6; border: 1px solid #f5c6c0;
  border-radius: 8px; padding: 14px 18px; color: #7b241c;
}
.success-box {
  background: #d4edda; border: 1px solid #bee3c8;
  border-radius: 8px; padding: 14px 18px; color: #1e6e3a;
}
.empty-state {
  text-align: center; padding: 48px 20px;
  color: #8c7e72; font-size: 1rem;
}
.action-msg { margin-top: 8px; font-size: 0.88rem; color: #4a7c59; min-height: 20px; }
.action-msg.error { color: #c0392b; }

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: baseline; gap: 16px; margin-bottom: 24px; }
.page-header h1 { font-size: 1.7rem; font-weight: 700; color: #2d2018; }
.result-count { font-size: 0.9rem; color: #8c7e72; }
.page-sub { color: #8c7e72; margin-top: 4px; }
.back-link { color: #6b5e4e; font-size: 0.9rem; display: inline-block; margin-bottom: 16px; }
.back-link:hover { color: #3d2f23; }
.section { margin-top: 48px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h2, .section-title { font-size: 1.3rem; font-weight: 600; color: #2d2018; margin-bottom: 16px; }
.link-more { font-size: 0.88rem; color: #6b5e4e; }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  text-align: center; padding: 48px 20px 32px;
  background: linear-gradient(135deg, #3d2f23 0%, #5a4030 100%);
  border-radius: 16px; margin-bottom: 48px; color: #fff;
}
.hero h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.03em; }
.hero-sub { margin-top: 10px; font-size: 1rem; color: #d4c4b0; }
.hero-sub a { color: #e8d4b8; text-decoration: underline; }
.stats-bar {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 28px;
}
.stat-card {
  background: rgba(255,255,255,0.1); border-radius: 10px;
  padding: 14px 20px; min-width: 100px; text-align: center;
}
.stat-emoji { font-size: 1.4rem; }
.stat-value { font-size: 1.4rem; font-weight: 700; margin-top: 4px; }
.stat-label { font-size: 0.78rem; color: #d4c4b0; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Book grid ───────────────────────────────────────────────────────────── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
}
.book-card {
  background: #fff; border-radius: 10px;
  border: 1px solid #e8e3dc;
  overflow: hidden; transition: box-shadow 0.2s, transform 0.2s;
  display: flex; flex-direction: column;
}
.book-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-2px); }
.book-card-link { display: flex; flex-direction: column; flex: 1; color: inherit; }
.book-card-link:hover { text-decoration: none; }
.book-cover-wrap {
  aspect-ratio: 2/3; overflow: hidden; position: relative;
  background: #f0ebe4;
}
.book-cover-wrap img { width: 100%; height: 100%; object-fit: cover; }
.sale-ribbon {
  position: absolute; top: 8px; right: -8px;
  background: #c0392b; color: #fff;
  font-size: 0.65rem; font-weight: 700; padding: 2px 10px;
  transform: rotate(0deg);
}
.book-info { padding: 10px; flex: 1; }
.book-title { font-size: 0.88rem; font-weight: 600; color: #2d2018; line-height: 1.3; margin-bottom: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-author { font-size: 0.78rem; color: #6b5e4e; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.book-rating { font-size: 0.8rem; color: #b8860b; }
.book-rating small { color: #6b5e4e; }
.book-price { font-size: 0.9rem; font-weight: 600; color: #2d2018; margin-bottom: 4px; }
.book-price .disc { color: #c0392b; }
.book-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.genre-tag {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 0.7rem; background: #f0ebe4; color: #6b5e4e;
}
.btn-cart {
  margin: 0 10px 10px; padding: 7px; border-radius: 6px;
  background: #3d2f23; color: #fff; font-size: 0.8rem;
  transition: background 0.15s;
}
.btn-cart:hover { background: #2d2018; }
.btn-cart:disabled { opacity: 0.6; }

/* ── Bestsellers ─────────────────────────────────────────────────────────── */
.bestsellers-list { display: flex; flex-direction: column; gap: 12px; }
.bs-row {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-radius: 10px; border: 1px solid #e8e3dc;
  padding: 12px 16px;
}
.bs-rank { font-size: 1.1rem; font-weight: 700; color: #b8860b; min-width: 30px; }
.bs-cover { width: 50px; height: 70px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.bs-info { flex: 1; }
.bs-title { font-weight: 600; font-size: 0.95rem; }
.bs-author { font-size: 0.82rem; color: #6b5e4e; }
.bs-meta { font-size: 0.8rem; color: #6b5e4e; margin-top: 2px; }
.bs-price { font-weight: 600; font-size: 0.95rem; flex-shrink: 0; }
.bs-price .disc { color: #c0392b; }

/* ── Paginator ───────────────────────────────────────────────────────────── */
.paginator { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 32px; flex-wrap: wrap; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: 6px; border: 1px solid #e8e3dc;
  font-size: 0.88rem; background: #fff; color: #3d2f23;
  transition: background 0.15s;
}
.page-btn:hover { background: #f0ebe4; text-decoration: none; }
.page-btn.active { background: #3d2f23; color: #fff; border-color: #3d2f23; }
.page-btn.disabled { opacity: 0.35; pointer-events: none; }
.page-ellipsis { padding: 0 6px; color: #8c7e72; }

/* ── Books layout (browse) ───────────────────────────────────────────────── */
.books-layout { display: flex; gap: 28px; align-items: flex-start; }
.filters-panel {
  width: 220px; flex-shrink: 0;
  background: #fff; border-radius: 10px; border: 1px solid #e8e3dc;
  padding: 16px; position: sticky; top: 76px;
}
.filter-head { font-weight: 600; font-size: 0.95rem; margin-bottom: 12px; display: flex; justify-content: space-between; }
.clear-filters { font-size: 0.82rem; color: #c0392b; font-weight: 400; }
.filter-form .filter-group { margin-bottom: 12px; }
.filter-form label { display: block; font-size: 0.82rem; color: #6b5e4e; margin-bottom: 4px; }
.filter-form select, .filter-form input { font-size: 0.85rem; padding: 6px 10px; }
.filter-checkbox label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: #3d2f23; }
.filter-checkbox input { width: auto; }
.books-main { flex: 1; min-width: 0; }

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-form { margin-bottom: 24px; }
.search-input-wrap { display: flex; gap: 10px; margin-bottom: 12px; }
.search-input-wrap input { flex: 1; font-size: 1rem; }
.search-fields { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.field-label { font-size: 0.85rem; color: #6b5e4e; }
.field-check { display: flex; align-items: center; gap: 5px; font-size: 0.85rem; cursor: pointer; }
.field-check input { width: auto; cursor: pointer; }

/* ── Author grid / card ──────────────────────────────────────────────────── */
.author-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px;
}
.author-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: #fff; border-radius: 10px; border: 1px solid #e8e3dc;
  padding: 20px 16px; text-align: center;
  transition: box-shadow 0.2s;
}
.author-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); text-decoration: none; }
.author-card img { width: 72px; height: 72px; object-fit: cover; border-radius: 50%; }
.author-card-name { font-weight: 600; font-size: 0.95rem; }
.author-card-meta { font-size: 0.8rem; color: #8c7e72; }
.author-card-count { font-size: 0.8rem; color: #6b5e4e; }

/* ── Author detail ───────────────────────────────────────────────────────── */
.author-detail-header { display: flex; gap: 24px; margin-bottom: 32px; }
.author-photo { width: 120px; height: 120px; object-fit: cover; border-radius: 50%; flex-shrink: 0; }
.author-detail-info h1 { font-size: 1.6rem; font-weight: 700; }
.author-meta { font-size: 0.88rem; color: #6b5e4e; margin-top: 4px; }
.author-bio { margin-top: 10px; font-size: 0.92rem; color: #3d2f23; line-height: 1.6; }

/* ── Categories ──────────────────────────────────────────────────────────── */
.categories-tree { display: flex; flex-direction: column; gap: 6px; }
.cat-node { }
.cat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: #fff;
  border-radius: 8px; border: 1px solid #e8e3dc;
  margin-bottom: 4px;
}
.cat-name { font-weight: 500; font-size: 0.95rem; flex: 1; }
.cat-count { font-size: 0.82rem; color: #8c7e72; }
.cat-desc { color: #6b5e4e; font-size: 0.9rem; margin-bottom: 20px; }
.cat-desc-inline { cursor: help; }

/* ── Book detail ─────────────────────────────────────────────────────────── */
.book-detail { display: flex; gap: 40px; margin-bottom: 40px; }
.book-detail-left { width: 220px; flex-shrink: 0; }
.book-cover-lg { position: relative; margin-bottom: 16px; }
.book-cover-lg img { width: 100%; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
.sale-ribbon-lg {
  position: absolute; top: 12px; left: -4px;
  background: #c0392b; color: #fff; padding: 4px 12px;
  font-size: 0.75rem; font-weight: 700; border-radius: 0 4px 4px 0;
}
.book-detail-actions { display: flex; flex-direction: column; gap: 10px; }
.book-price-row { font-size: 1.4rem; font-weight: 700; }
.disc-big { color: #c0392b; }
.orig-price { color: #8c7e72; font-weight: 400; font-size: 1rem; }
.book-detail-right { flex: 1; }
.book-detail-title { font-size: 1.8rem; font-weight: 800; line-height: 1.2; margin-bottom: 6px; }
.book-detail-author { font-size: 1rem; color: #6b5e4e; margin-bottom: 12px; }
.book-detail-rating { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.stars-lg { font-size: 1.2rem; color: #b8860b; }
.rating-num { font-size: 1.1rem; font-weight: 600; }
.review-count { font-size: 0.88rem; color: #6b5e4e; }
.wishlist-count { font-size: 0.88rem; color: #6b5e4e; margin-left: 8px; }
.book-detail-meta { background: #f8f6f3; border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.meta-row { display: flex; gap: 12px; padding: 4px 0; font-size: 0.88rem; }
.meta-label { color: #8c7e72; min-width: 90px; }
.meta-value { color: #2d2018; font-weight: 500; }
.book-genres { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.book-desc { font-size: 0.95rem; line-height: 1.7; color: #3d2f23; }

/* ── Related books mini ──────────────────────────────────────────────────── */
.book-grid-sm { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }
.book-card-mini {
  display: block; text-align: center; color: inherit;
  transition: transform 0.15s;
}
.book-card-mini:hover { transform: translateY(-2px); text-decoration: none; }
.book-card-mini img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; margin-bottom: 4px; }
.mini-title { font-size: 0.75rem; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-rating { font-size: 0.72rem; color: #b8860b; }

/* ── Reviews ─────────────────────────────────────────────────────────────── */
.reviews-list { display: flex; flex-direction: column; gap: 16px; }
.review-item { background: #fff; border-radius: 10px; border: 1px solid #e8e3dc; padding: 16px; }
.review-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.review-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.review-user { flex: 1; }
.review-user strong { display: block; font-size: 0.9rem; }
.review-date { font-size: 0.78rem; color: #8c7e72; }
.review-stars { font-size: 1rem; color: #b8860b; }
.verified-badge { font-size: 0.75rem; color: #4a7c59; background: #e8f5ee; padding: 2px 6px; border-radius: 4px; }
.review-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.review-comment { font-size: 0.88rem; color: #3d2f23; line-height: 1.6; }

/* ── Reviews feed ────────────────────────────────────────────────────────── */
.reviews-feed { display: flex; flex-direction: column; gap: 14px; }
.review-feed-row {
  display: flex; gap: 16px; background: #fff;
  border-radius: 10px; border: 1px solid #e8e3dc; padding: 16px;
}
.review-book-cover img { width: 60px; height: 85px; object-fit: cover; border-radius: 6px; }
.review-feed-body { flex: 1; }
.review-feed-book { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.review-feed-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.review-avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.review-stars-sm { font-size: 0.9rem; color: #b8860b; }
.review-feed-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 2px; }
.review-feed-comment { font-size: 0.85rem; color: #5a4f46; line-height: 1.5; }

/* ── Review form ─────────────────────────────────────────────────────────── */
.review-form, .inline-edit-form {
  background: #f8f6f3; border-radius: 10px; border: 1px solid #e8e3dc;
  padding: 20px; margin-bottom: 20px;
}
.review-form h3 { margin-bottom: 14px; font-size: 1rem; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.85rem; color: #6b5e4e; margin-bottom: 5px; font-weight: 500; }
.req { color: #c0392b; }
.form-hint { font-size: 0.82rem; color: #8c7e72; margin-bottom: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.star-picker { display: flex; gap: 4px; font-size: 1.6rem; color: #d4cfc9; cursor: pointer; margin-bottom: 4px; }
.star-pick:hover, .star-pick.active { color: #b8860b; }

/* ── Account tabs ────────────────────────────────────────────────────────── */
.tab-nav { display: flex; gap: 4px; border-bottom: 2px solid #e8e3dc; margin-bottom: 24px; }
.tab-btn { padding: 10px 18px; font-size: 0.9rem; font-weight: 500; color: #6b5e4e; border-radius: 6px 6px 0 0; transition: background 0.15s; }
.tab-btn:hover { background: #f0ebe4; text-decoration: none; }
.tab-btn.active { color: #3d2f23; border-bottom: 2px solid #3d2f23; margin-bottom: -2px; }

/* ── Profile ─────────────────────────────────────────────────────────────── */
.profile-wrap { max-width: 600px; }
.profile-header { display: flex; gap: 20px; align-items: center; margin-bottom: 28px; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.profile-meta { font-size: 0.88rem; color: #6b5e4e; margin-top: 2px; }
.edit-form { background: #f8f6f3; border-radius: 10px; border: 1px solid #e8e3dc; padding: 20px; }
.edit-form h3, .edit-form h4 { margin-bottom: 14px; font-size: 1rem; }
.edit-form h4 { margin-top: 16px; }

/* ── Orders ──────────────────────────────────────────────────────────────── */
.orders-list { display: flex; flex-direction: column; gap: 12px; }
.order-row { background: #fff; border-radius: 10px; border: 1px solid #e8e3dc; overflow: hidden; }
.order-row-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; flex-wrap: wrap; }
.order-row-meta { font-size: 0.88rem; color: #6b5e4e; margin-left: auto; }
.order-detail { border-top: 1px solid #e8e3dc; }
.order-detail-inner { padding: 16px; }
.order-items-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-bottom: 14px; }
.order-items-table th { text-align: left; padding: 8px; border-bottom: 1px solid #e8e3dc; font-size: 0.8rem; color: #6b5e4e; }
.order-items-table td { padding: 8px; border-bottom: 1px solid #f0ebe4; vertical-align: middle; }
.order-item-cover { width: 36px; height: 50px; object-fit: cover; border-radius: 3px; display: inline-block; vertical-align: middle; margin-right: 8px; }
.order-totals { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-bottom: 12px; font-size: 0.88rem; }
.total-row { display: flex; gap: 20px; min-width: 200px; }
.total-row span:first-child { flex: 1; color: #6b5e4e; }
.total-final { font-weight: 700; font-size: 1rem; padding-top: 6px; border-top: 1px solid #e8e3dc; }
.order-shipping { font-size: 0.82rem; color: #6b5e4e; margin-bottom: 12px; }

/* ── Wishlist ────────────────────────────────────────────────────────────── */
.wishlist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.wishlist-item { background: #fff; border-radius: 10px; border: 1px solid #e8e3dc; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.wishlist-item-link { display: flex; gap: 12px; color: inherit; }
.wishlist-item-link:hover { text-decoration: none; }
.wishlist-item-link img { width: 80px; height: 110px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.wishlist-item-info { flex: 1; }
.wishlist-item-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 2px; }
.wishlist-item-author { font-size: 0.82rem; color: #6b5e4e; margin-bottom: 4px; }
.wishlist-item-price { font-size: 0.95rem; font-weight: 600; }
.wishlist-item-rating { font-size: 0.82rem; color: #b8860b; margin-bottom: 4px; }

/* ── My reviews ──────────────────────────────────────────────────────────── */
.my-reviews-list { display: flex; flex-direction: column; gap: 14px; }
.my-review-row { background: #fff; border-radius: 10px; border: 1px solid #e8e3dc; padding: 16px; }
.my-review-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.my-review-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 4px; }
.review-actions { margin-left: auto; display: flex; gap: 6px; }

/* ── Checkout ────────────────────────────────────────────────────────────── */
.checkout-layout { display: flex; gap: 32px; align-items: flex-start; }
.checkout-left { flex: 1; }
.checkout-right { width: 380px; flex-shrink: 0; }
.checkout-items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.checkout-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 8px; border: 1px solid #e8e3dc; padding: 10px;
}
.checkout-item img { width: 50px; height: 70px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.checkout-item-info { flex: 1; font-size: 0.88rem; }
.checkout-item-qty { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qty-btn { width: 26px; height: 26px; border-radius: 6px; border: 1px solid #d4cfc9; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; background: #f8f6f3; }
.qty-val { min-width: 24px; text-align: center; font-weight: 600; }
.remove-item { color: #8c7e72; font-size: 0.8rem; padding: 2px 6px; border-radius: 4px; }
.remove-item:hover { color: #c0392b; background: #fde8e6; }
.checkout-item-price { font-weight: 600; font-size: 0.9rem; margin-left: auto; flex-shrink: 0; }
.checkout-totals { background: #f8f6f3; border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.checkout-form { background: #fff; border-radius: 10px; border: 1px solid #e8e3dc; padding: 20px; }
.checkout-form h2 { font-size: 1.1rem; margin-bottom: 14px; margin-top: 8px; }
.checkout-form h2:first-child { margin-top: 0; }
.order-success-page {
  text-align: center; padding: 60px 20px;
}
.success-icon { font-size: 4rem; color: #4a7c59; margin-bottom: 16px; }
.success-actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }

/* ── API Explorer ────────────────────────────────────────────────────────── */
.log-container { display: flex; flex-direction: column; gap: 8px; }
.log-entry { background: #fff; border-radius: 8px; border: 1px solid #e8e3dc; overflow: hidden; }
.log-summary {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; flex-wrap: wrap;
  cursor: default;
}
.log-method { font-size: 0.78rem; font-weight: 700; padding: 3px 7px; border-radius: 4px; flex-shrink: 0; }
.method-get    { background: #d1ecf1; color: #0c5460; }
.method-post   { background: #d4edda; color: #1e6e3a; }
.method-put    { background: #fff3cd; color: #856404; }
.method-delete { background: #fde8e6; color: #8b2318; }
.log-url { font-size: 0.82rem; color: #3d2f23; flex: 1; font-family: monospace; word-break: break-all; }
.log-status { font-size: 0.82rem; font-weight: 600; flex-shrink: 0; }
.status-ok  { color: #4a7c59; }
.status-err { color: #c0392b; }
.status-other { color: #6b5e4e; }
.log-duration { font-size: 0.78rem; color: #8c7e72; flex-shrink: 0; }
.log-ts { font-size: 0.78rem; color: #b0a89e; flex-shrink: 0; }
.log-detail { padding: 0 14px 14px; border-top: 1px solid #f0ebe4; background: #fafaf8; }
.log-detail.hidden { display: none; }
.log-section { margin-top: 10px; }
.log-section strong { font-size: 0.8rem; color: #6b5e4e; display: block; margin-bottom: 4px; }
.log-pre {
  background: #f0ede8; border-radius: 6px; padding: 10px 12px;
  font-size: 0.78rem; font-family: monospace;
  overflow: auto; max-height: 300px; white-space: pre-wrap; word-break: break-word;
}

/* ── Cart drawer ─────────────────────────────────────────────────────────── */
.cart-drawer { position: fixed; inset: 0; z-index: 500; display: none; }
.cart-drawer.open { display: flex; }
.cart-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.cart-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: 380px; max-width: 100%;
  background: #fff; display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
}
.cart-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e8e3dc; }
.cart-header h2 { font-size: 1.1rem; }
#cart-items-wrap { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
#cart-footer { padding: 16px 20px; border-top: 1px solid #e8e3dc; }
.cart-empty { color: #8c7e72; text-align: center; padding: 32px 0; }
.cart-item { display: flex; gap: 12px; align-items: flex-start; }
.cart-item img { width: 50px; height: 70px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.cart-item-info { flex: 1; }
.cart-item-title { font-size: 0.88rem; font-weight: 500; margin-bottom: 4px; line-height: 1.3; }
.cart-item-price { font-size: 0.82rem; color: #6b5e4e; margin-bottom: 6px; }
.cart-item-qty { display: flex; align-items: center; gap: 8px; }
.cart-remove { color: #b0a89e; font-size: 0.9rem; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; margin-top: 2px; }
.cart-remove:hover { color: #c0392b; background: #fde8e6; }
.cart-subtotal { display: flex; justify-content: space-between; font-weight: 600; font-size: 1rem; margin-bottom: 12px; }
.drawer-open { overflow: hidden; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center; z-index: 600; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; padding: 28px;
  max-width: 480px; width: 100%; position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.modal h2 { margin-bottom: 10px; }
.modal p  { font-size: 0.9rem; color: #5a4f46; margin-bottom: 12px; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  font-size: 1.1rem; color: #8c7e72; background: none; border: none; cursor: pointer;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.modal-close:hover { background: #f0ebe4; }
.key-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.key-pill {
  padding: 6px 14px; border-radius: 20px; font-size: 0.85rem;
  border: 1px solid #d4cfc9; background: #f8f6f3; color: #3d2f23; cursor: pointer;
}
.key-pill:hover { background: #f0ebe4; }
.key-pill.selected { background: #3d2f23; color: #fff; border-color: #3d2f23; }

/* ── Auth gate ───────────────────────────────────────────────────────────── */
.auth-gate {
  background: #fff; border-radius: 10px; border: 1px solid #e8e3dc;
  padding: 28px; max-width: 480px;
}
.auth-gate p { margin-bottom: 8px; font-size: 0.92rem; color: #5a4f46; }
.auth-gate ul { margin-left: 18px; }
.auth-gate li { font-size: 0.88rem; margin-bottom: 4px; }
.auth-gate code { background: #f0ebe4; padding: 2px 6px; border-radius: 4px; font-size: 0.82rem; word-break: break-all; }

/* ── Not found ───────────────────────────────────────────────────────────── */
.not-found { text-align: center; padding: 80px 20px; }
.not-found h1 { font-size: 4rem; color: #d4cfc9; }
.not-found p { color: #6b5e4e; margin: 12px 0 24px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .books-layout { flex-direction: column; }
  .filters-panel { width: 100%; position: static; }
  .book-detail { flex-direction: column; }
  .book-detail-left { width: 100%; display: flex; gap: 20px; }
  .book-cover-lg { width: 140px; flex-shrink: 0; }
  .book-detail-actions { flex: 1; }
  .checkout-layout { flex-direction: column; }
  .checkout-right { width: 100%; }
  .author-detail-header { flex-direction: column; align-items: flex-start; }
  nav { gap: 2px; }
  .nav-link { padding: 5px 8px; font-size: 0.82rem; }
  .hero h1 { font-size: 1.8rem; }
}
@media (max-width: 480px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-bar .stat-card { min-width: 80px; }
  .bs-row { flex-wrap: wrap; }
}
