/* Reachify Frontend Styles
 * Floating social button widget.
 * TOM-23: Widget layout & visual design.
 */

/* =========================================================================
   Widget container
   ========================================================================= */

.reachify-widget {
	--reachify-bg: #ffffff;
	--reachify-text-primary: #111111;
	--reachify-text-secondary: #555555;
	--reachify-text-muted: #888888;
	--reachify-border: #cccccc;
	--reachify-overlay: rgba( 0, 0, 0, 0.5 );
	--reachify-btn-text: #ffffff;
	--reachify-glass-bg: rgba( 255, 255, 255, 0.85 );
	--reachify-glass-border: rgba( 255, 255, 255, 0.3 );
	--reachify-shadow: rgba( 0, 0, 0, 0.2 );

	position: fixed;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	gap: 10px;
	transition: opacity 200ms ease;
}

.reachify-dark .reachify-widget,
.reachify-dark.reachify-widget {
	--reachify-bg: #1a1a2e;
	--reachify-text-primary: #e0e0e0;
	--reachify-text-secondary: #b0b0b0;
	--reachify-text-muted: #777777;
	--reachify-border: #333333;
	--reachify-overlay: rgba( 0, 0, 0, 0.7 );
	--reachify-btn-text: #ffffff;
	--reachify-glass-bg: rgba( 30, 30, 50, 0.85 );
	--reachify-glass-border: rgba( 255, 255, 255, 0.1 );
	--reachify-shadow: rgba( 0, 0, 0, 0.4 );
}

.reachify-dark .reachify-qr-modal img {
	background: #fff;
	padding: 8px;
	border-radius: 4px;
}

@supports ( backdrop-filter: blur( 1px ) ) {
	.reachify-dark .reachify-btn--glass {
		background: rgba( 30, 30, 50, 0.15 );
	}

	.reachify-dark .reachify-speech-bubble--glass {
		background: rgba( 30, 30, 50, 0.15 );
	}

	.reachify-dark .reachify-speech-bubble--glass.reachify-speech-bubble--right::after {
		border-left-color: rgba( 255, 255, 255, 0.1 );
	}

	.reachify-dark .reachify-speech-bubble--glass.reachify-speech-bubble--left::after {
		border-right-color: rgba( 255, 255, 255, 0.1 );
	}

	.reachify-dark .reachify-speech-bubble--glass.reachify-speech-bubble--top-right::after {
		border-left-color: rgba( 255, 255, 255, 0.1 );
	}

	.reachify-dark .reachify-speech-bubble--glass.reachify-speech-bubble--top-left::after {
		border-right-color: rgba( 255, 255, 255, 0.1 );
	}
}

.reachify-dark .reachify-lead-form__field input,
.reachify-dark .reachify-lead-form__field textarea {
	background: var(--reachify-bg);
	color: var(--reachify-text-primary);
}

.reachify-position-bottom-right {
	bottom: 24px;
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	right: 24px;
	align-items: flex-end;
}

.reachify-position-bottom-left {
	bottom: 24px;
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	left: 24px;
	align-items: flex-start;
}

.reachify-position-top-right {
	top: 24px;
	right: 24px;
	align-items: flex-end;
}

.reachify-position-top-left {
	top: 24px;
	left: 24px;
	align-items: flex-start;
}

.reachify-position-middle-right {
	top: 50%;
	transform: translateY(-50%);
	right: 24px;
	align-items: flex-end;
}

.reachify-position-middle-left {
	top: 50%;
	transform: translateY(-50%);
	left: 24px;
	align-items: flex-start;
}

/* TOM-339: bottom-center position. */
.reachify-position-bottom-center {
	bottom: 24px;
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	left: 50%;
	transform: translateX(-50%);
	align-items: center;
}

/* =========================================================================
   Buttons
   ========================================================================= */

.reachify-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border-radius: 12px;
	text-decoration: none;
	color: var(--reachify-btn-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	box-shadow: 0 2px 8px var(--reachify-shadow);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	white-space: nowrap;
	cursor: pointer;
}

.reachify-btn:hover,
.reachify-btn:focus-visible {
	transform: translateY( -2px );
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.25 );
	color: var(--reachify-btn-text);
	text-decoration: none;
}

.reachify-btn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

/* Platform icon — inline SVG injected by PHP via wp_localize_script (TOM-39). */
.reachify-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

.reachify-icon svg {
	width: 100%;
	height: 100%;
	fill: currentColor;
}

.reachify-label {
	/* Hidden on mobile via @media query below. */
}

/* =========================================================================
   TOM-134: Display triggers — hidden state & slide-in animation
   ========================================================================= */

.reachify-widget--hidden {
	display: none;
}

/* TOM-510: Hide floating widget when exit popup or QR modal is open. */
.reachify-widget--popup-hidden {
	opacity: 0;
	pointer-events: none;
	transition: opacity 200ms ease;
}

.reachify-animate-in {
	animation: reachifySlideIn 0.3s ease-out;
}

@keyframes reachifySlideIn {
	from {
		opacity: 0;
		transform: translateY( 20px );
	}
	to {
		opacity: 1;
		transform: translateY( 0 );
	}
}

/* =========================================================================
   TOM-83: Transparent background variant
   ========================================================================= */

.reachify-btn-transparent {
	box-shadow: none;
	background: transparent !important;
}

.reachify-btn-transparent:hover,
.reachify-btn-transparent:focus-visible {
	box-shadow: none;
	color: inherit;
}

/* =========================================================================
   TOM-312: Glassmorphism / liquid glass button style
   ========================================================================= */

/* Opaque fallback for browsers without backdrop-filter support. */
.reachify-btn--glass {
	background: var(--reachify-glass-bg);
	border: 1px solid var(--reachify-glass-border);
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.1 );
}

.reachify-btn--glass:hover,
.reachify-btn--glass:focus-visible {
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.15 );
}

/* Enhanced glass effect when backdrop-filter is supported. */
@supports ( backdrop-filter: blur( 1px ) ) {
	.reachify-btn--glass {
		background: rgba( 255, 255, 255, 0.15 );
		backdrop-filter: blur( 12px ) saturate( 180% );
		-webkit-backdrop-filter: blur( 12px ) saturate( 180% );
	}
}

/* Speech bubble glass variant — opaque fallback. */
.reachify-speech-bubble--glass {
	background: var(--reachify-glass-bg);
	border: 1px solid var(--reachify-glass-border);
}

/* Speech bubble glass variant — enhanced. */
@supports ( backdrop-filter: blur( 1px ) ) {
	.reachify-speech-bubble--glass {
		background: rgba( 255, 255, 255, 0.15 );
		backdrop-filter: blur( 12px ) saturate( 180% );
		-webkit-backdrop-filter: blur( 12px ) saturate( 180% );
	}
}

/* Speech bubble tail color must match glass background for visual continuity. */
.reachify-speech-bubble--glass.reachify-speech-bubble--right::after {
	border-left-color: var(--reachify-glass-bg);
}

.reachify-speech-bubble--glass.reachify-speech-bubble--left::after {
	border-right-color: var(--reachify-glass-bg);
}

.reachify-speech-bubble--glass.reachify-speech-bubble--top-right::after {
	border-left-color: var(--reachify-glass-bg);
}

.reachify-speech-bubble--glass.reachify-speech-bubble--top-left::after {
	border-right-color: var(--reachify-glass-bg);
}

@supports ( backdrop-filter: blur( 1px ) ) {
	.reachify-speech-bubble--glass.reachify-speech-bubble--right::after {
		border-left-color: var(--reachify-glass-border);
	}

	.reachify-speech-bubble--glass.reachify-speech-bubble--left::after {
		border-right-color: var(--reachify-glass-border);
	}

	.reachify-speech-bubble--glass.reachify-speech-bubble--top-right::after {
		border-left-color: var(--reachify-glass-border);
	}

	.reachify-speech-bubble--glass.reachify-speech-bubble--top-left::after {
		border-right-color: var(--reachify-glass-border);
	}
}

/* Glass speech bubble text needs higher contrast on translucent background. */
.reachify-speech-bubble--glass .reachify-speech-bubble__name {
	color: var(--reachify-text-primary);
}

.reachify-speech-bubble--glass .reachify-speech-bubble__message {
	color: var(--reachify-text-secondary);
}

/* =========================================================================
   TOM-584: Icon style variants — brand, mono, outline
   Applied per button via JS modifier class. Default "white" has no class.
   ========================================================================= */

/* --- Brand: white background, brand-colored icon, dark label --- */
.reachify-btn--icon-brand {
	background: #ffffff !important;
	border: 1px solid #e0e0e0;
	color: var(--reachify-btn-color, #333333);
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.08 );
}

.reachify-btn--icon-brand .reachify-label,
.reachify-btn--icon-brand .reachify-label--hover-only {
	color: #333333;
}

.reachify-btn--icon-brand:hover,
.reachify-btn--icon-brand:focus-visible {
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.15 );
	color: var(--reachify-btn-color, #333333);
}

/* --- Mono: white background, black icon, dark label --- */
.reachify-btn--icon-mono {
	background: #ffffff !important;
	border: 1px solid #e0e0e0;
	color: #000000;
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.08 );
}

.reachify-btn--icon-mono .reachify-label,
.reachify-btn--icon-mono .reachify-label--hover-only {
	color: #333333;
}

.reachify-btn--icon-mono:hover,
.reachify-btn--icon-mono:focus-visible {
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.15 );
	color: #000000;
}

/* --- Outline: transparent background, brand-colored border/icon/label --- */
.reachify-btn--icon-outline {
	background: transparent !important;
	border: 1.5px solid currentColor;
	color: var(--reachify-btn-color, #333333);
	box-shadow: none;
}

.reachify-btn--icon-outline .reachify-label,
.reachify-btn--icon-outline .reachify-label--hover-only {
	color: var(--reachify-btn-color, #333333);
}

.reachify-btn--icon-outline:hover,
.reachify-btn--icon-outline:focus-visible {
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.1 );
	color: var(--reachify-btn-color, #333333);
}

/* --- Glass + icon style combo: glass overrides background, icon color still applies --- */
.reachify-btn--glass.reachify-btn--icon-brand,
.reachify-btn--glass.reachify-btn--icon-mono,
.reachify-btn--glass.reachify-btn--icon-outline {
	border: 1px solid var(--reachify-glass-border);
}

.reachify-btn--glass.reachify-btn--icon-brand {
	color: var(--reachify-btn-color, #333333);
}

.reachify-btn--glass.reachify-btn--icon-mono {
	color: #000000;
}

.reachify-btn--glass.reachify-btn--icon-outline {
	color: var(--reachify-btn-color, #333333);
}

/* --- Transparent bg override: transparent_bg takes precedence over icon-style background --- */
.reachify-btn-transparent.reachify-btn--icon-brand,
.reachify-btn-transparent.reachify-btn--icon-mono,
.reachify-btn-transparent.reachify-btn--icon-outline {
	background: transparent !important;
	border: none;
	box-shadow: none;
}

/* --- Dark mode adjustments for icon style variants --- */
.reachify-dark .reachify-btn--icon-brand {
	background: var(--reachify-bg) !important;
	border-color: var(--reachify-border);
}

.reachify-dark .reachify-btn--icon-brand .reachify-label,
.reachify-dark .reachify-btn--icon-brand .reachify-label--hover-only {
	color: var(--reachify-text-primary);
}

.reachify-dark .reachify-btn--icon-mono {
	background: var(--reachify-bg) !important;
	border-color: var(--reachify-border);
	color: var(--reachify-text-primary);
}

.reachify-dark .reachify-btn--icon-mono .reachify-label,
.reachify-dark .reachify-btn--icon-mono .reachify-label--hover-only {
	color: var(--reachify-text-primary);
}

.reachify-dark .reachify-btn--icon-mono:hover,
.reachify-dark .reachify-btn--icon-mono:focus-visible {
	color: var(--reachify-text-primary);
}

.reachify-dark .reachify-btn--icon-outline {
	border-color: currentColor;
}

/* =========================================================================
   TOM-310: Button shape variants — applied via container class
   ========================================================================= */

/* Rounded (default) — uses base .reachify-btn border-radius: 14px, no override needed. */

/* Circle — equal padding, 50% radius for perfect circle. */
.reachify-shape-circle .reachify-btn {
	border-radius: 50%;
	padding: 8px;
}

/* Circle hides label text — circle shape is icon-only by design. */
.reachify-shape-circle .reachify-label {
	display: none;
}

/* Circle hides hover-only labels too. */
.reachify-shape-circle .reachify-label--hover-only {
	display: none;
}

/* Square — softened 4px corners. */
.reachify-shape-square .reachify-btn {
	border-radius: 4px;
}

/* =========================================================================
   Per-button hover-only label — hidden by default, expand on hover
   ========================================================================= */

/* Hover-only label: collapsed to zero width, shown on JS-triggered reveal. */
.reachify-label--hover-only {
	display: inline-block;
	max-width: 0;
	overflow: hidden;
	opacity: 0;
	transition: max-width 0.3s ease, opacity 0.2s ease 0.1s;
	vertical-align: middle;
	white-space: nowrap;
}

/* JS-driven reveal: 300ms delay handled by JS, class toggled on button. */
.reachify-btn.reachify-tooltip-visible .reachify-label--hover-only {
	max-width: 200px;
	opacity: 1;
}

/* When hover-only label is collapsed, remove gap so icon is centered. */
.reachify-btn:has(.reachify-label--hover-only) {
	gap: 0;
}

.reachify-btn.reachify-tooltip-visible:has(.reachify-label--hover-only) {
	gap: 6px;
}

/* =========================================================================
   TOM-313: Idle animations — optional attention-drawing motion
   ========================================================================= */

/* Scale (pulse): subtle grow-and-shrink loop */
.reachify-idle-scale .reachify-btn {
	animation: reachifyIdlePulse 2s ease-in-out infinite;
}

@keyframes reachifyIdlePulse {
	0%, 100% { transform: scale( 1 ); }
	50%      { transform: scale( 1.06 ); }
}

/* Opacity (fade): gentle fade in-and-out loop */
.reachify-idle-opacity .reachify-btn {
	animation: reachifyIdleFade 2.5s ease-in-out infinite;
}

@keyframes reachifyIdleFade {
	0%, 100% { opacity: 1; }
	50%      { opacity: 0.6; }
}

/* Pause idle animation on hover/focus — user is interacting, stop distracting. */
.reachify-idle-scale .reachify-btn:hover,
.reachify-idle-scale .reachify-btn:focus-visible,
.reachify-idle-opacity .reachify-btn:hover,
.reachify-idle-opacity .reachify-btn:focus-visible {
	animation-play-state: paused;
}


/* =========================================================================
   TOM-342: Hover animations — one-shot micro-interactions on hover/focus
   ========================================================================= */

/* Scale: smooth scale-up — replaces default translateY lift */
.reachify-hover-scale .reachify-btn:hover,
.reachify-hover-scale .reachify-btn:focus-visible {
	transform: scale( 1.08 );
	transition: transform 150ms ease-in-out, box-shadow 0.15s ease;
}

/* Bounce: spring overshoot scale — replaces default translateY lift */
.reachify-hover-bounce .reachify-btn:hover,
.reachify-hover-bounce .reachify-btn:focus-visible {
	transform: scale( 1.08 );
	transition: transform 400ms cubic-bezier( 0.34, 1.56, 0.64, 1 ), box-shadow 0.15s ease;
}

/* Pulse: expanding glow ring — keeps translateY lift, adds box-shadow ring */
.reachify-hover-pulse .reachify-btn:hover,
.reachify-hover-pulse .reachify-btn:focus-visible {
	box-shadow: 0 0 0 6px rgba( 255, 255, 255, 0.3 ),
	            0 4px 14px rgba( 0, 0, 0, 0.25 );
	transform: translateY( -2px );
	transition: box-shadow 300ms ease-out, transform 0.15s ease;
}

/* =========================================================================
   TOM-342: Hover animations — interactive motion on :hover / :focus-visible
   ========================================================================= */

/* Scale up: quick grow on interaction */
.reachify-hover-scale .reachify-btn:hover,
.reachify-hover-scale .reachify-btn:focus-visible {
	transform: scale( 1.08 );
	transition: transform 150ms ease-in-out, box-shadow 0.15s ease;
}

/* Bounce (spring): overshoot with cubic-bezier spring curve */
.reachify-hover-bounce .reachify-btn:hover,
.reachify-hover-bounce .reachify-btn:focus-visible {
	transform: scale( 1.08 );
	transition: transform 400ms cubic-bezier( 0.34, 1.56, 0.64, 1 ), box-shadow 0.15s ease;
}

/* Pulse (glow ring): expanding box-shadow ring */
.reachify-hover-pulse .reachify-btn:hover,
.reachify-hover-pulse .reachify-btn:focus-visible {
	box-shadow: 0 0 0 6px rgba( 255, 255, 255, 0.3 ), 0 4px 14px rgba( 0, 0, 0, 0.25 );
	transform: translateY( -2px );
	transition: box-shadow 300ms ease-out, transform 0.15s ease;
}

/* =========================================================================
   TOM-342: Hover animations — one-shot micro-interactions on hover/focus
   ========================================================================= */

/* Scale: smooth scale-up — replaces default translateY lift */
.reachify-hover-scale .reachify-btn:hover,
.reachify-hover-scale .reachify-btn:focus-visible {
	transform: scale( 1.08 );
	transition: transform 150ms ease-in-out, box-shadow 0.15s ease;
}

/* Bounce: spring overshoot scale — replaces default translateY lift */
.reachify-hover-bounce .reachify-btn:hover,
.reachify-hover-bounce .reachify-btn:focus-visible {
	transform: scale( 1.08 );
	transition: transform 400ms cubic-bezier( 0.34, 1.56, 0.64, 1 ), box-shadow 0.15s ease;
}

/* Pulse: expanding glow ring — keeps translateY lift, adds box-shadow ring */
.reachify-hover-pulse .reachify-btn:hover,
.reachify-hover-pulse .reachify-btn:focus-visible {
	box-shadow: 0 0 0 6px rgba( 255, 255, 255, 0.3 ),
	            0 4px 14px rgba( 0, 0, 0, 0.25 );
	transform: translateY( -2px );
	transition: box-shadow 300ms ease-out, transform 0.15s ease;
}

/* =========================================================================
   TOM-342: Hover animations — one-shot micro-interactions on hover/focus
   ========================================================================= */

/* Scale: smooth scale-up — replaces default translateY lift */
.reachify-hover-scale .reachify-btn:hover,
.reachify-hover-scale .reachify-btn:focus-visible {
	transform: scale( 1.08 );
	transition: transform 150ms ease-in-out, box-shadow 0.15s ease;
}

/* Bounce: spring overshoot scale — replaces default translateY lift */
.reachify-hover-bounce .reachify-btn:hover,
.reachify-hover-bounce .reachify-btn:focus-visible {
	transform: scale( 1.08 );
	transition: transform 400ms cubic-bezier( 0.34, 1.56, 0.64, 1 ), box-shadow 0.15s ease;
}

/* Pulse: expanding glow ring — keeps translateY lift, adds box-shadow ring */
.reachify-hover-pulse .reachify-btn:hover,
.reachify-hover-pulse .reachify-btn:focus-visible {
	box-shadow: 0 0 0 6px rgba( 255, 255, 255, 0.3 ),
	            0 4px 14px rgba( 0, 0, 0, 0.25 );
	transform: translateY( -2px );
	transition: box-shadow 300ms ease-out, transform 0.15s ease;
}

/* =========================================================================
   Exit popup
   ========================================================================= */

.reachify-exit-popup {
	position: fixed;
	inset: 0;
	z-index: 10000;
	background: var(--reachify-overlay);
	display: flex;
	align-items: center;
	justify-content: center;
}

.reachify-exit-popup-box {
	background: var(--reachify-bg);
	border-radius: 12px;
	padding: 32px 28px;
	max-width: 360px;
	width: 90%;
	text-align: center;
	box-shadow: 0 8px 32px rgba( 0, 0, 0, 0.2 );
}

.reachify-exit-popup-heading {
	margin: 0 0 8px;
	font-size: 20px;
	font-weight: 700;
	color: var(--reachify-text-primary);
}

.reachify-exit-popup-subtext {
	margin: 0 0 24px;
	font-size: 15px;
	color: var(--reachify-text-secondary);
}

.reachify-exit-popup-confirm,
.reachify-exit-popup-cancel {
	display: block;
	width: 100%;
	padding: 12px;
	border: none;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.reachify-exit-popup-confirm {
	margin-bottom: 10px;
	background: #111;
	color: #fff;
}

.reachify-exit-popup-cancel {
	background: transparent;
	color: var(--reachify-text-muted);
	font-weight: 400;
}

.reachify-exit-popup-confirm:hover,
.reachify-exit-popup-cancel:hover {
	opacity: 0.85;
}

/* =========================================================================
   TOM-235: Speech bubble popup
   ========================================================================= */

.reachify-speech-bubble {
	--reachify-bubble-offset: 90px;
	position: fixed;
	z-index: 9998; /* Below widget (9999) and exit popup (10000), above page content */
	display: none; /* JS toggles to flex when shown */
	align-items: flex-start;
	gap: 10px;
	max-width: 280px;
	padding: 14px 16px;
	background: var(--reachify-bg);
	border-radius: 16px;
	box-shadow: 0 4px 20px rgba( 0, 0, 0, 0.12 );
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	cursor: pointer;
}

/* Position variants — same corner as widget, offset to clear the button stack */
.reachify-speech-bubble--right {
	bottom: 24px;
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	right: var( --reachify-bubble-offset );
}

.reachify-speech-bubble--left {
	bottom: 24px;
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	left: var( --reachify-bubble-offset );
}

.reachify-speech-bubble--top-right {
	top: 24px;
	right: var( --reachify-bubble-offset );
}

.reachify-speech-bubble--top-left {
	top: 24px;
	left: var( --reachify-bubble-offset );
}

/* CSS triangle tail pointing toward the button stack */
.reachify-speech-bubble--right::after {
	content: '';
	position: absolute;
	bottom: 16px;
	right: -8px;
	width: 0;
	height: 0;
	border-top: 8px solid transparent;
	border-bottom: 8px solid transparent;
	border-left: 8px solid var(--reachify-bg);
}

.reachify-speech-bubble--left::after {
	content: '';
	position: absolute;
	bottom: 16px;
	left: -8px;
	width: 0;
	height: 0;
	border-top: 8px solid transparent;
	border-bottom: 8px solid transparent;
	border-right: 8px solid var(--reachify-bg);
}

.reachify-speech-bubble--top-right::after {
	content: '';
	position: absolute;
	top: 16px;
	right: -8px;
	width: 0;
	height: 0;
	border-top: 8px solid transparent;
	border-bottom: 8px solid transparent;
	border-left: 8px solid var(--reachify-bg);
}

.reachify-speech-bubble--top-left::after {
	content: '';
	position: absolute;
	top: 16px;
	left: -8px;
	width: 0;
	height: 0;
	border-top: 8px solid transparent;
	border-bottom: 8px solid transparent;
	border-right: 8px solid var(--reachify-bg);
}

/* Close button */
.reachify-speech-bubble__close {
	position: absolute;
	top: 6px;
	right: 8px;
	background: none;
	border: none;
	font-size: 18px;
	line-height: 1;
	color: var(--reachify-text-muted);
	cursor: pointer;
	padding: 2px 4px;
}

.reachify-speech-bubble__close:hover {
	color: var(--reachify-text-primary);
}

/* Content layout */
.reachify-speech-bubble__content {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

/* Avatar */
.reachify-speech-bubble__avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.reachify-speech-bubble__avatar--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #25D366;
	color: #fff;
	font-size: 18px;
	font-weight: 700;
}

/* Text block */
.reachify-speech-bubble__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding-right: 16px; /* Space for close button */
}

.reachify-speech-bubble__name {
	font-size: 13px;
	font-weight: 700;
	color: var(--reachify-text-primary);
	line-height: 1.2;
}

.reachify-speech-bubble__message {
	font-size: 14px;
	font-weight: 400;
	color: var(--reachify-text-secondary);
	line-height: 1.4;
}

/* TOM-459: Lead capture form */
.reachify-lead-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 4px;
}

.reachify-lead-form__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.reachify-lead-form__field label {
	font-size: 12px;
	font-weight: 600;
	color: var(--reachify-text-primary);
}

.reachify-lead-form__field input,
.reachify-lead-form__field textarea {
	font-size: 14px;
	padding: 8px 10px;
	border: 1px solid var(--reachify-border);
	border-radius: 6px;
	font-family: inherit;
	background: var(--reachify-bg);
	color: var(--reachify-text-primary);
}

.reachify-lead-form__field--checkbox {
	flex-direction: row;
	align-items: flex-start;
}

.reachify-lead-form__field--checkbox label {
	font-weight: 400;
	font-size: 13px;
}

.reachify-lead-form__error {
	font-size: 12px;
	color: #c00;
	margin-top: 2px;
}

.reachify-lead-form__errors {
	font-size: 12px;
	color: #c00;
	display: none;
}

.reachify-lead-form__submit {
	font-size: 14px;
	font-weight: 600;
	padding: 10px 16px;
	background: #25D366;
	color: #fff;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	margin-top: 4px;
}

.reachify-lead-form__submit:hover:not(:disabled) {
	background: #20bd5a;
}

.reachify-lead-form__submit:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

/* Hover */
.reachify-speech-bubble:hover {
	box-shadow: 0 6px 24px rgba( 0, 0, 0, 0.16 );
}

/* Animations */
.reachify-speech-bubble--animate-in {
	animation: reachifySpeechBubbleIn 0.4s ease-out;
}

.reachify-speech-bubble--animate-out {
	animation: reachifySpeechBubbleOut 0.25s ease-in forwards;
}

@keyframes reachifySpeechBubbleIn {
	from {
		opacity: 0;
		transform: translateY( 10px ) scale( 0.95 );
	}
	to {
		opacity: 1;
		transform: translateY( 0 ) scale( 1 );
	}
}

@keyframes reachifySpeechBubbleOut {
	from {
		opacity: 1;
		transform: translateY( 0 ) scale( 1 );
	}
	to {
		opacity: 0;
		transform: translateY( 10px ) scale( 0.95 );
	}
}

/* =========================================================================
   Mobile adjustments (<768px)
   ========================================================================= */

@media ( max-width: 767px ) {
	/* Reduce position offsets to save screen real estate. */
	.reachify-position-bottom-right,
	.reachify-position-bottom-left {
		bottom: 16px;
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	}

	.reachify-position-bottom-right {
		right: 16px;
	}

	.reachify-position-bottom-left {
		left: 16px;
	}

	.reachify-position-top-right,
	.reachify-position-top-left {
		top: 16px;
	}

	.reachify-position-top-right {
		right: 16px;
	}

	.reachify-position-top-left {
		left: 16px;
	}

	.reachify-position-middle-right,
	.reachify-position-middle-left {
		top: 50%;
		transform: translateY(-50%);
	}

	.reachify-position-middle-right {
		right: 16px;
	}

	.reachify-position-middle-left {
		left: 16px;
	}

	/* TOM-339: bottom-center mobile override. */
	.reachify-position-bottom-center {
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	}

	/* Slightly smaller buttons on mobile. */
	.reachify-btn {
		padding: 7px 10px;
		font-size: 12px;
	}

	/* Collapse label text on mobile — show icon only. */
	.reachify-label {
		display: none;
	}

	/* Hover-only labels on mobile — JS swaps class to always-show.
	   Specificity (0,2,0) beats .reachify-label (0,1,0) above. */
	.reachify-mobile-tooltip-fallback .reachify-label {
		display: inline-block;
	}

	/* Show hover-only labels on mobile when tooltip is visible. */
	.reachify-mobile-tooltip-fallback .reachify-label--hover-only {
		display: inline-block;
		max-width: 200px;
		opacity: 1;
	}

	/* Increase icon size slightly to compensate for hidden label. */
	.reachify-icon {
		width: 22px;
		height: 22px;
	}

	/* Reduce gap for tighter stacking. */
	.reachify-widget {
		gap: 8px;
	}

	/* Circle buttons on mobile. */
	.reachify-shape-circle .reachify-btn {
		padding: 7px;
	}
}

/* =========================================================================
   TOM-234: Offline state
   ========================================================================= */

.reachify-btn-offline {
	opacity: 0.7;
	cursor: default;
}

.reachify-btn-offline .reachify-icon {
	filter: grayscale(50%);
}

/* =========================================================================
   TOM-237: Speech bubble compact mode (<=480px)
   ========================================================================= */

@media ( max-width: 480px ) {
	.reachify-speech-bubble {
		--reachify-bubble-offset: 16px;
		max-width: calc( 100vw - 80px );
		padding: 10px 14px;
		border-radius: 12px;
	}

	/* Hide avatar on compact mode — message-only bubble. */
	.reachify-speech-bubble__avatar {
		display: none;
	}

	/* Hide agent name — keep only the message for minimal footprint. */
	.reachify-speech-bubble__name {
		display: none;
	}

	/* Adjust padding for close button. */
	.reachify-speech-bubble__text {
		padding-right: 20px;
	}

	/* Smaller close button. */
	.reachify-speech-bubble__close {
		top: 4px;
		right: 4px;
		font-size: 16px;
	}

	/* Message text: slightly smaller. */
	.reachify-speech-bubble__message {
		font-size: 13px;
		line-height: 1.35;
	}

	/* Position: place bubble ABOVE the widget stack to avoid overlap.
	   Widget is at bottom:16px on mobile. Bubble sits at bottom:70px
	   giving ~16px gap above a typical single-button stack. */
	.reachify-speech-bubble--right,
	.reachify-speech-bubble--left {
		bottom: 70px;
	}

	.reachify-speech-bubble--right {
		right: 16px;
		left: auto;
	}

	.reachify-speech-bubble--left {
		left: 16px;
		right: auto;
	}

	/* Top variants: push down to clear mobile browser chrome. */
	.reachify-speech-bubble--top-right,
	.reachify-speech-bubble--top-left {
		top: 60px;
	}

	.reachify-speech-bubble--top-right {
		right: 16px;
	}

	.reachify-speech-bubble--top-left {
		left: 16px;
	}

	/* Remove CSS triangle tail — not meaningful when bubble
	   is repositioned above the stack instead of beside it. */
	.reachify-speech-bubble--right::after,
	.reachify-speech-bubble--left::after {
		display: none;
	}
}

/* =========================================================================
   TOM-477: Desktop QR code modal
   ========================================================================= */

.reachify-qr-overlay {
	position: fixed;
	inset: 0;
	background: var(--reachify-overlay);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 200ms ease;
	pointer-events: none;
}

.reachify-qr-overlay--visible {
	opacity: 1;
	pointer-events: auto;
}

.reachify-qr-modal {
	background: var(--reachify-bg);
	border-radius: 16px;
	padding: 24px;
	max-width: 360px;
	width: 90vw;
	box-shadow: 0 20px 60px rgba( 0, 0, 0, 0.3 );
	text-align: center;
}

.reachify-qr-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
}

.reachify-qr-title {
	font-size: 18px;
	font-weight: 600;
	color: var(--reachify-text-primary);
}

.reachify-qr-close {
	background: none;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: var(--reachify-text-muted);
	padding: 4px 8px;
	line-height: 1;
}

.reachify-qr-close:hover {
	color: var(--reachify-text-primary);
}

.reachify-qr-code {
	margin: 16px auto;
}

.reachify-qr-code canvas,
.reachify-qr-code svg {
	display: block;
	margin: 0 auto;
}

.reachify-qr-hint {
	font-size: 14px;
	color: var(--reachify-text-muted);
	margin: 12px 0 0;
}

.reachify-qr-footer {
	margin-top: 16px;
}

.reachify-qr-fallback-link {
	font-size: 13px;
	color: #25D366;
	text-decoration: underline;
}

/* =========================================================================
   TOM-307: Accessibility — prefers-reduced-motion
   ========================================================================= */

@media ( prefers-reduced-motion: reduce ) {
	/* Buttons: disable hover/focus transform + shadow transition */
	.reachify-btn {
		transition: none;
	}

	/* TOM-313: Disable idle animations */
	.reachify-idle-scale .reachify-btn,
	.reachify-idle-opacity .reachify-btn {
		animation: none;
	}

	/* TOM-342: Disable hover animations */
	.reachify-hover-scale .reachify-btn,
	.reachify-hover-bounce .reachify-btn,
	.reachify-hover-pulse .reachify-btn {
		transition: none;
	}

	/* Disable hover-only label expand transition */
	.reachify-label--hover-only {
		transition: none;
	}

	/* Widget slide-in: disable animation, ensure visible */
	.reachify-animate-in {
		animation: none;
		opacity: 1;
		transform: none;
	}

	/* Exit popup buttons: disable opacity transition */
	.reachify-exit-popup-confirm,
	.reachify-exit-popup-cancel {
		transition: none;
	}

	/* Speech bubble enter: appear instantly */
	.reachify-speech-bubble--animate-in {
		animation-duration: 0.01s;
	}

	/* Speech bubble exit: hide instantly (must still fire animationend for JS) */
	.reachify-speech-bubble--animate-out {
		animation-duration: 0.01s;
	}

	.reachify-qr-overlay {
		transition: none;
	}
}
