/**
 * Tab Chats — Public Styles
 *
 * Provides the floating button, tooltip, pulse ring, and entrance animation.
 * Dynamic values (size, position, margin) are injected via inline CSS
 * generated by TC_Frontend::build_inline_css().
 *
 * @package Tab_Chats
 * @since   1.0.0
 */

/* ── Button wrapper ──────────────────────────────────────────────────────── */
#tc-whatsapp-btn {
	position: fixed;
	z-index: 99999;
	line-height: 0;
	/* Size, bottom, left/right are set via inline CSS */
	animation: tc-slide-in .45s cubic-bezier( .175, .885, .32, 1.275 ) both;
}

/* ── Link ────────────────────────────────────────────────────────────────── */
#tc-whatsapp-btn .tc-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	text-decoration: none;
	position: relative;
	border-radius: 50%;
}

/* ── Icon circle ─────────────────────────────────────────────────────────── */
#tc-whatsapp-btn .tc-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: transparent;
	/* width & height explicitly set via inline CSS to match button size */
	transition: transform .25s cubic-bezier( .175, .885, .32, 1.275 ),
	            box-shadow .25s ease;
	box-shadow: 0 4px 16px rgba( 37, 211, 102, .45 ),
	            0 2px 6px rgba( 0, 0, 0, .18 );
	position: relative;
}

/* SVG fills the icon circle exactly — size driven by inline CSS on svg itself */
#tc-whatsapp-btn .tc-icon svg {
	display: block;
	border-radius: 50%;
	/* width & height set directly on the <svg> element via PHP */
}

#tc-whatsapp-btn:hover .tc-icon,
#tc-whatsapp-btn:focus-within .tc-icon {
	transform: scale( 1.1 );
	box-shadow: 0 8px 28px rgba( 37, 211, 102, .6 ),
	            0 4px 10px rgba( 0, 0, 0, .2 );
}

/* ── Pulse ring ──────────────────────────────────────────────────────────── */
#tc-whatsapp-btn .tc-icon::before {
	content: "";
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	border: 3px solid rgba( 37, 211, 102, .5 );
	animation: tc-pulse 2.4s ease-out infinite;
	pointer-events: none;
}

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
#tc-whatsapp-btn .tc-tooltip {
	position: absolute;
	background: #1d2327;
	color: #fff;
	font-size: 13px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-weight: 500;
	line-height: 1.3;
	white-space: nowrap;
	padding: 7px 12px;
	border-radius: 6px;
	pointer-events: none;
	opacity: 0;
	/* Position injected via inline CSS */
	transition: opacity .2s ease, transform .2s ease;
	transform: translateY( 50% ) translateX( 6px );
	box-shadow: 0 2px 8px rgba( 0, 0, 0, .25 );
}

/* Arrow on the tooltip */
#tc-whatsapp-btn .tc-tooltip::after {
	content: "";
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	border: 6px solid transparent;
}

/* Arrow: right-positioned button → arrow points right */
#tc-whatsapp-btn.tc-pos-right .tc-tooltip::after {
	right: -11px;
	border-left-color: #1d2327;
}

/* Arrow: left-positioned button → arrow points left */
#tc-whatsapp-btn.tc-pos-left .tc-tooltip::after {
	left: -11px;
	border-right-color: #1d2327;
}

/* Show tooltip on hover */
#tc-whatsapp-btn:hover .tc-tooltip,
#tc-whatsapp-btn:focus-within .tc-tooltip {
	opacity: 1;
	transform: translateY( 50% ) translateX( 0 );
}

/* ── Keyframes ───────────────────────────────────────────────────────────── */

@keyframes tc-slide-in {
	from {
		opacity: 0;
		transform: translateY( 30px ) scale( .8 );
	}
	to {
		opacity: 1;
		transform: translateY( 0 ) scale( 1 );
	}
}

@keyframes tc-pulse {
	0%   { opacity: .8; transform: scale( 1 ); }
	70%  { opacity: 0;  transform: scale( 1.55 ); }
	100% { opacity: 0;  transform: scale( 1.55 ); }
}

/* ── Reduced-motion ──────────────────────────────────────────────────────── */
@media ( prefers-reduced-motion: reduce ) {
	#tc-whatsapp-btn {
		animation: none;
	}
	#tc-whatsapp-btn .tc-icon::before {
		animation: none;
	}
	#tc-whatsapp-btn:hover .tc-icon,
	#tc-whatsapp-btn:focus-within .tc-icon {
		transform: none;
	}
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media ( max-width: 480px ) {
	#tc-whatsapp-btn .tc-tooltip {
		font-size: 11px;
		padding: 5px 9px;
	}
}
