/* ================================================
   E-BOOK PERPUSTAKAAN BBGTK PROVINSI JAWA BARAT ? Halaman Publik
   (Katalog & Statistik) ? Bootstrap 4 + Font Awesome 5
   ================================================ */

:root {
  /* Warna logo BBGTK: biru #0090D4 / #067AC1, oranye #F9A703 */
  --pb-primary:      #05609A;   /* hover */
  --pb-primary-2:    #067AC1;   /* tombol & link (kontras teks putih 4.6:1) */
  --pb-brand:        #0090D4;
  --pb-primary-soft: #E0F2FB;
  --pb-navy:         #072A47;
  --pb-accent:       #F9A703;
  --pb-accent-hover: #E89B00;
  --pb-accent-ink:   #10233A;   /* teks di atas oranye */
  --pb-bg:           #F5F7FB;
  --pb-surface:      #FFFFFF;
  --pb-border:       #E3E8F0;
  --pb-text:         #1E293B;
  --pb-muted:        #64748B;
  --pb-radius:       12px;
  --pb-shadow:       0 1px 2px rgba(15, 30, 70, .06), 0 4px 14px rgba(15, 30, 70, .06);
  --pb-shadow-hover: 0 10px 28px rgba(6, 122, 193, .2);
}

html, body { overflow-x: hidden; }

body.public-page {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--pb-bg);
  color: var(--pb-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

a { color: var(--pb-primary-2); }

/* ---------- Navbar ---------- */
.pb-nav {
  background: var(--pb-surface);
  border-bottom: 1px solid var(--pb-border);
  border-top: 3px solid var(--pb-accent);
  position: sticky;
  top: 0;
  z-index: 1020;
}
.pb-nav .container { display: flex; align-items: center; min-height: 64px; gap: 1rem; }
.pb-brand { display: flex; align-items: center; gap: .65rem; color: var(--pb-text); text-decoration: none !important; min-width: 0; }
.pb-brand img { height: 42px; width: auto; flex-shrink: 0; }
.pb-brand-text { line-height: 1.15; min-width: 0; padding-left: .75rem; border-left: 2px solid var(--pb-border); }
.pb-brand-text strong { display: block; font-size: 1.05rem; font-weight: 800; color: var(--pb-primary-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-brand-text small { color: var(--pb-muted); font-weight: 600; font-size: .78rem; }
.pb-menu { margin-left: auto; display: flex; gap: .25rem; }
.pb-menu a {
  padding: .45rem .8rem; border-radius: 8px; color: var(--pb-muted);
  font-weight: 700; font-size: .9rem; text-decoration: none; white-space: nowrap;
}
.pb-menu a:hover { color: var(--pb-primary); background: var(--pb-primary-soft); }
.pb-menu a.active { color: var(--pb-primary-2); background: var(--pb-primary-soft); box-shadow: inset 0 -3px 0 var(--pb-accent); }

/* ---------- Hero + pencarian ---------- */
.pb-hero {
  background:
    radial-gradient(900px 260px at 90% -10%, rgba(249, 167, 3, .22), transparent 60%),
    linear-gradient(135deg, var(--pb-navy) 0%, var(--pb-primary-2) 60%, var(--pb-brand) 100%);
  color: #fff;
  padding: 2.75rem 0 3.75rem;
}
.pb-hero h1 { font-weight: 800; font-size: 2rem; margin-bottom: .35rem; letter-spacing: -.01em; }
.pb-hero h1 .hl { color: var(--pb-accent); }
.pb-hero p { color: rgba(255, 255, 255, .82); margin-bottom: 1.5rem; font-size: 1.02rem; }

.pb-search { position: relative; max-width: 640px; }
.pb-search .fa-search { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%); color: #94A3B8; pointer-events: none; }
.pb-search input {
  width: 100%; height: 54px; border: 0; border-radius: 14px;
  padding: 0 7.5rem 0 2.9rem; font-size: 1rem; color: var(--pb-text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18); outline: none;
}
.pb-search input:focus { box-shadow: 0 0 0 4px rgba(249, 167, 3, .55), 0 10px 30px rgba(0, 0, 0, .18); }
.pb-search button {
  position: absolute; right: 6px; top: 6px; bottom: 6px;
  border: 0; border-radius: 10px; padding: 0 1.25rem;
  background: var(--pb-accent); color: var(--pb-accent-ink); font-weight: 800;
}
.pb-search button:hover { background: var(--pb-accent-hover); }

/* ---------- Toolbar filter ---------- */
.pb-toolbar {
  background: var(--pb-surface);
  border: 1px solid var(--pb-border);
  border-radius: var(--pb-radius);
  box-shadow: var(--pb-shadow);
  padding: .9rem 1rem;
  margin-top: -2rem;
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
}
.pb-toolbar label { font-size: .78rem; font-weight: 700; color: var(--pb-muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 .4rem 0 0; }
.pb-toolbar .form-control { height: 38px; border-radius: 8px; border-color: var(--pb-border); font-size: .9rem; min-width: 170px; }
.pb-filter-group { display: flex; align-items: center; }
.pb-result { margin-left: auto; color: var(--pb-muted); font-size: .9rem; }
.pb-result strong { color: var(--pb-text); }
.pb-reset { font-size: .85rem; font-weight: 700; margin-left: .5rem; }

/* ---------- Grid ebook ---------- */
/* Desktop: 5 ebook per baris (25 per halaman = 5 baris, lihat katalog.per.halaman) */
.pb-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.5rem 1.25rem;
  margin: 1.75rem 0 2rem;
}
@media (max-width: 1199.98px) { .pb-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 991.98px)  { .pb-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.pb-book { display: block; color: var(--pb-text); text-decoration: none !important; outline: none; }
.pb-cover {
  position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden;
  background: #E2E8F0; box-shadow: var(--pb-shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.pb-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-book:hover .pb-cover, .pb-book:focus-visible .pb-cover { transform: translateY(-4px); box-shadow: var(--pb-shadow-hover); }
.pb-book:focus-visible .pb-cover { outline: 3px solid var(--pb-primary-2); outline-offset: 2px; }

/* Sampul cadangan bila gambar belum tersedia */
.pb-cover-fallback {
  position: absolute; inset: 0; display: none; flex-direction: column; justify-content: flex-start; gap: .9rem;
  padding: 1rem .9rem 2.6rem 1.25rem; color: #fff;
  background:
    linear-gradient(90deg, var(--pb-accent) 0, var(--pb-accent) 6px, transparent 6px),
    linear-gradient(160deg, var(--pb-navy) 0%, var(--pb-primary-2) 55%, var(--pb-brand) 100%);
}
.pb-cover.no-img img { display: none; }
.pb-cover.no-img .pb-cover-fallback { display: flex; }
.pb-cover-fallback .fa-book-open { font-size: 1.4rem; opacity: .8; }
.pb-cover-fallback span { font-weight: 800; font-size: .95rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

.pb-views {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(15, 23, 42, .78); color: #fff; backdrop-filter: blur(4px);
  font-size: .75rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px;
}
.pb-open-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 30, 70, .55); color: #fff; font-weight: 800; font-size: .9rem;
  opacity: 0; transition: opacity .2s ease;
}
.pb-book:hover .pb-open-hint, .pb-book:focus-visible .pb-open-hint { opacity: 1; }

.pb-book-body { padding: .7rem .1rem 0; }
.pb-book-kat { font-size: .72rem; font-weight: 800; color: var(--pb-primary-2); text-transform: uppercase; letter-spacing: .04em; }
.pb-book-title {
  font-weight: 800; font-size: .95rem; line-height: 1.35; margin: .15rem 0 .2rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pb-book:hover .pb-book-title { color: var(--pb-primary); }
.pb-book-meta { font-size: .8rem; color: var(--pb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Kosong ---------- */
.pb-empty { text-align: center; padding: 4rem 1rem; color: var(--pb-muted); }
.pb-empty i { font-size: 2.6rem; color: #CBD5E1; margin-bottom: 1rem; }
.pb-empty h5 { color: var(--pb-text); font-weight: 800; }

/* ---------- Pagination ---------- */
.pb-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin-bottom: 3rem; }
.pb-pagination a, .pb-pagination span {
  min-width: 40px; height: 40px; padding: 0 .75rem; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; text-decoration: none !important;
  border: 1px solid var(--pb-border); background: var(--pb-surface); color: var(--pb-text);
}
.pb-pagination a:hover { border-color: var(--pb-primary-2); color: var(--pb-primary-2); }
.pb-pagination .current { background: var(--pb-primary-2); border-color: var(--pb-primary-2); color: #fff; }
.pb-pagination .disabled { color: #CBD5E1; pointer-events: none; }
.pb-pagination .gap { border: 0; background: transparent; min-width: 20px; padding: 0; }

/* ---------- Statistik ---------- */
.pb-page-head { padding: 2rem 0 1rem; }
.pb-page-head h1 { font-weight: 800; font-size: 1.6rem; margin: 0; }
.pb-page-head p { color: var(--pb-muted); margin: .25rem 0 0; }

.pb-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.pb-tile { background: var(--pb-surface); border: 1px solid var(--pb-border); border-top: 3px solid var(--pb-brand); border-radius: var(--pb-radius); padding: 1.1rem 1.2rem; box-shadow: var(--pb-shadow); }
.pb-tile-label { font-size: .78rem; font-weight: 700; color: var(--pb-muted); text-transform: uppercase; letter-spacing: .04em; }
.pb-tile-value { font-size: 1.9rem; font-weight: 800; line-height: 1.2; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.pb-tile-value small { font-size: .85rem; color: var(--pb-muted); font-weight: 700; }

.pb-card { background: var(--pb-surface); border: 1px solid var(--pb-border); border-radius: var(--pb-radius); box-shadow: var(--pb-shadow); margin-bottom: 1.5rem; }
.pb-card-head { padding: 1rem 1.25rem .25rem; }
.pb-card-head h2 { font-size: 1.05rem; font-weight: 800; margin: 0; }
.pb-card-head p { font-size: .85rem; color: var(--pb-muted); margin: .15rem 0 0; }
.pb-card-body { padding: .75rem 1.25rem 1.1rem; }
.pb-chart { position: relative; height: 300px; }
.pb-chart.tall { height: 380px; }

.pb-table-toggle summary { cursor: pointer; font-size: .85rem; font-weight: 700; color: var(--pb-primary-2); margin-top: .75rem; }
.pb-table-toggle table { font-size: .85rem; margin-top: .5rem; }
.pb-table-toggle td.num, .pb-table-toggle th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Footer ---------- */
.pb-footer { background: var(--pb-navy); border-top: 3px solid var(--pb-accent); color: rgba(255, 255, 255, .7); font-size: .85rem; padding: 1.25rem 0; flex-shrink: 0; }
.pb-footer a { color: var(--pb-accent); }

/* ---------- Responsif ---------- */
@media (max-width: 767.98px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .pb-brand img { height: 30px; }
  .pb-brand-text { display: none; }
  .pb-menu a { padding: .4rem .55rem; font-size: .85rem; }
  .pb-menu a .label { display: none; }
  .pb-hero { padding: 2rem 0 3.25rem; }
  .pb-hero h1 { font-size: 1.5rem; }
  .pb-search input { height: 50px; padding-right: 5.5rem; }
  .pb-search button { padding: 0 .9rem; }
  .pb-toolbar { flex-direction: column; align-items: stretch; }
  .pb-filter-group { justify-content: space-between; }
  .pb-toolbar .form-control { min-width: 0; flex: 1; }
  .pb-result { margin-left: 0; }
  .pb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem .9rem; }
  .pb-chart { height: 260px; }
  .pb-chart.tall { height: 340px; }
}
