* { box-sizing: border-box; }
html { width: 100%; height: 100%; margin: 0; padding: 0 !important; }
body.sf-flipbook-page { width: 100vw !important; height: 100svh; min-height: 0; margin: 0 !important; padding: 0 !important; overflow: hidden; background: #f4f4f4; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body.admin-bar.sf-flipbook-page { height: calc(100svh - 32px); }
@media screen and (max-width: 782px) { body.admin-bar.sf-flipbook-page { height: calc(100svh - 46px); } }
body.sf-flipbook-page .sf-flipbook-container { width: 100vw !important; height: 100%; margin: 0 !important; padding: 0 !important; display: flex; flex-direction: column; overflow: hidden; }
body.sf-flipbook-page .sf-flipbook-header { width: 100vw !important; flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 0 !important; padding: 16px 24px; background: white; border-bottom: 1px solid #ddd; }
body.sf-flipbook-page .sf-flipbook-header h1 { margin: 0; font-size: 20px; line-height: 1.2; }
body.sf-flipbook-page .sf-flipbook-download { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 10px 16px; background: #111; color: #fff; text-decoration: none; border-radius: 6px; white-space: nowrap; }
body.sf-flipbook-page .sf-flipbook-viewer { flex: 1 1 auto; width: 100vw !important; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; margin: 0 !important; padding: 16px 24px 160px; overflow: hidden; }
body.sf-flipbook-page .sf-flipbook-book { max-height: calc(100% - 20px); margin: 0 auto !important; }
body.sf-flipbook-page .stf__parent { margin-left: auto !important; margin-right: auto !important; }
/* Desktop: limitar el área de StPageFlip para forzar su orientación portrait.
   Con minWidth: 280, la biblioteca usa portrait por debajo de 560px. */
@media (min-width: 601px) {
  body.sf-flipbook-page .sf-desktop-single-stage {
    position: relative;
    flex: 0 1 520px;
    width: min(520px, 100%);
    max-width: 520px;
    height: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
  }
  body.sf-flipbook-page .sf-desktop-single-stage .sf-flipbook-book {
    width: 100%;
    max-width: 100%;
    margin: 0 auto !important;
  }
}

body.sf-flipbook-page .sf-flipbook-page-item { position: relative; background: #fff; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.15); }
body.sf-flipbook-page .sf-flipbook-page-canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
body.sf-flipbook-page .sf-mobile-book { width: 100%; max-width: 100%; display: flex; justify-content: center; align-items: center; }
body.sf-flipbook-page .sf-mobile-page { position: relative; flex: 0 0 auto; background: white; box-shadow: 0 2px 12px rgba(0,0,0,.15); transform-origin: center center; }
body.sf-flipbook-page .sf-mobile-page .sf-flipbook-page-canvas { width: 100%; height: 100%; }
body.sf-flipbook-page .sf-pdf-link-layer { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 25; pointer-events: none; }
body.sf-flipbook-page .sf-pdf-link { position: absolute; display: block; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; pointer-events: auto; touch-action: manipulation; appearance: none; }
/* Para depurar enlaces, descomenta: body.sf-flipbook-page .sf-pdf-link { outline: 2px solid red; background: rgba(255,0,0,.1); } */
body.sf-flipbook-page .sf-flipbook-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 100; font-size: 16px; pointer-events: none; }

/* Accesos directos personalizados: entre el libro y la toolbar */
body.sf-flipbook-page .sf-flipbook-shortcuts { position: absolute; left: 50%; bottom: 95px; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 32px); max-height: 100px; overflow-y: auto; padding: 4px; z-index: 48; }
body.sf-flipbook-page .sf-flipbook-shortcut { background: var(--sf-shortcut-color, #2563eb); color: #fff; border: 0; padding: 9px 15px; min-height: 36px; font-size: 13px; font-weight: 600; line-height: 1.2; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.17); transition: filter .15s ease; }
body.sf-flipbook-page .sf-flipbook-shortcut:hover { filter: brightness(.90); }
body.sf-flipbook-page .sf-flipbook-shortcut:focus-visible { outline: 3px solid #111; outline-offset: 3px; }
body.sf-flipbook-page .sf-flipbook-shortcut:disabled { opacity: .4; cursor: not-allowed; }

body.sf-flipbook-page .sf-flipbook-toolbar { position: absolute; left: 50%; bottom: 27px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: rgba(20,20,20,.92); border-radius: 8px; z-index: 50; box-shadow: 0 4px 18px rgba(0,0,0,.25); }
body.sf-flipbook-page .sf-flipbook-control { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: #fff; font-size: 18px; line-height: 1; text-decoration: none; cursor: pointer; }
body.sf-flipbook-page .sf-flipbook-control:hover { background: rgba(255,255,255,.12); }
body.sf-flipbook-page .sf-flipbook-control:disabled { opacity: .35; cursor: default; }
body.sf-flipbook-page .sf-flipbook-counter { min-width: 70px; text-align: center; color: #fff; font-size: 14px; font-weight: 500; }
body.sf-flipbook-page .sf-flipbook-toolbar-download { font-size: 20px; }

@media (max-width: 600px) {
  body.sf-flipbook-page .sf-flipbook-header { gap: 12px; padding: 12px 16px; }
  body.sf-flipbook-page .sf-flipbook-header h1 { font-size: 16px; }
  body.sf-flipbook-page .sf-flipbook-download { padding: 8px 12px; font-size: 14px; }
  body.sf-flipbook-page .sf-flipbook-viewer { padding: 8px 8px 148px; }
  body.sf-flipbook-page .sf-flipbook-shortcuts { position: absolute; left: 50%; bottom: 84px; max-height: 74px; width: max-content; max-width: calc(100vw - 16px); gap: 6px; padding: 4px; }
  body.sf-flipbook-page .sf-flipbook-shortcut { padding: 7px 10px; min-height: 32px; font-size: 11px; }
  body.sf-flipbook-page .sf-flipbook-toolbar { position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9999; gap: 4px; width: auto; max-width: calc(100vw - 16px); padding: 6px 8px; background: rgba(20,20,20,.94); }
  body.sf-flipbook-page .sf-flipbook-control { min-width: 34px; height: 34px; padding: 0 7px; font-size: 17px; }
  body.sf-flipbook-page .sf-flipbook-counter { min-width: 54px; font-size: 13px; }
}
