/* Shared page, lesson, and document viewing modes. */
[hidden] { display: none !important; }
.view-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.view-controls .btn,
.document-controls .btn,
[data-lesson-outline-open] { min-height: 44px; min-width: 44px; }
.view-status { flex-basis: 100%; font-size: .875rem; color: #34425d; }
.view-status:empty { display: none; }
.page-view-menu {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 1040;
  max-width: calc(100vw - 28px);
  border: 1px solid var(--ca-line, #cfd8e5);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 20px rgba(16, 40, 77, .14);
  color: #17223b;
}
.page-view-menu summary { min-height: 44px; padding: 12px 16px; cursor: pointer; font-weight: 700; }
.page-view-menu[open] .view-controls { padding: 8px; }
.view-mode-active { overflow: hidden !important; }
.frontend-site .view-expanded {
  position: fixed !important;
  inset: 0;
  z-index: 1090;
  width: 100% !important;
  max-width: none !important;
  height: 100vh;
  height: 100dvh;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--ca-canvas, #faf7f0);
  overflow: auto;
  overscroll-behavior: contain;
}
.frontend-site main.view-expanded { padding: 24px 0 90px !important; }
.view-expanded .page-view-menu { z-index: 1100; }
.view-expanded .page-view-menu > summary { display: none; }
.frontend-site #lessonPlayerPane.view-expanded,
.frontend-site #ebookReaderPane.view-expanded { display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.view-expanded .lesson-player-toolbar,
.view-expanded .ebook-reader-toolbar { position: relative; flex: 0 0 auto; }
.view-expanded #lessonPlayerBody,
.view-expanded .ebook-reader-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
.view-expanded #lessonPlayerBody { display: flex; flex-direction: column; }
.view-expanded #lessonPlayerBody > * { flex-shrink: 0; }
.view-expanded [data-lesson-outline-open] { display: none !important; }
.view-expanded .pdf-canvas-wrap,
.view-expanded .ebook-pdf-canvas-wrap { max-height: none; min-height: 0; }
.view-expanded .lesson-document { display: flex; flex-direction: column; flex: 1 0 240px; min-height: 0; }
.view-expanded #pdfViewerApp,
.view-expanded #ebookPdfViewer { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.view-expanded .lesson-document .pdf-canvas-wrap,
.view-expanded #ebookPdfViewer .ebook-pdf-canvas-wrap { flex: 1 1 auto; }
.view-expanded .document-frame { height: calc(100vh - 170px); height: calc(100dvh - 170px); min-height: 220px; }
.view-expanded .document-frame::before { display: none; }
.lesson-player-toolbar { gap: 12px; flex-wrap: wrap; }
.lesson-player-title { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.lesson-player-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lesson-outline .offcanvas-body { display: block; padding: 0; }
.lesson-outline-list { max-height: 70vh; overflow-y: auto; }
.lesson-outline .list-group-item > div { gap: 12px; }
.lesson-outline .list-group-item span { overflow-wrap: anywhere; }
.lesson-outline .list-group-item small { flex-shrink: 0; }
.lesson-navigation { align-items: center; }
.lesson-navigation .btn { min-height: 44px; }
.lesson-rich-content { overflow-wrap: anywhere; }
.lesson-rich-content img,
.lesson-rich-content video { max-width: 100%; height: auto; }
.lesson-rich-content iframe { max-width: 100%; }
.lesson-rich-content table { display: block; max-width: 100%; overflow: auto; }
.pdf-canvas-wrap,
.ebook-pdf-canvas-wrap { scroll-behavior: auto; overflow-anchor: none; }
.pdf-page-item,
.ebook-pdf-page-item { width: max-content; min-width: 100%; }
.pdf-page-canvas,
.ebook-pdf-page-canvas { max-width: none !important; flex-shrink: 0; }
.document-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 991.98px) {
  .lesson-outline { --bs-offcanvas-width: min(360px, 90vw); }
  .lesson-outline .offcanvas-body { overflow-y: auto; }
  .lesson-outline-list { max-height: none; overflow: visible; }
  .lesson-outline .offcanvas-header { border-bottom: 1px solid var(--ca-line, #e6e1d7); }
  .lesson-outline .btn-close { min-width: 44px; min-height: 44px; padding: 8px; background-size: 16px; }
}
@media (min-width: 992px) {
  .lesson-outline .offcanvas-body { flex-grow: 0; }
}
@media (max-width: 575.98px) {
  .lesson-player-title { flex-basis: 100%; }
  .lesson-player-toolbar { padding: 12px !important; }
  .lesson-player-body { padding: 12px !important; }
  .lesson-navigation form { margin-left: 0 !important; }
  .frontend-site .pdf-canvas-wrap,
  .frontend-site .ebook-pdf-canvas-wrap { min-height: 240px; min-height: min(40dvh, 320px); padding: 6px; }
  .frontend-site .ebook-image-preview { min-height: 240px; padding: 12px; }
  .frontend-site .ebook-reader-toolbar { padding: 12px; }
}
@media print {
  .page-view-menu,
  .view-controls,
  [data-lesson-outline-open] { display: none !important; }
}
