@font-face {
	font-family: "Vazirmatn";
	src: url("../font/Vazirmatn-Regular.woff2") format("woff2");
	font-weight: normal;
	font-style: normal;
	font-display: swap;
}

:root {
	--fb-primary: linear-gradient(135deg, #0084ff 0%, #00c6ff 100%);
	--fb-admin-bg: #0084ff;
	--fb-user-bg: #f0f2f5;
	--fb-text-primary: #1c1e21;
	--fb-font: "Vazirmatn", Tahoma, Arial, sans-serif;
}

.fb-support-wrapper,
.fb-message-wrapper {
	font-family: var(--fb-font);
}

.fb-support-wrapper {
	max-width: 800px;
	margin: 20px auto;
	padding: 16px;
	color: var(--fb-text-primary);
	/* overflow: hidden; */
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.fb-support-header {
	padding: 12px;
	color: var(--fb-text-primary);
	border-radius: 24px;
	text-align: center;
}

.fb-support-header h3 {
	margin: 0;
	font-size: 1.2rem;
	margin-bottom: 16px !important;
	color: inherit !important;
}

.fb-support-header p {
	margin: 5px 0 0;
	opacity: 0.6;
	font-size: 0.9rem;
}

.fb-message-wrapper {
	background: #fff;
	border-radius: 32px;
	padding: 20px;
	padding-top: 0;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
	position: relative;
}
.fb-message-wrapper::before {
	content: "";
	border-radius: inherit;
	position: absolute;
	inset: 0;
	box-shadow:
		inset 0 2px 2px rgba(0, 0, 0, 0.15),
		inset 0 -2px 2px rgba(0, 0, 0, 0.15);
	z-index: 2;
	pointer-events: none;
}

.fb-message-history {
	height: 350px;
	overflow-y: auto;
	padding-block: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #ffffff;
	border-radius: 12px 12px 0 0;
	margin-bottom: 16px;
	scroll-behavior: smooth;
}

.fb-message-history::-webkit-scrollbar {
	width: 6px;
}

.fb-message-history::-webkit-scrollbar-thumb {
	background: #ddd;
	border-radius: 10px;
}

.fb-msg-item {
	display: flex;
	width: 100%;
	animation: fbFadeIn 0.3s ease-out;
}

@keyframes fbFadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.fb-msg-user {
	justify-content: flex-start;
}

.fb-msg-admin {
	justify-content: flex-end;
}

.fb-msg-bubble {
	max-width: 75%;
	padding: 12px 18px;
	border-radius: 18px;
	position: relative;
	font-size: 0.9rem;
	line-height: 1.6;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.fb-msg-user .fb-msg-bubble {
	background: var(--fb-user-bg);
	color: var(--fb-text-primary);
	border-bottom-right-radius: 4px;
}

.fb-msg-admin .fb-msg-bubble {
	background: var(--fb-admin-bg);
	color: #fff;
	border-bottom-left-radius: 4px;
}

.fb-msg-time {
	display: block;
	font-size: 0.625rem;
	opacity: 0.6;
	margin-top: 8px;
	text-align: left;
}

.fb-message-input-area {
	display: flex;
	align-items: end;
	gap: 8px;
	background: #fff;
	border-radius: 32px;
}

.fb-message-text {
	flex-grow: 1;
	font-family: var(--fb-font);
	font-size: 1rem;
	line-height: 1.5;
	border-radius: 25px;
	border: 2px solid hsl(0, 0%, 88%);
	padding: 12px 20px;
	resize: none;
	background: #f0f2f5;
	transition: all 0.3s;
	outline: none;
	field-sizing: content;
	overflow: hidden;
}

.fb-message-text::placeholder {
	font-size: inherit;
	line-height: inherit;
}

.fb-message-text:focus {
	border-color: var(--fb-primary);
}

.fb-send-btn {
	background: var(--fb-primary);
	color: #fff;
	border: none;
	padding: 0 8px;
	width: 120px;
	height: 48px;
	border-radius: 25px;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex-shrink: 0;
	font-weight: bold;
	box-shadow: 0 4px 20px -12px #0056ab;
	transition: box-shadow 0.4s ease;
}

.fb-send-btn:hover {
	box-shadow: 0 4px 20px -8px #0056ab;
}

.fb-send-btn:disabled {
	background: #ccc;
	cursor: not-allowed;
	box-shadow: 0 4px 20px -8px #848484;
	transition: none;
}

.fb-spinner {
	width: 20px;
	height: 20px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #fff;
	animation: fb-spin 1s ease-in-out infinite;
}

@keyframes fb-spin {
	to {
		transform: rotate(360deg);
	}
}

.fb-support-notice {
	padding: 16px 20px;
	font-size: 0.8rem;
	opacity: 0.6;
	text-align: center;
}

/* استایل‌های مربوط به ارسال آنی (Optimistic UI) */
.fb-msg-sending .fb-msg-bubble {
	opacity: 0.5;
	transition: opacity 0.3s ease;
}

.fb-msg-failed {
	animation: fbFadeOut 0.4s forwards ease-in !important;
}

@keyframes fbFadeOut {
	from {
		opacity: 1;
		transform: scale(1);
		max-height: 200px;
	}

	to {
		opacity: 0;
		transform: scale(0.8);
		max-height: 0;
		margin: 0;
		padding: 0;
		overflow: hidden;
	}
}

/* استایل نشان پیام‌های خوانده‌نشده در منوی ووکامرس */
.fb-unread-badge {
	background-color: #ff3b30;
	color: #ffffff;
	font-size: 11px;
	font-weight: bold;
	padding: 2px 8px;
	border-radius: 12px;
	margin-right: 8px;
	display: inline-block;
	vertical-align: middle;
	line-height: 1.4;
	box-shadow: 0 2px 6px rgba(255, 59, 48, 0.3);
}

.fb-badge-fade-in {
	animation: fbBadgeFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
	transform-origin: center right;
}

@keyframes fbBadgeFadeIn {
	from {
		opacity: 0;
		transform: scale(0.6) translateY(2px);
	}

	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

/* خط افقی جداکننده پیام‌های جدید با گرادیان زیبا */
.fb_unread_divider {
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 20px 0;
	position: relative;
	width: 100%;
	animation: fbFadeIn 0.5s ease-out;
	box-shadow: none;
	border-color: #ddd;
}

.fb_unread_divider::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	height: 1px;
	background: linear-gradient(90deg, transparent, #c3c3c3 50%, transparent);
	z-index: 1;
}

/* متن نشان‌دهنده پیام جدید با استایل متناسب */
.fb_unread_divider_text {
	background: #eee;
	color: #656565;
	font-size: 0.6rem;
	font-weight: bold;
	padding: 4px 8px;
	border-radius: 20px;
	position: relative;
	z-index: 2;
	border: 1px solid #ddd;
}

@media (width < 768px) {
	.fb-message-wrapper {
		padding: 0 8px 8px 8px;
	}
	#fb-send-btn {
		width: 60px;
	}

	.fb-btn-text {
		display: none;
	}
}
