/* =========================================================
   DIGILIB — Stylesheet Utama
   ========================================================= */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../vendor/fonts/plus-jakarta-sans.woff2') format('woff2');
}

:root {
  --primary: #2f5ce0;
  --primary-dark: #1f3f9e;
  --primary-light: #eef2ff;
  --accent: #16a34a;
  --accent-dark: #15803d;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0891b2;
  --text: #1e293b;
  --text-muted: #64748b;
  --bg: #f1f5f9;
  --white: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
  --radius: 12px;
  --radius-sm: 8px;
}

html { scroll-behavior: smooth; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 960px; }
.container-narrow { max-width: 520px; }

main { flex: 1; }

.page-title { font-size: 26px; font-weight: 800; margin: 0 0 4px; }
.page-subtitle { color: var(--text-muted); margin: 0 0 24px; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; margin: 0 0 18px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); transition: color .15s ease; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--text-muted); opacity: .6; }
.breadcrumb .cur { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }

.rp-item { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.rp-item:last-child { border-bottom: none; }
.rp-item:hover .font-bold { color: var(--primary); }
.rp-bar-wrap { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 8px; max-width: 420px; }
.rp-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .4s ease; }

/* Tombol share */
.share-row { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.share-lbl { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.share-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
  background: var(--white); color: var(--text); border: 1px solid var(--border);
  transition: transform .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.share-btn:hover { transform: translateY(-2px) scale(1.05); box-shadow: var(--shadow); }
.share-btn.wa:hover { color: #25d366; border-color: #25d366; }
.share-btn.tg:hover { color: #229ed9; border-color: #229ed9; }
.share-btn.fb:hover { color: #1877f2; border-color: #1877f2; }
.share-btn.cp:hover { color: var(--primary); border-color: var(--primary); }
.share-btn.cp.copied { background: var(--accent); color: #fff; border-color: var(--accent); }
html.dark .share-btn { background: #1e293b; border-color: #334155; }
html.dark .share-btn.cp.copied { background: var(--accent); color: #0f172a; }

/* Quick view buku */
.book-cover-wrap { position: relative; }
.quick-view {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(15,23,42,.55); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
  opacity: 0; transform: scale(.7); cursor: pointer;
  transition: opacity .2s ease, transform .2s ease, background .2s ease;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.book-card:hover .quick-view, .quick-view:focus-visible { opacity: 1; transform: scale(1); }
.quick-view:hover { background: var(--primary); }
@media (hover: none) { .quick-view { opacity: 1; transform: scale(1); background: rgba(15,23,42,.65); } }

.quick-modal { position: relative; }
.quick-modal .modal-close { position: absolute; top: 12px; right: 14px; z-index: 2; }
.quick-body { padding: 24px; }
.quick-loading { text-align: center; padding: 40px 0; color: var(--text-muted); }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 12px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.quick-grid { display: grid; grid-template-columns: 190px 1fr; gap: 24px; align-items: start; }
.quick-cover img { width: 100%; border-radius: 10px; box-shadow: var(--shadow-lg); }
.quick-cover .book-cover-placeholder { height: 260px; }
.quick-info h2 { margin: 4px 0 2px; font-size: 22px; line-height: 1.3; }
.quick-info .author { color: var(--text-muted); margin: 0 0 10px; }
.qv-rating { margin: 0 0 12px; color: #f59e0b; font-size: 14px; }
.qv-rating .qv-num { color: var(--text); font-weight: 700; margin-left: 6px; }
.qv-rating .qv-cnt { color: var(--text-muted); font-size: 13px; }
.qv-rating .qv-empty { color: #cbd5e1; }
.qv-desc { color: var(--text-muted); font-size: 14px; line-height: 1.7; margin: 0 0 14px; }
.qv-info { margin: 0 0 18px; }
@media (max-width: 640px) {
  .quick-grid { grid-template-columns: 1fr; }
  .quick-cover img, .quick-cover .book-cover-placeholder { max-width: 180px; }
}

/* =========================================================
   Header & Navigasi
   ========================================================= */
.site-header {
  background: linear-gradient(120deg, rgba(22,33,62,.92) 0%, rgba(31,63,158,.86) 60%, rgba(47,92,224,.88) 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: box-shadow .3s ease;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  flex-wrap: nowrap;
  transition: padding .3s cubic-bezier(.22,.68,.38,1);
}

/* Header menyusut saat di-scroll */
.site-header.scrolled { box-shadow: 0 6px 24px rgba(15,23,42,.28); }
.site-header.scrolled .navbar { padding: 9px 0; }
.site-header.scrolled .brand-logo { height: 34px; }
.site-header.scrolled .brand { font-size: 20px; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; color: #fff; letter-spacing: .5px; }
.brand:hover { color: #fff; }
.brand-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,.15);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.brand small { display: block; font-size: 10px; font-weight: 500; letter-spacing: 2px; color: #c7d2fe; }

.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.nav-link {
  color: #e2e8f0;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.12); }
.nav-link.active { color: #fff; background: rgba(255,255,255,.18); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.2;
  font-family: inherit;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-light:hover { background: rgba(255,255,255,.24); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 14px 26px; font-size: 16px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-light); }

/* =========================================================
   Hero
   ========================================================= */
.hero-full {
  width: 100vw;
  margin: -24px 0 0 calc(50% - 50vw);
}
.hero {
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(255,255,255,.14), transparent 60%),
    linear-gradient(120deg, #16213e 0%, #1f3f9e 60%, #2f5ce0 100%);
  color: #fff;
  padding: 60px 0 70px;
  text-align: center;
}
.hero.has-bg { animation: none; }
.hero-slides { position: absolute; inset: 0; z-index: 0; }
.hero-slide {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.2s ease;
}
.hero-slide.active { opacity: 1; }
.hero-slide::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(13,23,48,.68), rgba(31,63,158,.42));
}
.hero-slide-dots {
  position: absolute; bottom: 20px; left: 0; right: 0; z-index: 3;
  display: flex; gap: 9px; justify-content: center;
}
.hero-slide-dots span {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,.4); cursor: pointer;
  transition: background .25s ease, transform .25s ease;
}
.hero-slide-dots span.active { background: #fff; transform: scale(1.3); }
.hero .container { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(24px, 3.2vw, 40px); font-weight: 800; line-height: 1.3; margin: 0 0 14px; text-wrap: balance; }
.hero p { font-size: 17px; color: #dbe3f5; max-width: 640px; margin: 0 auto 26px; }
.hero-stats { display: flex; gap: 40px; justify-content: center; margin-top: 34px; flex-wrap: wrap; }
.hero-stat .num { font-size: 28px; font-weight: 800; }
.hero-stat .lbl { color: #c7d2fe; font-size: 13px; }

.search-box {
  background: #fff;
  border-radius: 50px;
  padding: 6px;
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
}
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 18px;
  font-size: 15px;
  background: transparent;
  color: var(--text);
}
.search-box .btn { border-radius: 50px; padding: 12px 26px; }

/* =========================================================
   Sections
   ========================================================= */
.section { padding: 44px 0; }
.section-alt { background: var(--white); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 22px; font-weight: 800; margin: 0; }
.section-head p { color: var(--text-muted); margin: 2px 0 0; }

/* =========================================================
   Grid kartu buku
   ========================================================= */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 22px;
}

.book-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s;
  display: flex;
  flex-direction: column;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.book-cover-wrap { position: relative; aspect-ratio: 2/3; background: var(--primary-light); }
.book-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-cover-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 800; color: #c7d2fe; background: linear-gradient(135deg, #dbe4ff, #eef2ff);
}

.book-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.book-cat { font-size: 11px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .8px; }
.book-title { font-size: 15px; font-weight: 700; line-height: 1.35; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-author { color: var(--text-muted); font-size: 13px; margin: 0; }
.book-meta { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }

/* =========================================================
   Slider Buku Unggulan
   ========================================================= */
.h-slider { position: relative; display: flex; align-items: center; }
.h-track {
  display: flex; gap: 22px; overflow-x: auto; scroll-behavior: smooth;
  padding: 8px 2px 16px; scrollbar-width: thin; scroll-snap-type: x mandatory;
}
.h-track .book-card { flex: 0 0 200px; scroll-snap-align: start; }
.h-track::-webkit-scrollbar { height: 8px; }
.h-track::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 999px; }
.h-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--white); color: var(--text); font-size: 18px; line-height: 1;
  cursor: pointer; box-shadow: var(--shadow); transition: background .2s, color .2s, transform .2s;
  display: flex; align-items: center; justify-content: center;
}
.h-arrow:hover { background: var(--primary); color: #fff; }
.h-prev { left: -52px; } .h-next { right: -52px; }
@media (max-width: 900px) {
  .h-prev { left: 0; } .h-next { right: 0; }
}

/* =========================================================
   Statistik & Chart
   ========================================================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.stat-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .stat-two { grid-template-columns: 1fr; } }
.chart-bars {
  display: flex; align-items: flex-end; gap: 14px; height: 260px;
  padding: 20px 16px 10px; justify-content: space-between;
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar {
  width: 100%; max-width: 60px; min-height: 4px; border-radius: 8px 8px 2px 2px;
  background: linear-gradient(180deg, #4f6ef7, #2f5ce0); transition: height .8s cubic-bezier(.22,.68,.38,1);
  position: relative;
}
.chart-bar:hover::after { content: attr(data-label); position: absolute; top: -26px; left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.chart-val { font-size: 13px; font-weight: 800; color: var(--primary); }
.chart-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-align: center; }
.cat-bars { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.cat-row { display: flex; align-items: center; gap: 12px; }
.cat-name { flex: 0 0 200px; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-track { flex: 1; background: var(--border); height: 18px; border-radius: 999px; overflow: hidden; }
.cat-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #4f6ef7, #22d3ee); transition: width .8s cubic-bezier(.22,.68,.38,1); }
.cat-val { flex: 0 0 30px; text-align: right; font-size: 13px; font-weight: 800; color: var(--primary); }

/* =========================================================
   Kontak & Jam Layanan
   ========================================================= */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card { background: var(--card, #fff); border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
.contact-card .ic { font-size: 26px; margin-bottom: 6px; }
.contact-card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.contact-card p { margin: 0; font-size: 14px; color: var(--text); line-height: 1.6; }
.hours-table { border-collapse: collapse; }
.hours-table td { padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.hours-table tr:last-child td { border-bottom: none; }
.hours-table .val { font-weight: 700; text-align: right; }

/* =========================================================
   FAQ / Bantuan
   ========================================================= */
.faq-list { max-width: 820px; display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: var(--card, #fff); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.faq-item summary {
  list-style: none; cursor: pointer; padding: 16px 18px; font-weight: 700; font-size: 15px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; transition: color .2s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 22px; font-weight: 800; color: var(--primary); transition: transform .2s; line-height: 1; }
.faq-item[open] summary::after { content: '−'; }
.faq-item[open] summary { color: var(--primary); }
.faq-answer { padding: 0 18px 16px; font-size: 14px; line-height: 1.7; color: var(--text-muted); }

/* =========================================================
   Artikel (kebijakan, syarat, dll)
   ========================================================= */
.article-content { max-width: 820px; background: var(--card, #fff); border: 1px solid var(--border); border-radius: 14px; padding: 26px; }
.article-content h3 { font-size: 17px; font-weight: 800; margin: 22px 0 8px; }
.article-content h3:first-child { margin-top: 0; }
.article-content p, .article-content li { font-size: 14.5px; line-height: 1.8; color: var(--text); }
.article-content ul { padding-left: 22px; margin: 6px 0; }

/* =========================================================
   Buku tamu
   ========================================================= */
.gb-rating { display: flex; gap: 6px; }
.gb-star { font-size: 26px; line-height: 1; cursor: pointer; color: #cbd5e1; transition: color .15s; }
.gb-star:hover, .gb-star:has(input:checked) { color: #f59e0b; }
.gb-star input { position: absolute; opacity: 0; pointer-events: none; }
.gb-card { background: var(--card, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; }
.gb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.gb-cat { padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.gb-saran { background: #dbeafe; color: #1d4ed8; }
.gb-kritik { background: #fee2e2; color: #b91c1c; }
.gb-pertanyaan { background: #dcfce7; color: #15803d; }
.gb-date { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.gb-name { font-weight: 700; font-size: 15px; }
.gb-stars { color: #e2e8f0; font-size: 15px; letter-spacing: 2px; }
.gb-stars .on { color: #f59e0b; }
.gb-msg { margin: 8px 0 0; font-size: 14px; line-height: 1.7; color: var(--text); white-space: pre-line; }
.gb-row { display: flex; gap: 14px; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--border); }
.gb-row:last-child { border-bottom: none; }
.gb-row.gb-hidden { opacity: .55; }
.gb-row-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.gb-badge { padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.gb-badge-pub { background: #dcfce7; color: #15803d; }
.gb-badge-hid { background: #f1f5f9; color: #64748b; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-yellow { background: #fef3c7; color: #b45309; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-gray { background: #e2e8f0; color: #475569; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* =========================================================
   Detail buku
   ========================================================= */
.book-detail { display: grid; grid-template-columns: 260px 1fr; gap: 30px; }
@media (max-width: 760px) { .book-detail { grid-template-columns: 1fr; } }
.book-detail .cover { border-radius: var(--radius); box-shadow: var(--shadow-lg); aspect-ratio: 2/3; object-fit: cover; width: 100%; }
.book-detail h1 { font-size: 28px; font-weight: 800; margin: 0 0 4px; }
.book-detail .author { color: var(--text-muted); font-size: 16px; margin: 0 0 14px; }

.info-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.info-list li { display: flex; gap: 12px; }
.info-list .k { width: 130px; color: var(--text-muted); font-weight: 600; flex-shrink: 0; font-size: 14px; }
.info-list .v { font-weight: 600; }

.desc { color: #334155; margin: 16px 0 0; }

.action-bar { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

/* =========================================================
   Alerts / Flash
   ========================================================= */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.alert-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.alert .close { margin-left: auto; cursor: pointer; background: none; border: none; font-size: 18px; color: inherit; opacity: .7; }
.alert .close:hover { opacity: 1; }

/* =========================================================
   Formulir
   ========================================================= */
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
}
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.form-group label .req { color: var(--danger); }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,92,224,.15); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: auto; }
.form-hint { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; }
.form-error { color: var(--danger); font-size: 13px; margin-top: 5px; font-weight: 600; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

.auth-wrap { max-width: 440px; margin: 50px auto; padding: 0 20px; }
.auth-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 34px; }
.auth-card h1 { font-size: 24px; font-weight: 800; margin: 0 0 4px; }
.auth-card .sub { color: var(--text-muted); margin: 0 0 24px; }
.auth-footer { text-align: center; margin-top: 18px; font-size: 14px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checkbox-row input { width: 16px; height: 16px; }

/* =========================================================
   Tabel
   ========================================================= */
.table-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 12px 16px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-muted); background: #f8fafc; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table tbody tr { transition: background .15s ease; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table .actions .btn-sm { transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.table .actions .btn-sm:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.avatar-sm {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light);
  color: var(--primary); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; flex-shrink: 0;
}
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .nm { font-weight: 700; }
.cell-user .em { font-size: 12px; color: var(--text-muted); }

/* =========================================================
   Kartu statistik
   ========================================================= */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-icon.blue { background: #dbeafe; }
.stat-icon.green { background: #dcfce7; }
.stat-icon.amber { background: #fef3c7; }
  .stat-icon.red { background: #fee2e2; }

  .stat-icon.purple { background: #ede9fe; }
.stat-card .num { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-card .lbl { color: var(--text-muted); font-size: 13px; font-weight: 600; }

/* =========================================================
   Pembaca teraktif (beranda)
   ========================================================= */
.top-readers { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.reader-card {
  position: relative; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 16px 18px; text-align: center; transition: transform .2s ease, box-shadow .2s ease;
}
.reader-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.reader-rank { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 5px; font-weight: 800; font-size: 12.5px; }
.reader-rank i { font-size: 15px; }
.reader-rank.rank-1 { color: #d97706; }
.reader-rank.rank-2 { color: #94a3b8; }
.reader-rank.rank-3 { color: #b45309; }
.reader-avatar {
  width: 72px; height: 72px; border-radius: 50%; margin: 6px auto 12px; overflow: hidden; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary); font-size: 30px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; border: 3px solid var(--border, #e2e8f0);
}
.reader-avatar img { width: 100%; height: 100%; object-fit: cover; }
.reader-name { font-weight: 800; font-size: 16px; margin-bottom: 10px; }
.reader-meta { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
html.dark .reader-card { background: #1e293b; border: 1px solid rgba(255,255,255,.06); }

/* =========================================================
   Sidebar Admin
   ========================================================= */
.admin-shell { display: flex; min-height: calc(100vh - 62px); }
.admin-sidebar {
  width: 240px; background: #0f172a; color: #cbd5e1; padding: 20px 0; flex-shrink: 0;
}
.admin-sidebar .side-brand { padding: 0 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 17px; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 11px 20px; color: #cbd5e1; font-weight: 600; font-size: 14px; }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link.active { background: var(--primary); color: #fff; }
.side-link .ic { font-size: 18px; width: 22px; text-align: center; }
.side-badge {
  margin-left: auto; min-width: 20px; height: 20px; line-height: 20px; padding: 0 6px;
  border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 800;
  text-align: center; animation: popIn .3s cubic-bezier(.22,.68,.38,1);
}
@keyframes popIn { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.admin-main { flex: 1; padding: 26px; min-width: 0; }
@media (max-width: 820px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; padding: 10px 0; display: flex; overflow-x: auto; }
  .admin-sidebar .side-brand { display: none; }
  .side-link { white-space: nowrap; padding: 10px 14px; }
  .admin-main { padding: 16px; }
}

/* =========================================================
   Pagination
   ========================================================= */
.pagination { display: flex; gap: 6px; justify-content: center; margin: 28px 0 0; flex-wrap: wrap; list-style: none; padding: 0; }
.pagination .page-item { list-style: none; }
.pagination a, .pagination span {
  padding: 8px 14px; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; color: var(--text);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .disabled { opacity: .5; }
.pagination .active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Bootstrap pagination adapter */
.pagination .page-item { margin: 0 2px; }
.pagination .page-link { display: inline-block; padding: 8px 14px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; color: var(--text); }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .page-item.disabled .page-link { opacity: .5; color: var(--text-muted); }
.pagination .page-item:not(.disabled):not(.active) .page-link:hover { border-color: var(--primary); color: var(--primary); }

/* Custom pagination (prev/next + numbers) */
.pagination .page-link { display: inline-flex; align-items: center; gap: 6px; }
.pagination .page-link i { font-size: 11px; }
.pagination .page-nav .page-link { font-weight: 700; }
.pagination .page-nav.disabled .page-link { background: var(--bg); }
.pagination .dots { border: none; background: transparent; padding: 8px 2px; letter-spacing: 2px; color: var(--text-muted); cursor: default; }

/* =========================================================
   Reader PDF
   ========================================================= */
.reader-shell { display: flex; flex-direction: column; height: calc(100vh - 62px); background: #1f2937; }
.reader-topbar {
  background: #0f172a; color: #fff; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.reader-topbar .rt-title { font-weight: 700; flex: 1; min-width: 150px; font-size: 14px; }
.reader-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reader-tools .btn { padding: 6px 12px; font-size: 13px; }
.reader-tools #toggleNotes {
  background: #2563eb; border-color: #2563eb; color: #fff;
  box-shadow: 0 2px 12px rgba(37,99,235,.45);
}
.reader-tools #toggleNotes:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.reader-tools #toggleNotes.active { background: #1e40af; border-color: #1e40af; }
.reader-tools input[type=number] { width: 70px; padding: 6px 8px; border-radius: 6px; border: 1px solid #334155; background: #1e293b; color: #fff; text-align: center; }
.reader-tools span { font-size: 13px; color: #cbd5e1; }
.reader-canvas-wrap {
  flex: 1; min-width: 0; overflow: auto; display: flex; justify-content: safe center; padding: 20px;
  background: repeating-linear-gradient(45deg, #2b3444, #2b3444 10px, #29313f 10px, #29313f 20px);
}
.reader-canvas-wrap > canvas { box-shadow: 0 10px 40px rgba(0,0,0,.5); background: #fff; max-width: 100%; }
.reader-loading { color: #cbd5e1; text-align: center; padding: 80px 20px; font-size: 16px; }

/* =========================================================
   Reader: buku satu halaman (format ISO 216, flip realistis)
   ========================================================= */
.book-viewer {
  flex: 0 0 auto; display: flex; width: max-content; min-height: 0;
  align-items: safe center; justify-content: safe center;
}
.book {
  position: relative; perspective: 2600px;
  user-select: none; -webkit-user-select: none; touch-action: pan-x pan-y;
}
.book-stack {
  position: absolute; left: 1.5%; right: 0; top: 3px; bottom: -5px;
  background: #e9edf4; border-radius: 8px; box-shadow: 0 12px 26px rgba(0,0,0,.35);
}
.book-page {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: #fff; overflow: hidden;
  border-radius: 7px;
  box-shadow: 0 14px 40px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.04);
}
.book-page canvas { display: block; width: 100%; height: 100%; }
.book-leaf {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 4; display: none; overflow: hidden;
  border-radius: 7px;
  box-shadow: 0 14px 40px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.04);
  pointer-events: none;
}
.book-leaf canvas { display: block; width: 100%; height: 100%; }
.reader-canvas-wrap.flipping { overflow: hidden; }
/* Kilau halus di lekukan/lipatan (bergerak bersama lipatan) */
.fold-light {
  position: absolute; top: 0; bottom: 0; width: 18%;
  z-index: 5; pointer-events: none; opacity: 0;
  transform-origin: center; will-change: transform;
  background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,.30) 45%, rgba(255,255,255,.38) 55%, rgba(255,255,255,0));
}
/* Bayangan lipatan yang menyapu halaman dasar (mengikuti posisi lipatan) */
.fold-shadow {
  position: absolute; top: 0; bottom: 0; width: 30%;
  z-index: 3; pointer-events: none; opacity: 0;
  transform-origin: center; will-change: transform;
  background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,.30) 42%, rgba(0,0,0,.40) 55%, rgba(0,0,0,0));
}
/* Bayangan dinamis di atas halaman yang sedang dilipat (digerakkan lewat JS) */
.page-shade {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,.30) 40%, rgba(0,0,0,0) 75%);
}

/* =========================================================
   Reader: panel catatan
   ========================================================= */
.reader-shell { position: relative; }
.notes-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
  width: min(360px, 88vw);
  background: #0f172a; color: #e2e8f0;
  box-shadow: -12px 0 32px rgba(0,0,0,.45);
  display: flex; flex-direction: column;
  transform: translateX(105%);
  transition: transform .28s ease;
  border-left: 3px solid #2563eb;
}
.notes-panel.open { transform: translateX(0); }
.notes-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
  background: linear-gradient(90deg, rgba(37,99,235,.28), rgba(37,99,235,.08));
}
.notes-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: #60a5fa; }
.notes-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.notes-new { background: #1e293b; border: 1px solid #334155; border-radius: 10px; padding: 12px; }
.notes-new-meta { font-size: 12px; color: #94a3b8; margin-bottom: 8px; }
.notes-new-meta strong { color: #38bdf8; }
.notes-new textarea {
  width: 100%; background: #0f172a; color: #e2e8f0; border: 1px solid #334155;
  border-radius: 8px; padding: 10px; font-size: 13px; line-height: 1.5;
  resize: vertical; min-height: 74px; box-sizing: border-box;
}
.notes-new textarea:focus { outline: none; border-color: #38bdf8; }
.notes-list-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: #64748b; margin-top: 4px; }
.notes-list { display: flex; flex-direction: column; gap: 10px; }
.notes-empty { font-size: 13px; color: #64748b; text-align: center; padding: 24px 8px; }
.note-item {
  background: #1e293b; border: 1px solid #334155; border-radius: 10px; padding: 10px 12px;
}
.note-item.current { border-color: #38bdf8; box-shadow: 0 0 0 1px rgba(56,189,248,.4); }
.note-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.note-page {
  background: #0ea5e9; color: #fff; border: none; border-radius: 6px;
  padding: 3px 9px; font-size: 11px; font-weight: 700; cursor: pointer;
}
.note-page:hover { background: #0284c7; }
.note-actions { display: flex; gap: 4px; }
.note-btn {
  background: none; border: none; color: #94a3b8; cursor: pointer;
  font-size: 12px; padding: 3px 6px; border-radius: 5px;
}
.note-btn:hover { background: #334155; color: #fff; }
.note-btn-del:hover { background: #7f1d1d; color: #fecaca; }
.note-body { font-size: 13px; line-height: 1.55; color: #e2e8f0; white-space: pre-wrap; word-break: break-word; }
.note-edit {
  width: 100%; background: #0f172a; color: #e2e8f0; border: 1px solid #38bdf8;
  border-radius: 8px; padding: 8px; font-size: 13px; line-height: 1.5; box-sizing: border-box; resize: vertical;
}

/* =========================================================
   Panel / misc
   ========================================================= */
.panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.panel h3 { margin: 0 0 16px; font-size: 18px; font-weight: 800; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-lg { font-size: 17px; }
.font-bold { font-weight: 700; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .ic { font-size: 46px; margin-bottom: 10px; display: inline-block; color: var(--text-muted); animation: floatSoft 4s ease-in-out infinite; }
.empty-state h3 { color: var(--text); margin: 0 0 6px; }
.hidden { display: none !important; }

.tab-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab-filters a {
  padding: 8px 16px; border-radius: 999px; background: var(--white); border: 1px solid var(--border);
  font-weight: 600; font-size: 13px; color: var(--text-muted);
}
.tab-filters a:hover { color: var(--primary); border-color: var(--primary); }
.tab-filters a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.filter-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar .form-control { width: auto; flex: 1; min-width: 160px; }
.filter-bar select.form-control { width: auto; flex: 0 0 auto; }

.category-pills { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.category-pill {
  padding: 10px 20px; background: var(--white); border-radius: 50px; border: 1px solid var(--border);
  font-weight: 700; font-size: 14px; box-shadow: var(--shadow);
}
.category-pill:hover { border-color: var(--primary); color: var(--primary); }
.category-pill .cnt { color: var(--text-muted); font-weight: 600; }

.progress-track { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-track .bar { height: 100%; background: var(--accent); border-radius: 999px; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.feature-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.feature-card .ic { font-size: 34px; margin-bottom: 12px; }
.feature-card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 800; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer { background: #0f172a; color: #94a3b8; font-size: 14px; margin-top: 40px; }
.site-footer a { color: #cbd5e1; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer .foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.5fr; gap: 36px; padding: 44px 0 34px; }
.site-footer .brand { font-size: 18px; margin-bottom: 10px; }
.site-footer .brand span { color: #fff; font-weight: 800; }
.site-footer .foot-desc { margin: 0 0 16px; line-height: 1.6; max-width: 320px; }
.site-footer .foot-donate { margin-bottom: 16px; }
.site-footer .foot-map { border-radius: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); box-shadow: 0 4px 14px rgba(0,0,0,.25); line-height: 0; max-width: 320px; }
.site-footer .foot-map iframe { width: 100%; height: 180px; border: 0; display: block; }
.site-footer .foot-map-addr { display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; margin: 10px 0 0; }
.site-footer .foot-map-addr i { color: var(--primary, #6366f1); margin-top: 3px; width: 16px; flex: 0 0 auto; }
.site-footer h4 { color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 14px; }
.site-footer .foot-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer .foot-links a { display: inline-flex; align-items: center; gap: 6px; }
.site-footer .foot-links a::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #475569; transition: background .15s; }
.site-footer .foot-links a:hover::before { background: var(--primary, #6366f1); }
.site-footer .foot-contact { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.site-footer .foot-contact li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }
.site-footer .foot-contact i { color: var(--primary, #6366f1); margin-top: 3px; width: 16px; flex: 0 0 auto; }
.site-footer .foot-social { display: flex; gap: 10px; margin-top: 16px; }
.site-footer .foot-social a { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); color: #cbd5e1; font-size: 16px; transition: all .15s; }
.site-footer .foot-social a:hover { background: var(--primary, #6366f1); border-color: var(--primary, #6366f1); color: #fff; transform: translateY(-2px); }
.site-footer .copy { text-align: center; border-top: 1px solid rgba(255,255,255,.08); padding: 16px 0; font-size: 13px; }
@media (max-width: 900px) {
  .site-footer .foot-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
}
@media (max-width: 560px) {
  .site-footer .foot-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 640px) {
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .search-box { border-radius: 14px; flex-direction: column; }
  .search-box .btn { border-radius: 12px; }
  .form-actions { flex-direction: column; }
}

/* =========================================================
   Repository
   ========================================================= */
.repo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-top: 18px; }

.repo-card { display: block; background: var(--card, #fff); border: 1px solid var(--border); border-radius: 14px; padding: 18px; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.repo-card:hover { box-shadow: 0 6px 20px rgba(15, 23, 42, .08); transform: translateY(-2px); }

.repo-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }

.repo-type { display: inline-block; background: #e0e7ff; color: #3730a3; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 4px 10px; border-radius: 999px; }

.repo-title { font-size: 17px; font-weight: 800; line-height: 1.35; margin: 0 0 6px; color: var(--heading, #0f172a); }

.repo-author { font-size: 14px; color: var(--muted, #64748b); margin: 0 0 4px; }

.repo-dept { font-size: 12px; color: #475569; margin-bottom: 8px; }

.repo-abstract { font-size: 13px; color: #64748b; line-height: 1.55; margin: 10px 0 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.form-control-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; border: 1px solid var(--border); }

.locked-banner { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, #eef2ff, #f5f3ff); border: 1px dashed #a5b4fc; border-radius: 14px; padding: 20px 24px; margin-top: 24px; }
.locked-banner .ic { font-size: 34px; }
.locked-banner h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.locked-banner p { margin: 0; color: #64748b; font-size: 14px; line-height: 1.5; flex: 1; }
.locked-banner .btn { white-space: nowrap; }
@media (max-width: 640px) {
  .locked-banner { flex-wrap: wrap; }
  .locked-banner .btn { flex: 1; }
}

@media (max-width: 640px) {
  .repo-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   Berita / Pengumuman
   ========================================================= */
.news-card {
  display: block; background: var(--card, #fff); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .25s cubic-bezier(.22,.68,.38,1), box-shadow .25s ease;
}
.news-card:hover { transform: translateY(-5px); box-shadow: 0 14px 30px rgba(15,23,42,.12); }
.news-card:hover .news-title { color: var(--primary); }
.news-thumb { aspect-ratio: 16/9; overflow: hidden; background: var(--primary-light); }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.news-card:hover .news-thumb img { transform: scale(1.06); }
.news-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.news-date { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.news-title { margin: 0; font-size: 16px; font-weight: 800; line-height: 1.35; transition: color .2s ease; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-excerpt { margin: 0; font-size: 13px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-article { background: var(--card, #fff); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.news-article-img { width: 100%; border-radius: 12px; margin-bottom: 16px; max-height: 380px; object-fit: cover; }
.news-meta { display: flex; gap: 8px; margin-bottom: 10px; }
.news-article h1 { font-size: 26px; font-weight: 800; margin: 0 0 10px; line-height: 1.3; }
.news-lead { font-size: 16px; color: #475569; font-weight: 600; margin: 0 0 16px; }
.news-body-text { font-size: 15px; line-height: 1.75; color: #334155; }
.news-body-text p { margin: 0 0 14px; }

/* =========================================================
   Rating & Ulasan
   ========================================================= */
.rating-summary { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; }
.rating-num { font-size: 16px; font-weight: 800; }
.rating-count { font-size: 13px; color: var(--text-muted); }
.review-section { background: var(--card, #fff); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.review-section .section-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 18px; }
.review-form { border: 1px dashed var(--border); border-radius: 12px; padding: 16px; margin-bottom: 20px; }
.review-form textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 14px; margin: 8px 0 12px; background: var(--bg); }
.review-form .form-row { margin-bottom: 8px; }
.review-form .form-row label { font-size: 13px; font-weight: 700; margin-right: 10px; }
.review-form select { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-family: inherit; background: var(--bg); }
.review-list { display: flex; flex-direction: column; gap: 14px; }
.review-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.review-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.review-comment { margin: 8px 0 0; font-size: 14px; line-height: 1.6; color: var(--text); }
.stars { font-size: 16px; line-height: 1; }

/* =========================================================
   Animasi & Transisi
   ========================================================= */
@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
@keyframes heroGrad { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes floatY { 0%, 100% { transform: translateY(0) translateX(0) rotate(0deg); } 50% { transform: translateY(-22px) translateX(14px) rotate(8deg); } }
@keyframes floatSoft { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes shineText { to { background-position: 200% center; } }
@keyframes shineSweep { from { left: -60%; } to { left: 160%; } }
@keyframes searchGlow { 0%, 100% { box-shadow: 0 6px 22px rgba(47,92,224,.35); } 50% { box-shadow: 0 6px 30px rgba(47,92,224,.6); } }
@keyframes underlineGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }

.anim-rise { opacity: 0; animation: rise .7s cubic-bezier(.22,.68,.38,1) both; }
.anim-pop { opacity: 0; animation: pop .5s cubic-bezier(.22,.68,.38,1) both; }

.reveal, .reveal-zoom {
  opacity: 0;
  transition: opacity .65s ease, transform .65s cubic-bezier(.22,.68,.38,1);
}
.reveal { transform: translateY(28px); }
.reveal-zoom { transform: scale(.93); }
.reveal.active, .reveal-zoom.active { opacity: 1; transform: translateY(0) scale(1); }

.d-1 { transition-delay: .06s; } .d-2 { transition-delay: .12s; }
.d-3 { transition-delay: .18s; } .d-4 { transition-delay: .24s; }
.d-5 { transition-delay: .30s; } .d-6 { transition-delay: .36s; }
.d-7 { transition-delay: .42s; } .d-8 { transition-delay: .48s; }

#scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100;
  background: linear-gradient(90deg, #34d399, #2f5ce0, #8b5cf6, #34d399);
  background-size: 200% 100%;
  animation: heroGrad 6s linear infinite;
  box-shadow: 0 0 8px rgba(47,92,224,.6);
  transition: width .1s linear;
}

/* Hero hidup */
.hero { position: relative; overflow: hidden; background-size: 200% 200%; animation: heroGrad 16s ease infinite; }
.hero-blob {
  position: absolute; border-radius: 50%; filter: blur(8px); opacity: .5; pointer-events: none;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.35), transparent 70%);
}
.hero-blob-a { width: 320px; height: 320px; top: -90px; left: -70px; animation: floatY 11s ease-in-out infinite; }
.hero-blob-b { width: 260px; height: 260px; bottom: -80px; right: -50px; animation: floatY 13s ease-in-out infinite reverse; }
.hero-blob-c { width: 150px; height: 150px; top: 60px; right: 16%; animation: floatY 9s ease-in-out infinite; }
.hero h1.anim-rise { animation-delay: .05s; }
.hero p.anim-rise { animation-delay: .15s; }

/* Judul hero: 2 baris di desktop/tablet, 3 baris di smartphone.
   Gradient diterapkan per baris agar background-clip:text tetap
   berfungsi meski baris dijadikan block di layar kecil. */
.hero h1 .hero-line-1,
.hero h1 .hero-line-2,
.hero h1 .hero-line-3 {
  background: linear-gradient(90deg, #ffffff, #c7d2fe, #ffffff, #c7d2fe);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: shineText 3.2s linear infinite;
}
.hero h1 .hero-line-3 { display: block; }

/* 4.8em = ruang 3 baris teks (line-height 1.6) agar tinggi hero/slide tetap sama walau teks 2 baris */
.hero-typed { min-height: 4.8em; }
.hero-typed::after {
  content: ''; display: inline-block; width: 2px; height: 1.05em;
  margin-left: 3px; vertical-align: text-bottom; background: #fff;
  animation: blink 1s step-end infinite;
}
/* Di desktop teks hero dibuat 2 baris saja (tablet/mobile tetap 3 baris) */
@media (min-width: 1025px) {
  .hero p.hero-typed { max-width: 720px; }
}

.search-box { animation: searchGlow 3s ease-in-out infinite; }
.search-box.anim-rise { animation: rise .7s cubic-bezier(.22,.68,.38,1) both, searchGlow 3s ease-in-out 1.1s infinite; }

/* Tombol: sapuan kilau + angkat */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 45%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.38), transparent);
  transform: skewX(-20deg); pointer-events: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:hover::after { animation: shineSweep .55s ease; }

/* Nav: garis bawah animasi */
.nav-link { position: relative; transition: background .15s, color .15s, transform .15s; }
.nav-link::after {  content: ''; position: absolute; left: 14px; right: 14px; bottom: 5px; height: 2px;
  border-radius: 2px; background: #fff; transform: scaleX(0); transform-origin: left;
  transition: transform .25s ease;
}
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

/* Badge jumlah notifikasi di nav */
.nav-badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px;
  margin-left: 4px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px;
  font-weight: 800; text-align: center; vertical-align: middle; }

/* Baris notifikasi belum dibaca */
.notif-unread { background: rgba(255, 193, 7, .06); }
.notif-unread td:first-child { border-left: 3px solid #f59e0b; }

/* Judul seksi: garis aksen animasi */
.section-head h2 { position: relative; padding-bottom: 10px; }
.section-head h2::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: 46px; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform-origin: left; animation: underlineGrow .8s ease both;
}

/* Kartu: interaksi halus */
.book-card { transition: transform .25s cubic-bezier(.22,.68,.38,1), box-shadow .25s ease; }
.book-cover-wrap { overflow: hidden; }
.book-cover { transition: transform .5s ease; }
.book-card:hover .book-cover { transform: scale(1.07); }
.book-card:hover { transform: translateY(-6px); box-shadow: 0 16px 36px rgba(15,23,42,.16); }
.book-card:hover .book-title { color: var(--primary); }
.book-title { transition: color .2s ease; }

.feature-card, .stat-card, .category-pill, .repo-card {
  transition: transform .25s cubic-bezier(.22,.68,.38,1), box-shadow .25s ease, border-color .25s ease;
}
.feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.feature-card .ic { display: inline-block; transition: transform .3s ease; }
.feature-card:hover .ic { transform: scale(1.18) rotate(-6deg); }
.category-pill:hover { transform: translateY(-2px) scale(1.04); }
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.repo-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(15,23,42,.1); }
.repo-card:hover .repo-title { color: var(--primary); }
.repo-title { transition: color .2s ease; }

.badge-gray, .badge-yellow { transition: transform .2s ease; }
.repo-card:hover .badge-gray { animation: wiggle .4s ease; }

/* Pastikan fade+slide kartu reveal tetap berjalan walau kelas kartu menimpa transition */
.reveal, .reveal-zoom {
  transition: opacity .65s ease, transform .65s cubic-bezier(.22,.68,.38,1), box-shadow .3s ease, border-color .3s ease;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  .reveal, .reveal-zoom, .anim-rise, .anim-pop { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
}

/* =========================================================
   Dark mode
   ========================================================= */
html.dark {
  --primary: #7aa2ff;
  --primary-dark: #9db8ff;
  --primary-light: #1e2a4a;
  --accent: #34d399;
  --accent-dark: #2bb68a;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --bg: #0f172a;
  --white: #1e293b;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .45);
}

html.dark .section-alt { background: #1e293b; }
html.dark .search-box { background: #0f172a; border: 1px solid var(--border); }
html.dark .form-control { background: #0f172a; border-color: var(--border); color: var(--text); }
html.dark .form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(122, 162, 255, .2); }
html.dark .table th { background: #172033; }
html.dark .table tbody tr:hover { background: #172033; }
html.dark .desc, html.dark .news-body-text { color: #cbd5e1; }
html.dark .gb-badge-hid { background: #172033; color: #94a3b8; }
html.dark .notif-unread { background: rgba(255, 193, 7, .08); }
html.dark .gb-star { color: #475569; }
html.dark .theme-toggle { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25); }
html.dark .filter-bar { background: var(--card, #1e293b); }

/* =========================================================
   Tombol ganti tema
   ========================================================= */
.theme-toggle {
  background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .3); color: #fff;
  border-radius: 999px; width: 38px; height: 38px; font-size: 17px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  transition: background .2s, transform .2s; flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .28); transform: rotate(20deg) scale(1.05); }



/* =========================================================
   Header responsif (hamburger menu)
   ========================================================= */
.navbar { position: relative; }

.navbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.nav-toggle {
  display: none;
  width: 38px; height: 38px;
  padding: 0;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: 10px;
  font-size: 17px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s, transform .2s;
}
.nav-toggle:hover { background: rgba(255,255,255,.28); }
.nav-toggle .fa-xmark { display: none; }
.nav-toggle.open .fa-bars { display: none; }
.nav-toggle.open .fa-xmark { display: block; }

.nav-menu { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-menu .nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.nav-divider { width: 1px; height: 24px; background: rgba(255,255,255,.25); margin: 0 8px; flex-shrink: 0; }
.logout-form { display: inline; }
.nav-user { color: #c7d2fe; padding: 0 4px; white-space: nowrap; font-weight: 600; font-size: 14px; }

/* Dropdown submenu "Informasi" */
.nav-drop { position: relative; }
.nav-drop-toggle { background: none; border: none; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.nav-drop-caret { font-size: 12px; transition: transform .2s; }
.nav-drop-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 190px;
  padding: 10px;
  background: #16213e;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15,23,42,.4);
  display: none;
  flex-direction: column;
  z-index: 60;
}
.nav-drop.open .nav-drop-menu { display: flex; }
.nav-drop.open .nav-drop-caret { transform: rotate(180deg); }
.nav-drop-menu .nav-link { white-space: nowrap; padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.nav-drop-menu .nav-link:hover { background: rgba(255,255,255,.1); }
.nav-drop-menu .nav-link.active { background: rgba(255,255,255,.18); }
.nav-drop-sep { height: 1px; background: rgba(255,255,255,.12); margin: 6px 4px; }
.nav-drop-link {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; padding: 10px 12px;
  color: #e2e8f0; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  text-align: left; white-space: nowrap; border-radius: 8px;
}
.nav-drop-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-avatar {
  width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: rgba(255,255,255,.18); display: inline-flex; align-items: center;
  justify-content: center; font-size: 14px;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-avatar-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 1025px) {
  .nav-drop:hover .nav-drop-menu { display: flex; }
  .nav-drop:hover .nav-drop-caret { transform: rotate(180deg); }
  .navbar { min-height: 79px; }
}

@media (max-width: 1024px) {
  .nav-drop { width: 100%; }
  .nav-drop-toggle { width: 100%; justify-content: space-between; }
  .nav-drop-menu {
    position: static;
    background: rgba(255,255,255,.06);
    border: none;
    border-radius: 10px;
    box-shadow: none;
    padding: 4px;
  }
  .nav-drop-menu .nav-link { white-space: normal; }
}

@media (max-width: 1024px) {
  .nav-toggle { display: flex; }
  .navbar { position: static; flex-wrap: nowrap; min-height: 51px; }
  .site-header.scrolled .navbar { padding: 0; }

  #nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(15,23,42,.38);
    -webkit-backdrop-filter: blur(7px);
    backdrop-filter: blur(7px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s;
    pointer-events: none;
  }
  #nav-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  .nav-menu {
    display: flex;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(330px, 75%);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-left: 0;
    background: rgba(255,255,255,.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-left: 1px solid rgba(226,232,240,.9);
    box-shadow: -18px 0 40px rgba(15,23,42,.22);
    padding: 84px 16px 20px;
    max-height: 100vh;
    overflow-y: auto;
    transform: translateX(105%);
    transition: transform .25s ease, visibility .25s;
    visibility: hidden;
    z-index: 40;
  }
  .nav-menu.open { transform: translateX(0); visibility: visible; }

  .nav-menu .nav-links {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 2px;
    padding: 6px 0;
  }
  .nav-menu .nav-links .nav-link {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 10px;
    font-size: 15px;
    color: #0f172a;
  }
  .nav-menu .nav-links .nav-link:hover { background: rgba(37,99,235,.08); color: #0f172a; }
  .nav-menu .nav-links .nav-link.active { background: rgba(37,99,235,.12); color: #0f172a; }
  .nav-menu .nav-link::after { background: linear-gradient(90deg, var(--primary), var(--accent)); }

  .nav-divider { width: 100%; height: 1px; background: #e2e8f0; margin: 4px 0; }

  .nav-menu .nav-links .btn { width: 100%; justify-content: center; margin-top: 6px; }
  .nav-menu .btn-light { background: #ffffff; color: var(--primary); border-color: #cbd5e1; }
  .nav-menu .btn-light:hover { background: #f1f5f9; color: var(--primary); }
  .logout-form { display: block; width: 100%; }
  .nav-menu .logout-form .btn { width: 100%; }
  .nav-user { display: block; text-align: center; padding: 10px 0 2px; color: #475569; }
  .nav-avatar { background: #e2e8f0; color: #475569; }
  .nav-avatar-name { color: #0f172a; }

  .nav-drop { width: 100%; }
  .nav-drop-toggle { width: 100%; justify-content: space-between; color: #0f172a; }
  .nav-drop-menu {
    position: static;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: none;
    padding: 4px;
  }
  .nav-drop-menu .nav-link { white-space: normal; color: #334155; }
  .nav-drop-menu .nav-link:hover { background: rgba(37,99,235,.08); color: #0f172a; }
  .nav-drop-menu .nav-link.active { background: rgba(37,99,235,.12); color: #0f172a; }
  .nav-drop-link { color: #334155; }
  .nav-drop-link:hover { background: rgba(37,99,235,.08); color: #0f172a; }
  .nav-drop-sep { background: #e2e8f0; }
}

/* Logo & tagline selalu terlihat, menyesuaikan lebar perangkat */
.brand-logo { height: 40px; width: auto; margin-right: 0; }

/* Header sedikit lebih lebar agar logo + semua menu + tombol tema tetap satu baris (ukuran asli) */
.site-header .container { max-width: 1280px; }


@media (max-width: 640px) {
  .site-header .brand { flex: 1; min-width: 0; font-size: 21px; gap: 12px; }
  .site-header .brand > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .site-header .brand small {
    display: block; margin-top: 4px; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: 10px; letter-spacing: 1.5px; color: #c7d2fe;
  }
  .site-header .brand-logo { height: 36px; }
  .site-header .admin-user { display: none; }
  .navbar { gap: 12px; padding: 20px 0; min-height: 50px; }
  .container { padding: 0 16px; }
  main > .container { padding-top: 16px; }
}

@media (max-width: 400px) {
  .site-header .brand { font-size: 18px; gap: 10px; }
  .site-header .brand-logo { height: 32px; }
  .site-header .brand small { font-size: 9px; letter-spacing: 1px; }
  .navbar { gap: 10px; min-height: 50px; }
}

/* =========================================================
   Modal (dialog) sederhana
   ========================================================= */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .55);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #eef1f6;
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-close { background: none; border: none; font-size: 22px; color: #94a3b8; cursor: pointer; line-height: 1; }

/* Modal konfirmasi */
.confirm-modal .confirm-msg { margin: 0; font-size: 15px; color: var(--text-muted); line-height: 1.6; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
html.dark .modal { background: #1e293b; }
html.dark .modal-head { border-bottom-color: #334155; }
html.dark .modal-head h3 { color: var(--text); }
html.dark .confirm-modal .confirm-msg { color: #cbd5e1; }

.gb-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; background: var(--card, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 12px 18px; margin-bottom: 18px; }
.gb-sum-label { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.gb-sum-item { font-size: 13px; color: var(--text-muted); }
.gb-sum-item b { color: var(--text); margin-left: 2px; }

/* =========================================================
   Transisi antar halaman (murni CSS, didukung Chrome/Edge 126+)
   ========================================================= */
@view-transition { navigation: auto; }

::view-transition-old(root) {
  animation: vtOut .22s ease both;
}
::view-transition-new(root) {
  animation: vtIn .32s cubic-bezier(.22,.68,.38,1) both;
}
@keyframes vtOut {
  to { opacity: 0; transform: translateY(6px); }
}
@keyframes vtIn {
  from { opacity: 0; transform: translateY(10px); }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* =========================================================
   Scrollbar kustom halus (Firefox + WebKit)
   ========================================================= */
html { scrollbar-width: thin; scrollbar-color: #c7d2fe transparent; }
html.dark { scrollbar-color: #334155 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #c7d2fe; border-radius: 999px; border: 2px solid var(--bg);
}
html.dark ::-webkit-scrollbar-thumb { background: #334155; border-color: var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #a5b4fc; }
html.dark ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* =========================================================
   Tombol kembali ke atas
   ========================================================= */
#back-to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 16px;
  box-shadow: 0 8px 22px rgba(47, 92, 224, .35);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s, background .2s ease;
}
#back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
#back-to-top:hover { background: var(--primary-dark); transform: translateY(-3px); }
html.dark #back-to-top { color: #0f172a; }
#back-to-top:active { transform: scale(.94); }

/* =========================================================
   Toast notifikasi melayang (kanan atas)
   ========================================================= */
.toast-stack {
  position: fixed; top: 18px; right: 18px; z-index: 120;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(360px, calc(100vw - 36px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--white, #fff); color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 12px; padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(15,23,42,.16);
  animation: toastIn .35s cubic-bezier(.22,.68,.38,1) both;
}
.toast-ic { font-size: 18px; margin-top: 1px; flex-shrink: 0; }
.toast-msg { font-size: 14px; line-height: 1.45; word-break: break-word; }
.toast-close {
  margin-left: auto; cursor: pointer; background: none; border: none;
  font-size: 18px; line-height: 1; color: var(--text-muted);
  padding: 0 2px; flex-shrink: 0;
}
.toast-close:hover { color: var(--text); }
.toast-success { border-left-color: var(--accent); } .toast-success .toast-ic { color: var(--accent); }
.toast-error { border-left-color: var(--danger); } .toast-error .toast-ic { color: var(--danger); }
.toast-info { border-left-color: var(--info); } .toast-info .toast-ic { color: var(--info); }
.toast-warning { border-left-color: var(--warning); } .toast-warning .toast-ic { color: var(--warning); }
.toast.out { animation: toastOut .3s ease both; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px); }
}
@media (max-width: 640px) {
  .toast-stack { top: auto; bottom: 16px; right: 16px; left: 16px; max-width: none; }
}

/* =========================================================
   Loader navigasi (bar atas saat pindah halaman)
   ========================================================= */
#page-loader {
  position: fixed; top: 0; left: 0; right: 0; z-index: 130;
  height: 3px; pointer-events: none;
  opacity: 0; transition: opacity .25s ease;
  overflow: hidden; display: none;
}
#page-loader.on { display: block; opacity: 1; }
#page-loader::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0;
  width: 40%; border-radius: 0 2px 2px 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  animation: loaderSweep 1.1s ease-in-out infinite;
}
@keyframes loaderSweep {
  0% { left: -40%; }
  100% { left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #page-loader { display: none !important; }
}

/* =========================================================
   Responsive menyeluruh — tablet, smartphone, & semua ukuran
   ========================================================= */

/* Tablet / laptop kecil (≤ 1024px) */
@media (max-width: 1024px) {
  .container { padding: 0 18px; }
  .page-title { font-size: 23px; }
  .hero h1 { font-size: clamp(22px, 3.6vw, 34px); }
}

/* Tablet portrait (≤ 820px) */
@media (max-width: 820px) {
  .section { padding: 34px 0; }
  .hero { padding: 46px 0 56px; }
  .hero p { font-size: 15.5px; }
  .hero-stats { gap: 26px; margin-top: 28px; }
  .hero-stat .num { font-size: 24px; }
  .section-head h2 { font-size: 20px; }
  .book-detail h1 { font-size: 24px; }
  .panel, .form-card { padding: 20px; }
  .auth-card { padding: 26px 22px; }
  .article-content { padding: 20px; }
  .admin-main { padding: 18px; }
  .chart-bars { height: 220px; padding: 14px 12px 8px; gap: 10px; }
  .cat-name { flex-basis: 150px; }
  .book-grid { gap: 16px; }
  .h-track .book-card { flex-basis: 185px; }
}

/* Smartphone (≤ 640px) */
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  main > .container { padding-top: 12px; }

  .page-title { font-size: 20px; }
  .page-subtitle { margin-bottom: 18px; font-size: 13.5px; }

  .hero { padding: 34px 0 42px; }
  .hero h1 { font-size: 19px; }
  .hero h1 .hero-line-1 { display: block; }
  .hero p { font-size: 14px; margin-bottom: 18px; }
  .hero-stats { gap: 14px; margin-top: 24px; }
  .hero-stat .num { font-size: 18px; }
  .hero-stat .lbl { font-size: 11.5px; }
  .hero-blob-a, .hero-blob-b { display: none; }
  .hero-blob-c { width: 110px; height: 110px; }
  .search-box input { padding: 11px 14px; font-size: 14px; }
  .search-box .btn { width: 100%; padding: 11px 18px; }

  .section { padding: 28px 0; }
  .section-head { gap: 8px; margin-bottom: 16px; }
  .section-head h2 { font-size: 18px; }
  .section-head > .btn { width: 100%; margin-top: 2px; }

  .feature-card { padding: 20px; }
  .feature-card .ic { font-size: 28px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; }
  .stat-card .num { font-size: 19px; }
  .top-readers { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
  .reader-card { padding: 20px 12px 14px; }
  .reader-avatar { width: 60px; height: 60px; font-size: 24px; }
  .reader-name { font-size: 14.5px; }

  /* Filter bar: satu baris horizontal seperti tablet, bisa digeser (swipe) */
  .filter-bar { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar .form-control, .filter-bar select.form-control { flex: 0 0 auto; width: auto; min-width: 165px; }
  .filter-bar input.form-control[type="text"] { flex: 0 0 auto; width: auto; min-width: 215px; }
  .filter-bar .btn { flex: 0 0 auto; width: auto; white-space: nowrap; }

  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }

  .auth-wrap { margin: 26px auto; padding: 0 14px; }
  .auth-card { padding: 22px 18px; }
  .auth-card h1 { font-size: 21px; }

  .panel, .form-card, .article-content, .news-article, .review-section { padding: 16px; }
  .modal-body { padding: 16px; }
  .quick-body { padding: 16px; }
  .contact-card { padding: 16px; }

  .table th, .table td { padding: 10px 12px; }
  .table-card { border-radius: 10px; }

  .book-detail { gap: 18px; }
  .book-detail .cover { max-width: 240px; margin: 0 auto; }
  .book-detail h1 { font-size: 21px; }
  .info-list li { flex-wrap: wrap; gap: 2px 10px; }
  .info-list .k { width: 100%; }

  .chart-bars { height: 200px; gap: 8px; }
  .chart-label { font-size: 10px; }
  .cat-name { flex-basis: 100px; }

  .news-article h1 { font-size: 21px; }
  .news-lead { font-size: 14.5px; }
  .news-article-img { max-height: 220px; }

  .locked-banner { padding: 16px 18px; }
  .locked-banner .ic { font-size: 26px; }

  .rp-item { gap: 10px; }
  .rp-item .badge { font-size: 11px; }

  /* Header umum: tombol aksi menjadi satu kolom */
  .flex-between { align-items: stretch; }
  .flex-between > .flex { width: 100%; flex-direction: column; align-items: stretch; gap: 8px; }
  .flex-between > .flex .btn { width: 100%; }
  .flex-between > .btn { width: 100%; }

  .gb-summary { padding: 10px 14px; }
  .gb-row { flex-direction: column; gap: 10px; }
  .gb-row-actions { justify-content: flex-start; }

  .pagination { gap: 5px; }
  .pagination .page-link { padding: 7px 11px; font-size: 13px; }
  .pagination .page-nav .page-link { padding: 7px 10px; }

  .reader-canvas-wrap { padding: 12px; }
  .reader-topbar { padding: 8px 10px; gap: 8px; }
  .reader-tools .btn { padding: 5px 10px; font-size: 12px; }

  .category-pill { padding: 8px 14px; font-size: 13px; }
}

/* Smartphone kecil (≤ 400px) */
@media (max-width: 400px) {
  .container { padding: 0 12px; }
  .page-title { font-size: 19px; }
  .hero h1 { font-size: 17px; }
  .hero p { font-size: 13.5px; }
  .book-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .book-body { padding: 10px 12px 12px; }
  .book-title { font-size: 13.5px; }
  .book-cat { font-size: 10px; }
  .book-author { font-size: 12px; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 12px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .stat-card .num { font-size: 18px; }
  .btn { padding: 9px 14px; font-size: 13.5px; }
  .h-track .book-card { flex-basis: 155px; }
  .auth-card { padding: 20px 14px; }
  .pagination .page-nav .page-link { padding: 7px 8px; font-size: 12px; }
}
