/**
 * ELMS Security Shield - Anti-Screenshot, Anti-Copy, Anti-Print CSS
 * Copyright (c) Examg LMS
 */

/* 1. Prevent text selection and touch callouts across protected content */
body.security-shield-enabled {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Allow text selection inside interactive form controls so users can type */
input, textarea, select, [contenteditable="true"], .allow-copy-select {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* Prevent image dragging and selection */
img, svg, video, iframe, canvas {
    -webkit-user-drag: none !important;
    user-drag: none !important;
    -webkit-touch-callout: none !important;
}

/* 2. Privacy Blur Shield (Triggered when window loses focus e.g. Snipping Tool) */
.security-blur-curtain {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.96) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    z-index: 2147483647 !important;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #ffffff;
    text-align: center;
    padding: 24px;
    box-sizing: border-box;
    cursor: pointer;
}

.security-blur-curtain.active {
    display: flex !important;
}

body.security-blur-active > *:not(.security-blur-curtain) {
    filter: blur(20px) !important;
    opacity: 0.1 !important;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

.security-curtain-card {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 32px 40px;
    max-width: 460px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: secPulseIn 0.3s ease-out;
}

@keyframes secPulseIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.security-curtain-icon {
    font-size: 54px;
    color: #38bdf8;
    margin-bottom: 16px;
    animation: secShieldFloat 2s infinite ease-in-out;
}

@keyframes secShieldFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.security-curtain-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #f8fafc;
}

.security-curtain-desc {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.5;
    margin-bottom: 20px;
}

.security-curtain-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* 3. Flash Blackout (When PrintScreen Key is pressed) */
.security-flash-blackout {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: #000000 !important;
    z-index: 2147483647 !important;
    display: none;
}

.security-flash-blackout.active {
    display: block !important;
}

/* 4. Forensic Floating Watermark Overlay */
.security-watermark-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
    z-index: 99998 !important;
    overflow: hidden !important;
    opacity: 0.13 !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
    grid-auto-rows: 140px !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.security-watermark-cell {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: rotate(-24deg) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    letter-spacing: 1.5px !important;
    white-space: nowrap !important;
    text-transform: uppercase !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* 5. Warning Toast Notification */
.security-toast-alert {
    position: fixed !important;
    top: 24px !important;
    right: 24px !important;
    background: #ef4444 !important;
    color: #ffffff !important;
    padding: 14px 20px !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.4) !important;
    z-index: 2147483647 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    animation: secToastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    max-width: 380px !important;
}

@keyframes secToastSlide {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 6. Strict Print Restrictions */
@media print {
    html, body {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        background: #ffffff !important;
    }
}
