/* ==========================================================================
   Avarida Group — floating WhatsApp bubble (site-wide).

   Bottom-LEFT by design: the growth-engine AI agent toggle owns bottom-right
   (fixed, z-index 99998). This sits at 99990 so that if the agent's mobile
   panel (which spans the full width) ever overlaps, the panel layers on top.

   Everything is scoped under `.avarida-wa` because hello-elementor's reset.css
   styles bare interactive elements and out-specifies a lone class on :hover.
   ========================================================================== */

.avarida-wa {
	--wa-green: #25d366;
	--wa-green-dark: #1da851;
	--wa-size: 3.5rem;

	position: fixed;
	left: 1.25rem;
	bottom: calc( 1.25rem + env( safe-area-inset-bottom, 0px ) );
	z-index: 99990;

	/* Raised above the website-offer page's full-width mobile sticky bar.
	   The script measures that bar and sets --avarida-fab-offset on <html>,
	   so both floating actions lift by the same amount. */
	margin-bottom: var( --avarida-fab-offset, 0px );
	transition: margin-bottom 0.25s ease, opacity 0.3s ease, transform 0.3s ease;

	/* Hidden until the script reveals it, so it animates in rather than
	   appearing mid-paint. No-JS visitors get the fallback below. */
	opacity: 0;
	transform: translateY( 12px ) scale( 0.9 );
	pointer-events: none;
}

.avarida-wa.is-ready {
	opacity: 1;
	transform: translateY( 0 ) scale( 1 );
	pointer-events: auto;
}

/* Yield the corner while the AI agent's panel is open. */
.avarida-wa.is-hidden {
	opacity: 0;
	transform: translateY( 12px ) scale( 0.9 );
	pointer-events: none;
}

/* Without JS nothing ever adds .is-ready, so the markup ships a <noscript>
   override that reveals the bubble. See avarida_render_whatsapp_bubble(). */

/* --------------------------------------------------------------------------
   Button
   -------------------------------------------------------------------------- */

.avarida-wa .avarida-wa__btn {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0;
	height: var( --wa-size );
	width: var( --wa-size );
	padding: 0;
	border-radius: 9999px;
	background: linear-gradient( 160deg, var( --wa-green ) 0%, var( --wa-green-dark ) 100% );
	color: #fff;
	text-decoration: none;
	box-shadow:
		0 10px 28px -6px rgba( 37, 211, 102, 0.55 ),
		0 2px 6px rgba( 0, 0, 0, 0.18 ),
		inset 0 1px 0 rgba( 255, 255, 255, 0.28 );
	overflow: hidden;
	transition: width 0.32s cubic-bezier( 0.22, 0.61, 0.36, 1 ), box-shadow 0.22s ease, transform 0.22s ease;
	-webkit-tap-highlight-color: transparent;
}

.avarida-wa .avarida-wa__btn:hover,
.avarida-wa .avarida-wa__btn:focus-visible {
	color: #fff;
	text-decoration: none;
	box-shadow:
		0 14px 34px -6px rgba( 37, 211, 102, 0.68 ),
		0 2px 8px rgba( 0, 0, 0, 0.22 ),
		inset 0 1px 0 rgba( 255, 255, 255, 0.34 );
}

.avarida-wa .avarida-wa__btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.avarida-wa .avarida-wa__btn:active {
	transform: scale( 0.95 );
}

.avarida-wa .avarida-wa__icon {
	flex: 0 0 var( --wa-size );
	display: flex;
	align-items: center;
	justify-content: center;
	width: var( --wa-size );
	height: var( --wa-size );
}

.avarida-wa .avarida-wa__icon svg {
	width: 1.75rem;
	height: 1.75rem;
	display: block;
}

/* Label slides out of the circle on hover (pointer devices only). */
.avarida-wa .avarida-wa__text {
	white-space: nowrap;
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	opacity: 0;
	transform: translateX( -6px );
	transition: opacity 0.2s ease, transform 0.28s ease;
	padding-right: 0;
}

@media ( hover: hover ) and ( pointer: fine ) {
	.avarida-wa .avarida-wa__btn:hover,
	.avarida-wa .avarida-wa__btn:focus-visible {
		width: 12.5rem;
	}

	.avarida-wa .avarida-wa__btn:hover .avarida-wa__text,
	.avarida-wa .avarida-wa__btn:focus-visible .avarida-wa__text {
		opacity: 1;
		transform: translateX( 0 );
		padding-right: 1.25rem;
	}
}

/* On touch devices the label can never be revealed, so keep it out of the
   layout entirely — the aria-label still names the control. */
@media not all and ( hover: hover ) {
	.avarida-wa .avarida-wa__text {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect( 0 0 0 0 );
		clip-path: inset( 50% );
		white-space: nowrap;
	}
}

/* --------------------------------------------------------------------------
   Attention ring — one slow pulse, not a strobe
   -------------------------------------------------------------------------- */

.avarida-wa .avarida-wa__ring {
	position: absolute;
	inset: 0;
	border-radius: 9999px;
	border: 2px solid var( --wa-green );
	opacity: 0;
	animation: avarida-wa-pulse 2.8s ease-out infinite;
	pointer-events: none;
}

.avarida-wa .avarida-wa__btn:hover .avarida-wa__ring {
	animation-play-state: paused;
	opacity: 0;
}

@keyframes avarida-wa-pulse {
	0%   { opacity: 0.6; transform: scale( 1 ); }
	70%  { opacity: 0; transform: scale( 1.45 ); }
	100% { opacity: 0; transform: scale( 1.45 ); }
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */

@media ( max-width: 640px ) {
	.avarida-wa {
		--wa-size: 3.25rem;
		left: 0.875rem;
		bottom: calc( 0.875rem + env( safe-area-inset-bottom, 0px ) );
	}

	.avarida-wa .avarida-wa__icon svg {
		width: 1.6rem;
		height: 1.6rem;
	}
}

/* --------------------------------------------------------------------------
   Print / reduced motion
   -------------------------------------------------------------------------- */

@media print {
	.avarida-wa { display: none; }
}

/* ==========================================================================
   Floating-action stack — theme-side adjustments to the growth-engine agent.

   The agent widget (.avge-agent) belongs to the avarida-growth-engine plugin;
   nothing here edits that plugin. This sheet currently loads after the
   plugin's, so source order alone would win — but every rule below is
   prefixed with `body` (0,1,1 vs the plugin's 0,1,0) so the override still
   holds if either enqueue priority ever changes. No !important needed.

   Two fixes:
   1. The agent sat at bottom:14px while the website-offer sticky CTA bar is
      ~60px tall at bottom:0 — it covered the "Build My Website" button. Both
      floating actions now lift by the measured bar height.
      (The agent's own breakpoint is 480px but the sticky bar's is 768px, so
      the overlap also spanned 481–768px. The shared offset covers both.)
   2. On phones the agent is a wide text pill while WhatsApp is a 52px circle.
      Below 768px the pill collapses to a matching icon-only circle, so the two
      corners read as a pair instead of competing.
   ========================================================================== */

body .avge-agent {
	bottom: calc( 22px + env( safe-area-inset-bottom, 0px ) + var( --avarida-fab-offset, 0px ) );
	transition: bottom 0.25s ease;
}

@media ( max-width: 768px ) {
	body .avge-agent {
		bottom: calc( 14px + env( safe-area-inset-bottom, 0px ) + var( --avarida-fab-offset, 0px ) );
		right: 14px;
	}

	/* Pill -> circle. The button keeps its aria-label, so hiding the visible
	   text costs nothing for assistive tech. */
	body .avge-agent__toggle {
		width: 3.25rem;
		height: 3.25rem;
		padding: 0;
		gap: 0;
		justify-content: center;
	}

	body .avge-agent__toggle-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect( 0 0 0 0 );
		clip-path: inset( 50% );
		white-space: nowrap;
	}

	body .avge-agent__spark {
		font-size: 20px;
		line-height: 1;
	}

}

/* Only below 480px does the plugin switch the panel to position:fixed, so only
   there does it need the offset applied directly. Above that it is
   position:absolute inside .avge-agent and rides along with the toggle. */
@media ( max-width: 480px ) {
	body .avge-agent__panel {
		bottom: calc( 74px + env( safe-area-inset-bottom, 0px ) + var( --avarida-fab-offset, 0px ) );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	body .avge-agent { transition: none; }

	.avarida-wa,
	.avarida-wa .avarida-wa__btn,
	.avarida-wa .avarida-wa__text {
		transition-duration: 0.01ms !important;
	}

	.avarida-wa .avarida-wa__ring {
		animation: none !important;
		opacity: 0 !important;
	}

	.avarida-wa .avarida-wa__btn:active {
		transform: none;
	}
}
