/* PDF Viewer Exclusive – viewer.css */

.pve-viewer,
.pve-viewer *,
.pve-viewer *::before,
.pve-viewer *::after {
    box-sizing: border-box;
}

.pve-viewer {
    --pve-stage: #3d4249;
    --pve-bar: #1f2328;
    --pve-bar-ink: #eceff3;
    --pve-bar-dim: #9aa3ad;
    --pve-hover: rgba(255, 255, 255, .12);
    --pve-focus: #6cc3b4;

    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    min-height: 260px;
    margin: 1.25em 0;
    overflow: hidden;
    border-radius: 6px;
    background: var(--pve-stage);
    color: var(--pve-bar-ink);
    font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-touch-callout: none;
}

.pve-viewer.pve-nosel {
    -webkit-user-select: none;
    user-select: none;
}

/* ---------- Toolbar ---------- */

.pve-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 18px;
    padding: 6px 10px;
    background: var(--pve-bar);
}

.pve-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.pve-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--pve-bar-ink);
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    text-shadow: none;
    transition: background-color .12s;
}
.pve-btn:hover { background: var(--pve-hover); color: var(--pve-bar-ink); }
.pve-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.pve-btn:focus-visible,
.pve-page-input:focus-visible,
.pve-scroll:focus-visible {
    outline: 2px solid var(--pve-focus);
    outline-offset: -2px;
}

.pve-pager {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px;
    color: var(--pve-bar-dim);
    font-variant-numeric: tabular-nums;
}
.pve-page-input {
    width: 3.4em;
    height: 28px;
    margin: 0;
    padding: 0 4px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 5px;
    background: rgba(255, 255, 255, .08);
    color: var(--pve-bar-ink);
    font: inherit;
    text-align: center;
    box-shadow: none;
}
.pve-zoom-label {
    min-width: 3.6em;
    text-align: center;
    color: var(--pve-bar-ink);
    font-variant-numeric: tabular-nums;
}

.pve-no-toolbar .pve-toolbar,
.pve-fallback-on .pve-toolbar {
    display: none;
}

/* ---------- Area dokumen ---------- */

.pve-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}

.pve-scroll {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    overflow: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
}

.pve-page {
    position: relative;
    margin: 0 auto 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .22);
}
.pve-page:last-child { margin-bottom: 0; }
.pve-page canvas {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    -webkit-user-drag: none;
}

/* Lapisan teks (hanya dibuat bila seleksi teks diizinkan) */
.pve-textlayer {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    line-height: 1;
    text-size-adjust: none;
}
.pve-textlayer span,
.pve-textlayer br {
    position: absolute;
    color: transparent;
    white-space: pre;
    cursor: text;
    transform-origin: 0 0;
}
.pve-textlayer ::selection { background: rgba(0, 110, 255, .3); }

/* ---------- Status / progres ---------- */

.pve-status {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: var(--pve-stage);
    color: var(--pve-bar-ink);
    text-align: center;
}
.pve-ready .pve-status { display: none; }

.pve-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(255, 255, 255, .22);
    border-top-color: var(--pve-bar-ink);
    border-radius: 50%;
    animation: pve-spin .8s linear infinite;
}
.pve-error .pve-spinner,
.pve-error .pve-progress { display: none; }

.pve-progress {
    display: block;
    width: min(240px, 70%);
    height: 4px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, .16);
}
.pve-progress i {
    display: block;
    width: 0;
    height: 100%;
    background: var(--pve-focus);
    transition: width .15s linear;
}

@keyframes pve-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .pve-spinner { animation-duration: 2.4s; }
    .pve-progress i { transition: none; }
}

/* ---------- Fallback iframe ---------- */

.pve-fallback {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}
.pve-fallback iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 360px;
    border: 0;
    background: #fff;
}
.pve-body > .pve-fallback { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 4; }
/* noscript hanya diberi layout saat scripting benar-benar mati; jika tidak, isinya tampil sebagai teks mentah. */
@media (scripting: none) {
    .pve-viewer noscript { display: block; flex: 1 1 auto; min-height: 0; }
}
.pve-fallback-link { margin: 0; padding: 8px 12px; background: var(--pve-bar); text-align: center; }
.pve-fallback-link a { color: var(--pve-bar-ink); }

/* ---------- Pesan (akses ditolak, tidak tersedia) ---------- */

.pve-notice {
    max-width: 100%;
    margin: 1.25em 0;
    padding: 14px 18px;
    border: 1px solid #d0d5db;
    border-left: 4px solid #b5473a;
    border-radius: 4px;
    background: #f8f5f4;
    color: #2b2f33;
}
.pve-notice p { margin: 0; }
.pve-notice p + p { margin-top: .6em; }
.pve-notice a { font-weight: 600; }

/* ---------- Layar penuh ---------- */

.pve-viewer:fullscreen {
    width: 100% !important;
    height: 100% !important;
    margin: 0;
    border-radius: 0;
}
.pve-viewer:-webkit-full-screen {
    width: 100% !important;
    height: 100% !important;
    margin: 0;
    border-radius: 0;
}

/* ---------- Layar kecil ---------- */

@media (max-width: 520px) {
    .pve-toolbar { gap: 2px 8px; padding: 4px 6px; }
    .pve-btn { width: 38px; height: 38px; }
    .pve-scroll { padding: 8px; }
    .pve-zoom-label { min-width: 3em; }
}

/* ---------- Modal kata sandi unduhan ---------- */

.pve-dl-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(20, 22, 25, .55);
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease;
    font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.pve-dl-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.pve-dl-modal {
    width: 100%;
    max-width: 360px;
    background: #fff;
    color: #1f2328;
    border-radius: 8px;
    padding: 20px 22px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}
.pve-dl-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
}
.pve-dl-desc {
    margin: 0 0 14px;
    color: #5c6570;
}
.pve-dl-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 1px solid #ccd0d4;
    border-radius: 5px;
    font-size: 14px;
}
.pve-dl-input:focus {
    outline: none;
    border-color: #6cc3b4;
    box-shadow: 0 0 0 2px rgba(108, 195, 180, .3);
}
.pve-dl-error {
    margin-top: 8px;
    color: #c0392b;
    font-size: 13px;
}
.pve-dl-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}
.pve-dl-btn {
    appearance: none;
    border: none;
    border-radius: 5px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.pve-dl-btn-ghost {
    background: transparent;
    color: #5c6570;
}
.pve-dl-btn-ghost:hover { background: #f0f1f2; }
.pve-dl-btn-primary {
    background: #1f2328;
    color: #fff;
}
.pve-dl-btn-primary:hover { background: #33383f; }
.pve-dl-btn-primary:disabled {
    opacity: .6;
    cursor: default;
}

/* ---------- Cetak ---------- */

.pve-print-msg { display: none; }

@media print {
    .pve-viewer.pve-noprint { display: none !important; }
    .pve-print-msg {
        display: block !important;
        padding: 12px;
        border: 1px solid #999;
        text-align: center;
    }
}
