/* ============================================================
   Secure ISO certificate viewer
   Displays watermarked certificate images in a locked overlay.
   Pairs with js/cert-viewer.js and the /cert-view.php gateway.
   ============================================================ */

.cert-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(10, 15, 30, 0.92);
    backdrop-filter: blur(4px);
    padding: 24px 16px;
    /* Block native selection / callout / touch save on the whole overlay */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.cert-viewer-overlay.is-open {
    display: flex;
}

.cert-viewer-topbar {
    width: 100%;
    max-width: 900px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #fff;
    margin-bottom: 14px;
}

.cert-viewer-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: #fff;
}

.cert-viewer-close {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    color: #fff;
    border-radius: 999px;
    padding: 8px 18px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    flex: 0 0 auto;
}

.cert-viewer-close:hover,
.cert-viewer-close:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    outline: none;
}

/* Stage is the scroll viewport. The image keeps a readable, width-driven size;
   when the window is too short the image does NOT shrink — the stage scrolls. */
.cert-viewer-stage {
    position: relative;
    max-width: 900px;
    width: 100%;
    max-height: calc(100vh - 150px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* Frame wraps the image + shield and matches the image size, so the shield
   always covers the whole page even while the tall image is scrolled. */
.cert-viewer-frame {
    position: relative;
    display: block;
    width: 100%;
}

.cert-viewer-img {
    display: block;
    width: 100%;          /* size by width → stays readable regardless of height */
    height: auto;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    /* Prevent drag-to-save and long-press save */
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none; /* clicks pass to the shield, never to the img itself */
    transition: filter 0.2s ease;
}

/* Transparent layer above the image: intercepts context menu, drag, long-press */
.cert-viewer-shield {
    position: absolute;
    inset: 0;
    z-index: 2;
    cursor: default;
}

/* Obscure the image when the tab/window loses focus (screenshot deterrent) */
.cert-viewer-overlay.is-obscured .cert-viewer-img {
    filter: blur(22px);
}

.cert-viewer-notice {
    max-width: 900px;
    width: 100%;
    margin-top: 14px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.4;
}

.cert-viewer-status {
    color: #fff;
    font-size: 0.95rem;
    text-align: center;
    padding: 40px 0;
}

.cert-viewer-status.is-error {
    color: #ffb4b4;
}

/* ---- Print guard --------------------------------------------------------
   While the viewer is open, printing (Ctrl/Cmd+P, browser print) yields a
   blank page with a notice instead of the certificate. */
@media print {
    body.cert-print-guard * {
        display: none !important;
    }
    body.cert-print-guard::after {
        content: "Documento protegido — impressão não autorizada / Protected document — printing not allowed";
        display: block;
        padding: 40px;
        font-family: sans-serif;
        font-size: 16px;
    }
}
