/* ============================================================
   DHFlipbook — estilos
   ============================================================ */
.fb { position: fixed; inset: 0; z-index: 1000; background: radial-gradient(ellipse at 50% 40%, #243b55, #0b1e33 70%); color: #fff; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 58px 1fr 60px; opacity: 0; transition: opacity .45s ease; font-family: "Montserrat", system-ui, sans-serif; user-select: none; }
.fb.is-open { opacity: 1; }
.fb[hidden] { display: none; }
body.fb-open { overflow: hidden; }
.fb svg { width: 20px; height: 20px; fill: currentColor; display: block; }

/* topo */
.fb__top { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: rgba(8,20,34,.55); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(255,255,255,.08); }
.fb__title { display: flex; align-items: center; gap: 14px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; opacity: .9; }
.fb__title img { height: 28px; }
.fb__pager { font-family: "Square721 Cn", "Square721", sans-serif; font-size: 15px; letter-spacing: .1em; opacity: .9; display: flex; align-items: center; gap: 6px; }
.fb__pageInput { width: 54px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); color: #fff; font: inherit; text-align: center; padding: 4px; border-radius: 3px; }
.fb__pageInput::-webkit-outer-spin-button, .fb__pageInput::-webkit-inner-spin-button { -webkit-appearance: none; }
.fb__btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: rgba(255,255,255,.85); transition: background .25s, color .25s, transform .25s; }
.fb__btn:hover { background: rgba(255,255,255,.12); color: #fff; transform: translateY(-2px); }
.fb__btn.is-on { background: #2DB4E6; color: #fff; }
.fb__btn:disabled { opacity: .25; pointer-events: none; }
.fb__sep { width: 1px; height: 22px; background: rgba(255,255,255,.15); margin: 0 6px; }

/* palco */
.fb__stage { position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; overflow: hidden; }
.fb__viewport { position: relative; height: 100%; display: grid; place-items: center; overflow: hidden; cursor: grab; touch-action: none; }
.fb--zoomed .fb__viewport { cursor: move; }
.fb__zoom { transition: transform .35s cubic-bezier(.22,.61,.36,1); will-change: transform; }
.fb__book { position: relative; perspective: 2800px; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.22,.61,.36,1); }
.fb__book--closed-right { transform: translateX(-25%); }
.fb__book--closed-left { transform: translateX(25%); }
.fb--single .fb__book--closed-right, .fb--single .fb__book--closed-left { transform: none; }
.fb__book::before { content: ""; position: absolute; left: 50%; top: 2%; bottom: 2%; width: 1px; margin-left: -.5px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.25), transparent); z-index: 0; }
.fb--single .fb__book::before { display: none; }

.fb__sheet { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; transform-origin: left center; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.45,.05,.3,1); }
.fb--single .fb__sheet { left: 0; width: 100%; }
.fb__sheet.no-anim { transition: none !important; }
.fb__sheet.is-flipped { transform: rotateY(-180deg); }
.fb__face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: #fff; overflow: hidden; }
/* sombra só embaixo do livro, numa camada única (as sombras de cada folha somavam e formavam a faixa preta na lombada) */
.fb__book::after { content: ""; position: absolute; left: 3%; right: 3%; bottom: -18px; height: 36px; background: radial-gradient(50% 50% at 50% 50%, rgba(0,0,0,.55), transparent); filter: blur(8px); transform: translateZ(-2px); pointer-events: none; transition: left .8s cubic-bezier(.22,.61,.36,1), right .8s cubic-bezier(.22,.61,.36,1); }
.fb__book--closed-right::after { left: 50%; }
.fb__book--closed-left::after { right: 50%; }
.fb__face img { width: 100%; height: 100%; object-fit: fill; display: block; pointer-events: none; }
.fb__face--back { transform: rotateY(180deg); }
.fb__face--front { border-radius: 0 4px 4px 0; }
.fb__face--back { border-radius: 4px 0 0 4px; }
.fb--single .fb__face { border-radius: 4px; }
.fb__fold { position: absolute; inset: 0; pointer-events: none; opacity: .9; }
.fb__face--front .fb__fold { background: linear-gradient(90deg, rgba(0,0,0,.14), rgba(0,0,0,.04) 3%, transparent 7%); }
.fb__face--back .fb__fold { background: linear-gradient(270deg, rgba(0,0,0,.14), rgba(0,0,0,.04) 3%, transparent 7%); }
.fb--single .fb__fold { display: none; }
/* sombreamento dinâmico durante a virada */
.fb__sheet.is-flipping .fb__face::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.35), transparent 50%, rgba(0,0,0,.25)); animation: fbShade .9s ease-in-out; pointer-events: none; }
@keyframes fbShade { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }
.fb__sheet.is-flipping .fb__face { box-shadow: -20px 20px 50px -10px rgba(0,0,0,.55); }

.fb__arrow { width: 52px; height: 52px; margin: 0 6px; border-radius: 50%; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; justify-self: center; transition: background .25s, transform .25s, opacity .25s; }
.fb__arrow svg { width: 26px; height: 26px; }
.fb__arrow:hover { background: #2DB4E6; border-color: #2DB4E6; transform: scale(1.08); }
.fb__arrow:disabled { opacity: .15; pointer-events: none; }
.fb__loading { position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; justify-items: center; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; background: rgba(11,30,51,.6); transition: opacity .5s; }
.fb__loading.is-hidden { opacity: 0; pointer-events: none; }
.fb__loading span { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255,255,255,.2); border-top-color: #2DB4E6; animation: fbSpin 1s linear infinite; }
@keyframes fbSpin { to { transform: rotate(360deg); } }

/* barra inferior */
.fb__bar { display: flex; align-items: center; justify-content: center; gap: 4px; background: rgba(8,20,34,.55); backdrop-filter: blur(8px); border-top: 1px solid rgba(255,255,255,.08); padding: 0 10px; }

/* painéis laterais */
.fb__panel { position: absolute; top: 58px; bottom: 60px; left: 0; width: min(420px, 100%); background: rgba(11,30,51,.96); backdrop-filter: blur(14px); border-right: 1px solid rgba(255,255,255,.08); transform: translateX(-100%); transition: transform .4s cubic-bezier(.22,.61,.36,1); display: flex; flex-direction: column; z-index: 5; }
.fb__panel.is-open { transform: none; }
.fb__panel header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; font-family: "Square721", sans-serif; letter-spacing: .1em; text-transform: uppercase; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,.08); }
.fb__panel header button { color: rgba(255,255,255,.7); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.fb__panel header button:hover { background: rgba(255,255,255,.1); color: #fff; }
.fb__panel ul { overflow-y: auto; padding: 8px 0; }
.fb__panel ul button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; text-align: left; font-size: 13px; color: rgba(255,255,255,.85); border-left: 3px solid transparent; transition: background .2s, border-color .2s; }
.fb__panel ul button:hover { background: rgba(255,255,255,.06); border-left-color: #D4323F; color: #fff; }
.fb__panel ul button b { font-family: "Square721 Cn", sans-serif; font-weight: 400; color: #56C7E0; letter-spacing: .1em; }
.fb__thumbs { overflow-y: auto; padding: 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.fb__thumbs button { position: relative; border-radius: 3px; overflow: hidden; background: #fff; aspect-ratio: 1600/1131; transition: transform .25s, box-shadow .25s; }
.fb__thumbs button:hover { transform: scale(1.04); box-shadow: 0 10px 20px -8px rgba(0,0,0,.6); }
.fb__thumbs img { width: 100%; height: 100%; object-fit: cover; }
.fb__thumbs span { position: absolute; right: 0; bottom: 0; background: rgba(20,53,90,.85); color: #fff; font-size: 10px; padding: 3px 8px; border-radius: 3px 0 0 0; letter-spacing: .08em; }

.fb__toast { position: absolute; left: 50%; bottom: 80px; transform: translateX(-50%); background: #2DB4E6; color: #fff; padding: 10px 18px; border-radius: 30px; font-size: 13px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.6); z-index: 6; }

/* responsivo */
@media (max-width: 760px) {
  .fb { grid-template-rows: 52px 1fr 54px; }
  .fb__stage { grid-template-columns: minmax(0, 1fr); }
  .fb__bar { justify-content: safe center; overflow-x: auto; scrollbar-width: none; }
  .fb__bar::-webkit-scrollbar { display: none; }
  .fb__arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; z-index: 3; }
  .fb__arrow--prev { left: 8px; } .fb__arrow--next { right: 8px; }
  .fb__arrow:hover { transform: translateY(-50%) scale(1.08); }
  .fb__title span { display: none; }
  .fb__btn { width: 38px; height: 38px; }
  .fb__sep { display: none; }
  .fb__panel { width: 100%; }
}
@media print { .fb { display: none !important; } }
