/* Pharmacist365.in - Google Play Books Style Reader Theme */
@import url('https://fonts.googleapis.com/css2?family=Literata:ital,opsz,wght@0,7..72,300..700;1,7..72,300..700&family=Roboto+Mono:wght@400;500&display=swap');

html, body.reader-body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* Print Protection: Prevents Print-to-PDF */
@media print {
  body {
    display: none !important;
    visibility: hidden !important;
  }
}

.reader-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Themes */
/* 1. Sepia Theme (Google Play Books Signature) */
.theme-sepia {
  background-color: #fbf0d9 !important;
  color: #4a3b2c !important;
}
.theme-sepia .reader-topbar,
.theme-sepia .reader-bottombar,
.theme-sepia .reader-sidebar {
  background-color: #f4e5c3 !important;
  border-color: #e5d4aa !important;
  color: #4a3b2c !important;
}
.theme-sepia .reader-btn {
  color: #4a3b2c !important;
  border-color: #dfcca2 !important;
}
.theme-sepia .reader-btn:hover {
  background: #ecd9b3 !important;
}
.theme-sepia ::selection {
  background: #e3bc7b;
  color: #2b1f13;
}

/* 2. Light Theme */
.theme-light {
  background-color: #ffffff !important;
  color: #1e293b !important;
}
.theme-light .reader-topbar,
.theme-light .reader-bottombar,
.theme-light .reader-sidebar {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}
.theme-light .reader-btn {
  color: #334155 !important;
  border-color: #e2e8f0 !important;
}
.theme-light .reader-btn:hover {
  background: #f1f5f9 !important;
}
.theme-light ::selection {
  background: #a7f3d0;
  color: #064e3b;
}

/* 3. Dark Theme */
.theme-dark {
  background-color: #131517 !important;
  color: #e2e8f0 !important;
}
.theme-dark .reader-topbar,
.theme-dark .reader-bottombar,
.theme-dark .reader-sidebar {
  background-color: #1c1f24 !important;
  border-color: #2e343e !important;
  color: #e2e8f0 !important;
}
.theme-dark .reader-btn {
  color: #e2e8f0 !important;
  border-color: #2e343e !important;
}
.theme-dark .reader-btn:hover {
  background: #272c34 !important;
}
.theme-dark ::selection {
  background: #047857;
  color: #ffffff;
}

/* Reader Topbar */
.reader-topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid;
  z-index: 100;
  user-select: none;
}

.reader-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}
.reader-title {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 450px;
}
.reader-badge-pci {
  font-size: 0.7rem;
  font-weight: 700;
  background: #059669;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 4px;
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reader-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

/* Reader Main Content Container */
.reader-stage {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Sidebar (Table of Contents) */
.reader-sidebar {
  width: 320px;
  border-right: 1px solid;
  position: absolute;
  top: 0;
  bottom: 0;
  left: -320px;
  z-index: 95;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  padding: 1rem;
}
.reader-sidebar.open {
  left: 0;
}
.reader-toc-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.reader-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.reader-toc-item {
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.reader-toc-item:hover, .reader-toc-item.active {
  background: rgba(5, 150, 105, 0.15);
  font-weight: 600;
}

/* Reader Scroll/Flip Area */
.reader-viewport {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.5rem 6rem;
  position: relative;
}

.reader-page-sheet {
  max-width: 820px;
  width: 100%;
  padding: 3rem 3.5rem;
  margin-bottom: 2rem;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  font-family: 'Literata', Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.85;
  position: relative;
  background: inherit;
}

.reader-page-sheet h2 {
  font-size: 1.7rem;
  font-weight: 700;
  border-bottom: 2px solid #059669;
  padding-bottom: 8px;
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.reader-page-sheet h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 1.8rem;
  margin-bottom: 0.8rem;
}

.reader-page-sheet .callout {
  padding: 1rem 1.25rem;
  border-left: 4px solid #059669;
  background: rgba(5, 150, 105, 0.08);
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
}

.reader-page-sheet .feature-box {
  background: rgba(2, 132, 199, 0.06);
  border: 1px solid rgba(2, 132, 199, 0.2);
  border-radius: 8px;
  padding: 1.25rem;
  margin: 1.25rem 0;
}
.reader-page-sheet .feature-box h4 {
  margin-top: 0;
  color: #0284c7;
}

.reader-page-sheet .table-content {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.reader-page-sheet .table-content th,
.reader-page-sheet .table-content td {
  padding: 10px 14px;
  border: 1px solid rgba(150, 150, 150, 0.25);
  text-align: left;
}
.reader-page-sheet .table-content th {
  background: rgba(0, 0, 0, 0.04);
  font-weight: 700;
}

.math-display {
  text-align: center;
  font-size: 1.2rem;
  padding: 1rem;
  font-family: 'Roboto Mono', monospace;
  background: rgba(0,0,0,0.03);
  border-radius: 6px;
  margin: 1.2rem 0;
}

.exam-tip {
  background: #fef3c7;
  color: #92400e;
  border-left: 4px solid #f59e0b;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

/* PDF.js Canvas Page Rendering */
.pdf-canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}
.pdf-page-canvas {
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border-radius: 4px;
  max-width: 100%;
  height: auto !important;
}

/* Reader Bottom Progress Bar */
.reader-bottombar {
  height: 56px;
  border-top: 1px solid;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  user-select: none;
}

.reader-slider-box {
  flex: 1;
  max-width: 500px;
  margin: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.reader-slider {
  width: 100%;
  accent-color: #059669;
  cursor: pointer;
}
.reader-page-indicator {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Floating Action Notification for Copy */
.copy-pill-floating {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 999;
  animation: fadeInDown 0.25s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 768px) {
  .reader-page-sheet {
    padding: 1.5rem 1.25rem;
  }
  .reader-title {
    max-width: 160px;
  }
  .reader-slider-box {
    margin: 0 8px;
  }
}
