/* Visualizador de edições — Correio do Povo
   Visual igual ao leitor FlipHTML5 das edições anteriores
   (/wp-content/uploads/online/edXXX/mobile/): fundo azul, uma página
   centralizada e barras pretas que aparecem ao mexer o mouse/tocar. */

:root {
  --bar-bg: #110e0f;
  --bar-h: 38px;
  --icon: #e5e5e5;
  --icon-hover: #ffffff;
  --stage-bg: #1f2232;
  --accent: #ffb000;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--stage-bg);
  color: var(--icon);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input, a { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Palco: ocupa a tela toda, com a imagem de fundo ---------- */
.vf-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background-color: var(--stage-bg);
  background-image:
    url("../../uploads/online/ed598/files/mobile-ext/backGroundImgURL.jpg"),
    radial-gradient(ellipse at 30% 20%, #3f7fd6 0%, #1c4f9c 35%, #0f2f66 70%, #0a1f45 100%);
  background-size: 100% 100%, cover;
  background-repeat: no-repeat;
}

.vf-book-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.vf-book { flex: 0 0 auto; margin: 0 auto; }

.vf-page { background: #fff; overflow: hidden; }
.vf-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.vf-page img:not([src]) { visibility: hidden; }
.vf-page.is-pending::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border: 2px solid #d6d6d6;
  border-top-color: #888;
  border-radius: 50%;
  animation: vf-spin 0.9s linear infinite;
}
.stf__parent { margin: 0 auto; }
.stf__item { box-shadow: 0 0 10px rgba(0, 0, 0, 0.45); }

/* ---------- Barras (sobrepostas; somem sozinhas) ---------- */
.vf-topbar, .vf-bottombar {
  position: fixed;
  left: 0; right: 0;
  z-index: 30;
  background: var(--bar-bg);
  transition: transform .25s ease, opacity .25s ease;
}
.vf-topbar {
  top: 0;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.vf-bottombar {
  bottom: 0;
  height: calc(var(--bar-h) + env(safe-area-inset-bottom));
  padding: 0 6px env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
body.bars-hidden .vf-topbar { transform: translateY(-100%); opacity: 0; }
body.bars-hidden .vf-bottombar { transform: translateY(100%); opacity: 0; }

/* O título não aparece no leitor antigo; fica só para leitores de tela */
.vf-brand {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.vf-search {
  position: relative;
  flex: 0 1 236px;
  height: 24px;
  display: flex;
  align-items: center;
  background: #3a3a3c;
  border-radius: 2px;
}
.vf-search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 28px 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 12px;
}
.vf-search-input::placeholder { color: #8d8d8f; }
.vf-search-input::-webkit-search-cancel-button { display: none; }
.vf-search-btn {
  position: absolute;
  right: 6px; top: 4px;
  width: 16px; height: 16px;
  color: #8d8d8f;
}
.vf-search-btn:hover { color: #fff; }

.vf-search-results {
  position: fixed;
  top: calc(var(--bar-h) + env(safe-area-inset-top));
  right: 8px;
  z-index: 31;
  width: min(360px, calc(100vw - 16px));
  max-height: min(60vh, 460px);
  overflow-y: auto;
  background: rgba(17, 14, 15, 0.96);
  border: 1px solid #2c2a2b;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  font-size: 13px;
}
.vf-search-status { padding: 10px 12px; color: #aaa; }
.vf-search-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-top: 1px solid #262324;
  line-height: 1.35;
  color: #ddd;
}
.vf-search-item:hover, .vf-search-item:focus { background: #2a2627; outline: 0; }
.vf-search-item b { color: var(--accent); font-weight: normal; }
.vf-search-page { display: block; font-size: 11px; color: #9a9a9a; margin-bottom: 2px; }

/* ---------- Setas laterais finas ---------- */
.vf-side {
  position: absolute;
  top: 50%;
  width: 52px;
  height: 130px;
  margin-top: -65px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 10;
  transition: background-color .15s;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.45));
}
.vf-side svg { width: 26px; height: 52px; }
.vf-side-prev { left: 0; }
.vf-side-next { right: 0; }
.vf-side:hover { background: rgba(17, 26, 43, 0.82); }
.vf-side:disabled { opacity: 0; pointer-events: none; }

.vf-corner {
  position: absolute;
  bottom: calc(var(--bar-h) + 6px);
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.35);
  z-index: 10;
}
.vf-corner:hover { color: rgba(255,255,255,.85); }
.vf-corner-first { left: 14px; }
.vf-corner-last { right: 14px; }
.vf-corner:disabled { opacity: 0; pointer-events: none; }

/* ---------- Carregando / erro ---------- */
.vf-loading, .vf-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bar-bg);
  color: #ddd;
  z-index: 20;
  text-align: center;
  padding: 24px;
}
.vf-spinner {
  width: 38px; height: 38px;
  border: 3px solid rgba(255,255,255,.18);
  border-top-color: #ddd;
  border-radius: 50%;
  animation: vf-spin 0.9s linear infinite;
}
.vf-loading-text { margin: 0; font-size: 14px; }
.vf-progress { width: 200px; height: 3px; background: rgba(255,255,255,.15); }
.vf-progress-bar { width: 0; height: 100%; background: #ddd; transition: width .2s; }
.vf-error p { margin: 0; }
.vf-error-detail { font-size: 12px; color: #999; max-width: 520px; word-break: break-word; }

@keyframes vf-spin { to { transform: rotate(360deg); } }

/* ---------- Ícones da barra inferior ---------- */
.vf-group { display: flex; align-items: center; gap: 2px; }
.vf-group-right { justify-content: flex-end; }

.vf-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--icon);
  text-decoration: none;
  border-radius: 2px;
}
.vf-icon svg { width: 19px; height: 19px; }
.vf-icon:hover { color: var(--icon-hover); background: rgba(255,255,255,.08); }
.vf-icon:disabled { opacity: .35; pointer-events: none; }
.vf-icon.is-active { color: var(--accent); }

#vfAutoBtn .vf-ico-pause { display: none; }
#vfAutoBtn.is-active .vf-ico-play { display: none; }
#vfAutoBtn.is-active .vf-ico-pause { display: block; }

.vf-page-input {
  width: 50px;
  height: 19px;
  margin: 0 8px;
  padding: 0 4px;
  border: 0;
  border-radius: 1px;
  background: #fff;
  color: #000;
  font-size: 12px;
  text-align: center;
  outline: 0;
}

/* ---------- Miniaturas ---------- */
.vf-thumbs {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--bar-h) + env(safe-area-inset-bottom));
  height: 168px;
  background: rgba(51, 51, 51, 0.75);
  z-index: 25;
}
.vf-thumbs-strip {
  height: 100%;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 0 16px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.vf-thumb {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #ddd;
  font-size: 11px;
}
.vf-thumb-img {
  height: 124px;
  background: #fff center/cover no-repeat;
  border: 2px solid transparent;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.vf-thumb:hover .vf-thumb-img { border-color: rgba(255,255,255,.7); }
.vf-thumb.is-current .vf-thumb-img { border-color: var(--accent); }

/* ---------- Zoom ---------- */
.vf-zoom {
  position: absolute;
  inset: 0;
  z-index: 26;
  background: rgba(17, 14, 15, 0.94);
}
.vf-zoom-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  cursor: grab;
  -webkit-overflow-scrolling: touch;
}
.vf-zoom-scroll.is-dragging { cursor: grabbing; }
.vf-zoom-inner {
  margin: 0 auto;
  padding: 16px;
  width: max-content;
}
.vf-zoom-inner img {
  display: block;
  background: #fff;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 0 8px rgba(0,0,0,.5);
}
.vf-zoom-tools {
  position: absolute;
  top: calc(var(--bar-h) + 10px);
  right: 14px;
  display: flex;
  gap: 6px;
}
.vf-zoom-tool {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(17,14,15,.85);
  border: 1px solid #3a3a3c;
  color: #e5e5e5;
}
.vf-zoom-tool:hover { color: #fff; border-color: #777; }

.vf-toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--bar-h) + 18px);
  transform: translateX(-50%);
  padding: 8px 14px;
  background: rgba(17,14,15,.92);
  color: #fff;
  font-size: 13px;
  border-radius: 3px;
  z-index: 40;
}

/* ---------- Celular: página na largura toda, sem setas (folheia com o dedo) ---------- */
@media (max-width: 639px) {
  .vf-hide-sm { display: none !important; }
  .vf-search { flex-basis: 170px; }
  .vf-side, .vf-corner { display: none !important; }
  .vf-icon { width: 30px; }
  .vf-icon svg { width: 17px; height: 17px; }
  .vf-page-input { width: 50px; margin: 0 4px; }
  .vf-thumbs { height: 140px; }
  .vf-thumb-img { height: 100px; }
  .stf__item { box-shadow: none; }
}
@media (max-width: 380px) {
  #vfFirst, #vfLast { display: none; }
}
