/* ==========================================
   ONE INSIDER - GLOBAL CONTENT PROTECTION STYLES
   ========================================== */

/* 1. Global Selection & Touch Callout Protection Across All Elements */
html, body, div, p, span, h1, h2, h3, h4, h5, h6, a, button, section, article, 
header, footer, nav, main, table, tr, td, th, ul, ol, li, blockquote, figure, 
figcaption, canvas, img, video, iframe, svg, label {
  -webkit-touch-callout: none !important; /* Disable long-press menu on mobile */
  -webkit-user-select: none !important;   /* Safari */
  -moz-user-select: none !important;      /* Firefox */
  -ms-user-select: none !important;       /* IE/Edge */
  user-select: none !important;           /* Standard */
  touch-action: manipulation;
}

/* Prevent text selection / drag-copy on body */
body {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  user-select: none !important;
}

/* Prevent image dragging and mouse pointer events on images */
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;
}

/* Allow text selection & interaction in editable form fields & explicitly unprotected elements */
input, 
textarea, 
[contenteditable="true"], 
select, 
option, 
button,
a,
.unprotected, 
.allow-select {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  pointer-events: auto;
}

/* Prevent selection highlight styling */
::selection {
  background: transparent !important;
  color: inherit !important;
}
::-moz-selection {
  background: transparent !important;
  color: inherit !important;
}

/* Allow normal selection highlight inside inputs and textareas */
input::selection, 
textarea::selection, 
[contenteditable="true"]::selection {
  background: rgba(99, 102, 241, 0.4) !important;
  color: #ffffff !important;
}

/* 2. Drag & Drop & Transparent Overlay Protection for Media Elements */
canvas, 
video, 
audio, 
iframe, 
svg, 
.protected-media, 
.protected-element {
  -webkit-user-drag: none !important;
  -khtml-user-drag: none !important;
  -moz-user-drag: none !important;
  -o-user-drag: none !important;
  user-drag: none !important;
}

.protected-image-container {
  position: relative !important;
  display: inline-block !important;
  max-width: 100%;
}

.image-protection-overlay {
  position: absolute !important;
  inset: 0 !important;
  z-index: 10 !important;
  background: rgba(0, 0, 0, 0.001) !important;
  pointer-events: auto !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
}

/* Dynamic Watermark Overlay */
.protection-watermark-overlay {
  position: absolute !important;
  inset: 0 !important;
  pointer-events: none !important;
  z-index: 15 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-content: space-around !important;
  justify-content: space-around !important;
  opacity: 0.15 !important;
}

.protection-watermark-item {
  font-family: system-ui, -apple-system, sans-serif !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  color: rgba(255, 255, 255, 0.6) !important;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.8) !important;
  transform: rotate(-25deg) !important;
  user-select: none !important;
  white-space: nowrap !important;
  padding: 20px !important;
}

/* 3. Blank-out Overlay & Screenshot Protection */
.privacy-blur {
  filter: blur(0);
}
.privacy-blur > *:not(.protection-toast-container) {
  visibility: hidden !important;
}
.privacy-blur::before {
  content: "";
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 999999;
}

body.screenshot-protected > *:not(.screenshot-protection-overlay):not(.protection-toast-container) {
  filter: blur(45px) brightness(0.2) !important;
  user-select: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.screenshot-protection-overlay {
  display: none;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(9, 13, 22, 0.96) !important;
  backdrop-filter: blur(30px) !important;
  -webkit-backdrop-filter: blur(30px) !important;
  color: #ef4444 !important;
  z-index: 99999998 !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: system-ui, -apple-system, sans-serif !important;
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  gap: 12px;
  text-align: center;
  padding: 24px;
}

body.screenshot-protected .screenshot-protection-overlay {
  display: flex !important;
}

/* 4. PDF & Video Media Toolbar Protection */
video::-internal-media-controls-download-button,
video::-webkit-media-controls-download-button {
  display: none !important;
}

video::-webkit-media-controls-enclosure {
  overflow: hidden !important;
}

iframe.protected-pdf-viewer {
  pointer-events: auto;
  border: none;
}

.pdf-toolbar-download,
.pdf-toolbar-print,
#download,
#print,
#secondaryDownload,
#secondaryPrint {
  display: none !important;
  visibility: hidden !important;
}

/* 5. CSS Print Media Protection */
@media print {
  html, body {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    background: #000000 !important;
  }
  
  .protection-print-warning {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    background: #090d16 !important;
    color: #ef4444 !important;
    font-size: 24px !important;
    font-weight: bold !important;
    font-family: system-ui, -apple-system, sans-serif !important;
    text-align: center !important;
    padding-top: 20% !important;
    z-index: 99999999 !important;
    visibility: visible !important;
  }
}

.protection-print-warning {
  display: none;
}

/* 6. Toast Notification UI */
.protection-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.protection-toast {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 15px rgba(239, 68, 68, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f8fafc;
  padding: 10px 18px;
  border-radius: 10px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(15px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.protection-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.protection-toast-icon {
  width: 18px;
  height: 18px;
  color: #ef4444;
  flex-shrink: 0;
}
