/* Materi (buku belajar) - semua selektor di bawah .cbtm; bergantung pada cbtp-packages.css */

/* ===== Sampul buku ===== */
.cbtm .cbtm-cover { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 3px 10px 10px 3px; background: #e2e8f0; box-shadow: 0 12px 26px rgba(15, 23, 42, .24), inset -2px 0 0 rgba(0, 0, 0, .08); }
.cbtm .cbtm-cover::before { content: ""; position: absolute; z-index: 2; left: 0; top: 0; bottom: 0; width: 9%; background: linear-gradient(90deg, rgba(0, 0, 0, .3), rgba(255, 255, 255, .14) 55%, rgba(0, 0, 0, .06)); pointer-events: none; }
.cbtm .cbtm-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cbtm .cbtm-cover-gen { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; padding: 14% 11% 11% 17%; color: #fff; background: linear-gradient(155deg, hsl(var(--h), 62%, 38%), hsl(calc(var(--h) + 40), 58%, 22%)); }
.cbtm .cbtm-cover-ico .cbtp-ico { width: 28px; height: 28px; opacity: .85; }
.cbtm .cbtm-cover-title { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; margin-top: auto; font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: clamp(14px, 1.7vw, 20px); line-height: 1.22; overflow-wrap: anywhere; }
.cbtm .cbtm-cover-author { font-size: 11px; opacity: .85; overflow-wrap: anywhere; }
.cbtm .cbtm-author { font-size: 13px; color: var(--p-muted); }

/* ===== Rak buku (daftar) ===== */
.cbtm .cbtm-shelf { align-items: stretch; }
.cbtm .cbtm-book { padding-top: 24px; background: linear-gradient(180deg, #eef2f7 0, #eef2f7 58%, #fff 58%); }
.cbtm .cbtm-book > .cbtm-cover { width: 52%; max-width: 190px; margin: 0 auto 4px; }
.cbtm .cbtm-book .cbtp-card-body { background: #fff; }
.cbtm .cbtm-actions { display: grid; gap: 8px; margin-top: auto; }

/* ===== Detail ===== */
.cbtm-hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: center; margin-bottom: 18px; padding: 24px; background: linear-gradient(135deg, #eef2f7, #fff); border: 1px solid var(--p-line); border-radius: 16px; }
.cbtm-hero-info { display: grid; gap: 10px; min-width: 0; }
.cbtm-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.cbtm-toc-list { display: grid; gap: 6px; list-style: none; }
.cbtm .cbtm-toc-list a { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--p-bg); color: var(--p-text); text-decoration: none; }
.cbtm .cbtm-toc-list a:hover { background: var(--p-brand-soft); }
.cbtm-toc-no { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--p-brand-dark); font-weight: 800; font-size: 13px; }
.cbtm-toc-t { font-weight: 600; word-break: break-word; }
.cbtm-toc-m { font-size: 12px; color: var(--p-muted); white-space: nowrap; }

/* ===== Pembaca ===== */
.cbtm-reader { --cbtm-fs: 18px; --r-bg: #f1f5f9; --r-paper: #fff; --r-text: #1f2937; --r-muted: #64748b; --r-line: #e2e8f0; --r-link: #1d4ed8; --r-soft: #eef2ff; position: relative; padding-bottom: 8px; background: var(--r-bg); border-radius: 16px; }
.cbtm-reader[data-theme="night"] { --r-bg: #0b1220; --r-paper: #111c33; --r-text: #e2e8f0; --r-muted: #94a3b8; --r-line: #243352; --r-link: #93c5fd; --r-soft: #16233f; }
.cbtm-reader[data-theme="night"] .cbtp-btn:not(.cbtp-btn-primary) { background: #1e293b; border-color: #334155; color: #e2e8f0; }
.cbtm-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--r-paper); color: var(--r-text); border-bottom: 1px solid var(--r-line); border-radius: 16px 16px 0 0; }
.cbtm .cbtm-bar a.cbtm-bar-back { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 10px; border-radius: 10px; color: var(--r-link); font-weight: 600; text-decoration: none; white-space: nowrap; }
.cbtm-bar-mid { flex: 1; min-width: 0; display: grid; }
.cbtm-bar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14px; }
.cbtm-bar-pos { font-size: 12px; color: var(--r-muted); }
.cbtm-tools { display: flex; gap: 6px; }
.cbtm-tools button { min-width: 40px; min-height: 40px; padding: 4px 10px; border: 1px solid var(--r-line); border-radius: 10px; background: transparent; color: var(--r-text); font: inherit; font-weight: 700; cursor: pointer; }
.cbtm-tools button:hover, .cbtm-tools button[aria-pressed="true"], .cbtm-tools button[aria-expanded="true"] { background: var(--p-brand); border-color: var(--p-brand); color: #fff; }
.cbtm-toc-btn { display: none; }
.cbtm-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; }
.cbtm-progress span { display: block; width: 0; height: 100%; background: var(--p-brand); transition: width .1s linear; }
.cbtm-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px; align-items: start; padding: 18px; }
.cbtm-toc { position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow-y: auto; padding: 14px; background: var(--r-paper); color: var(--r-text); border: 1px solid var(--r-line); border-radius: 14px; }
.cbtm-toc-title { margin-bottom: 8px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--r-muted); }
.cbtm-toc ol { display: grid; gap: 2px; list-style: none; }
.cbtm .cbtm-toc a { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 8px; border-radius: 8px; color: var(--r-text); font-size: 14px; text-decoration: none; }
.cbtm .cbtm-toc a:hover { background: var(--r-soft); }
.cbtm-toc li.is-current a { background: var(--r-soft); color: var(--r-link); font-weight: 700; }
.cbtm-toc .cbtm-toc-no { width: 24px; height: 24px; font-size: 12px; background: var(--r-bg); color: var(--r-muted); }
.cbtm-page { min-width: 0; padding: 38px clamp(18px, 5vw, 60px) 30px; background: var(--r-paper); color: var(--r-text); border: 1px solid var(--r-line); border-radius: 14px; box-shadow: 0 6px 20px rgba(15, 23, 42, .06); }
.cbtm-kicker { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--p-brand); }
.cbtm .cbtm-chtitle { margin: 6px 0 22px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(24px, 4vw, 34px); line-height: 1.25; color: var(--r-text); }
.cbtm .cbtm-prose { max-width: 70ch; font-family: Georgia, "Times New Roman", serif; font-size: var(--cbtm-fs); line-height: 1.85; color: var(--r-text); overflow-wrap: anywhere; }
.cbtm .cbtm-prose p { margin: 0 0 1.1em; }
.cbtm .cbtm-prose h2, .cbtm .cbtm-prose h3, .cbtm .cbtm-prose h4 { margin: 1.6em 0 .6em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.3; color: var(--r-text); }
.cbtm .cbtm-prose h2 { font-size: 1.35em; padding-bottom: .25em; border-bottom: 2px solid var(--r-line); }
.cbtm .cbtm-prose h3 { font-size: 1.15em; }
.cbtm .cbtm-prose h4 { font-size: 1em; }
.cbtm .cbtm-prose ul, .cbtm .cbtm-prose ol { margin: 0 0 1.1em; padding-left: 1.5em; }
.cbtm .cbtm-prose li { margin-bottom: .35em; }
.cbtm .cbtm-prose blockquote { margin: 1.3em 0; padding: .5em 1.1em; border-left: 4px solid var(--p-brand); background: var(--r-soft); font-style: italic; }
.cbtm .cbtm-prose blockquote p { margin: 0; }
.cbtm .cbtm-prose img { max-width: 100%; height: auto; border-radius: 8px; }
.cbtm .cbtm-prose a { color: var(--r-link); }
.cbtm .cbtm-prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0 0 1.1em; font-size: .92em; }
.cbtm .cbtm-prose th, .cbtm .cbtm-prose td { padding: 7px 11px; border: 1px solid var(--r-line); text-align: left; }
.cbtm .cbtm-prose th { background: var(--r-soft); }
.cbtm-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--r-line); }
.cbtm-finish { display: grid; justify-items: start; gap: 8px; margin-top: 24px; padding: 18px; background: var(--r-soft); border-radius: 12px; }
.cbtm-finish p { color: var(--r-muted); font-size: 14px; }

@media (max-width: 1024px) {
  .cbtm-hero { grid-template-columns: 180px minmax(0, 1fr); gap: 20px; }
  .cbtm-layout { grid-template-columns: 1fr; }
  .cbtm-toc-btn { display: inline-flex; align-items: center; justify-content: center; }
  .cbtm-toc { display: none; position: static; max-height: 50vh; }
  .cbtm-toc.is-open { display: block; }
}
@media (max-width: 640px) {
  .cbtm-hero { grid-template-columns: 1fr; padding: 16px; text-align: left; }
  .cbtm-hero-cover { width: 150px; margin: 0 auto; }
  .cbtm-hero-actions .cbtp-btn { flex: 1 1 100%; }
  .cbtm-bar { gap: 6px; padding: 8px; }
  .cbtm-bar-back span { display: none; }
  .cbtm-tools { gap: 4px; }
  .cbtm-tools button { min-width: 38px; padding: 4px 8px; }
  .cbtm-layout { padding: 10px; }
  .cbtm-page { padding: 24px 16px 20px; }
  .cbtm-pager .cbtp-btn { flex: 1; }
  .cbtm-pager > span { display: none; }
}
@media print { .cbtm-bar, .cbtm-toc, .cbtm-pager, .cbtm-finish { display: none !important; } .cbtm-layout { display: block; padding: 0; } .cbtm-page { border: 0; box-shadow: none; } }
