/* ============================================================
   CONTENT PROTECTION — global, applies on every page
   Deterrent only: text-select / drag disabled, right-click toast UI,
   plus an "ACCESS DENIED" modal for more serious triggers.
   ============================================================ */

/* Disable text selection everywhere EXCEPT actual input fields,
   so admin login / OTP / change-password / add-entry forms still work. */
html body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input,
textarea,
select,
[contenteditable="true"],
[contenteditable=""] {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

/* Disable image drag/save affordances */
img {
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none; /* stops the iOS long-press "save image" menu */
  pointer-events: auto;
}

/* ---- Protection toast (modern style) ---- */
#protectToast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-24px) scale(0.96);
  z-index: 100000;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(24, 24, 28, 0.72);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  color: #f5f5f7;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 13px 22px 13px 18px;
  border-radius: 14px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: calc(100vw - 32px);
  text-align: left;
  white-space: normal;
}

#protectToast::before {
  content: '';
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background: #ff5c5c;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E") center / contain no-repeat;
}

#protectToast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

@media (max-width: 480px) {
  #protectToast {
    top: 14px;
    padding: 11px 16px 11px 14px;
    font-size: 13px;
    border-radius: 12px;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }
}

/* ---- Access Denied modal ---- */
#accessDeniedOverlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  background: rgba(5, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  overflow: hidden;
}

#accessDeniedOverlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* faint scanning noise behind the box */
#accessDeniedOverlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 0, 0, 0.04) 0px,
      rgba(255, 0, 0, 0.04) 1px,
      transparent 1px,
      transparent 3px
    );
  animation: adScan 6s linear infinite;
}

@keyframes adScan {
  from { transform: translateY(0); }
  to   { transform: translateY(40px); }
}

.accessDeniedBox {
  position: relative;
  border: 3px solid #ff1e1e;
  color: #ff1e1e;
  font-family: 'Courier New', 'Space Grotesk', monospace;
  font-weight: 700;
  letter-spacing: 6px;
  font-size: clamp(28px, 6vw, 56px);
  padding: 28px 48px;
  background: rgba(20, 0, 0, 0.55);
  text-shadow: 0 0 8px rgba(255, 30, 30, 0.9), 0 0 20px rgba(255, 0, 0, 0.5);
  box-shadow:
    0 0 20px rgba(255, 0, 0, 0.55),
    inset 0 0 20px rgba(255, 0, 0, 0.25);
  animation: adFlicker 2.4s infinite;
  text-align: center;
  white-space: nowrap;
}

.accessDeniedSub {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: 2px;
  font-weight: 500;
  opacity: 0.85;
  text-shadow: none;
}

@keyframes adFlicker {
  0%, 100% { opacity: 1; }
  92%      { opacity: 1; }
  93%      { opacity: 0.4; }
  94%      { opacity: 1; }
  96%      { opacity: 0.6; }
  97%      { opacity: 1; }
}

@media (max-width: 480px) {
  .accessDeniedBox {
    letter-spacing: 3px;
    padding: 20px 24px;
    white-space: normal;
  }
}