/**
 * Floating WhatsApp chat widget styles.
 *
 * Purpose: Styling for the interactive floating WhatsApp button and chat pop-up.
 * Behavior: Fixed position at bottom right; responsive panel; animations for typing and messages.
 * Dependencies: Base CSS variables (--acfarm_color_*, --acfarm_font_*).
 * Consumers: Registered and enqueued by inc/enqueue.php.
 * Side effects: None (strictly scoped to .acfarm_wa_widget).
 *
 * @package ArkaCahayaFarm
 * @since 0.1.0 Initial introduction; see CHANGELOG.md.
 */

.acfarm_wa_widget {
	--wa-green: #25d366;
	--wa-dark: #075e54;
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 1000;
	transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.acfarm_wa_widget.is-footer-visible {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(12px);
}

.acfarm_wa_widget .acfarm_wa_toggle {
	width: 58px;
	height: 58px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--wa-green);
	box-shadow: 0 8px 24px rgba(20, 42, 31, .22);
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.acfarm_wa_widget .acfarm_wa_toggle:hover,
.acfarm_wa_widget .acfarm_wa_toggle:focus-visible {
	transform: translateY(-3px) scale(1.04);
	box-shadow: 0 12px 28px rgba(20, 42, 31, .28);
	outline: none;
}

.acfarm_wa_widget .acfarm_wa_toggle img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	border-radius: 50%;
}

.acfarm_wa_widget .acfarm_wa_floating_bar {
	display: flex;
	align-items: center;
	gap: 10px;
}

.acfarm_wa_widget .acfarm_wa_social_list {
	display: flex;
	align-items: center;
	gap: 8px;
}

.acfarm_wa_widget .acfarm_wa_social_btn {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #ffffff;
	border: 1px solid var(--acfarm_color_line, #E5DDD3);
	color: var(--acfarm_color_coffee, #3F2416);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 18px rgba(20, 42, 31, .15);
	text-decoration: none;
	font-size: 1.15rem;
	transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease;
	flex-shrink: 0;
}

.acfarm_wa_widget .acfarm_wa_social_btn:hover,
.acfarm_wa_widget .acfarm_wa_social_btn:focus-visible {
	transform: translateY(-3px) scale(1.08);
	box-shadow: 0 10px 24px rgba(20, 42, 31, .25);
	background: var(--acfarm_color_coffee, #3F2416);
	color: #ffffff;
	outline: none;
}

.acfarm_wa_widget .acfarm_wa_social_btn .acfarm_icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.acfarm_wa_widget .acfarm_wa_social_btn i {
	font-size: 1.15rem;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.acfarm_wa_widget .acfarm_wa_social_btn .acfarm_icon svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.acfarm_wa_widget .acfarm_wa_chat {
	position: absolute;
	right: 0;
	bottom: 76px;
	width: 340px;
	overflow: hidden;
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 18px 50px rgba(31, 41, 38, .22);
	transform: translateY(30px) scale(.96);
	transform-origin: bottom right;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity .2s ease, transform .45s cubic-bezier(.2, .8, .2, 1), visibility .2s;
	font-family: var(--acfarm_font_sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

.acfarm_wa_widget.is-open .acfarm_wa_chat {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateY(0) scale(1);
}

.acfarm_wa_widget .acfarm_wa_chat_header {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 14px 16px;
	color: #fff;
	background: var(--wa-dark);
}

.acfarm_wa_widget .acfarm_wa_chat_avatar {
	width: 38px;
	height: 38px;
	flex: 0 0 38px;
	border-radius: 50%;
	background: #fff;
	overflow: hidden;
}

.acfarm_wa_widget .acfarm_wa_chat_avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.acfarm_wa_widget .acfarm_wa_chat_heading {
	min-width: 0;
	flex: 1;
	line-height: 1.2;
}

.acfarm_wa_widget .acfarm_wa_chat_heading strong,
.acfarm_wa_widget .acfarm_wa_chat_heading span {
	display: block;
}

.acfarm_wa_widget .acfarm_wa_chat_heading strong {
	font-size: .92rem;
	font-weight: 600;
	color: #fff;
}

.acfarm_wa_widget .acfarm_wa_chat_heading span {
	margin-top: 3px;
	font-size: .72rem;
	opacity: .76;
	color: #fff;
}

.acfarm_wa_widget .acfarm_wa_chat_close {
	padding: 0 0 3px;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 1.65rem;
	line-height: 1;
	cursor: pointer;
}

.acfarm_wa_widget .acfarm_wa_chat_body {
	min-height: 180px;
	padding: 18px 14px;
	background-color: #ece5dd;
	background-image: radial-gradient(rgba(117, 109, 102, .10) 1px, transparent 1px);
	background-size: 18px 18px;
}

.acfarm_wa_widget .acfarm_wa_chat_message,
.acfarm_wa_widget .acfarm_wa_chat_typing {
	width: fit-content;
	max-width: 88%;
	padding: 10px 13px;
	border-radius: 4px 15px 15px 15px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .10);
	color: var(--acfarm_color_ink, #2C2521);
	font-size: .88rem;
	line-height: 1.45;
}

.acfarm_wa_widget .acfarm_wa_chat_message.is-visible {
	animation: acfarm_wa_message_in .28s ease both;
}

.acfarm_wa_widget .acfarm_wa_chat_typing {
	display: flex;
	gap: 4px;
	padding: 14px 15px;
}

.acfarm_wa_widget .acfarm_wa_chat_typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #8b8985;
	animation: acfarm_wa_typing 1s infinite ease-in-out;
}

.acfarm_wa_widget .acfarm_wa_chat_typing span:nth-child(2) {
	animation-delay: .15s;
}

.acfarm_wa_widget .acfarm_wa_chat_typing span:nth-child(3) {
	animation-delay: .3s;
}

.acfarm_wa_widget .acfarm_wa_chat_form {
	display: flex;
	gap: 8px;
	padding: 10px;
	background: #f7f7f7;
	border-top: 1px solid #e4e4e4;
}

.acfarm_wa_widget .acfarm_wa_chat_input {
	min-width: 0;
	flex: 1;
	padding: 10px 13px;
	border: 1px solid #ddd;
	border-radius: 999px;
	outline: 0;
	background: #fff;
	color: var(--acfarm_color_ink, #2C2521);
	font-size: .88rem;
	font-family: inherit;
}

.acfarm_wa_widget .acfarm_wa_chat_input:focus {
	border-color: var(--wa-green);
	box-shadow: 0 0 0 3px rgba(37, 211, 102, .16);
}

.acfarm_wa_widget .acfarm_wa_chat_send {
	width: 40px;
	height: 40px;
	padding: 0 0 3px 2px;
	border: 0;
	border-radius: 50%;
	background: var(--wa-green);
	color: #fff;
	font-size: 1.25rem;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color .15s ease;
}

.acfarm_wa_widget .acfarm_wa_chat_send:hover {
	background: #1fbd59;
}

@keyframes acfarm_wa_typing {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: .55;
	}
	30% {
		transform: translateY(-4px);
		opacity: 1;
	}
}

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

@media (max-width: 480px) {
	.acfarm_wa_widget {
		right: 12px;
		bottom: 12px;
	}
	.acfarm_wa_widget .acfarm_wa_chat {
		right: 0;
		bottom: 64px;
		width: calc(100vw - 24px);
	}
	.acfarm_wa_widget .acfarm_wa_floating_bar {
		gap: 6px;
	}
	.acfarm_wa_widget .acfarm_wa_social_list {
		gap: 6px;
	}
	.acfarm_wa_widget .acfarm_wa_social_btn {
		width: 38px;
		height: 38px;
		font-size: 1rem;
	}
	.acfarm_wa_widget .acfarm_wa_social_btn .acfarm_icon svg {
		width: 15px;
		height: 15px;
	}
	.acfarm_wa_widget .acfarm_wa_toggle {
		width: 48px;
		height: 48px;
	}
}
