/* ============================================
   LEITOR DE PDF — Livro do Sistema
   Paleta: preto + vermelho
   ============================================ */

.pv-reader{
    padding:40px 0 60px;
}

.pv-reader__bar{
    display:flex;
    flex-wrap:wrap;
    align-items:flex-end;
    justify-content:space-between;
    gap:16px;
    margin-bottom:24px;
}

.pv-reader__title{
    margin:0;
    font-size:clamp(1.6rem, 4vw, 2.2rem);
    letter-spacing:.03em;
}

.pv-reader__actions{
    display:flex;
    flex-wrap:wrap;
    gap:12px;
}

.pv-reader__actions .pv-btn{
    padding:10px 22px;
}

/* ---------- Aplicativo ---------- */

.pv-reader__app{
    position:relative;
    display:grid;
    grid-template-columns:310px 1fr;
    height:82vh;
    min-height:540px;
    background:#0a0707;
    border:1px solid var(--pv-border);
    border-radius:var(--pv-radius);
    overflow:hidden;
    transition:grid-template-columns .25s;
}

.pv-reader__app:fullscreen{
    height:100vh;
    border-radius:0;
    border:0;
}

.pv-reader__app.is-side-hidden{
    grid-template-columns:0 1fr;
}

.pv-reader__app.is-side-hidden .pv-reader__side{
    visibility:hidden;
    border-right:0;
}

.pv-reader__app button:focus-visible,
.pv-reader__app input:focus-visible,
.pv-reader__stage:focus-visible{
    outline:2px solid var(--pv-red-bright);
    outline-offset:-2px;
}

/* ---------- Barra lateral ---------- */

.pv-reader__side{
    display:flex;
    flex-direction:column;
    min-width:0;
    overflow:hidden;
    background:var(--pv-bg-alt);
    border-right:1px solid var(--pv-border);
}

.pv-reader__tabs{
    display:flex;
    border-bottom:1px solid var(--pv-border);
    background:var(--pv-bg);
}

.pv-reader__tabs button{
    flex:1;
    padding:14px 10px;
    background:none;
    border:0;
    border-bottom:2px solid transparent;
    color:var(--pv-muted);
    font-family:var(--fonte-titulo);
    font-size:.82rem;
    font-weight:700;
    letter-spacing:.05em;
    text-transform:uppercase;
    cursor:pointer;
    transition:color .15s, background .15s;
}

.pv-reader__tabs button:hover{
    color:#fff;
    background:var(--pv-surface);
}

.pv-reader__tabs button.is-active{
    color:#fff;
    border-bottom-color:var(--pv-red);
}

.pv-reader__count{
    display:inline-block;
    min-width:18px;
    margin-left:4px;
    padding:1px 6px;
    border-radius:20px;
    background:var(--pv-red-dark);
    color:#fff;
    font-size:.7rem;
    line-height:1.4;
}

.pv-reader__count.is-pulse{
    animation:pv-pulse .4s ease-out;
}

@keyframes pv-pulse{
    0%   { transform:scale(1); }
    50%  { transform:scale(1.2); }
    100% { transform:scale(1); }
}

.pv-reader__panel{
    flex:1;
    overflow-y:auto;
    padding:10px;
}

.pv-reader__panel[hidden]{
    display:none;
}

.pv-reader__list{
    margin:0;
    padding:0;
    list-style:none;
}

.pv-reader__list li{
    display:flex;
    align-items:stretch;
    margin-bottom:4px;
}

.pv-reader__item{
    flex:1;
    min-width:0;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:10px 12px;
    text-align:left;
    background:none;
    border:0;
    border-left:3px solid transparent;
    border-radius:6px;
    color:var(--pv-text);
    font-family:Georgia, serif;
    font-size:.92rem;
    cursor:pointer;
    transition:background .15s;
}

.pv-reader__item:hover{
    background:var(--pv-surface);
}

.pv-reader__item.is-active{
    background:var(--pv-surface-2);
    border-left-color:var(--pv-red);
    color:#fff;
}

.pv-reader__item small{
    flex-shrink:0;
    color:var(--pv-muted);
    font-size:.75rem;
    white-space:nowrap;
}

/* Marcadores */

.pv-reader__mark-info{
    display:flex;
    flex-direction:column;
    min-width:0;
}

.pv-reader__mark-name{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.pv-reader__mark-info small{
    margin-top:2px;
    color:var(--pv-muted);
    white-space:normal;
}

.pv-reader__edit,
.pv-reader__remove{
    width:32px;
    background:none;
    border:0;
    border-radius:6px;
    color:var(--pv-muted);
    font-size:1rem;
    cursor:pointer;
    transition:background .15s, color .15s;
}

.pv-reader__edit:hover,
.pv-reader__remove:hover{
    background:var(--pv-surface);
    color:#fff;
}

.pv-reader__empty{
    margin:8px 6px;
    color:var(--pv-muted);
    font-size:.88rem;
    line-height:1.5;
}

.pv-reader__empty kbd{
    padding:1px 6px;
    border:1px solid var(--pv-border);
    border-radius:4px;
    background:var(--pv-surface);
    font-size:.8rem;
}

/* ---------- Barra de ferramentas ---------- */

.pv-reader__main{
    position:relative;
    display:flex;
    flex-direction:column;
    min-width:0;
    min-height:0;
}

.pv-reader__toolbar{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:8px 18px;
    padding:10px 14px;
    background:var(--pv-bg);
    border-bottom:1px solid var(--pv-border);
}

.pv-tool-group{
    display:flex;
    align-items:center;
    gap:6px;
}

.pv-tool-group--end{
    margin-left:auto;
}

.pv-tool{
    display:grid;
    place-items:center;
    width:36px;
    height:36px;
    padding:0;
    background:var(--pv-surface);
    border:1px solid var(--pv-border);
    border-radius:6px;
    color:var(--pv-text);
    font-size:1.1rem;
    line-height:1;
    cursor:pointer;
    transition:background .15s, border-color .15s, opacity .15s;
}

.pv-tool:hover:not(:disabled){
    background:var(--pv-surface-2);
}

.pv-tool:disabled{
    opacity:.35;
    cursor:default;
}

.pv-tool--mark.is-on{
    color:#fff;
    border-color:var(--pv-red);
    background:var(--pv-red-dark);
}

.pv-reader__page{
    width:64px;
    padding:7px 6px;
    text-align:center;
    background:var(--pv-surface);
    border:1px solid var(--pv-border);
    border-radius:6px;
    color:var(--pv-text);
    font-size:.95rem;
    -moz-appearance:textfield;
}

.pv-reader__page::-webkit-outer-spin-button,
.pv-reader__page::-webkit-inner-spin-button{
    -webkit-appearance:none;
    margin:0;
}

.pv-reader__total,
.pv-reader__zoom{
    color:var(--pv-muted);
    font-size:.9rem;
}

.pv-reader__zoom{
    min-width:46px;
    text-align:center;
}

/* ---------- Área de leitura (rolagem contínua) ---------- */

.pv-reader__stage{
    position:relative;
    flex:1;
    overflow:auto;
    padding:20px;
    background:#0a0707;
}

.pv-reader__pages{
    position:relative;
    display:flex;
    flex-direction:column;
    align-items:center;
    width:max-content;
    min-width:100%;
}

.pv-page{
    position:relative;
    flex:none;
    margin:0 auto 16px;
    isolation:isolate;
    line-height:0;
    background:var(--pv-surface-2);
    border:0;
    box-shadow:0 4px 16px rgba(0,0,0,.5);
}

.pv-page::before{
    content:attr(data-n);
    position:absolute;
    inset:0;
    display:grid;
    place-items:center;
    font-family:var(--fonte-titulo);
    font-size:2.2rem;
    line-height:1;
    color:rgba(214,60,60,.3);
}

.pv-page.is-ready{
    background:#fff;
}

.pv-page.is-ready::before{
    display:none;
}

.pv-page canvas{
    display:block;
}

/* Página inteira marcada */

.pv-page.is-bookmarked{
    box-shadow:0 0 0 2px var(--pv-red), 0 4px 16px rgba(0,0,0,.5);
}

.pv-page__ribbon{
    display:none;
    position:absolute;
    top:-2px;
    right:22px;
    z-index:3;
    width:26px;
    height:40px;
    background:var(--pv-red);
    clip-path:polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}

.pv-page.is-bookmarked .pv-page__ribbon{
    display:block;
}

/* Trechos marcados */

.pv-page__marks{
    position:absolute;
    inset:0;
    pointer-events:none;
}

.pv-mark{
    position:absolute;
    background:rgba(214,60,60,.4);
    border-radius:2px;
    mix-blend-mode:multiply;
    pointer-events:none;
}

.pv-mark.is-flash{
    animation:pv-flash 1s ease-out 2;
}

@keyframes pv-flash{
    0%   { background:rgba(255,30,30,.85); }
    100% { background:rgba(214,60,60,.4); }
}

/* Camada de texto (seleção) — equivalente ao pdf_viewer.css */

.pv-page .textLayer{
    position:absolute;
    top:0;
    left:0;
    z-index:2;
    overflow:hidden;
    line-height:1;
    text-align:initial;
    text-size-adjust:none;
    forced-color-adjust:none;
    transform-origin:0 0;
}

.pv-page .textLayer span,
.pv-page .textLayer br{
    position:absolute;
    color:transparent;
    white-space:pre;
    cursor:text;
    transform-origin:0 0;
}

.pv-page .textLayer .markedContent{
    top:0;
    height:0;
}

.pv-page .textLayer ::selection{
    background:rgba(214,60,60,.45);
}

/* Botão flutuante ao selecionar texto */

.pv-reader__pop{
    position:absolute;
    z-index:20;
    transform:translateX(-50%);
    padding:8px 14px;
    background:var(--pv-red-dark);
    color:#fff;
    border:1px solid var(--pv-red);
    border-radius:6px;
    font-family:var(--fonte-titulo);
    font-size:.8rem;
    font-weight:700;
    letter-spacing:.03em;
    white-space:nowrap;
    cursor:pointer;
    box-shadow:0 4px 12px rgba(0,0,0,.5);
}

.pv-reader__pop:hover{
    background:var(--pv-red);
}

.pv-reader__pop[hidden]{
    display:none;
}

/* Carregando */

.pv-reader__status{
    position:absolute;
    inset:56px 0 0 0;
    z-index:10;
    display:grid;
    place-items:center;
    padding:20px;
    text-align:center;
    background:rgba(8,5,6,.92);
    color:var(--pv-muted);
    font-family:var(--fonte-titulo);
    letter-spacing:.04em;
    pointer-events:none;
}

.pv-reader__status[hidden]{
    display:none;
}

/* ---------- Barras de rolagem ---------- */

.pv-reader__stage,
.pv-reader__panel{
    scrollbar-width:thin;
    scrollbar-color:#6e2525 #1b0d0d;
}

.pv-reader__stage::-webkit-scrollbar,
.pv-reader__panel::-webkit-scrollbar{
    width:10px;
    height:10px;
}

.pv-reader__stage::-webkit-scrollbar-track,
.pv-reader__panel::-webkit-scrollbar-track{
    background:#1b0d0d;
}

.pv-reader__stage::-webkit-scrollbar-thumb,
.pv-reader__panel::-webkit-scrollbar-thumb{
    background:#6e2525;
    border-radius:10px;
    border:2px solid #1b0d0d;
}

.pv-reader__stage::-webkit-scrollbar-thumb:hover,
.pv-reader__panel::-webkit-scrollbar-thumb:hover{
    background:#8f3030;
}

/* ---------- Responsivo ---------- */

@media (max-width:820px){

    .pv-reader__app,
    .pv-reader__app.is-side-hidden{
        grid-template-columns:1fr;
        height:78vh;
    }

    .pv-reader__side,
    .pv-reader__app.is-side-hidden .pv-reader__side{
        position:absolute;
        top:0;
        bottom:0;
        left:0;
        z-index:15;
        width:min(86%, 330px);
        visibility:visible;
        border-right:1px solid var(--pv-border);
        box-shadow:var(--pv-shadow);
        transform:translateX(-105%);
        transition:transform .25s;
    }

    .pv-reader__app.is-side-open .pv-reader__side{
        transform:translateX(0);
    }

    .pv-tool-group--end{
        margin-left:0;
    }

    .pv-reader__stage{
        padding:12px;
    }
}

@media (prefers-reduced-motion:reduce){
    .pv-mark.is-flash,
    .pv-reader__count.is-pulse{
        animation:none;
    }
}