/* ============================================================
   flipbook.css — visualizador de jornal/revista em folhas
   Ver public/js/flipbook.js e blocos/documento/view.ejs.
   ============================================================ */

.flipbook-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 21, 46, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

body.flipbook-aberto {
  overflow: hidden;
}

.flipbook-caixa {
  width: 100%;
  max-width: 1100px;
  height: 100%;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  background: #525659;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.flipbook-caixa:fullscreen {
  max-width: none;
  max-height: none;
  border-radius: 0;
}

.flipbook-barra {
  background: #0A2247;
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.flipbook-titulo {
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flipbook-acoes {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.flipbook-baixar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #EC3136;
  color: #fff !important;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s;
}
.flipbook-baixar:hover {
  background: #C81F24;
}
.flipbook-botao {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.flipbook-botao:hover {
  background: rgba(255, 255, 255, 0.25);
}
.flipbook-botao i,
.flipbook-baixar i {
  width: 15px;
  height: 15px;
}

.flipbook-area {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  overflow: hidden;
}

.flipbook-carregando {
  position: absolute;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}
.flipbook-carregando i {
  width: 32px;
  height: 32px;
  animation: flipbook-girar 1s linear infinite;
}
@keyframes flipbook-girar {
  to { transform: rotate(360deg); }
}

.flipbook-livro {
  display: none;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}
.flipbook-pagina {
  background: #fff;
  overflow: hidden;
}
.flipbook-pagina canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* fallback quando o visualizador em folhas falha */
.flipbook-livro--iframe {
  width: 100%;
  height: 100%;
  box-shadow: none;
}
.flipbook-livro--iframe iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* embutido na página da revista/jornal ([data-flipbook-inline]) — a mesma
   caixa da janela, com altura própria em vez da tela inteira */
.flipbook-caixa--inline {
  height: min(82vh, 860px);
  min-height: 420px;
  max-height: none;
  margin: 0 auto;
}
.flipbook-caixa--inline:fullscreen {
  height: 100%;
}
/* sem JS: a capa e o link pro PDF que vêm no HTML */
.flipbook-semjs {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 100%;
  padding: 24px;
}
.flipbook-semjs img {
  max-height: 70%;
  width: auto;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
