/**
 * Research Gate Pro — Public Styles
 *
 * Note: Product blur CSS and overlay styles are injected inline
 * by RGP_Blur_Content::inject_blur_css() so they can use dynamic
 * settings (blur intensity, primary color). This file handles
 * gate screen, age popup, and base utility styles.
 *
 * @package ResearchGatePro
 */

/* ==================================================================
   Gate screen (Full Redirect Gate mode)
   ================================================================== */
.rgp-gate-screen {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	background-color: #f5f5f5;
}

.rgp-gate-container {
	max-width: 480px;
	width: 90%;
	padding: 40px;
	text-align: center;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rgp-gate-title {
	margin-bottom: 16px;
	font-size: 24px;
}

.rgp-gate-message {
	margin-bottom: 24px;
	color: #555;
	line-height: 1.5;
}

/* ==================================================================
   Shared buttons
   ================================================================== */
.rgp-btn {
	display: inline-block;
	padding: 10px 24px;
	margin: 4px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	line-height: 1.4;
}

.rgp-btn--primary {
	color: #fff;
	background-color: var(--rgp-primary, #7c3aed);
}

.rgp-btn--primary:hover {
	opacity: 0.9;
}

.rgp-btn--secondary {
	color: var(--rgp-primary, #7c3aed);
	background-color: transparent;
	border: 1px solid var(--rgp-primary, #7c3aed);
}

.rgp-btn--secondary:hover {
	opacity: 0.85;
}

/* ==================================================================
   Age popup
   ================================================================== */
.rgp-age-popup {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 2147483647; /* Max 32-bit int — sits above ALL theme/builder headers. */
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 16px;
	box-sizing: border-box;
}

/* Hidden by default — JS shows popup after cookie check to prevent flicker on cached pages. */
.rgp-age-popup--pending {
	display: none !important;
}

/* Hidden state for add_to_cart trigger (kept hidden until JS triggers it). */
.rgp-age-popup--hidden {
	display: none !important;
}

/* Backdrop blur overlay */
.rgp-age-popup__overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	-webkit-backdrop-filter: blur(5px);
	backdrop-filter: blur(5px);
}

.rgp-age-popup__content {
	position: relative;
	z-index: 1; /* Above the overlay backdrop within the popup container. */
	max-width: 640px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
	animation: rgp-popup-fade-in 0.2s ease-out;
}

/* Custom scrollbar for popup body */
.rgp-age-popup__content::-webkit-scrollbar {
	width: 6px;
}

.rgp-age-popup__content::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 0 8px 8px 0;
}

.rgp-age-popup__content::-webkit-scrollbar-thumb {
	background: #c1c1c1;
	border-radius: 3px;
}

.rgp-age-popup__content::-webkit-scrollbar-thumb:hover {
	background: #a1a1a1;
}

/* Firefox scrollbar */
.rgp-age-popup__content {
	scrollbar-width: thin;
	scrollbar-color: #c1c1c1 #f1f1f1;
}

@keyframes rgp-popup-fade-in {
	from {
		opacity: 0;
		transform: scale(0.95);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* Header bar */
.rgp-age-popup__header {
	padding: 16px 24px;
	border-radius: 8px 8px 0 0;
}

.rgp-age-popup__title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #333;
}

/* Body */
.rgp-age-popup__body {
	padding: 24px;
}

.rgp-age-popup__message {
	margin: 0 0 20px;
	color: #555;
	font-size: 14px;
	line-height: 1.6;
}

/* Checkbox groups */
.rgp-age-popup__checkbox-group {
	margin-bottom: 16px;
	padding: 16px;
	border: 1px solid #ddd;
	border-radius: 6px;
	background: #fafafa;
	text-align: left;
}

.rgp-age-popup__checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	cursor: pointer;
	font-size: 14px;
	line-height: 1.5;
	color: #333;
}

.rgp-age-popup__checkbox {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	margin-top: 2px;
	cursor: pointer;
	/* Use default browser checkbox color — no accent-color override. */
}

.rgp-age-popup__checkbox-text {
	flex: 1;
}

.rgp-age-popup__checkbox-text strong,
.rgp-age-popup__checkbox-text b {
	font-weight: 700;
}

.rgp-age-popup__checkbox-text a {
	color: var(--rgp-primary, #7c3aed);
	text-decoration: underline;
}

/* Disclaimer */
.rgp-age-popup__disclaimer {
	margin: 16px 0 0;
	padding: 0 4px;
	font-size: 12px;
	line-height: 1.5;
	color: #777;
	text-align: left;
}

/* Remember me */
.rgp-age-popup__remember {
	margin-top: 16px;
	padding: 0 4px;
	text-align: left;
}

.rgp-age-popup__remember-label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	font-size: 13px;
	color: #555;
}

.rgp-age-popup__remember-text {
	flex: 1;
}

/* Actions (buttons) */
.rgp-age-popup__actions {
	display: flex;
	justify-content: flex-end;
	gap: 12px;
	padding: 16px 24px;
	border-top: 1px solid #eee;
}

.rgp-age-popup__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 28px;
	min-height: 44px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	line-height: 1.4;
	transition: opacity 0.15s ease;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

.rgp-age-popup__btn--deny {
	color: #fff;
	background-color: #d9534f; /* Fallback; overridden by inline style when configured. */
}

.rgp-age-popup__btn--deny:hover {
	opacity: 0.9;
}

.rgp-age-popup__btn--confirm {
	color: #fff;
	background-color: #888; /* Disabled state fallback. */
}

.rgp-age-popup__btn--confirm[disabled] {
	opacity: 0.6;
	cursor: not-allowed;
}

.rgp-age-popup__btn--confirm:not([disabled]):hover {
	opacity: 0.9;
}

/* Button loading spinner */
.rgp-btn-loading {
	position: relative;
	pointer-events: none;
	min-width: 120px;
}

.rgp-btn-loading::after {
	content: '';
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: rgp-spin 0.6s linear infinite;
}

@keyframes rgp-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Mobile responsive */
@media (max-width: 480px) {
	.rgp-age-popup__content {
		max-height: 95vh;
	}

	.rgp-age-popup__body {
		padding: 16px;
	}

	.rgp-age-popup__actions {
		flex-direction: column-reverse;
		padding: 12px 16px;
	}

	.rgp-age-popup__btn {
		width: 100%;
		text-align: center;
	}
}

/* Body scroll lock when popup is open */
body.rgp-body-locked {
	overflow: hidden !important;
	height: 100% !important;
}

html.rgp-html-locked {
	overflow: hidden !important;
	height: 100% !important;
}

/* ==================================================================
   UNIVERSAL PRODUCT BLUR SYSTEM
   Applied via JavaScript to any detected product container.
   ================================================================== */

/* Product container that has been blurred */
.rgp-blurred-product {
	position: relative !important;
	overflow: hidden !important;
}

/* Blur effect on images within product containers */
.rgp-blur-image {
	filter: blur(8px) !important;
	-webkit-filter: blur(8px) !important;
	pointer-events: none !important;
	user-select: none !important;
	transition: filter 0.3s ease;
}

/* Product overlay (lock icon + login button) */
.rgp-product-overlay {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	justify-content: center !important;
	z-index: 10 !important;
	text-align: center !important;
	padding: 20px !important;
	box-sizing: border-box !important;
	background: rgba(255, 255, 255, 0.85) !important;
}

.rgp-product-overlay__icon {
	margin-bottom: 10px;
}

.rgp-product-overlay__icon svg {
	width: 32px;
	height: 32px;
	fill: var(--rgp-primary, #7c3aed);
}

.rgp-product-overlay__text {
	margin: 0 0 12px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	color: #333 !important;
	line-height: 1.4 !important;
}

.rgp-product-overlay__btn {
	display: inline-block !important;
	padding: 8px 20px !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	text-decoration: none !important;
	border: none !important;
	border-radius: 4px !important;
	cursor: pointer !important;
	color: #fff !important;
	background-color: var(--rgp-primary, #7c3aed) !important;
	line-height: 1.4 !important;
}

.rgp-product-overlay__btn:hover {
	opacity: 0.9 !important;
	color: #fff !important;
}

/* Single product page overlay */
.rgp-single-product-overlay {
	margin: 20px 0;
	padding: 30px 20px;
	text-align: center;
	background: #f9f5ff;
	border: 2px solid var(--rgp-primary, #7c3aed);
	border-radius: 8px;
}

.rgp-single-product-overlay__icon svg {
	width: 40px;
	height: 40px;
	fill: var(--rgp-primary, #7c3aed);
}

.rgp-single-product-overlay__text {
	margin: 12px 0 16px;
	font-size: 16px;
	font-weight: 600;
	color: #333;
}

/* Blurred price wrapper (from PHP filter) */
.rgp-blurred-price {
	filter: blur(8px) !important;
	-webkit-filter: blur(8px) !important;
	pointer-events: none !important;
	user-select: none !important;
}
