/**
 * CSS-BASED CODE PROTECTION
 * Prevents text selection, copying, and various inspection methods
 */

/* ==================== DISABLE TEXT SELECTION ==================== */

* {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* Allow selection for input fields (important for forms) */
input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* ==================== DISABLE DRAG AND DROP ==================== */

* {
    -webkit-user-drag: none !important;
    -moz-user-drag: none !important;
    user-drag: none !important;
}

img,
a {
    -webkit-user-drag: none !important;
    -moz-user-drag: none !important;
    user-drag: none !important;
    pointer-events: auto !important;
}

/* ==================== DISABLE CONTEXT MENU ==================== */

body {
    -webkit-touch-callout: none !important;
}

/* ==================== PREVENT HIGHLIGHTING ==================== */

::selection {
    background: transparent !important;
    color: inherit !important;
}

::-moz-selection {
    background: transparent !important;
    color: inherit !important;
}

/* ==================== HIDE CURSOR ON TEXT ==================== */

body {
    cursor: default !important;
}

/* Prevent I-beam cursor on text */
p, span, div, h1, h2, h3, h4, h5, h6, li, td, th, label {
    cursor: default !important;
}

/* ==================== WATERMARK PROTECTION ==================== */

/* Add invisible watermark to deter screenshots */
body::before {
    content: attr(data-user-id) " - " attr(data-timestamp);
    position: fixed;
    bottom: 0;
    right: 0;
    font-size: 1px;
    opacity: 0.01;
    pointer-events: none;
    z-index: 999999;
}

/* ==================== PREVENT SCREENSHOT INDICATORS ==================== */

/* Blur content when window loses focus (possible DevTools or screenshot) */
/* DISABLED - Too aggressive for normal use */
/*
html:not(:focus-within) body {
    filter: blur(5px);
    transition: filter 0.1s;
}
*/

/* ==================== PRINT PROTECTION ==================== */

@media print {
    body {
        display: none !important;
    }

    body::before {
        content: "Printing is disabled on this website.";
        display: block !important;
        font-size: 24px;
        text-align: center;
        margin-top: 50px;
        color: #000;
    }
}

/* ==================== HIDE ELEMENTS IN DEVTOOLS ==================== */

/* These classes will be hidden when inspected */
.protected-content {
    position: relative;
}

.protected-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* ==================== ANTI-INSPECT OVERLAY ==================== */

.no-inspect {
    position: relative;
    pointer-events: auto;
}

.no-inspect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
}

/* ==================== DISABLE IMAGE SAVING ==================== */

img {
    pointer-events: none !important;
    -webkit-touch-callout: none !important;
}

/* Re-enable for clickable images */
a img {
    pointer-events: auto !important;
}

/* ==================== ANIMATED WATERMARK (DETERS RECORDING) ==================== */

@keyframes watermarkMove {
    0% { transform: translate(0, 0); }
    25% { transform: translate(10px, 10px); }
    50% { transform: translate(0, 20px); }
    75% { transform: translate(-10px, 10px); }
    100% { transform: translate(0, 0); }
}

/* Watermark disabled - not needed */
/*
body::after {
    content: '© Protected';
    position: fixed;
    top: 50%;
    left: 50%;
    font-size: 80px;
    color: rgba(255, 255, 255, 0.01);
    pointer-events: none;
    z-index: 999998;
    transform: translate(-50%, -50%) rotate(-45deg);
    animation: watermarkMove 10s infinite;
    white-space: nowrap;
}
*/

/* ==================== MOBILE PROTECTION ==================== */

/* Disable long-press context menu on mobile */
* {
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* ==================== CODE BLOCK PROTECTION ==================== */

/* Hide code blocks from inspection */
pre, code {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    user-select: none !important;
    pointer-events: none !important;
}

/* ==================== DEVELOPER TOOLS DETECTION INDICATOR ==================== */

/* This creates a CSS-only devtools detector */
@media (max-width: 0px) {
    body::before {
        content: 'devtools-open';
    }
}

/* ==================== ACCESSIBILITY EXCEPTIONS ==================== */

/* Allow selection for screen readers but hide from normal users */
[role="textbox"],
[role="searchbox"],
.selectable {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    user-select: text !important;
}

/* ==================== ENCRYPTED CLASS ==================== */

/* Add this class to elements you want extra protection on */
.encrypted {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    user-select: none !important;
    pointer-events: none !important;
    filter: contrast(1.01);
    /* The slight filter prevents direct pixel copying */
}

/* ==================== IFRAME PROTECTION ==================== */

iframe:not([data-allowed]) {
    display: none !important;
}

/* ==================== PREVENT DEVTOOLS STYLE INSPECTION ==================== */

/* Randomize style values to confuse inspectors */
:root {
    --random-1: calc(1px * 1);
    --random-2: calc(1px * 2);
    --random-3: calc(1px * 3);
}

/* ==================== OBFUSCATED LAYOUT ==================== */

/* Use this to hide actual structure from inspector */
.obfuscated {
    all: unset;
    display: contents;
}

/* ==================== END OF PROTECTION STYLES ==================== */
