.ctcfb-widget {
	position: fixed;
	bottom: var(--ctcfb-offset-v, 20px);
	z-index: 999999;
	direction: rtl;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, "IRANSans", "Vazir", sans-serif;
}
.ctcfb-widget.ctcfb-pos-right { right: var(--ctcfb-offset-h, 20px); }
.ctcfb-widget.ctcfb-pos-left  { left: var(--ctcfb-offset-h, 20px); }

/* --- حباب شناور --- */
.ctcfb-bubble {
	width: var(--ctcfb-bubble-size, 62px);
	height: var(--ctcfb-bubble-size, 62px);
	border-radius: 50%;
	background: var(--ctcfb-bubble-bg, #25D366);
	color: var(--ctcfb-bubble-icon, #fff);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 20px rgba(0,0,0,.22);
	position: relative;
	padding: 0 14px;
	transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.ctcfb-bubble:hover {
	background: var(--ctcfb-bubble-bg-hover, var(--ctcfb-bubble-bg, #25D366));
	transform: scale(1.06);
	box-shadow: 0 10px 26px rgba(0,0,0,.28);
}
.ctcfb-bubble-icon {
	width: 46%;
	height: 46%;
	color: var(--ctcfb-bubble-icon, #fff);
}
.ctcfb-bubble-text {
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	color: var(--ctcfb-bubble-icon, #fff);
}
.ctcfb-bubble-ping {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--ctcfb-bubble-bg, #25D366);
	opacity: .55;
	z-index: -1;
}

/* --- انیمیشن‌های حباب --- */
.ctcfb-anim-pulse .ctcfb-bubble-ping {
	animation: ctcfb-pulse 1.8s ease-out infinite;
}
@keyframes ctcfb-pulse {
	0%   { transform: scale(1);   opacity: .55; }
	70%  { transform: scale(1.7); opacity: 0; }
	100% { transform: scale(1.7); opacity: 0; }
}
.ctcfb-anim-bounce { animation: ctcfb-bounce 1.6s ease-in-out infinite; }
@keyframes ctcfb-bounce {
	0%, 100% { transform: translateY(0); }
	50%      { transform: translateY(-10px); }
}
.ctcfb-anim-shake { animation: ctcfb-shake 3.2s ease-in-out infinite; }
@keyframes ctcfb-shake {
	0%, 88%, 100% { transform: rotate(0deg); }
	90%  { transform: rotate(-12deg); }
	92%  { transform: rotate(10deg); }
	94%  { transform: rotate(-8deg); }
	96%  { transform: rotate(6deg); }
	98%  { transform: rotate(0deg); }
}
.ctcfb-anim-none .ctcfb-bubble-ping { display: none; }

/* --- پنجره پاپ‌آپ --- */
.ctcfb-popup {
	position: absolute;
	bottom: calc(var(--ctcfb-bubble-size, 62px) + 16px);
	width: 300px;
	max-width: calc(100vw - 40px);
	background: var(--ctcfb-popup-bg, #fff);
	color: var(--ctcfb-popup-text, #333);
	border-radius: 16px;
	box-shadow: 0 14px 40px rgba(0,0,0,.22);
	padding: 18px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px) scale(.96);
	transition: all .25s ease;
	transform-origin: bottom;
}
.ctcfb-widget.ctcfb-pos-right .ctcfb-popup { right: 0; }
.ctcfb-widget.ctcfb-pos-left  .ctcfb-popup { left: 0; }

.ctcfb-widget.ctcfb-open .ctcfb-popup {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.ctcfb-popup-close {
	position: absolute;
	top: 10px;
	left: 10px;
	background: rgba(0,0,0,.06);
	border: none;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	color: inherit;
}

.ctcfb-popup-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 12px;
}
.ctcfb-avatar {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	border: 2px solid rgba(0,0,0,.05);
}
.ctcfb-name {
	font-size: var(--ctcfb-font-name, 16px);
	font-weight: 700;
}
.ctcfb-caption {
	font-size: var(--ctcfb-font-caption, 13px);
	opacity: .65;
	margin-top: 2px;
}
.ctcfb-description {
	font-size: var(--ctcfb-font-desc, 13px);
	line-height: 1.9;
	margin-bottom: 14px;
	opacity: .9;
}
.ctcfb-phone-link {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: rgba(37, 211, 102, .12);
	background: var(--ctcfb-phone-color-bg, rgba(37, 211, 102, .12));
	color: var(--ctcfb-phone-color, #25D366);
	border: 1px solid var(--ctcfb-phone-color, #25D366);
	border-radius: 10px;
	padding: 10px 14px;
	text-decoration: none;
	font-weight: 700;
	font-size: var(--ctcfb-font-phone, 15px);
	transition: filter .2s ease, opacity .2s ease;
}
.ctcfb-phone-link:hover { opacity: .85; }
.ctcfb-phone-number { direction: ltr; }

/* --- منوی کشویی چند-کاناله (حالت stack) --- */
.ctcfb-stack {
	position: absolute;
	bottom: calc(var(--ctcfb-bubble-size, 62px) + 14px);
	display: flex;
	flex-direction: column-reverse; /* اولین کانال، نزدیک‌ترین به دکمه شناور باشد */
	gap: 10px;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}
.ctcfb-widget.ctcfb-pos-right .ctcfb-stack { right: 0; align-items: flex-end; }
.ctcfb-widget.ctcfb-pos-left  .ctcfb-stack { left: 0; align-items: flex-start; }

.ctcfb-widget.ctcfb-open .ctcfb-stack {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.ctcfb-stack-item {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--ctcfb-stack-item-bg, #ffffff);
	color: var(--ctcfb-stack-item-text, #1f2937);
	text-decoration: none;
	border-radius: 999px;
	padding: 6px 10px 6px 16px;
	box-shadow: 0 8px 22px rgba(0,0,0,.18);
	white-space: nowrap;
	transform: translateY(10px) scale(.92);
	opacity: 0;
	transition: transform .25s ease, opacity .25s ease, box-shadow .2s ease;
}
.ctcfb-widget.ctcfb-pos-left .ctcfb-stack-item { padding: 6px 16px 6px 10px; }

.ctcfb-widget.ctcfb-open .ctcfb-stack-item {
	transform: translateY(0) scale(1);
	opacity: 1;
}
.ctcfb-stack-item:hover {
	box-shadow: 0 12px 28px rgba(0,0,0,.24);
	filter: brightness(0.98);
}

.ctcfb-stack-item-icon {
	width: var(--ctcfb-stack-icon-size, 40px);
	height: var(--ctcfb-stack-icon-size, 40px);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
}
.ctcfb-stack-item-icon img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.ctcfb-stack-item-emoji {
	font-size: calc(var(--ctcfb-stack-icon-size, 40px) * 0.5);
	line-height: 1;
}
.ctcfb-stack-item-label {
	font-size: var(--ctcfb-stack-font-label, 14px);
	font-weight: 600;
}

/* --- کنترل نمایش بر اساس دستگاه --- */
@media (min-width: 1025px) {
	.ctcfb-hide-desktop { display: none !important; }
}
@media (min-width: 768px) and (max-width: 1024px) {
	.ctcfb-hide-tablet { display: none !important; }
}
@media (max-width: 767px) {
	.ctcfb-hide-mobile { display: none !important; }
	.ctcfb-popup { width: 88vw; }
}
