/* ============================================================
   PDF Reader — /read/
   ============================================================ */
.pdf-app {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: #0d0618;
}

[data-theme="light"] .pdf-app { background: #f8f6f3; }
[data-theme="sepia"] .pdf-app { background: #f4ece1; }

.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(20, 10, 40, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 210;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

[data-theme="light"] .pdf-toolbar {
  background: rgba(248, 246, 243, 0.97);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="sepia"] .pdf-toolbar {
  background: rgba(244, 236, 225, 0.97);
  border-bottom: 1px solid rgba(60, 47, 30, 0.1);
}

.pdf-toolbar::-webkit-scrollbar { display: none; }

.tbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.07);
  color: #efe6ff;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-size: 1rem;
  flex-shrink: 0;
  text-decoration: none;
}

[data-theme="light"] .tbtn {
  background: rgba(0, 0, 0, 0.05);
  color: #1a1025;
}

[data-theme="sepia"] .tbtn {
  background: rgba(60, 47, 30, 0.05);
  color: #3c2f1e;
}

.tbtn:hover { background: rgba(212, 175, 55, 0.25); color: #f5d97e; }
.tbtn svg { width: 18px; height: 18px; }

.toolbar-divider { width: 1px; height: 24px; background: rgba(255, 255, 255, 0.12); margin: 0 4px; flex-shrink: 0; }
[data-theme="light"] .toolbar-divider { background: rgba(0,0,0,0.1); }
[data-theme="sepia"] .toolbar-divider { background: rgba(60,47,30,0.12); }

.page-indicator, .zoom-val {
  color: #b9a8d9;
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

[data-theme="light"] .page-indicator, [data-theme="light"] .zoom-val { color: #4a3d5c; }
[data-theme="sepia"] .page-indicator, [data-theme="sepia"] .zoom-val { color: #6b5d4a; }

.toolbar-title {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: #efe6ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 8px;
  min-width: 60px;
}

[data-theme="light"] .toolbar-title { color: #1a1025; }
[data-theme="sepia"] .toolbar-title { color: #3c2f1e; }

.exit-btn { background: rgba(255, 107, 122, 0.12); color: #ff6b7a !important; }
.exit-btn:hover { background: rgba(255, 107, 122, 0.25); }

.pdf-searchbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(20, 10, 40, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

[data-theme="light"] .pdf-searchbar { background: rgba(248, 246, 243, 0.97); border-bottom: 1px solid rgba(0,0,0,0.08); }
[data-theme="sepia"] .pdf-searchbar { background: rgba(244, 236, 225, 0.97); border-bottom: 1px solid rgba(60,47,30,0.1); }

.pdf-searchbar input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #efe6ff;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

[data-theme="light"] .pdf-searchbar input {
  border-color: rgba(0,0,0,0.1);
  background: rgba(0,0,0,0.03);
  color: #1a1025;
}

.pdf-searchbar input:focus { border-color: #d4af37; }

.search-count {
  color: #b9a8d9;
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.pdf-canvas-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.pdf-canvas-wrap canvas {
  max-width: 100%;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
  background: #fff;
}

.pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #b9a8d9;
  padding-top: 80px;
  position: absolute;
  inset: 0;
}

.pdf-no-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #ff6b7a;
  text-align: center;
  padding-top: 60px;
  position: absolute;
  inset: 0;
}

.pdf-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px max(8px, env(safe-area-inset-bottom));
  background: rgba(20, 10, 40, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

[data-theme="light"] .pdf-bottom { background: rgba(248, 246, 243, 0.97); border-top: 1px solid rgba(0,0,0,0.08); }
[data-theme="sepia"] .pdf-bottom { background: rgba(244, 236, 225, 0.97); border-top: 1px solid rgba(60,47,30,0.1); }

.pdf-bottom input[type="range"] {
  width: min(600px, 92%);
  accent-color: #d4af37;
  height: 30px;
}

@media (max-width: 600px) {
  .pdf-toolbar { padding: 6px 8px; gap: 4px; }
  .tbtn { width: 32px; height: 32px; }
  .tbtn svg { width: 16px; height: 16px; }
  .toolbar-title { max-width: 90px; }
  .pdf-canvas-wrap { padding: 8px; }
  .zoom-val { display: none; }
}
