/* ── PDF Sidebar ────────────────────────────────────── */
#pdfSidebar {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 420px;
  background: linear-gradient(180deg, #0d1f12 0%, #091a0e 100%);
  border-left: 1.5px solid rgba(255, 215, 0, .15);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: -6px 0 32px rgba(0,0,0,.5);
}
#pdfSidebar.open {
  transform: translateX(0);
}

/* ── Sidebar header ──────────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,215,0,.12);
  flex-shrink: 0;
  background: rgba(0,0,0,.2);
}
.sidebar-title {
  font-family: 'Inter', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  color: #ffd700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-filename {
  font-size: .72rem;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* ── Load / close buttons ────────────────────────── */
.sidebar-load-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(255,215,0,.3);
  border-radius: 7px;
  background: rgba(255,215,0,.08);
  color: #ffd700;
  font-size: .73rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  flex-shrink: 0;
}
.sidebar-load-btn:hover {
  background: rgba(255,215,0,.18);
  border-color: rgba(255,215,0,.55);
}
.sidebar-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  background: rgba(255,255,255,.05);
  color: #aaa;
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.sidebar-close-btn:hover {
  background: rgba(231,76,60,.2);
  border-color: rgba(231,76,60,.4);
  color: #ff8a80;
}

/* Hidden file input */
#pdfFileInput {
  display: none;
}

/* ── PDF iframe ──────────────────────────────────── */
#pdfIframe {
  flex: 1;
  border: none;
  width: 100%;
  min-height: 0;
  background: #fff;
}

/* ── Empty state ─────────────────────────────────── */
.sidebar-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #555;
  text-align: center;
  padding: 24px;
}
.sidebar-empty-icon {
  font-size: 3rem;
  opacity: .4;
}
.sidebar-empty-text {
  font-size: .82rem;
  line-height: 1.6;
  color: #666;
}
.sidebar-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 22px;
  border: 1.5px solid rgba(255,215,0,.35);
  border-radius: 9px;
  background: rgba(255,215,0,.08);
  color: #ffd700;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  font-family: inherit;
}
.sidebar-empty-btn:hover {
  background: rgba(255,215,0,.18);
  border-color: rgba(255,215,0,.6);
}

/* ── Sidebar toggle button in header ─────────────── */
.btn-pdf-toggle {
  background: rgba(255,215,0,.1);
  border: 1.5px solid rgba(255,215,0,.35);
  color: #ffd700;
  font-size: .78rem;
  padding: 5px 14px;
  border-radius: 8px;
  letter-spacing: .03em;
}
.btn-pdf-toggle:hover {
  background: rgba(255,215,0,.22) !important;
  border-color: rgba(255,215,0,.6) !important;
  color: #ffd700 !important;
  box-shadow: 0 0 10px rgba(255,215,0,.12);
}
.btn-pdf-toggle.active {
  background: rgba(255,215,0,.22);
  border-color: rgba(255,215,0,.55);
  box-shadow: 0 0 8px rgba(255,215,0,.1);
}

/* ── Hide book-related UI on mobile ──────────────── */
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  #pdfSidebar   { display: none !important; }
  body.sidebar-open { padding-right: 0 !important; }
}

/* ── Body padding when sidebar open ─────────────── */
body.sidebar-open {
  padding-right: 420px;
  transition: padding-right .3s cubic-bezier(.4,0,.2,1);
}
body {
  transition: padding-right .3s cubic-bezier(.4,0,.2,1);
}

/* ── Resize handle ───────────────────────────────── */
#sidebarResizeHandle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  background: transparent;
  transition: background .15s;
}
#sidebarResizeHandle:hover,
#sidebarResizeHandle.dragging {
  background: rgba(255,215,0,.25);
}
