/* Strata Platform -- shared PDF viewer (Strata.PdfViewer.create).
 * Promoted from product-catalog's .pc-qpv-* styling. Platform helper, so NOT
 * scoped under any [data-module]; tokens inherit from :root / [data-theme] in
 * platform/styles.css. Design tokens only -- both themes follow automatically. */

.strata-pdfv-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg);
}

.strata-pdfv-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}

.strata-pdfv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  background: var(--panel);
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.strata-pdfv-btn:hover {
  background: var(--row-hover);
  color: var(--text-primary);
}

.strata-pdfv-pageinfo {
  font-size: 0.71875rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.strata-pdfv-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 0.25rem;
}

.strata-pdfv-zoom {
  width: auto;
  min-width: 48px;
  padding: 0 0.5rem;
}

.strata-pdfv-zoomlabel {
  font-size: 0.65625rem;
  color: var(--text-secondary);
  font-family: inherit;
  font-weight: 600;
}

.strata-pdfv-spacer {
  flex: 1 1 auto;
}

.strata-pdfv-tool {
  padding: 0.1875rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  background: var(--panel);
  color: var(--text-secondary);
  font-size: 0.65625rem;
  font-family: inherit;
  cursor: pointer;
}

.strata-pdfv-tool:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
}

.strata-pdfv-status {
  padding: 0.25rem 0.75rem;
  font-size: 0.65625rem;
  color: var(--accent);
  background: var(--accent-soft);
  min-height: 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.strata-pdfv-status:empty {
  display: none;
}

.strata-pdfv-stage {
  flex: 1 1 auto;
  overflow: auto;
  background: var(--bg);
  padding: 1rem;
  /* Trap horizontal trackpad pan so it scrolls the PDF instead of triggering
     browser back / forward. */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.strata-pdfv-stage-inner {
  display: inline-block;
  min-width: calc(100% - 0px);
  text-align: center;
}

.strata-pdfv-page {
  position: relative;
  display: inline-block;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: left;
  vertical-align: top;
}

.strata-pdfv-canvas {
  display: block;
}

.strata-pdfv-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  cursor: grab; /* drag-pan when no marquee mode is active */
}

.strata-pdfv-overlay.is-panning {
  cursor: grabbing;
}

.strata-pdfv-overlay.is-marquee {
  cursor: crosshair;
}

.strata-pdfv-bbox {
  position: absolute;
  border: 1.5px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 2px;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.12s ease-out;
}

.strata-pdfv-bbox:hover,
.strata-pdfv-bbox.is-hovered {
  opacity: 0.85;
}

.strata-pdfv-bbox-header {
  border-color: var(--text-secondary);
  background: var(--panel);
  opacity: 0.35;
}

.strata-pdfv-bbox-row {
  border-style: dashed;
}

.strata-pdfv-marquee {
  position: absolute;
  border: 2px dashed var(--accent);
  background: var(--accent-soft);
  pointer-events: none;
  opacity: 0.6;
}

/* Fullscreen: the native :fullscreen pseudo-class (Fullscreen API) and the
 * .is-fullscreen-fallback class (when the API is unavailable / denied) both fill
 * the viewport. Tokens still resolve because the root stays in the themed DOM. */
.strata-pdfv-root:fullscreen {
  background: var(--bg);
  width: 100vw;
  height: 100vh;
}

.strata-pdfv-root.is-fullscreen-fallback {
  position: fixed;
  inset: 0;
  z-index: 9000;
  height: 100vh;
}

/* Overlay-mode fullscreen (opts.fullscreenMode === 'overlay'): an in-page modal
 * instead of the browser Fullscreen API. The platform helper lifts the viewer
 * root into this body-mounted backdrop, so this is NOT scoped under a module.
 * z-index 4500 = the "module-level full-viewport viewer" tier (alongside the DAM
 * lightbox in the platform z-index scale), well below platform modals (9000) so
 * a ctx.ui.confirm/modal still renders above it. Both themes via design tokens. */
.strata-pdfv-overlay-modal {
  position: fixed;
  inset: 0;
  z-index: 4500;
  display: flex;
  /* Solid themed surface so the maximized viewer reads as a true overlay; only
     visible in the safe-area gutters since the root fills the rest. */
  background: var(--bg);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

/* The lifted root fills the backdrop edge-to-edge. */
.strata-pdfv-overlay-modal > .strata-pdfv-root.is-fullscreen-overlay {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.strata-pdfv-overlay-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--button-radius);
  background: var(--panel);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  box-shadow: var(--shadow);
  touch-action: manipulation;
}

.strata-pdfv-overlay-close:hover {
  background: var(--row-hover);
  color: var(--text-primary);
}
