/* ═══════════════════════════════════════════════════════
   GMNIBook Reader — 3-column layout with PDF.js iframe
   ═══════════════════════════════════════════════════════ */

/* ── Sembunyikan site-header (adminbar) di halaman reader ── */
.site-header { display: none !important; }

/* ── Layout utama ── */
.gbr-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  min-height: 100vh;
  background: #1e1e1e;
  align-items: start;
}

/* ══ KOLOM KIRI ══ */
.gbr-left {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1;
  overflow-y: auto;
  background: #161616;
  border-right: 1px solid #2a2a2a;
}
.gbr-left::-webkit-scrollbar { width: 4px; }
.gbr-left::-webkit-scrollbar-thumb { background: #333; border-radius: 99px; }

.gbr-left-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 16px 80px;
}

.gbr-left-cover {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
}
.gbr-left-cover-placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  background: #2a2a2a;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
}
.gbr-left-cover-placeholder svg { width: 48px; height: 48px; }

.gbr-left-title {
  font-size: 15px;
  font-weight: 700;
  color: #f0f0f0;
  line-height: 1.4;
  margin: 0;
}
.gbr-left-author {
  font-size: 13px;
  color: #c41e1e;
  font-weight: 600;
}

.gbr-left-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.gbr-left-cat {
  font-size: 11px;
  background: #c41e1e22;
  color: #e84545;
  border: 1px solid #c41e1e44;
  border-radius: 4px;
  padding: 2px 8px;
  text-decoration: none;
  transition: background .2s;
}
.gbr-left-cat:hover { background: #c41e1e44; }

.gbr-left-info { display: flex; flex-direction: column; gap: 6px; }
.gbr-left-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  border-bottom: 1px solid #252525;
  padding-bottom: 5px;
}
.gbr-left-info-label { color: #666; }
.gbr-left-info-val { color: #ccc; font-weight: 500; }
.gbr-left-info-val .gbs-uploader-link {
  color: #ccc;
  text-decoration: none;
  transition: color .2s, letter-spacing .2s;
}
.gbr-left-info-val .gbs-uploader-link:hover {
  color: var(--red);
  letter-spacing: .3px;
}

.gbr-left-desc {
  font-size: 12px;
  color: #888;
  line-height: 1.7;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gbr-left-desc.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}
.gbr-left-desc-toggle {
  background: none;
  border: none;
  color: #c41e1e;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  margin-top: 4px;
  text-align: left;
}
.gbr-left-desc-toggle:hover { text-decoration: underline; }

.gbr-left-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.gbr-left-tag {
  font-size: 11px;
  color: #666;
  background: #252525;
  border-radius: 4px;
  padding: 2px 7px;
}

.gbr-left-detail-link {
  font-size: 12px;
  color: #555;
  text-decoration: none;
  transition: color .2s;
}
.gbr-left-detail-link:hover { color: #aaa; }

/* ══ KOLOM TENGAH ══ */
.gbr-center {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 1;
  border-right: 1px solid #2a2a2a;
}

/* ── Bar atas (back + judul + download) ── */
.gbr-center-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 12px;
  background: #111;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
}

.gbr-bar-back {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #888;
  text-decoration: none;
  font-size: 12px;
  flex-shrink: 0;
  transition: color .2s;
}
.gbr-bar-back:hover { color: #fff; }

.gbr-bar-title {
  flex: 1;
  font-size: 13px;
  color: #bbb;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gbr-bar-download {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #c41e1e;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s;
  flex-shrink: 0;
}
.gbr-bar-download:hover { background: #a01818; }

/* ── Resume bar ── */
.gbr-resume-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 16px;
  background: #c41e1e18;
  border-bottom: 1px solid #c41e1e33;
  font-size: 13px;
  color: #ddd;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.gbr-resume-bar strong { color: #e84545; }
.gbr-resume-actions { display: flex; gap: 6px; }
.gbr-resume-yes,
.gbr-resume-no {
  padding: 4px 12px;
  border-radius: 5px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.gbr-resume-yes { background: #c41e1e; color: #fff; }
.gbr-resume-no  { background: #333; color: #aaa; }


/* ── PDF.js iframe ── */
.gbr-iframe {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
  background: #323639;
}

/* ══ Preview mode (non-login) ══ */
.gbr-center--preview {
  position: static !important;
  height: auto !important;
  overflow: visible !important;
}
.gbr-center--preview .gbr-iframe {
  flex: none !important;
  height: 260vh; /* fallback sebelum JS mengukur */
}

/* ── Locked page Scribd-style ── */
.gbr-locked-page {
  position: relative;
  width: 100%;
  height: 420px;
  background: #323639;
  overflow: hidden;
}
.gbr-locked-blur {
  position: absolute;
  inset: 0;
  padding: 32px 48px;
  background: #f5f0e8;
  filter: blur(4px);
  opacity: .6;
  pointer-events: none;
}
.gbr-locked-lines {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.gbr-locked-line {
  height: 12px;
  background: #555;
  border-radius: 3px;
}
.gbr-locked-line:nth-child(odd)  { width: 100%; }
.gbr-locked-line:nth-child(even) { width: 85%; }
.gbr-locked-line:nth-child(3n)   { width: 92%; }

/* Gradient fade dari atas (nyambung dari iframe) */
.gbr-locked-fade {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 160px;
  background: linear-gradient(to bottom, #323639 0%, transparent 100%);
  pointer-events: none;
}

/* CTA box di tengah */
.gbr-locked-cta {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
}
.gbr-locked-cta-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: #c41e1e;
  border-radius: 10px;
  padding: 24px 32px;
  max-width: 340px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.gbr-locked-cta-card svg { color: #fff; opacity: .9; }
.gbr-locked-cta-card p { margin: 0; font-size: 14px; color: #fff; }
.gbr-locked-cta-card p strong { color: #fff; font-weight: 800; }
.gbr-locked-sub { font-size: 12px !important; color: rgba(255,255,255,.75) !important; }
.gbr-locked-btn {
  margin-top: 6px;
  padding: 9px 24px;
  background: #fff;
  color: #c41e1e;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background .2s, color .2s;
}
.gbr-locked-btn:hover { background: #f0f0f0; }

@keyframes gbr-spin { to { transform: rotate(360deg); } }

/* ── Loading Overlay ── */
#gbr-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,17,23,.95);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .5s ease;
}
#gbr-loading-overlay.gbr-loading-out { opacity: 0; pointer-events: none; }
.gbr-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 0 24px;
}
.gbr-loading-logo {
  font-family: Arial, sans-serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 4px;
}
.gbr-logo-g { color: #c41e1e; }
.gbr-logo-u { color: #fff; }
.gbr-loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: #c41e1e;
  border-radius: 50%;
  animation: gbr-spin .75s linear infinite;
}
.gbr-loading-text {
  font-size: 13px;
  color: #aaa;
  letter-spacing: .5px;
}
.gbr-loading-title {
  font-size: 14px;
  font-weight: 600;
  color: #ddd;
  max-width: 300px;
  line-height: 1.5;
  opacity: .7;
}
.gbr-loading-dots::after {
  content: '';
  animation: gbr-dots 1.2s steps(4, end) infinite;
}
@keyframes gbr-dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* ── Utility ── */
.is-hidden { display: none !important; }

/* ── Tombol info drawer (hanya mobile) ── */
.gbr-drawer-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid #333;
  border-radius: 5px;
  color: #999;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .2s, border-color .2s;
}
.gbr-drawer-toggle:hover { color: #fff; border-color: #555; }

/* ── Backdrop drawer ── */
.gbr-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 900;
}
.gbr-drawer-backdrop.is-open { display: block; }

/* ── Tombol tutup di dalam drawer ── */
.gbr-drawer-close {
  display: none;
  align-self: flex-end;
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 4px;
  margin-bottom: -6px;
  transition: color .2s;
}
.gbr-drawer-close:hover { color: #fff; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .gbr-layout { grid-template-columns: 1fr; }
  .gbr-center { position: static; height: 100vh; }

  /* Drawer mode untuk gbr-left */
  .gbr-left {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    border-right: 1px solid #2a2a2a;
    transition: left .3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .gbr-left.is-open { left: 0; }

  .gbr-drawer-toggle { display: flex; }
  .gbr-drawer-close  { display: block; }
}

@media (max-width: 480px) {
  .gbr-bar-title { display: none; }
  .gbr-bar-download { margin-left: auto; }
}
