/**
 * WP Content Guard — front-end styles.
 *
 * Form fields, textareas, and contenteditable regions are explicitly
 * re-enabled everywhere below so typing, selecting, and pasting inside
 * them always works normally (WooCommerce checkout, search boxes,
 * TinyMCE/Gutenberg, live chat widgets, etc.).
 */

/* -------------------------------------------------------------------
 * 1. Disable text selection across the page.
 * ---------------------------------------------------------------- */
body.wpcg-no-select {
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

body.wpcg-no-select input,
body.wpcg-no-select textarea,
body.wpcg-no-select select,
body.wpcg-no-select option,
body.wpcg-no-select [contenteditable="true"],
body.wpcg-no-select [contenteditable=""],
body.wpcg-no-select .wpcg-allow-select {
	-webkit-user-select: text;
	-moz-user-select: text;
	-ms-user-select: text;
	user-select: text;
}

/* -------------------------------------------------------------------
 * 2. Hide the visible selection highlight entirely. Independent of
 *    rule 1 above so a site can hide the highlight even where
 *    selection remains technically possible (e.g. relying on the
 *    JS "force clear selection" layer instead of CSS locking).
 * ---------------------------------------------------------------- */
body.wpcg-hide-selection ::selection {
	background: transparent;
	color: inherit;
	text-shadow: none;
}

body.wpcg-hide-selection ::-moz-selection {
	background: transparent;
	color: inherit;
	text-shadow: none;
}

/* Restore a normal, visible highlight inside form fields and editable
 * regions — hiding selection there would make editing your own typed
 * text confusing. */
body.wpcg-hide-selection input::selection,
body.wpcg-hide-selection textarea::selection,
body.wpcg-hide-selection [contenteditable="true"]::selection,
body.wpcg-hide-selection [contenteditable=""]::selection {
	background: Highlight;
	color: HighlightText;
}

body.wpcg-hide-selection input::-moz-selection,
body.wpcg-hide-selection textarea::-moz-selection,
body.wpcg-hide-selection [contenteditable="true"]::-moz-selection,
body.wpcg-hide-selection [contenteditable=""]::-moz-selection {
	background: Highlight;
	color: HighlightText;
}

/* -------------------------------------------------------------------
 * 3. Disable image dragging.
 * ---------------------------------------------------------------- */
body.wpcg-no-drag img {
	-webkit-user-drag: none;
	-khtml-user-drag: none;
	-moz-user-drag: none;
	-o-user-drag: none;
	user-drag: none;
}

/* -------------------------------------------------------------------
 * 4. Mobile long-press callout (iOS "Copy / Look Up" menu, and the
 *    Android long-press context menu on non-link content).
 * ---------------------------------------------------------------- */
body.wpcg-no-callout {
	-webkit-touch-callout: none;
}

body.wpcg-no-callout input,
body.wpcg-no-callout textarea,
body.wpcg-no-callout select,
body.wpcg-no-callout [contenteditable="true"],
body.wpcg-no-callout [contenteditable=""] {
	-webkit-touch-callout: default;
}

/* -------------------------------------------------------------------
 * 5. DOM text obfuscation wrapper spans (see class-wpcg-obfuscator.php).
 *    Explicitly zeroed out in case a theme's global reset styles
 *    spans with borders/margins/backgrounds — these must render as
 *    plain inline text with zero visual footprint of their own so
 *    the page looks identical to an unobfuscated one.
 * ---------------------------------------------------------------- */
.wpcg-a,
.wpcg-b,
.wpcg-c,
.wpcg-d {
	display: inline;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	font: inherit;
	color: inherit;
	line-height: inherit;
	white-space: inherit;
}

/* -------------------------------------------------------------------
 * 6. DevTools-detected response states. Classes are toggled on
 *    <html> by JavaScript (see content-guard.js) only while a
 *    heuristic currently believes DevTools is open. `.wpcg-protected`
 *    on <body> marks the areas these responses apply to.
 * ---------------------------------------------------------------- */
html.wpcg-dt-blur-active body.wpcg-protected {
	filter: blur(10px);
	transition: filter 0.15s ease;
}

html.wpcg-dt-hide-active body.wpcg-protected {
	visibility: hidden;
}

#wpcg-devtools-warning {
	position: fixed;
	inset: 0;
	background: rgba(20, 20, 22, 0.94);
	color: #fff;
	z-index: 2147483647;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	font-size: 18px;
	padding: 24px;
}

/* -------------------------------------------------------------------
 * 7. Transparent selection-blocking overlay. Positioned absolutely
 *    within its (relatively-positioned) target container. Pointer
 *    events are handled in JS: mousedown-based selection is blocked,
 *    but real clicks are forwarded to the element underneath, and
 *    wheel/touch scrolling is never intercepted here since no
 *    scroll-related listener is attached to it.
 * ---------------------------------------------------------------- */
.wpcg-select-overlay {
	position: absolute;
	inset: 0;
	z-index: 5;
	background: transparent;
}

/* -------------------------------------------------------------------
 * 8. Optional warning toast shown when a blocked action is attempted.
 * ---------------------------------------------------------------- */
.wpcg-warning-toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	max-width: 320px;
	background: #1d2327;
	color: #fff;
	padding: 10px 16px;
	border-radius: 4px;
	font-size: 14px;
	line-height: 1.4;
	z-index: 999999;
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.wpcg-warning-toast.wpcg-visible {
	opacity: 1;
	transform: translateY(0);
}
