/* ========================================================
   LiGaMu Katalog v1.0 (Fase 3)
   Halaman katalog publik + detail buku
   ======================================================== */

/* === KATALOG HEAD === */
.catalog-head {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  color: white; padding: 40px 0 32px;
  position: relative; overflow: hidden;
}
.catalog-head::before {
  content: '🐘'; position: absolute;
  top: 50%; right: 24px; font-size: 220px;
  opacity: 0.06; line-height: 1; pointer-events: none;
  transform: translate(0, -50%);
}
.catalog-head-inner { position: relative; z-index: 1; }
.catalog-head h1 { color: white; margin-bottom: 8px; }
.catalog-head-sub {
  font-size: 1rem; color: rgba(255,255,255,0.8);
  margin-bottom: 24px;
}
.catalog-searchbox {
  background: white; padding: 6px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; gap: 4px;
  max-width: 720px;
}
.catalog-searchbox input {
  flex: 1; border: none; outline: none;
  padding: 10px 14px; font-size: .9375rem;
  background: transparent;
}
.catalog-searchbox button {
  background: var(--brand); color: white;
  padding: 10px 20px; border-radius: var(--radius-md);
  font-size: .875rem; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.catalog-searchbox button:hover { background: var(--brand-dark); }

/* === LAYOUT === */
.catalog-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  padding: 24px 0 48px;
}

/* === SIDEBAR FILTER === */
.filter-sidebar {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px; height: fit-content;
  position: sticky; top: 80px;
}
.filter-group { padding: 14px 0; border-bottom: 1px solid var(--border); }
.filter-group:first-child { padding-top: 0; }
.filter-group:last-child { border-bottom: none; padding-bottom: 0; }
.filter-title {
  font-size: .75rem; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; margin-bottom: 10px;
}
.filter-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 260px; overflow-y: auto;
}
.filter-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: .875rem;
  transition: all .12s;
}
.filter-link:hover { background: var(--brand-light); color: var(--brand); }
.filter-link.is-active {
  background: var(--brand-light); color: var(--brand);
  font-weight: 500;
}
.filter-link .filter-count {
  margin-left: auto; font-size: .75rem;
  color: var(--ink-mute); font-family: var(--font-mono);
}
.filter-link.is-active .filter-count { color: var(--brand); }
.filter-link .ti { font-size: 14px; flex-shrink: 0; }
.filter-actions {
  display: flex; gap: 8px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.filter-actions .btn { flex: 1; }

/* === TOOLBAR === */
.catalog-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px; margin-bottom: 16px;
}
.catalog-result {
  font-size: .875rem; color: var(--ink-soft);
}
.catalog-result strong { color: var(--ink); font-weight: 600; }
.catalog-sort {
  display: flex; align-items: center; gap: 8px;
  font-size: .875rem;
}
.catalog-sort select {
  height: 34px; padding: 4px 28px 4px 10px;
  font-size: .875rem;
}

/* === ACTIVE FILTERS CHIPS === */
.active-filters {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 12px;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 4px 4px 10px;
  background: var(--brand-light); color: var(--brand);
  border-radius: var(--radius-pill);
  font-size: .8125rem; font-weight: 500;
}
.filter-chip a {
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand); transition: all .15s;
}
.filter-chip a:hover { background: var(--brand); color: white; }

/* === BOOK GRID === */
.book-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.book-card { cursor: pointer; transition: all .15s; }
.book-card:hover { transform: translateY(-3px); }
.book-card .book-cover {
  position: relative;
  aspect-ratio: 2/3; border-radius: var(--radius-md);
  padding: 14px; color: white;
  display: flex; flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  font-family: var(--font-display);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  background: var(--brand);
}
.book-cover img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.book-cover.has-img { padding: 0; background: var(--ink); }
.book-cover-title {
  font-size: .8125rem; font-weight: 500;
  line-height: 1.3; position: relative; z-index: 1;
}
.book-cover-meta {
  font-size: .6875rem; opacity: .85;
  position: relative; z-index: 1;
}
.book-card-badges {
  position: absolute; top: 8px; right: 8px;
  display: flex; flex-direction: column; gap: 4px;
  z-index: 2;
}
.book-flag {
  background: var(--accent-gold); color: #2C2416;
  padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: .625rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
}
.book-flag.is-local { background: var(--brand-light); color: var(--brand); }
.book-flag.is-new { background: var(--accent-gold); color: #2C2416; }
.book-flag.is-featured { background: var(--accent-ai-light); color: var(--accent-ai-text); }
.book-card .book-title {
  font-size: .875rem; font-weight: 500;
  color: var(--ink); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.book-card .book-meta {
  font-size: .75rem; color: var(--ink-mute);
  margin-top: 2px; line-height: 1.4;
}
.book-availability {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .6875rem; margin-top: 4px;
  color: var(--ink-mute);
}
.book-availability.is-out { color: var(--danger); }
.book-availability.is-ok { color: var(--success); }
.book-availability .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

/* Gradient covers */
.book-cover.gradient-1 { background: linear-gradient(135deg, #1B4D3E, #2D6A5A); }
.book-cover.gradient-2 { background: linear-gradient(135deg, #7C3AED, #5B21B6); }
.book-cover.gradient-3 { background: linear-gradient(135deg, #D4A574, #A07843); color: #2C2416; }
.book-cover.gradient-4 { background: linear-gradient(135deg, #185FA5, #042C53); }
.book-cover.gradient-5 { background: linear-gradient(135deg, #993556, #4B1528); }
.book-cover.gradient-6 { background: linear-gradient(135deg, #BA7517, #412402); }

/* === DETAIL PAGE === */
.detail-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  padding: 24px 0 48px;
}
.detail-cover-wrap { position: sticky; top: 80px; height: fit-content; }
.detail-cover {
  aspect-ratio: 2/3; border-radius: var(--radius-lg);
  padding: 28px; color: white;
  display: flex; flex-direction: column;
  justify-content: space-between;
  overflow: hidden; position: relative;
  font-family: var(--font-display);
  box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
  background: var(--brand);
}
.detail-cover.has-img { padding: 0; }
.detail-cover img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.detail-cover-title { font-size: 1.125rem; line-height: 1.3; position: relative; z-index: 1; }
.detail-cover-author { font-size: .8125rem; opacity: .85; margin-top: 4px; position: relative; z-index: 1; }

.detail-actions { display: flex; flex-direction: column; gap: 8px; }
.detail-actions .btn { width: 100%; }

.detail-content { min-width: 0; }
.detail-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
}
.detail-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.2;
  margin: 0 0 6px;
}
.detail-subtitle {
  font-size: 1rem; color: var(--ink-soft);
  margin-bottom: 12px; font-family: var(--font-display);
  font-style: italic;
}
.detail-authors {
  font-size: .9375rem; margin-bottom: 16px;
}
.detail-authors a { color: var(--brand); font-weight: 500; }
.detail-authors a:hover { text-decoration: underline; }

.detail-stats {
  display: flex; flex-wrap: wrap; gap: 16px;
  padding: 12px 0; margin-bottom: 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: .8125rem; color: var(--ink-mute);
}
.detail-stat { display: inline-flex; align-items: center; gap: 6px; }
.detail-stat .ti { font-size: 16px; color: var(--ink-soft); }
.detail-stat strong { color: var(--ink); font-weight: 600; }

.detail-section { padding: 16px 0; }
.detail-section h3 {
  font-size: 1rem; margin-bottom: 10px;
  font-family: var(--font-display); font-weight: 500;
}
.detail-description {
  font-size: .9375rem; line-height: 1.75;
  color: var(--ink); white-space: pre-line;
}

.meta-table {
  display: grid; grid-template-columns: 160px 1fr;
  gap: 8px 16px; font-size: .875rem;
}
.meta-table dt { color: var(--ink-mute); font-weight: 500; }
.meta-table dd { color: var(--ink); margin: 0; }

.detail-category-list {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.detail-cat-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; background: var(--brand-light);
  color: var(--brand); border-radius: var(--radius-pill);
  font-size: .8125rem; font-weight: 500;
  transition: all .15s;
}
.detail-cat-chip:hover { background: var(--brand); color: white; }

.related-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* === CATEGORY INDEX === */
.cat-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.cat-card {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px;
  transition: all .15s; display: block; color: inherit;
}
.cat-card:hover {
  border-color: var(--brand); box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.cat-card-icon {
  width: 44px; height: 44px;
  background: var(--brand-light); color: var(--brand);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 12px;
}
.cat-card-name {
  font-family: var(--font-display); font-weight: 500;
  font-size: 1rem; color: var(--ink); margin-bottom: 4px;
}
.cat-card-count {
  font-size: .8125rem; color: var(--ink-mute);
}
.cat-card-ddc {
  display: inline-block; font-family: var(--font-mono);
  font-size: .625rem; background: var(--neutral-warm);
  padding: 1px 6px; border-radius: var(--radius-sm);
  color: var(--ink-mute); margin-left: 6px;
}

/* === AUTHOR PROFILE === */
.author-hero {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 28px;
  display: flex; gap: 24px; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap;
}
.author-photo {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--accent-gold); color: #2C2416;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 500;
  font-size: 2rem; flex-shrink: 0;
  overflow: hidden;
}
.author-photo img { width: 100%; height: 100%; object-fit: cover; }
.author-info { flex: 1; min-width: 0; }
.author-name {
  font-family: var(--font-display); font-weight: 500;
  font-size: 1.5rem; margin: 0 0 4px;
}
.author-meta {
  font-size: .875rem; color: var(--ink-soft);
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.author-meta-item { display: inline-flex; align-items: center; gap: 4px; }
.author-bio {
  font-size: .9375rem; color: var(--ink-soft);
  line-height: 1.7;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .filter-sidebar { position: static; }
  .detail-layout { grid-template-columns: 220px 1fr; gap: 20px; }
  .detail-cover-wrap { position: static; }
}
@media (max-width: 640px) {
  .catalog-head { padding: 28px 0 24px; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-cover-wrap { max-width: 220px; margin: 0 auto; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
  .meta-table { grid-template-columns: 120px 1fr; }
  .author-hero { padding: 20px; gap: 16px; }
  .author-photo { width: 72px; height: 72px; font-size: 1.5rem; }
}
