/**
 * Content Restriction Popup — modern dialog (vanilla)
 * Themes + motion via CSS variables (Pop Any Article–inspired)
 */

:root {
	--jx-crp-accent: #2563eb;
	--jx-crp-radius: 20px;
	--jx-crp-overlay: rgba(15, 23, 42, 0.55);
	--jx-crp-blur: 10px;
	--jx-crp-width: 420px;
	--jx-crp-max-width: 92vw;
	--jx-crp-max-height: min(88vh, 720px);
	--jx-crp-bg: #ffffff;
	--jx-crp-text: #101828;
	--jx-crp-muted: #475467;
	--jx-crp-border: rgba(37, 99, 235, 0.12);
	--jx-crp-close-bg: #ffffff;
	--jx-crp-close-icon: #344054;
	--jx-crp-input-bg: #f8fafc;
	--jx-crp-input-border: #e2e8f0;
	--jx-crp-fx: 320ms;
}

.jx-crp--theme-dark {
	--jx-crp-bg: #0f172a;
	--jx-crp-text: #f8fafc;
	--jx-crp-muted: #94a3b8;
	--jx-crp-border: rgba(148, 163, 184, 0.18);
	--jx-crp-close-bg: #1e293b;
	--jx-crp-close-icon: #e2e8f0;
	--jx-crp-input-bg: #1e293b;
	--jx-crp-input-border: #334155;
}

.jx-crp--theme-soft {
	--jx-crp-bg: #f8fafc;
	--jx-crp-text: #0f172a;
	--jx-crp-muted: #64748b;
	--jx-crp-border: rgba(15, 23, 42, 0.08);
	--jx-crp-accent: #0f766e;
}

.jx-crp--theme-brand {
	--jx-crp-bg: #ffffff;
	--jx-crp-border: color-mix(in srgb, var(--jx-crp-accent) 18%, transparent);
}

.jx-crp {
	position: fixed;
	inset: 0;
	z-index: 10050;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
	box-sizing: border-box;
}

.jx-crp[hidden] {
	display: none !important;
}

.jx-crp__backdrop {
	position: absolute;
	inset: 0;
	background: var(--jx-crp-overlay);
	backdrop-filter: blur(var(--jx-crp-blur));
	-webkit-backdrop-filter: blur(var(--jx-crp-blur));
	opacity: 0;
	transition: opacity var(--jx-crp-fx) ease;
}

.jx-crp.is-open .jx-crp__backdrop {
	opacity: 1;
}

.jx-crp__dialog {
	position: relative;
	z-index: 1;
	width: var(--jx-crp-width);
	max-width: var(--jx-crp-max-width);
	max-height: var(--jx-crp-max-height);
	display: flex;
	flex-direction: column;
	background: var(--jx-crp-bg);
	color: var(--jx-crp-text);
	border: 1px solid var(--jx-crp-border);
	border-radius: var(--jx-crp-radius);
	overflow: hidden;
	box-shadow:
		0 1px 2px rgba(16, 24, 40, 0.04),
		0 24px 64px rgba(16, 24, 40, 0.18),
		0 8px 24px color-mix(in srgb, var(--jx-crp-accent) 10%, transparent);
	opacity: 0;
	transform: translateY(12px) scale(0.96);
	transition:
		opacity var(--jx-crp-fx) ease,
		transform var(--jx-crp-fx) cubic-bezier(0.22, 1, 0.36, 1);
	outline: none;
}

.jx-crp--effect-fade .jx-crp__dialog {
	transform: none;
}

.jx-crp--effect-slide-up .jx-crp__dialog {
	transform: translateY(28px);
}

.jx-crp--effect-zoom .jx-crp__dialog {
	transform: translateY(8px) scale(0.94);
}

.jx-crp.is-open .jx-crp__dialog {
	opacity: 1;
	transform: none;
}

.jx-crp__scroll {
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	padding: 1.75rem;
	scrollbar-width: thin;
	scrollbar-color: color-mix(in srgb, var(--jx-crp-accent) 35%, transparent) transparent;
}

.jx-crp__header {
	margin: 0 0 1.15rem;
	padding-bottom: 1rem;
	padding-right: 2.5rem;
	border-bottom: 1px solid color-mix(in srgb, var(--jx-crp-accent) 10%, transparent);
}

.jx-crp__title {
	margin: 0;
	font-size: clamp(1.2rem, 2.4vw, 1.45rem);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.02em;
	color: var(--jx-crp-text);
}

.jx-crp__intro {
	margin: 0.55rem 0 0;
	font-size: 0.95rem;
	line-height: 1.55;
	color: var(--jx-crp-muted);
}

.jx-crp__body {
	min-width: 0;
}

.jx-crp__footer {
	margin-top: 1.25rem;
	padding-top: 1rem;
	border-top: 1px solid color-mix(in srgb, var(--jx-crp-accent) 8%, transparent);
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	align-items: stretch;
}

.jx-crp__footer-text {
	margin: 0;
	font-size: 0.85rem;
	line-height: 1.45;
	color: var(--jx-crp-muted);
}

.jx-crp__continue {
	appearance: none;
	border: 1px solid color-mix(in srgb, var(--jx-crp-accent) 22%, transparent);
	background: transparent;
	color: var(--jx-crp-text);
	border-radius: 999px;
	padding: 0.7rem 1rem;
	font: 600 0.9rem/1.2 system-ui, -apple-system, Segoe UI, sans-serif;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.jx-crp__continue:hover {
	background: color-mix(in srgb, var(--jx-crp-accent) 8%, transparent);
	border-color: color-mix(in srgb, var(--jx-crp-accent) 40%, transparent);
}

.jx-crp__continue:focus-visible {
	outline: 2px solid var(--jx-crp-accent);
	outline-offset: 2px;
}

.jx-crp__close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid color-mix(in srgb, var(--jx-crp-accent) 14%, transparent);
	border-radius: 999px;
	background: var(--jx-crp-close-bg);
	box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.jx-crp__close span {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
}

.jx-crp__close span::before,
.jx-crp__close span::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 14px;
	height: 2px;
	border-radius: 1px;
	background: var(--jx-crp-close-icon);
}

.jx-crp__close span::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.jx-crp__close span::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.jx-crp__close:hover {
	transform: scale(1.05);
	border-color: color-mix(in srgb, var(--jx-crp-accent) 28%, transparent);
	box-shadow: 0 6px 18px color-mix(in srgb, var(--jx-crp-accent) 14%, transparent);
}

.jx-crp__close:focus-visible {
	outline: 2px solid var(--jx-crp-accent);
	outline-offset: 2px;
}

.jx-crp__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;
}

/* Login / form polish inside dialog */
.jx-crp__body .moduletable,
.jx-crp__body .module,
.jx-crp__body > div {
	margin: 0;
}

.jx-crp__body h3,
.jx-crp__body .page-header,
.jx-crp__body .card-header {
	display: none;
}

.jx-crp__body form {
	margin: 0;
}

.jx-crp__body label {
	display: block;
	margin: 0 0 0.35rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--jx-crp-muted);
}

.jx-crp__body .form-control,
.jx-crp__body input[type="text"],
.jx-crp__body input[type="password"],
.jx-crp__body input[type="email"],
.jx-crp__body select {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	border: 1px solid var(--jx-crp-input-border);
	background: var(--jx-crp-input-bg);
	color: var(--jx-crp-text);
	border-radius: 12px;
	padding: 0.7rem 0.85rem;
	font-size: 1rem;
	line-height: 1.4;
	margin-bottom: 0.85rem;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.jx-crp__body .form-control:focus,
.jx-crp__body input:focus,
.jx-crp__body select:focus {
	outline: none;
	border-color: color-mix(in srgb, var(--jx-crp-accent) 55%, var(--jx-crp-input-border));
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--jx-crp-accent) 18%, transparent);
}

.jx-crp__body .input-group,
.jx-crp__body .password-group {
	display: flex !important;
	flex-wrap: nowrap !important;
	align-items: stretch;
	gap: 0.45rem;
	width: 100%;
	margin-bottom: 0.85rem;
}

.jx-crp__body .input-group > .form-control,
.jx-crp__body .password-group > .form-control,
.jx-crp__body .input-group > input,
.jx-crp__body .password-group > input {
	flex: 1 1 auto;
	width: 1% !important;
	min-width: 0;
	margin-bottom: 0 !important;
}

.jx-crp__body .input-password-toggle,
.jx-crp__body .btn.input-password-toggle,
.jx-crp__body button[type="button"].input-password-toggle,
.jx-crp__body .input-group > .btn,
.jx-crp__body .password-group > .btn {
	flex: 0 0 auto;
	width: 44px !important;
	min-width: 44px;
	min-height: 44px;
	margin: 0 !important;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 12px;
	background: var(--jx-crp-input-bg);
	color: var(--jx-crp-muted);
	box-shadow: none !important;
	border: 1px solid var(--jx-crp-input-border);
	transform: none !important;
	filter: none !important;
}

.jx-crp__body .input-password-toggle:hover,
.jx-crp__body .input-group > .btn:hover {
	border-color: color-mix(in srgb, var(--jx-crp-accent) 40%, var(--jx-crp-input-border));
	color: var(--jx-crp-accent);
}

.jx-crp__body .btn-primary,
.jx-crp__body button[type="submit"],
.jx-crp__body input[type="submit"] {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 44px;
	margin-top: 0.35rem;
	padding: 0.75rem 1rem;
	border: 0;
	border-radius: 999px;
	background: var(--jx-crp-accent);
	color: #fff;
	font: 600 0.95rem/1.2 system-ui, -apple-system, Segoe UI, sans-serif;
	cursor: pointer;
	transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
	box-shadow: 0 8px 20px color-mix(in srgb, var(--jx-crp-accent) 28%, transparent);
}

.jx-crp__body .btn-primary:hover,
.jx-crp__body button[type="submit"]:hover,
.jx-crp__body input[type="submit"]:hover {
	filter: brightness(1.05);
	transform: translateY(-1px);
}

.jx-crp__body .btn-primary:focus-visible,
.jx-crp__body button[type="submit"]:focus-visible {
	outline: 2px solid var(--jx-crp-accent);
	outline-offset: 2px;
}

.jx-crp__body ul,
.jx-crp__body .list-unstyled,
.jx-crp__body .list-group {
	margin: 0.85rem 0 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0;
	border: 1px solid var(--jx-crp-input-border);
	border-radius: 12px;
	overflow: hidden;
}

.jx-crp__body .list-group-item,
.jx-crp__body ul a,
.jx-crp__body .list-group a {
	display: block;
	padding: 0.7rem 0.85rem;
	color: var(--jx-crp-accent);
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
	background: transparent;
	border: 0;
	border-bottom: 1px solid var(--jx-crp-input-border);
}

.jx-crp__body .list-group-item:last-child,
.jx-crp__body ul a:last-child,
.jx-crp__body .list-group a:last-child {
	border-bottom: 0;
}

.jx-crp__body .list-group-item:hover,
.jx-crp__body ul a:hover,
.jx-crp__body .list-group a:hover {
	background: color-mix(in srgb, var(--jx-crp-accent) 6%, transparent);
	text-decoration: none;
}

.jx-crp__body .mod-login__pretext,
.jx-crp__body .pretext {
	margin: 0 0 1rem;
	padding: 0.75rem 0.9rem;
	border-radius: 12px;
	background: color-mix(in srgb, var(--jx-crp-accent) 8%, transparent);
	color: var(--jx-crp-muted);
	font-size: 0.875rem;
	line-height: 1.45;
}

.jx-crp__body .mod-login__pretext p {
	margin: 0;
	white-space: pre-line;
}

.jx-crp__body .form-check,
.jx-crp__body .checkbox {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	margin: 0 0 0.85rem;
}

.jx-crp__body .form-check label,
.jx-crp__body .checkbox label {
	margin: 0;
	font-weight: 500;
}

html.jx-crp-lock,
html.jx-crp-lock body {
	overflow: hidden !important;
}

@media (max-width: 480px) {
	.jx-crp__scroll {
		padding: 1.25rem;
	}

	.jx-crp__header {
		padding-right: 2.25rem;
	}

	.jx-crp__dialog {
		width: 100%;
		max-width: 100%;
	}
}

@media (max-height: 480px) and (orientation: landscape) {
	.jx-crp {
		align-items: stretch;
	}

	.jx-crp__dialog {
		max-height: none;
		height: 100%;
		border-radius: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.jx-crp__backdrop,
	.jx-crp__dialog,
	.jx-crp__close,
	.jx-crp__continue,
	.jx-crp__body .btn {
		transition: none !important;
	}

	.jx-crp--effect-fade .jx-crp__dialog,
	.jx-crp--effect-slide-up .jx-crp__dialog,
	.jx-crp--effect-zoom .jx-crp__dialog {
		transform: none;
	}
}
