
/* ───────────────────────────────────────
   VIEWER MODAL (SECURE)
─────────────────────────────────────── */
.viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.viewer-header {
    width: 100%;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 10, 10, 0.8);
    border-bottom: 1px solid var(--border-glass);
}

.viewer-title {
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
}

.viewer-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.viewer-close:hover {
    color: #ff4d4d;
}

.viewer-modal.pseudo-fullscreen .viewer-header {
    display: none;
}

.viewer-modal.pseudo-fullscreen .viewer-content {
    padding: 0;
    position: absolute;
    inset: 0;
    align-items: stretch;
    justify-content: stretch;
}

.viewer-modal.pseudo-fullscreen .viewer-content iframe,
.viewer-modal.pseudo-fullscreen .viewer-content video,
.viewer-modal.pseudo-fullscreen .viewer-content img,
.viewer-modal.pseudo-fullscreen .external-frame-wrap {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.viewer-content {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
    position: relative;
}

/* ANTI-COPY PROTECTION */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.viewer-content iframe,
.viewer-content video,
.viewer-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    /* Disable interactions */
    pointer-events: auto; 
}

.external-frame-wrap {
    position: relative;
    isolation: isolate;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.external-frame-wrap iframe {
    position: relative;
    z-index: 1;
    width: 100% !important;
    height: 100% !important;
    border-radius: 8px;
}

.external-frame-wrap:fullscreen,
.external-frame-wrap:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.external-frame-wrap:fullscreen iframe,
.external-frame-wrap:-webkit-full-screen iframe {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
}

.external-frame-shield {
    position: absolute;
    z-index: 2;
    pointer-events: auto;
    background: transparent;
    touch-action: none;
}

.external-frame-shield-tr {
    top: 0;
    right: 0;
    width: 220px;
    height: 160px;
}

/* Watermark Overlay */
.watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><text x="50%" y="50%" font-family="Arial" font-size="20" fill="rgba(255,255,255,0.03)" text-anchor="middle" transform="rotate(-45 100 100)">MEMORA CONFIDENTIAL</text></svg>');
    z-index: 9999;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .viewer-header {
        padding: 10px 14px;
        padding-top: calc(10px + env(safe-area-inset-top));
    }

    .viewer-title {
        font-size: 1rem;
        max-width: 60vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .viewer-close {
        font-size: 1.8rem;
        padding: 6px;
    }

    .viewer-content {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }

    .viewer-content iframe {
        width: 100% !important;
        height: 100% !important;
    }

    .external-frame-shield-tr {
        width: 260px;
        height: 220px;
        top: 0;
        right: 0;
    }

    .viewer-content video {
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        object-fit: contain;
    }

    .viewer-content img {
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        object-fit: contain;
    }
}
