.wf-pdf-reader { max-width: 1800px; }
.wf-pdf-viewer { --wf-pdf-paper-shadow: 0 5px 24px #0003; position: relative; border: 1px solid var(--bs-border-color); border-radius: .8rem; background: var(--bs-body-bg); overflow: hidden; min-width: 0; box-shadow: 0 .3rem 1.4rem #0001; }
.wf-pdf-toolbar { display: grid; grid-template-columns: 1fr minmax(0, 1fr) 1fr; align-items: center; gap: .3rem .6rem; padding: .35rem .5rem; border-bottom: 1px solid var(--bs-border-color); background: var(--bs-body-bg); }
.wf-pdf-toolbar__title { min-width: 0; margin: 0; font-size: .95rem; font-weight: 600; text-align: center; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.wf-pdf-toolbar__heading { display: flex; justify-content: center; align-items: center; min-width: 0; }
.wf-pdf-toolbar__heading .wf-pdf-control { flex-shrink: 0; }
.wf-pdf-search { position: absolute; z-index: 5; top: 46px; left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 16px)); padding: .45rem; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .5rem; box-shadow: 0 4px 20px #0003; color: var(--bs-body-color); }
.wf-pdf-search[hidden] { display: none; }
.wf-pdf-search__form { display: flex; align-items: center; gap: .1rem; }
.wf-pdf-search__form input { flex: 1; min-width: 0; width: 100%; height: 32px; border: 1px solid var(--bs-border-color); border-radius: .35rem; padding: .25rem .45rem; background: var(--bs-body-bg); color: var(--bs-body-color); font-size: .9rem; }
.wf-pdf-search__form .wf-pdf-control { flex-shrink: 0; }
.wf-pdf-search__status { font-size: .78rem; padding: .25rem .1rem 0; overflow-wrap: anywhere; }
.wf-pdf-search[data-search-error="true"] .wf-pdf-search__status { color: var(--bs-danger-text-emphasis); }
/* Posicionamiento de la TextLayer oficial de PDF.js; no intercepta los gestos. */
.wf-pdf-search-text { position: absolute; inset: 0; pointer-events: none; line-height: 1; letter-spacing: normal; word-spacing: normal; text-size-adjust: none; transform-origin: 0 0; color-scheme: only light; --min-font-size: 1; --scale-round-x: 1px; --scale-round-y: 1px; }
.wf-pdf-search-text > :is(span, br) { position: absolute; color: transparent; white-space: pre; transform-origin: 0 0; font-size: calc(var(--total-scale-factor) * var(--min-font-size) * var(--font-height, 0px)); transform: rotate(var(--rotate, 0deg)) scaleX(var(--scale-x, 1)) scale(calc(1 / var(--min-font-size))); }
.wf-pdf-search-text[data-main-rotation="90"] { transform: rotate(90deg) translateY(-100%); }
.wf-pdf-search-text[data-main-rotation="180"] { transform: rotate(180deg) translate(-100%, -100%); }
.wf-pdf-search-text[data-main-rotation="270"] { transform: rotate(270deg) translateX(-100%); }
.wf-pdf-search-hit { color: transparent; background: #ffe25999; border-radius: 2px; padding: 1px; margin: -1px; }
.wf-pdf-search-hit.is-current { background: #ff9624b8; outline: 1px solid #a94f00; }
.wf-pdf-toolbar__options { justify-self: end; }
.wf-pdf-toolbar__group { display: flex; align-items: center; gap: .15rem; }
.wf-pdf-control { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; border-radius: .4rem; background: transparent; color: var(--bs-body-color); min-width: 32px; height: 34px; padding: .25rem .5rem; text-decoration: none; font-size: .9rem; cursor: pointer; }
.wf-pdf-control:hover:not(:disabled) { color: var(--wf-primary); background: var(--bs-tertiary-bg); }
.wf-pdf-control:focus-visible { outline: 2px solid var(--wf-primary); outline-offset: -2px; }
.wf-pdf-control:disabled { opacity: .35; cursor: default; }
.wf-pdf-toolbar__modes { background: var(--bs-tertiary-bg); border-radius: .45rem; padding: 2px; }
.wf-pdf-mode[aria-pressed="true"] { background: var(--wf-primary); color: var(--wf-on-primary, #fff); }
.wf-pdf-mode[aria-pressed="true"]:hover { background: var(--wf-primary); color: var(--wf-on-primary, #fff); }
.wf-pdf-toolbar__page { display: inline-flex; align-items: center; gap: .4rem; margin: 0 .3rem; font-size: .82rem; white-space: nowrap; }
.wf-pdf-toolbar__page input { background: var(--bs-body-bg); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); border-radius: .35rem; width: 4.4rem; height: 30px; text-align: center; font-variant-numeric: tabular-nums; }
.wf-pdf-toolbar__page input::-webkit-inner-spin-button { -webkit-appearance: none; }
.wf-pdf-toolbar__zoom { min-width: 56px; font-size: .8rem; font-variant-numeric: tabular-nums; }
.wf-pdf-stage { display: flex; flex-direction: column; gap: 18px; height: max(320px, calc(100dvh - 145px)); background: var(--bs-tertiary-bg); background-image: radial-gradient(ellipse at center, #0000, #0000000c); overflow: auto; overscroll-behavior: contain; padding: 12px; scroll-padding: 12px; position: relative; outline-offset: -3px; }
.wf-pdf-page { display: flex; flex: 0 0 auto; justify-content: center; align-items: center; min-width: 100%; width: max-content; position: relative; scroll-margin: 18px; }
.wf-pdf-page__paper { flex: 0 0 auto; background: #fff; box-shadow: var(--wf-pdf-paper-shadow); position: relative; overflow: hidden; color: #111; }
.wf-pdf-page canvas { display: block; width: 100%; height: 100%; max-width: none; }
.wf-pdf-page__paper[aria-busy="true"]::after { content: ""; position: absolute; left: calc(50% - 12px); top: calc(50% - 12px); width: 24px; height: 24px; border: 2px solid #ddd; border-top-color: #777; border-radius: 50%; animation: wf-pdf-wait .8s linear infinite; }
.wf-pdf-page__error { display: flex; align-items: center; justify-content: center; height: 100%; padding: 1rem; text-align: center; font-size: .85rem; }
.wf-pdf-spread { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; min-width: 100%; width: max-content; min-height: 100%; gap: 4px; }
.wf-pdf-spread .wf-pdf-page { min-width: 0; }
.wf-pdf-spread--vertical { flex-direction: column; }
.wf-pdf-stage { touch-action: none; }
.wf-pdf-document { display: flex; flex-direction: column; gap: 18px; min-width: 100%; width: max-content; flex: 0 0 auto; }
.wf-pdf-viewer[data-wf-mode="book"] .wf-pdf-stage { cursor: grab; user-select: none; }
.wf-pdf-stage.is-dragging { cursor: grabbing; }
.wf-pdf-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wf-pdf-viewer:not([data-wf-pdf-ready="true"]) .wf-pdf-status, .wf-pdf-status[data-error="true"] { width: auto; height: auto; max-width: calc(100% - 2rem); top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; padding: .7rem 1rem; clip-path: none; white-space: normal; border-radius: .5rem; background: var(--bs-body-bg); color: var(--bs-body-color); font-size: .85rem; text-align: center; pointer-events: none; }
.wf-pdf-status[data-error="true"] { color: var(--bs-danger-text-emphasis); }
.wf-pdf-float { display: none; position: absolute; z-index: 2; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid #ffffff6b; border-radius: 50%; background: #17202bbb; color: #fff; box-shadow: 0 2px 8px #0003; cursor: pointer; }
.wf-pdf-float:hover, .wf-pdf-float:focus-visible { background: #17202bee; outline: 2px solid #fff; outline-offset: 2px; }
.wf-pdf-float:disabled { opacity: .25; cursor: default; }
.wf-pdf-float--previous { top: calc(50% - 22px); left: 10px; }
.wf-pdf-float--next { top: calc(50% - 22px); right: 10px; }
.wf-pdf-float--restore { top: 10px; right: 10px; }
.wf-pdf-float--search { top: 10px; right: 64px; }
.wf-pdf-viewer:fullscreen, .wf-pdf-viewer.is-expanded { border-radius: 0; display: flex; flex-direction: column; height: 100dvh; width: 100%; background: var(--bs-body-bg); }
.wf-pdf-viewer.is-expanded { position: fixed; inset: 0; z-index: 2100; }
.wf-pdf-viewer:fullscreen .wf-pdf-toolbar, .wf-pdf-viewer.is-expanded .wf-pdf-toolbar { display: none; }
.wf-pdf-viewer:fullscreen .wf-pdf-float, .wf-pdf-viewer.is-expanded .wf-pdf-float { display: inline-flex; }
.wf-pdf-viewer:fullscreen .wf-pdf-stage, .wf-pdf-viewer.is-expanded .wf-pdf-stage { height: auto; flex: 1; min-height: 0; padding: 6px; }
[data-bs-theme="dark"] .wf-pdf-stage { background-color: #171b22; }
@keyframes wf-pdf-wait { to { transform: rotate(360deg); } }
@media (max-width: 1100px) {
  .wf-pdf-mode span { display: none; }
  .wf-pdf-toolbar { grid-template-columns: auto minmax(0, 1fr) auto; }
}
@media (max-width: 650px) {
  .wf-pdf-toolbar { display: flex; flex-wrap: wrap; justify-content: center; gap: .2rem .5rem; padding: .3rem; }
  .wf-pdf-toolbar__heading { flex-basis: 100%; order: -1; }
  .wf-pdf-toolbar__title { font-size: .85rem; }
  .wf-pdf-search { top: 42px; }
  .wf-pdf-toolbar__page { margin-inline: .1rem; gap: .2rem; }
  .wf-pdf-toolbar__page input { width: 2.7rem; }
  .wf-pdf-toolbar__zoom { min-width: 42px; }
  .wf-pdf-control { min-width: 30px; padding-inline: .35rem; }
  .wf-pdf-stage { padding: 8px; height: max(280px, calc(100dvh - 215px)); gap: 10px; scroll-padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { .wf-pdf-page__paper[aria-busy="true"]::after { animation: none; } }
