/**
 * WhoKnew Signal™ — Frontend subscription popup styles
 */

#wkspn-popup {
	box-sizing: content-box;
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 2147483647;
	max-width: 360px;
	width: calc(100% - 48px);
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.1);
	padding: 24px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	animation: wkspn-popup-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
	border: 1px solid rgba(0, 0, 0, 0.06);
	line-height: 1.4;
}

/*
 * Theme isolation: lock typography and spacing so global p/button rules
 * (line-height, margin, font-size) cannot loosen the layout on any theme.
 */
#wkspn-popup .wkspn-popup-title {
	margin: 0 0 8px 0 !important;
	padding: 0 24px 0 0 !important;
	line-height: 1.3 !important;
	letter-spacing: normal !important;
}

#wkspn-popup .wkspn-popup-body {
	margin: 0 0 20px 0 !important;
	padding: 0 !important;
	line-height: 1.4 !important;
	letter-spacing: normal !important;
}

#wkspn-popup .wkspn-popup-buttons {
	margin: 0 !important;
	padding: 0 !important;
}

#wkspn-popup .wkspn-popup-allow,
#wkspn-popup .wkspn-popup-deny,
#wkspn-popup .wkspn-popup-dismiss {
	margin: 0 !important;
	line-height: 1.25 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	font-family: inherit !important;
}

@keyframes wkspn-popup-in {
	from {
		opacity: 0;
		transform: translateY(20px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* Position modifiers — default is bottom-right (no extra class needed). */
#wkspn-popup.wkspn-pos-left {
	right: auto;
	left: 24px;
}

#wkspn-popup.wkspn-pos-center {
	right: auto;
	left: 50%;
	transform: translateX(-50%);
}

/* Center needs a combined transform for the entrance animation. */
#wkspn-popup.wkspn-pos-center {
	animation: wkspn-popup-in-center 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes wkspn-popup-in-center {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(20px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0) scale(1);
	}
}

.wkspn-popup-dismiss {
	position: absolute;
	top: 12px;
	right: 14px;
	background: none;
	border: none;
	font-size: 20px;
	color: #9ca3af;
	cursor: pointer;
	padding: 4px 6px;
	border-radius: 6px;
	line-height: 1;
	transition: all 0.2s ease;
}

.wkspn-popup-dismiss:hover {
	background: #f3f4f6;
	color: #374151;
}

.wkspn-popup-icon {
	width: 52px;
	height: 52px;
	border-radius: 12px;
	margin-bottom: 14px;
	object-fit: cover;
}

.wkspn-popup-icon-default {
	width: 52px;
	height: 52px;
	border-radius: 12px;
	margin-bottom: 14px;
	background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 26px;
}

.wkspn-popup-title {
	font-size: 17px;
	font-weight: 700;
	color: #111827;
	margin: 0 0 8px 0;
	line-height: 1.3;
	padding-right: 24px;
}

.wkspn-popup-body {
	font-size: 14px;
	color: #6b7280;
	margin: 0 0 20px 0;
	line-height: 1.4;
}

.wkspn-popup-buttons {
	display: flex;
	gap: 10px;
}

.wkspn-popup-allow {
	flex: 1;
	padding: 11px 16px;
	background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
	color: #ffffff;
	border: none;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.wkspn-popup-allow:hover {
	background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
	transform: translateY(-1px);
}

.wkspn-popup-deny {
	flex: 0 0 auto;
	padding: 11px 16px;
	background: #f3f4f6;
	color: #374151;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.wkspn-popup-deny:hover {
	background: #e5e7eb;
	border-color: #d1d5db;
}

/* Unsubscribe link in footer */
#wkspn-unsub-container {
	position: fixed;
	bottom: 8px;
	right: 24px;
	z-index: 2147483646;
}

#wkspn-unsubscribe-link {
	font-size: 11px !important;
	color: #9ca3af !important;
	text-decoration: underline !important;
	transition: color 0.2s ease;
}

#wkspn-unsubscribe-link:hover {
	color: #6b7280 !important;
}

/*
 * Mobile: pin equal left/right inset. With content-box, width calc(100% - 48px)
 * plus padding equals full viewport while only right is set -- the card drifts
 * flush to the left edge on phones wider than 360px.
 */
@media screen and (max-width: 600px) {
	#wkspn-popup:not(.wkspn-style-bar) {
		left: 24px;
		right: 24px;
		width: auto;
		max-width: none;
	}

	#wkspn-popup.wkspn-pos-center:not(.wkspn-style-bar) {
		transform: none;
		animation: wkspn-popup-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
	}
}

/* Very small screens: full-width bottom sheet */
@media screen and (max-width: 360px) {
	#wkspn-popup:not(.wkspn-style-bar) {
		bottom: 0;
		left: 0;
		right: 0;
		width: 100%;
		max-width: 100%;
		border-radius: 16px 16px 0 0;
	}
}

/* ==========================================================================
	Popup Style Templates
	========================================================================== */

/* -- Minimal (Stripe-style) ------------------------------------------------ */
#wkspn-popup.wkspn-style-minimal {
	max-width: 300px;
	padding: 16px 18px 18px;
	border-radius: 10px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
}

#wkspn-popup.wkspn-style-minimal .wkspn-popup-title {
	font-size: 14px;
	font-weight: 600;
	margin: 0 0 4px 0 !important;
}

#wkspn-popup.wkspn-style-minimal .wkspn-popup-body {
	font-size: 13px;
	margin: 0 0 14px 0 !important;
}

#wkspn-popup.wkspn-style-minimal .wkspn-popup-allow {
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 600;
	border-radius: 6px;
	background: #635bff;
	box-shadow: none;
}

#wkspn-popup.wkspn-style-minimal .wkspn-popup-allow:hover {
	background: #5147e5;
	box-shadow: none;
	transform: none;
}

#wkspn-popup.wkspn-style-minimal .wkspn-popup-deny {
	padding: 8px 14px;
	font-size: 13px;
	border-radius: 6px;
}

/* -- Bar -------------------------------------------------------------------- */
#wkspn-popup.wkspn-style-bar {
	bottom: 0;
	right: 0;
	left: 0;
	max-width: 100%;
	width: 100%;
	border-radius: 0;
	padding: 14px 20px;
	display: flex;
	align-items: center;
	gap: 16px;
	box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
	animation: wkspn-bar-in 0.3s ease both;
}

@keyframes wkspn-bar-in {
	from { transform: translateY(100%); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

#wkspn-popup.wkspn-style-bar .wkspn-popup-dismiss {
	position: static;
	order: 10;
	margin-left: auto;
}

#wkspn-popup.wkspn-style-bar .wkspn-popup-title {
	font-size: 14px;
	font-weight: 600;
	margin: 0;
	padding-right: 0;
	flex: 1;
	order: 1;
}

#wkspn-popup.wkspn-style-bar .wkspn-popup-body          { display: none; }
#wkspn-popup.wkspn-style-bar .wkspn-popup-icon,
#wkspn-popup.wkspn-style-bar .wkspn-popup-icon-default  { display: none; }

#wkspn-popup.wkspn-style-bar .wkspn-popup-buttons {
	flex: 0 0 auto;
	order: 2;
	gap: 8px;
}

#wkspn-popup.wkspn-style-bar .wkspn-popup-allow,
#wkspn-popup.wkspn-style-bar .wkspn-popup-deny {
	padding: 8px 14px;
	font-size: 13px;
	border-radius: 6px;
	flex: 0 0 auto;
}

#wkspn-popup.wkspn-style-bar .wkspn-popup-allow       { box-shadow: none; }
#wkspn-popup.wkspn-style-bar .wkspn-popup-allow:hover { box-shadow: none; transform: none; }

@media screen and (max-width: 600px) {
	#wkspn-popup.wkspn-style-bar {
		flex-wrap: wrap;
		padding-top: 36px;
	}
	#wkspn-popup.wkspn-style-bar .wkspn-popup-title {
		flex-basis: 100%;
	}
	#wkspn-popup.wkspn-style-bar .wkspn-popup-dismiss {
		position: absolute;
		top: 8px;
		right: 12px;
		margin-left: 0;
		order: 0;
	}
}

/* -- Dark ------------------------------------------------------------------- */
#wkspn-popup.wkspn-style-dark {
	background: #1f2937;
	border-color: rgba(255, 255, 255, 0.08);
}

#wkspn-popup.wkspn-style-dark .wkspn-popup-title { color: #f9fafb; }
#wkspn-popup.wkspn-style-dark .wkspn-popup-body  { color: #9ca3af; }

#wkspn-popup.wkspn-style-dark .wkspn-popup-dismiss { color: #6b7280; }
#wkspn-popup.wkspn-style-dark .wkspn-popup-dismiss:hover {
	background: rgba(255, 255, 255, 0.08);
	color: #e5e7eb;
}

#wkspn-popup.wkspn-style-dark .wkspn-popup-allow {
	background: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 100%);
	color: #111827;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#wkspn-popup.wkspn-style-dark .wkspn-popup-allow:hover {
	background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

#wkspn-popup.wkspn-style-dark .wkspn-popup-icon-default {
	background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
	border: 1px solid rgba(255, 255, 255, 0.1);
}

#wkspn-popup.wkspn-style-dark .wkspn-popup-deny {
	background: rgba(255, 255, 255, 0.07);
	border-color: rgba(255, 255, 255, 0.12);
	color: #d1d5db;
}

#wkspn-popup.wkspn-style-dark .wkspn-popup-deny:hover {
	background: rgba(255, 255, 255, 0.13);
	border-color: rgba(255, 255, 255, 0.18);
}

/* -- Forced light (always light, ignores OS dark mode) ----------------------- */
#wkspn-popup.wkspn-color-light.wkspn-style-card {
	background: #ffffff !important;
	border-color: rgba(0, 0, 0, 0.06) !important;
}

#wkspn-popup.wkspn-color-light.wkspn-style-card .wkspn-popup-title { color: #111827 !important; }
#wkspn-popup.wkspn-color-light.wkspn-style-card .wkspn-popup-body  { color: #4b5563 !important; }
#wkspn-popup.wkspn-color-light.wkspn-style-card .wkspn-popup-dismiss { color: #9ca3af !important; }
#wkspn-popup.wkspn-color-light.wkspn-style-card .wkspn-popup-dismiss:hover {
	background: #f3f4f6 !important;
	color: #374151 !important;
}

/* -- Forced dark (always dark, ignores OS light mode) ------------------------ */
#wkspn-popup.wkspn-color-dark.wkspn-style-card {
	background: #1f2937 !important;
	border-color: rgba(255, 255, 255, 0.08) !important;
}

#wkspn-popup.wkspn-color-dark.wkspn-style-card .wkspn-popup-title { color: #f9fafb !important; }
#wkspn-popup.wkspn-color-dark.wkspn-style-card .wkspn-popup-body  { color: #9ca3af !important; }
#wkspn-popup.wkspn-color-dark.wkspn-style-card .wkspn-popup-dismiss { color: #6b7280 !important; }
#wkspn-popup.wkspn-color-dark.wkspn-style-card .wkspn-popup-dismiss:hover {
	background: rgba(255, 255, 255, 0.08) !important;
	color: #e5e7eb !important;
}

#wkspn-popup.wkspn-color-dark.wkspn-style-card .wkspn-popup-allow {
	background: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 100%) !important;
	color: #111827 !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

#wkspn-popup.wkspn-color-dark.wkspn-style-card .wkspn-popup-allow:hover {
	background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%) !important;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5) !important;
}

#wkspn-popup.wkspn-color-dark.wkspn-style-card .wkspn-popup-icon-default {
	background: linear-gradient(135deg, #374151 0%, #1f2937 100%) !important;
	border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

#wkspn-popup.wkspn-color-dark.wkspn-style-card .wkspn-popup-deny {
	background: rgba(255, 255, 255, 0.07) !important;
	border-color: rgba(255, 255, 255, 0.12) !important;
	color: #d1d5db !important;
}

#wkspn-popup.wkspn-color-dark.wkspn-style-card .wkspn-popup-deny:hover {
	background: rgba(255, 255, 255, 0.13) !important;
	border-color: rgba(255, 255, 255, 0.18) !important;
}

/* -- Adaptive: follow OS/browser prefers-color-scheme ------------------------ */
@media (prefers-color-scheme: dark) {
	#wkspn-popup.wkspn-color-adaptive.wkspn-style-card {
		background: #1f2937;
		border-color: rgba(255, 255, 255, 0.08);
	}

	#wkspn-popup.wkspn-color-adaptive.wkspn-style-card .wkspn-popup-title { color: #f9fafb; }
	#wkspn-popup.wkspn-color-adaptive.wkspn-style-card .wkspn-popup-body  { color: #9ca3af; }
	#wkspn-popup.wkspn-color-adaptive.wkspn-style-card .wkspn-popup-dismiss { color: #6b7280; }

	#wkspn-popup.wkspn-color-adaptive.wkspn-style-card .wkspn-popup-dismiss:hover {
		background: rgba(255, 255, 255, 0.08);
		color: #e5e7eb;
	}

	#wkspn-popup.wkspn-color-adaptive.wkspn-style-card .wkspn-popup-allow {
		background: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 100%);
		color: #111827;
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
	}

	#wkspn-popup.wkspn-color-adaptive.wkspn-style-card .wkspn-popup-allow:hover {
		background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
		box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
	}

	#wkspn-popup.wkspn-color-adaptive.wkspn-style-card .wkspn-popup-icon-default {
		background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
		border: 1px solid rgba(255, 255, 255, 0.1);
	}

	#wkspn-popup.wkspn-color-adaptive.wkspn-style-card .wkspn-popup-deny {
		background: rgba(255, 255, 255, 0.07);
		border-color: rgba(255, 255, 255, 0.12);
		color: #d1d5db;
	}

	#wkspn-popup.wkspn-color-adaptive.wkspn-style-card .wkspn-popup-deny:hover {
		background: rgba(255, 255, 255, 0.13);
		border-color: rgba(255, 255, 255, 0.18);
	}
}
