/* Protected View-Only Presentation Stylesheet */

/* Disable selection across viewer */
* {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

body.viewer-body {
    background-color: #0b0f19;
    color: #f8fafc;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Watermark Overlay */
.watermark-overlay {
    position: fixed;
    inset: 0;
    z-index: 99;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.055;
    display: flex;
    align-items: center;
    justify-content: center;
}

.watermark-repeat {
    transform: rotate(-30deg);
    display: flex;
    flex-direction: column;
    gap: 120px;
    white-space: nowrap;
}

.watermark-repeat span {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: #ffffff;
}

/* Viewer Header */
.viewer-header {
    height: 56px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 100;
    flex-shrink: 0;
}

.viewer-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 50%;
}

.btn-viewer-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-viewer-back:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: #38bdf8;
    color: #ffffff;
    transform: translateX(-2px);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}

.viewer-badge-lock {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    padding: 2px 7px;
    border-radius: 4px;
    flex-shrink: 0;
}

.viewer-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewer-header-center {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.viewer-btn-group {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 2px;
}

.btn-tool {
    background: none;
    border: none;
    color: #94a3b8;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-tool:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.page-indicator, .zoom-level {
    font-size: 0.775rem;
    font-weight: 500;
    color: #e2e8f0;
    padding: 0 8px;
    min-width: 70px;
    text-align: center;
}

.viewer-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.viewer-protection-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Presentation Stage */
.viewer-stage {
    flex: 1;
    overflow: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem 1rem;
    background: #090d16;
}

/* Loading Spinner */
.viewer-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner-ring {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(56, 189, 248, 0.15);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spinRing 0.8s linear infinite;
}

.loader-text {
    font-size: 0.85rem;
    color: #94a3b8;
}

@keyframes spinRing {
    to { transform: rotate(360deg); }
}

/* PDF Stage */
.pdf-stage {
    display: flex;
    justify-content: center;
    width: 100%;
    padding-bottom: 2rem;
}

.pdf-canvas {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    max-width: 100%;
    background: #ffffff;
    pointer-events: none; /* Disables direct right-click or drag on canvas element */
}

/* Image Stage */
.image-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 80vh;
}

.image-canvas-wrapper {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
}

.image-canvas {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    max-width: 100%;
    max-height: 85vh;
    display: block;
    pointer-events: none;
}

/* Video Stage */
.video-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 80vh;
}

.video-player-wrapper {
    max-width: 960px;
    width: 100%;
    background: #000000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-video {
    width: 100%;
    display: block;
    max-height: 80vh;
}

/* DOCX Document Paper Rendering */
.docx-stage {
    width: 100%;
    display: flex;
    justify-content: center;
    padding-bottom: 3rem;
}

.docx-document-paper {
    background: #ffffff;
    color: #1e293b;
    width: 100%;
    max-width: 860px;
    min-height: 1100px;
    padding: 3.5rem 4rem;
    border-radius: 4px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
    line-height: 1.7;
    font-size: 1rem;
    font-family: 'Inter', -apple-system, sans-serif;
}

.docx-document-paper h1, 
.docx-document-paper h2, 
.docx-document-paper h3 {
    color: #0f172a;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.docx-document-paper p {
    margin-bottom: 1rem;
}

.docx-document-paper table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.docx-document-paper table, 
.docx-document-paper th, 
.docx-document-paper td {
    border: 1px solid #cbd5e1;
    padding: 8px 12px;
}

.docx-document-paper th {
    background: #f1f5f9;
    font-weight: 600;
}

/* PPTX Slide Stage */
.pptx-stage {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.pptx-slide-canvas {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #ffffff;
    color: #0f172a;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.pptx-slide-content {
    font-size: 1.25rem;
    line-height: 1.6;
}

.pptx-nav-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    padding: 6px 16px;
}

.pptx-tracker {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2e8f0;
}

/* Generic Text Document Paper */
.text-stage {
    width: 100%;
    max-width: 860px;
    display: flex;
    justify-content: center;
}

.text-document-paper {
    width: 100%;
    background: #111827;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 2rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Shield Notification Toast */
.shield-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(244, 63, 94, 0.4);
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 200;
    animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Mobile Floating Bottom Pagination Bar */
.mobile-pagination-bar {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 9999px;
    padding: 6px 14px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.2);
    animation: slideUpFade 0.3s ease-out;
}

.btn-mobile-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    transition: all 0.2s ease;
}

.btn-mobile-nav:active {
    background: #38bdf8;
    color: #0f172a;
    transform: scale(0.96);
}

.mobile-page-display {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
    min-width: 50px;
    justify-content: center;
}

.mobile-current-page {
    color: #38bdf8;
}

.mobile-page-divider {
    color: #64748b;
}

.mobile-total-pages {
    color: #94a3b8;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translate(-50%, 15px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Responsive Styles for Mobile and Tablets */
@media (max-width: 768px) {
    .viewer-header {
        height: auto;
        min-height: 52px;
        padding: 0.5rem 0.85rem;
        gap: 0.5rem;
    }

    .viewer-header-left {
        max-width: 70%;
        gap: 0.5rem;
    }

    .viewer-title {
        font-size: 0.85rem;
        max-width: 160px;
    }

    .btn-viewer-back {
        padding: 0.35rem 0.65rem;
        font-size: 0.75rem;
    }

    /* Hide desktop header pagination in favor of mobile floating bar */
    #pagination-controls {
        display: none !important;
    }

    #zoom-controls {
        display: none !important;
    }

    .viewer-protection-label {
        display: none;
    }

    .viewer-stage {
        padding: 1rem 0.5rem 5rem 0.5rem; /* Extra bottom padding so mobile bar doesn't overlap */
    }

    .pdf-canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    .docx-document-paper {
        padding: 1.5rem 1rem;
        min-height: auto;
        font-size: 0.925rem;
        border-radius: 4px;
        box-shadow: none;
    }

    .docx-document-paper h1 { font-size: 1.35rem; }
    .docx-document-paper h2 { font-size: 1.15rem; }

    .pptx-stage {
        gap: 0.75rem;
    }

    .pptx-slide-canvas {
        padding: 1.5rem 1rem;
        aspect-ratio: auto;
        min-height: 240px;
    }

    .pptx-nav-bar {
        display: none !important; /* Mobile floating bar replaces it */
    }
}

@media (max-width: 480px) {
    .viewer-title {
        max-width: 110px;
    }
    .viewer-badge-lock span {
        display: none;
    }
    .badge-type {
        font-size: 0.6rem;
    }
}

/* Complete Print Shield */
@media print {
    html, body {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        width: 0 !important;
    }
}
