// Disable right-click context menu
document.addEventListener("contextmenu", function(e) {
    e.preventDefault();
});

// Disable DevTools shortcuts
document.addEventListener("keydown", function(e) {

    // F12
    if (e.keyCode === 123) {
        e.preventDefault();
    }

    // Ctrl + Shift + I
    if (e.ctrlKey && e.shiftKey && e.keyCode === 73) {
        e.preventDefault();
    }

    // Ctrl + U
    if (e.ctrlKey && e.keyCode === 85) {
        e.preventDefault();
    }

    // **Cmd + Option + I (Mac DevTools)**
    if (e.metaKey && e.altKey && e.keyCode === 73) {
        e.preventDefault();
    }
});

// ======================
// Detect DevTools + open custom message
// ======================
// function openWarningMessage() {
//     let newPage = window.open("about:blank", "_self");

//     newPage.document.write(`
//         <body style="background:#000; display:flex; justify-content:center; align-items:center; height:100vh; margin:0;">
//             <h1 style="color:#fff; font-family:Arial; font-size:30px; text-align:center;">
//                 ❌ DevTools Detected!<br><br>
//                 Please close Inspect Element to continue.
//             </h1>
//         </body>
//     `);

//     newPage.document.close();
// }
function openWarningMessage() {
    document.body.innerHTML = `
        <div style="
            background:#000;
            color:#fff;
            height:100vh;
            display:flex;
            justify-content:center;
            align-items:center;
            text-align:center;
            font-family:Arial;
            font-size:30px;
        ">
            ❌ DevTools Detected!<br><br>
            Please close Inspect Element to continue.
        </div>
    `;
}



// ======================
// METHOD 1: Size Detection
// ======================
(function() {
    let detected = false;
    const threshold = 160;

    setInterval(function() {

        let widthDiff = window.outerWidth - window.innerWidth;
        let heightDiff = window.outerHeight - window.innerHeight;

        if (widthDiff > threshold || heightDiff > threshold) {
            if (!detected) {
                detected = true;
                openWarningMessage();
            }
        }
    }, 500);
})();

