/* Library stats */
.lib-stats-banner {
  background: rgba(0, 212, 255, 0.04);
  border-bottom: 1px solid rgba(0, 212, 255, 0.1);
  padding: 12px 0;
  margin-top: 64px;
}

.lib-stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.lib-stat {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lib-stat-icon { font-size: 16px; }
.lib-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--neon-blue);
}
.lib-stat-label { font-size: 12px; color: var(--text-muted); }
.lib-stat-divider {
  width: 1px;
  height: 20px;
  background: rgba(0, 212, 255, 0.2);
}

.lib-header {
  padding: 48px 0 24px;
  text-align: center;
}

.lib-title {
  font-size: clamp(28px, 5vw, 48px);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.lib-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
}

.featured-section { padding: 0 0 32px; }
.featured-card {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.08) 0%, rgba(11, 11, 24, 0.95) 60%, rgba(0, 255, 136, 0.05) 100%);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 20px;
  padding: 40px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 212, 255, 0.06);
}

.featured-card:empty {
  display: none;
}

.featured-cover,
.book-cover,
.modal-cover {
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.featured-cover {
  width: 120px;
  height: 160px;
  font-size: 48px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.pdf-cover {
  position: relative;
  overflow: hidden;
  background: #25252d;
  align-items: stretch;
  justify-content: stretch;
}

.pdf-cover-canvas {
  position: absolute;
  inset: 0;
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  background: #fff;
  pointer-events: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.pdf-cover-fallback {
  position: absolute;
  inset: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pdf-cover-fallback[hidden] {
  display: none;
}

.pdf-fallback-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  background: rgba(0, 212, 255, 0.12);
}

.pdf-cover-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), inset 0 -34px 42px rgba(0, 0, 0, 0.2);
}

.book-cover-placeholder {
  padding: 18px;
  text-align: center;
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  line-height: 1.15;
  word-break: break-word;
  box-sizing: border-box;
}

.featured-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: #ffd700;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.featured-cat,
.book-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.featured-cat {
  padding: 3px 12px;
  margin-bottom: 12px;
}

.featured-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.featured-author {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.featured-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  max-width: 600px;
}

.featured-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.lib-controls { padding: 0 0 24px; }
.lib-search-wrap {
  position: relative;
  margin-bottom: 20px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
}

.lib-search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 14px 48px;
  color: var(--text-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.lib-search-input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08);
}

.search-clear {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
}

.lib-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.lib-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.lib-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-muted);
}

.lib-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.lib-filter-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lib-sort select {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.lib-content { padding-bottom: 80px; }
.books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.book-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.book-card:hover {
  border-color: var(--border-active);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 212, 255, 0.1);
}

.book-cover {
  width: 100%;
  height: 140px;
  font-size: 48px;
  flex-shrink: 0;
}

.book-cover.pdf-cover {
  width: min(74%, 168px);
  height: auto;
  aspect-ratio: 3 / 4;
  align-self: center;
}

.featured-cover.pdf-cover {
  aspect-ratio: 3 / 4;
}

.book-badges,
.lang-chips,
.version-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.book-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.badge-new { background: rgba(0, 255, 136, 0.12); color: #00ff88; border: 1px solid rgba(0, 255, 136, 0.3); }
.badge-featured { background: rgba(255, 215, 0, 0.12); color: #ffd700; border: 1px solid rgba(255, 215, 0, 0.3); }
.badge-popular { background: rgba(255, 107, 0, 0.12); color: #ff6b00; border: 1px solid rgba(255, 107, 0, 0.3); }

.book-cat-badge {
  padding: 2px 10px;
  font-size: 11px;
  align-self: flex-start;
}

.book-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

.book-author {
  font-size: 12px;
  color: var(--text-muted);
  margin: -6px 0 0;
}

.book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 20px;
  margin-top: -2px;
}

.book-tag {
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.star-display {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stars { display: flex; gap: 2px; }
.star {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.15);
}
.star.filled,
.star.half {
  color: #ffd700;
}
.star.half { opacity: 0.6; }
.rating-num {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
}
.rating-count {
  font-size: 11px;
  color: var(--text-muted);
}

.book-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.book-downloads {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.lang-chip {
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  color: var(--neon-blue);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
}

.book-skeleton {
  height: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(0, 212, 255, 0.04) 50%, rgba(255, 255, 255, 0) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.books-empty {
  text-align: center;
  padding: 80px 20px;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.books-empty h3 {
  font-size: 20px;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.books-empty p {
  color: var(--text-muted);
  margin: 0 0 20px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: 20px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 0 60px rgba(0, 212, 255, 0.15);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.modal-close:hover {
  background: rgba(255, 51, 102, 0.15);
  color: #ff3366;
}

.modal-content { padding: 32px; }
.modal-top {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}

.modal-cover {
  width: 100px;
  height: 140px;
  font-size: 40px;
  flex-shrink: 0;
}

.modal-info { flex: 1; }
.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}
.modal-author {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.modal-meta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.modal-meta-item {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.rating-input-section {
  background: rgba(0, 212, 255, 0.04);
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.rating-input-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.star-input {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.star-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.15);
  transition: all 0.15s;
  padding: 0;
  line-height: 1;
}

.star-btn.active,
.star-btn:hover {
  color: #ffd700;
  transform: scale(1.2);
}

.rating-feedback {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.rating-breakdown { margin-bottom: 20px; }
.rating-breakdown-title,
.versions-title {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.breakdown-row,
.version-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breakdown-row {
  margin-bottom: 4px;
  font-size: 12px;
}

.breakdown-label {
  width: 24px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
}

.breakdown-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.breakdown-fill {
  height: 100%;
  background: #ffd700;
  border-radius: 2px;
}

.breakdown-pct {
  width: 30px;
  color: var(--text-muted);
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
}

.versions-section { margin-bottom: 20px; }
.versions-title {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.versions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.version-row {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 10px 14px;
}
.version-lang {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
}
.version-size {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

@media (max-width: 1200px) {
  .books-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .books-grid { grid-template-columns: repeat(2, 1fr); }
  .featured-card { grid-template-columns: 1fr; }
  .lib-meta { align-items: flex-start; flex-direction: column; }
  .lib-filter-controls { justify-content: flex-start; }
}

@media (max-width: 480px) {
  .books-grid { grid-template-columns: 1fr; }
  .modal-top { flex-direction: column; }
}

[dir="rtl"] .lib-meta,
[dir="rtl"] .book-meta,
[dir="rtl"] .version-row {
  flex-direction: row-reverse;
}
[dir="rtl"] .lib-filters,
[dir="rtl"] .modal-top {
  flex-direction: row-reverse;
}
[dir="rtl"] .modal-close { right: auto; left: 16px; }
[dir="rtl"] .featured-card { direction: rtl; }

/* ── Book Detail Page ───────────────────────────────── */
.book-detail-page {
  padding-top: 92px;
}

.book-detail-section {
  padding: 32px 0 80px;
}

.detail-back-link {
  display: inline-flex;
  align-items: center;
  color: var(--neon-blue);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
  transition: color 0.2s;
}

.detail-back-link:hover {
  color: var(--neon-green);
}

.detail-back-link::before {
  content: "←";
  margin-right: 8px;
}

.book-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 0 40px rgba(0,212,255,0.06);
}

.book-detail-loading,
.book-detail-error {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
}

.book-detail-error {
  color: #ff3366;
}

.book-detail-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 24px;
}

.book-detail-cover {
  width: 132px;
  height: 176px;
  font-size: 52px;
}

.book-detail-cover.pdf-cover {
  width: 164px;
  height: auto;
  aspect-ratio: 3 / 4;
}

.book-detail-main {
  min-width: 0;
}

.book-detail-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.15;
  color: var(--text-primary);
  margin: 12px 0 8px;
}

.book-detail-desc {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin: 0 0 28px;
  max-width: 900px;
}

.book-detail-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.book-share-btn {
  min-height: 38px;
}

.share-icon {
  font-size: 14px;
  line-height: 1;
}

.share-feedback {
  color: var(--neon-green);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  min-height: 16px;
}

.book-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 20px;
}

.book-detail-panel {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 20px;
}

.book-detail-panel-title {
  font-size: 15px;
  color: var(--text-primary);
  margin: 0 0 16px;
}

.book-detail-muted {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

@media (max-width: 768px) {
  .book-detail-card {
    padding: 22px;
  }

  .book-detail-hero,
  .book-detail-grid {
    grid-template-columns: 1fr;
  }

  .book-detail-cover {
    width: 100%;
    max-width: 190px;
    height: auto;
    aspect-ratio: 3 / 4;
    justify-self: center;
  }
}

[dir="rtl"] .detail-back-link::before {
  content: "→";
  margin-right: 0;
  margin-left: 8px;
}

[dir="rtl"] .book-detail-hero {
  direction: rtl;
}

/* ════════════════════════════════════════════════
   PDF VIEWER — Full Redesign
   ════════════════════════════════════════════════ */

/* Overlay: full screen, dark blur backdrop */
#pdf-modal.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
}

/* Main container: nearly full viewport */
.pdf-modal-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 1400px;
  max-height: calc(100vh - 24px);
  background: #1a1a2e;
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 212, 255, 0.1),
    0 24px 80px rgba(0, 0, 0, 0.8);
}

/* ── Slim Top Bar ──────────────────────────────── */
.pdf-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  min-height: 48px;
  padding: 0 16px;
  background: rgba(7, 7, 15, 0.95);
  border-bottom: 1px solid rgba(0, 212, 255, 0.12);
  flex-shrink: 0;
  gap: 12px;
}

/* Left side: icon + title */
.pdf-top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.pdf-bar-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.pdf-bar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right side: download + close */
.pdf-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Shared button base */
.pdf-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  white-space: nowrap;
}

/* Download button */
.pdf-bar-download {
  background: rgba(0, 212, 255, 0.12);
  border-color: rgba(0, 212, 255, 0.35);
  color: var(--neon-blue);
}

.pdf-bar-download:hover {
  background: rgba(0, 212, 255, 0.22);
  border-color: rgba(0, 212, 255, 0.6);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.25);
  color: var(--neon-blue);
}

/* Close button */
.pdf-bar-close {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 0 12px;
  font-size: 14px;
}

.pdf-bar-close:hover {
  background: rgba(255, 51, 102, 0.15);
  border-color: rgba(255, 51, 102, 0.4);
  color: #ff3366;
}

/* Hide label on very small screens, keep icon */
@media (max-width: 480px) {
  .pdf-btn-label { display: none; }
  .pdf-bar-download { padding: 0 10px; }
}

/* ── PDF Body ───────────────────────────────────── */
.pdf-viewer-body {
  flex: 1;
  min-height: 0;          /* critical for flex child to shrink */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #242528;
}

.pdf-viewer-toolbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 7px 12px;
  background: #3a3a3a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pdf-control-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.pdf-control-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pdf-page-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.pdf-page-input {
  width: 48px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  background: #12141c;
  color: #fff;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

.pdf-page-count,
.pdf-zoom-label {
  min-width: 48px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  text-align: center;
}

.pdf-toolbar-separator {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.16);
}

.pdf-canvas-scroll {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: auto;
  padding: 18px 14px 28px;
  text-align: center;
  -webkit-overflow-scrolling: touch;
}

.pdf-canvas {
  display: block;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

.pdf-viewer-status {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: calc(100% - 48px);
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}

/* ── Responsive adjustments ─────────────────────── */
@media (max-width: 768px) {
  #pdf-modal.modal-overlay {
    padding: 0;
  }

  .pdf-modal-container {
    border-radius: 0;
    max-height: 100vh;
    height: 100vh;
    border: none;
  }

  .pdf-top-bar {
    height: 44px;
    min-height: 44px;
    padding: 0 12px;
  }

  .pdf-bar-title {
    font-size: 12px;
  }

  .pdf-viewer-toolbar {
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
  }

  .pdf-control-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
  }

  .pdf-page-control,
  .pdf-zoom-label {
    flex: 0 0 auto;
  }

  .pdf-canvas-scroll {
    padding: 12px 8px 24px;
  }
}

/* ── RTL support ─────────────────────────────────── */
[dir="rtl"] .pdf-top-bar {
  flex-direction: row-reverse;
}

[dir="rtl"] .pdf-top-left {
  flex-direction: row-reverse;
}

[dir="rtl"] .pdf-top-right {
  flex-direction: row-reverse;
}
