/*!
 * Website Protection Styles v2.0
 * Additional CSS-based protection measures
 * Author: Ninja Coder
 */

/* ===========================================
   CONTENT PROTECTION STYLES
   =========================================== */

/* Disable text selection globally (with form exceptions) */
* {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-drag: none !important;
    -khtml-user-drag: none !important;
    -moz-user-drag: none !important;
    -o-user-drag: none !important;
    user-drag: none !important;
}

/* Allow text selection for form elements */
input,
textarea,
select,
[contenteditable="true"],
.editable {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}

/* Ensure interactive elements remain clickable */
button,
a,
input[type="submit"],
input[type="button"],
input[type="reset"],
input[type="checkbox"],
input[type="radio"],
.clickable {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* ===========================================
   IMAGE PROTECTION
   =========================================== */

/* Prevent image dragging and right-click saving */
img {
    -webkit-user-drag: none !important;
    -khtml-user-drag: none !important;
    -moz-user-drag: none !important;
    -o-user-drag: none !important;
    user-drag: none !important;
    pointer-events: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* Prevent image selection highlighting */
img::selection {
    background: transparent !important;
}

img::-moz-selection {
    background: transparent !important;
}

/* Add overlay protection for images */
img::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 1;
    pointer-events: none;
}

/* ===========================================
   SELECTION HIGHLIGHTING PREVENTION
   =========================================== */

/* Remove selection highlighting */
::selection {
    background: transparent !important;
    color: inherit !important;
}

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

/* Allow selection highlighting for form elements */
input::selection,
textarea::selection,
[contenteditable="true"]::selection {
    background: #007acc !important;
    color: white !important;
}

input::-moz-selection,
textarea::-moz-selection,
[contenteditable="true"]::-moz-selection {
    background: #007acc !important;
    color: white !important;
}

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

@media print {
    /* Hide all content when printing */
    * {
        visibility: hidden !important;
        display: none !important;
    }
    
    /* Show only the protection message */
    body {
        display: block !important;
        visibility: visible !important;
    }
    
    body::before {
        content: "🔒 PRINTING DISABLED" !important;
        display: block !important;
        visibility: visible !important;
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        font-size: 36px !important;
        font-weight: bold !important;
        color: #ff0000 !important;
        text-align: center !important;
        z-index: 9999 !important;
        background: white !important;
        padding: 50px !important;
        border: 5px solid #ff0000 !important;
        border-radius: 10px !important;
    }
    
    body::after {
        content: "This content is protected and cannot be printed. For authorized access, please contact the website administrator." !important;
        display: block !important;
        visibility: visible !important;
        position: fixed !important;
        top: 60% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        font-size: 16px !important;
        color: #333 !important;
        text-align: center !important;
        z-index: 9999 !important;
        background: white !important;
        padding: 20px !important;
        max-width: 400px !important;
        line-height: 1.5 !important;
    }
}

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

/* Prevent iOS callouts and selection on mobile */
* {
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Allow callouts for form elements */
input,
textarea,
select,
[contenteditable="true"] {
    -webkit-touch-callout: default !important;
}

/* Prevent pinch-to-zoom on mobile (optional) */
html {
    -ms-touch-action: manipulation !important;
    touch-action: manipulation !important;
}

/* ===========================================
   VISUAL FEEDBACK FOR PROTECTION
   =========================================== */

/* Add a subtle visual indicator that protection is active */
body::before {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    width: 3px;
    height: 3px;
    background: rgba(0, 255, 0, 0.3);
    z-index: 9999;
    border-radius: 50%;
    pointer-events: none;
    animation: protectionPulse 3s infinite;
}

@keyframes protectionPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* ===========================================
   DEVELOPER TOOLS DETECTION STYLES
   =========================================== */

/* Style for the access denied screen */
.protection-access-denied {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    z-index: 999999 !important;
    user-select: none !important;
}

.protection-denied-content {
    max-width: 500px !important;
    padding: 40px !important;
}

.protection-denied-title {
    font-size: 3rem !important;
    margin-bottom: 20px !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
}

.protection-denied-message {
    font-size: 1.2rem !important;
    margin-bottom: 30px !important;
    line-height: 1.5 !important;
    opacity: 0.9 !important;
}

.protection-denied-button {
    padding: 15px 30px !important;
    font-size: 1rem !important;
    background: rgba(255,255,255,0.2) !important;
    border: 2px solid white !important;
    color: white !important;
    border-radius: 25px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-block !important;
}

.protection-denied-button:hover {
    background: rgba(255,255,255,0.3) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
}

/* ===========================================
   CONTENT SCRAMBLING (Advanced Protection)
   =========================================== */

/* Hide text content when developer tools might be open */
@media (max-width: 1024px) and (max-height: 768px) {
    .sensitive-content {
        filter: blur(5px) !important;
        pointer-events: none !important;
    }
}

/* ===========================================
   FORM ACCESSIBILITY PRESERVATION
   =========================================== */

/* Ensure form elements remain fully functional */
form,
form *,
.form-container,
.form-container * {
    pointer-events: auto !important;
}

/* Style for form focus indicators */
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #007acc !important;
    outline-offset: 2px !important;
}

/* ===========================================
   LOADING SCREEN PROTECTION
   =========================================== */

/* Style for protection initialization screen */
.protection-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.protection-loading.fade-out {
    opacity: 0;
    pointer-events: none;
}

.protection-loading-text {
    text-align: center;
    font-size: 18px;
    line-height: 1.8;
}

.protection-loading-text::after {
    content: '|';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ===========================================
   RESPONSIVE PROTECTION ADJUSTMENTS
   =========================================== */

/* Mobile-specific protections */
@media (max-width: 768px) {
    /* Prevent viewport manipulation */
    html {
        -webkit-text-size-adjust: 100% !important;
        -ms-text-size-adjust: 100% !important;
    }
    
    /* Enhanced touch protection */
    * {
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Medium screen protections */
    .protection-enhanced {
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        user-select: none !important;
    }
}

/* ===========================================
   ACCESSIBILITY COMPLIANCE
   =========================================== */

/* Ensure screen readers can still access content */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    user-select: text !important;
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    .protection-access-denied {
        background: #000 !important;
        color: #fff !important;
    }
    
    .protection-denied-button {
        background: #fff !important;
        color: #000 !important;
        border: 2px solid #fff !important;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .protection-loading-text::after,
    body::before {
        animation: none !important;
    }
}

/* ===========================================
   DEBUG STYLES (Development Only)
   =========================================== */

/* These styles are only active in debug mode */
body.protection-debug::after {
    content: 'Protection Active (Debug Mode)';
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #00ff00;
    padding: 5px 10px;
    font-size: 12px;
    font-family: monospace;
    border-radius: 3px;
    z-index: 99999;
    pointer-events: none;
}

/* ===========================================
   UTILITY CLASSES
   =========================================== */

/* Class to temporarily disable protection for specific elements */
.protection-exempt {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    user-select: text !important;
    -webkit-user-drag: auto !important;
    user-drag: auto !important;
    pointer-events: auto !important;
}

/* Class to enhance protection for specific elements */
.protection-enhanced {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    user-drag: none !important;
    pointer-events: none !important;
}

/* Class for clickable protected elements */
.protection-clickable {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    user-select: none !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}