/* AI Flow Chatbot Floating Widget Styles */

.afc-widget-wrapper {
	position: fixed;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	box-sizing: border-box;
}

/* Desktop Positioning */
.afc-pos-bottom_right {
	bottom: var(--afc-desktop-bottom, 20px);
	right: var(--afc-desktop-side, 20px);
}

.afc-pos-bottom_left {
	bottom: var(--afc-desktop-bottom, 20px);
	left: var(--afc-desktop-side, 20px);
}

/* Floating Animations */
.afc-anim-pulse .afc-launcher-btn {
	animation: afcPulse 2s infinite;
}

.afc-anim-bounce .afc-launcher-btn {
	animation: afcFloatingBounce 3s ease-in-out infinite;
}

.afc-anim-spin .afc-launcher-btn:hover,
.afc-anim-rotate .afc-launcher-btn {
	animation: afcRotate 4s linear infinite;
}

.afc-anim-glow .afc-launcher-btn {
	animation: afcGlowRing 2.5s infinite;
}

.afc-anim-shake .afc-launcher-btn {
	animation: afcShake 3s infinite;
}

@keyframes afcGlowRing {
	0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.6); }
	50% { box-shadow: 0 0 0 14px rgba(79, 70, 229, 0); }
}

@keyframes afcShake {
	0%, 100% { transform: rotate(0deg); }
	20%, 60% { transform: rotate(-12deg); }
	40%, 80% { transform: rotate(12deg); }
}

@keyframes afcRotate {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Button Shapes */
.afc-shape-round .afc-launcher-btn,
.afc-shape-circle .afc-launcher-btn,
.afc-shape-round .afc-quick-btn {
	border-radius: 50% !important;
}

.afc-shape-square .afc-launcher-btn,
.afc-shape-square .afc-quick-btn {
	border-radius: 4px !important;
}

.afc-shape-rounded_square .afc-launcher-btn,
.afc-shape-rounded_square .afc-quick-btn {
	border-radius: 16px !important;
}

.afc-shape-none .afc-launcher-btn {
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	border: none !important;
}

/* Shadows */
.afc-shadow-none .afc-launcher-btn {
	box-shadow: none !important;
}

.afc-shadow-soft .afc-launcher-btn {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
}

.afc-shadow-medium .afc-launcher-btn {
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18) !important;
}

.afc-shadow-strong .afc-launcher-btn {
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28) !important;
}

/* Sizes */
.afc-size-small .afc-launcher-btn {
	width: 48px;
	height: 48px;
	font-size: 24px;
}

.afc-size-medium .afc-launcher-btn {
	width: 58px;
	height: 58px;
	font-size: 30px;
}

.afc-size-large .afc-launcher-btn {
	width: 68px;
	height: 68px;
	font-size: 36px;
}

.afc-size-custom .afc-launcher-btn {
	width: var(--afc-launcher-custom-size, 60px) !important;
	height: var(--afc-launcher-custom-size, 60px) !important;
	font-size: calc(var(--afc-launcher-custom-size, 60px) * 0.5) !important;
}

/* Primary Launcher Button */
.afc-launcher-btn {
	background: var(--afc-launcher-bg, var(--afc-primary-color, #4F46E5));
	color: var(--afc-icon-color, #FFFFFF);
	border: none;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease;
	outline: none;
}

.afc-icon-chat {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: inherit;
	line-height: 1;
}

.afc-icon-chat svg {
	width: 1.2em;
	height: 1.2em;
	min-width: 24px;
	min-height: 24px;
	max-width: 40px;
	max-height: 40px;
	fill: currentColor;
	display: block;
}

.afc-custom-launcher-icon,
.afc-icon-chat img {
	width: 65%;
	height: 65%;
	min-width: 24px;
	min-height: 24px;
	max-width: 44px;
	max-height: 44px;
	object-fit: contain;
	display: block;
	margin: 0 auto;
}

.afc-launcher-btn:hover {
	transform: scale(1.08);
}

.afc-launcher-btn.afc-main-type-wa {
	background: var(--afc-wa-bg, #25D366) !important;
	color: var(--afc-wa-text, #FFFFFF) !important;
	box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4) !important;
}

.afc-launcher-btn.afc-main-type-phone {
	background: var(--afc-phone-bg, #0284C7) !important;
	color: var(--afc-phone-text, #FFFFFF) !important;
	box-shadow: 0 8px 24px rgba(2, 132, 199, 0.4) !important;
}

/* Quick Actions Sub-Buttons Menu */
.afc-quick-actions-menu {
	position: absolute;
	bottom: 74px;
	right: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: flex-end;
	z-index: 999999;
	animation: afcSlideUp 0.2s ease-out;
}

.afc-pos-bottom_left .afc-quick-actions-menu {
	right: auto;
	left: 0;
	align-items: flex-start;
}

.afc-quick-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	border-radius: 24px;
	background: #FFFFFF;
	color: #1F2937;
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	box-shadow: 0 6px 20px rgba(0,0,0,0.15);
	border: 1px solid #E5E7EB;
	cursor: pointer;
	white-space: nowrap;
	transition: all 0.2s ease;
}

.afc-quick-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.afc-btn-wa {
	background: var(--afc-wa-bg, #25D366) !important;
	color: var(--afc-wa-text, #FFFFFF) !important;
	border: none !important;
}

.afc-btn-phone {
	background: var(--afc-phone-bg, #0284C7) !important;
	color: var(--afc-phone-text, #FFFFFF) !important;
	border: none !important;
}

.afc-btn-ai {
	background: var(--afc-ai-bg, #4F46E5) !important;
	color: var(--afc-ai-text, #FFFFFF) !important;
	border: none !important;
}

/* Handover Header Buttons */
.afc-handover-btn {
	font-size: 11px;
	font-weight: 600;
	padding: 3px 8px;
	border-radius: 12px;
	text-decoration: none;
	color: #FFFFFF;
	background: rgba(255,255,255,0.2);
	transition: background 0.2s ease;
	margin-right: 4px;
}

.afc-handover-btn:hover {
	background: rgba(255,255,255,0.35);
}

.afc-handover-wa {
	background: #25D366 !important;
}

.afc-handover-call {
	background: #0284C7 !important;
}

/* Welcome Popup */
.afc-welcome-popup {
	position: absolute;
	bottom: 74px;
	right: 0;
	width: 280px;
	max-width: calc(100vw - 40px);
	background: #FFFFFF;
	border-radius: 14px;
	padding: 14px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.15);
	border: 1px solid #E5E7EB;
	z-index: 999999;
	margin: 0;
	box-sizing: border-box;
	animation: afcPopIn 0.25s ease-out;
}

.afc-pos-bottom_left .afc-welcome-popup {
	right: auto;
	left: 0;
}

.afc-popup-close {
	position: absolute;
	top: 8px;
	right: 10px;
	border: none;
	background: none;
	font-size: 16px;
	cursor: pointer;
	color: #9CA3AF;
}

.afc-popup-title {
	font-weight: 700;
	font-size: 14px;
	color: #111827;
	margin-bottom: 4px;
}

.afc-popup-body {
	font-size: 13px;
	color: #4B5563;
	line-height: 1.4;
}

.afc-unread-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	background: #EF4444;
	color: #FFFFFF;
	font-size: 11px;
	font-weight: 700;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #FFFFFF;
}

/* Floating Chat Window */
.afc-chat-window {
	position: fixed;
	bottom: calc(var(--afc-desktop-bottom, 20px) + 70px);
	right: var(--afc-desktop-side, 20px);
	width: 380px;
	height: 580px;
	max-width: calc(100vw - 30px);
	max-height: calc(100vh - 120px);
	background: var(--afc-chat-bg, #FFFFFF);
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0,0,0,0.18);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 999999;
	border: 1px solid #E5E7EB;
	box-sizing: border-box;
	animation: afcPopIn 0.25s ease-out;
}

.afc-pos-bottom_left .afc-chat-window {
	right: auto;
	left: var(--afc-desktop-side, 20px);
}

/* Maximize Mode */
.afc-chat-window.afc-maximized {
	width: calc(100vw - 20px) !important;
	height: calc(100vh - 20px) !important;
	max-height: calc(100vh - 20px) !important;
	top: 10px !important;
	left: 10px !important;
	right: auto !important;
	bottom: auto !important;
}

/* Header */
.afc-chat-header {
	background: var(--afc-header-bg, var(--afc-primary-color, #4F46E5));
	color: var(--afc-header-text-color, #FFFFFF);
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.afc-bot-profile {
	display: flex;
	align-items: center;
	gap: 10px;
}

.afc-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255,255,255,0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
}

.afc-bot-info {
	display: flex;
	flex-direction: column;
}

.afc-bot-name {
	font-weight: 700;
	font-size: 15px;
	color: var(--afc-header-text-color, #FFFFFF);
}

.afc-bot-status {
	font-size: 11px;
	opacity: 0.9;
	display: flex;
	align-items: center;
	gap: 4px;
	color: var(--afc-header-text-color, #FFFFFF);
}

.afc-status-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #10B981;
}

.afc-header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
}

.afc-header-btn {
	background: none;
	border: none;
	color: var(--afc-header-text-color, #FFFFFF);
	font-size: 14px;
	cursor: pointer;
	padding: 4px 6px;
	border-radius: 4px;
	opacity: 0.85;
}

.afc-header-btn:hover {
	opacity: 1;
	background: rgba(255,255,255,0.2);
}

/* Messages List */
.afc-messages-list {
	flex: 1;
	padding: 16px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: var(--afc-chat-bg, #F9FAFB);
}

.afc-msg {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.45;
	word-wrap: break-word;
}

.afc-msg-bot {
	background: var(--afc-bot-bubble-bg, #FFFFFF);
	color: var(--afc-bot-bubble-text, #1F2937);
	align-self: flex-start;
	border-bottom-left-radius: 2px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.05);
	border: 1px solid #E5E7EB;
}

.afc-msg-visitor {
	background: var(--afc-user-bubble-bg, var(--afc-primary-color, #4F46E5));
	color: var(--afc-user-bubble-text, #FFFFFF);
	align-self: flex-end;
	border-bottom-right-radius: 2px;
}

.afc-options-group {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 8px;
}

.afc-option-btn {
	padding: 6px 12px;
	background: var(--afc-button-bg, #EEF2FF);
	color: var(--afc-button-text-color, var(--afc-primary-color, #4F46E5));
	border: 1px solid var(--afc-button-text-color, #C7D2FE);
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.afc-option-btn:hover {
	background: var(--afc-button-text-color, var(--afc-primary-color, #4F46E5));
	color: var(--afc-button-bg, #FFFFFF);
}

/* Typing Indicator */
.afc-typing-indicator {
	display: flex;
	gap: 4px;
	padding: 8px 16px;
	align-self: flex-start;
}

.afc-typing-indicator span {
	width: 6px;
	height: 6px;
	background: #9CA3AF;
	border-radius: 50%;
	animation: afcBounce 1.4s infinite ease-in-out both;
}

.afc-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.afc-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

/* Chat Footer Form */
.afc-chat-footer {
	padding: 12px;
	background: var(--afc-input-bg, #FFFFFF);
	border-top: 1px solid #E5E7EB;
	display: flex;
	gap: 8px;
}

.afc-chat-footer input {
	flex: 1;
	background: var(--afc-input-bg, #FFFFFF);
	color: var(--afc-input-text-color, #1F2937);
	border: 1px solid #D1D5DB;
	border-radius: 20px;
	padding: 8px 16px;
	font-size: 14px;
	outline: none;
}

.afc-chat-footer input:focus {
	border-color: var(--afc-button-text-color, var(--afc-primary-color, #4F46E5));
}

.afc-send-btn,
.afc-chat-footer button {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--afc-launcher-bg, var(--afc-primary-color, #4F46E5));
	color: var(--afc-icon-color, #FFFFFF);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.afc-send-btn svg,
.afc-chat-footer button svg {
	width: 18px;
	height: 18px;
	display: block;
	color: #ffffff;
	flex-shrink: 0;
}

/* Dark Mode Styles */
.afc-mode-dark .afc-chat-window {
	background: #1F2937;
	border-color: #374151;
	color: #F9FAFB;
}

.afc-mode-dark .afc-messages-list {
	background: #111827;
}

.afc-mode-dark .afc-msg-bot {
	background: #374151;
	color: #F9FAFB;
	border-color: #4B5563;
}

.afc-mode-dark .afc-chat-footer {
	background: #1F2937;
	border-color: #374151;
}

.afc-mode-dark .afc-chat-footer input {
	background: #374151;
	border-color: #4B5563;
	color: #FFFFFF;
}

/* Keyframe Animations */
@keyframes afcPopIn {
	from { opacity: 0; transform: scale(0.9); }
	to { opacity: 1; transform: scale(1); }
}

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

@keyframes afcPulse {
	0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.5); }
	70% { box-shadow: 0 0 0 15px rgba(79, 70, 229, 0); }
	100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

@keyframes afcFloatingBounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-8px); }
}

@keyframes afcBounce {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1.0); }
}

/* Mobile Responsive */
@media (max-width: 480px) {
	.afc-mob-pos-bottom_right {
		bottom: var(--afc-mobile-bottom, 15px);
		right: var(--afc-mobile-side, 15px);
		left: auto;
	}

	.afc-mob-pos-bottom_left {
		bottom: var(--afc-mobile-bottom, 15px);
		left: var(--afc-mobile-side, 15px);
		right: auto;
	}

	.afc-chat-window {
		width: calc(100vw - 20px);
		height: calc(100vh - 90px);
		bottom: calc(var(--afc-mobile-bottom, 15px) + 65px);
	}
}
