:root {
	--fb-admin-bg: #962696;
	--fb-admin-text: #fff;
	--fb-user-bg: #f0f2f5;
	--fb-user-text: #1c1e21;
	--fb-button-bg: #962696;
	--fb-button-text: #fff;
	--fb-text-primary: #1c1e21;
	--fb-font: inherit;
}

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

.fb-support-wrapper {
	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-guest-login-box {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 16px;
	padding: 20px;
	border: 1px solid color-mix(in srgb, var(--fb-button-bg) 16%, #e5e7eb);
	border-radius: 22px;
	background: #fff;
	color: var(--fb-text-primary);
	box-shadow: 0 12px 34px rgba(0, 0, 0, 0.06);
	font-family: var(--fb-font);
	direction: rtl;
}

.fb-guest-login-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 16px;
	background: #f5edf5;
	background: color-mix(in srgb, var(--fb-button-bg) 10%, #fff);
	color: var(--fb-button-bg);
}

.fb-guest-login-content strong {
	display: block;
	margin-bottom: 5px;
	font-size: 1rem;
}

.fb-guest-login-content p {
	margin: 0;
	color: #6b7280;
	font-size: 0.84rem;
	line-height: 1.8;
}

.fb-guest-login-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 18px;
	border-radius: 999px;
	background: var(--fb-button-bg);
	color: var(--fb-button-text) !important;
	font-weight: 700;
	text-decoration: none !important;
	white-space: nowrap;
	box-shadow: 0 8px 22px -12px var(--fb-button-bg);
	transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.fb-guest-login-button:hover {
	color: var(--fb-button-text) !important;
	filter: brightness(0.92);
	box-shadow: 0 10px 24px -10px var(--fb-button-bg);
	transform: none !important;
}

.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-history-wrap {
	position: relative;
}

.fb-message-history-wrap::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 46px;
	background: linear-gradient(to bottom, #fff 5%, rgba(255, 255, 255, 0));
	z-index: 3;
	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;
	direction: ltr;
	scrollbar-width: thin;
	scrollbar-color: #d8d8d8 transparent;
}

.fb-message-history > * {
	direction: rtl;
}

.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-user-text);
	border-bottom-right-radius: 4px;
}

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

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

.fb-msg-text {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.fb-card-copy {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 12px;
	padding-top: 10px;
	border-top: 1px solid currentColor;
	border-top-color: color-mix(in srgb, currentColor 18%, transparent);
}

.fb-card-number {
	display: inline-block;
	font-family: inherit;
	font-size: 0.88rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	white-space: nowrap;
	color: inherit;
	background: transparent;
}

.fb-copy-card-btn {
	border: 0;
	border-radius: 999px;
	padding: 6px 10px;
	background: var(--fb-button-bg);
	color: var(--fb-button-text);
	font-family: var(--fb-font);
	font-size: 0.68rem;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: 0 5px 16px -11px var(--fb-button-bg);
}

.fb-copy-card-btn:hover {
	filter: brightness(0.92);
}

.fb-msg-image-link {
	display: block;
	margin: -6px -12px 9px;
	border-radius: 13px;
	overflow: hidden;
	background: rgba(255, 255, 255, 0.18);
}

.fb-msg-image {
	display: block;
	width: 100%;
	max-width: 360px;
	max-height: 320px;
	object-fit: cover;
}

.fb-composer.fb-is-hidden,
.fb-quick-replies.fb-is-hidden,
.fb-guest-profile.fb-is-hidden,
.fb-guest-profile-step.fb-is-hidden {
	display: none;
}

.fb-composer {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

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

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

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

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

.fb-send-btn {
	background: var(--fb-button-bg);
	color: var(--fb-button-text);
	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 7px 24px -12px var(--fb-button-bg);
	transition: box-shadow 0.25s ease, filter 0.25s ease, transform 0.25s ease;
}

.fb-send-btn:hover {
	filter: brightness(0.92);
	box-shadow: 0 9px 26px -9px var(--fb-button-bg);
}

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

.fb-image-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.fb-upload-btn {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 48px;
	color: var(--fb-button-bg);
	background: #f5edf5;
	background: color-mix(in srgb, var(--fb-button-bg) 10%, #fff);
	cursor: pointer;
	margin: 0 !important;
	margin-bottom: 0 !important;
	transition: background 0.2s ease, transform 0.2s ease;
}

.fb-upload-btn:hover {
	background: #eee1ee;
	background: color-mix(in srgb, var(--fb-button-bg) 18%, #fff);
}

.fb-upload-btn.fb-is-disabled {
	opacity: 0.45;
	pointer-events: none;
}

.fb-file-preview {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	border-radius: 14px;
	background: #f6f7f8;
	color: var(--fb-text-primary);
	direction: rtl;
}

.fb-file-preview[hidden],
.fb-upload-progress[hidden] {
	display: none;
}

.fb-file-preview img {
	width: 42px;
	height: 42px;
	border-radius: 10px;
	object-fit: cover;
}

.fb-file-preview span {
	min-width: 0;
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 0.8rem;
}

.fb-file-preview button {
	width: 28px;
	height: 28px;
	border: 0;
	border-radius: 50%;
	background: #e5e7eb;
	color: #4b5563;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
}

.fb-upload-progress {
	height: 5px;
	border-radius: 99px;
	background: #eceef1;
	overflow: hidden;
}

.fb-upload-progress span {
	display: block;
	height: 100%;
	width: 0;
	background: var(--fb-button-bg);
	border-radius: inherit;
	transition: width 0.15s linear;
}

.fb-guest-profile {
	padding: 18px;
	border: 1px solid color-mix(in srgb, var(--fb-button-bg) 15%, #e5e7eb);
	border-radius: 20px;
	background: linear-gradient(145deg, color-mix(in srgb, var(--fb-button-bg) 5%, #fff), #fff 68%);
	color: var(--fb-text-primary);
	direction: rtl;
}

.fb-guest-profile-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 16px;
}

.fb-guest-profile-head strong {
	display: block;
	margin-bottom: 4px;
	font-size: 0.94rem;
}

.fb-guest-profile-head p {
	margin: 0;
	color: #6b7280;
	font-size: 0.74rem;
	line-height: 1.7;
}

.fb-guest-steps {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
}

.fb-guest-steps span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: #e5e7eb;
	color: #6b7280;
	font-size: 0.7rem;
	font-weight: 700;
}

.fb-guest-steps span.is-active {
	background: var(--fb-button-bg);
	color: var(--fb-button-text);
}

.fb-guest-steps i {
	display: block;
	width: 18px;
	height: 2px;
	background: #d1d5db;
}

.fb-guest-profile-step {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: end;
	gap: 9px;
}

.fb-guest-profile-step label {
	grid-column: 1 / -1;
	font-size: 0.76rem;
	font-weight: 700;
}

.fb-guest-profile-step input {
	width: 100%;
	height: 44px;
	margin: 0;
	padding: 0 14px;
	border: 1px solid #d9dde3;
	border-radius: 13px;
	background: #fff;
	font-family: var(--fb-font);
	font-size: 0.88rem;
	outline: none;
	box-shadow: none;
}

.fb-guest-profile-step input:focus {
	border-color: var(--fb-button-bg);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--fb-button-bg) 10%, transparent);
}

.fb-guest-profile-step button {
	min-width: 112px;
	height: 44px;
	margin: 0;
	padding: 0 15px;
	border: 0;
	border-radius: 13px;
	background: var(--fb-button-bg);
	color: var(--fb-button-text);
	font-family: var(--fb-font);
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 7px 20px -13px var(--fb-button-bg);
}

.fb-guest-profile-step button:hover {
	filter: brightness(0.92);
}

.fb-guest-profile-step button:disabled {
	opacity: 0.55;
	cursor: wait;
}

.fb-guest-profile-actions {
	display: flex;
	gap: 8px;
}

.fb-guest-profile-actions .fb-guest-secondary-btn {
	min-width: auto;
	background: #eef0f3;
	color: #4b5563;
	box-shadow: none;
}

.fb-guest-profile-error {
	min-height: 20px;
	margin: 8px 0 0;
	color: #b42318;
	font-size: 0.72rem;
}

.fb-quick-replies {
	margin-top: 2px;
	padding: 12px;
	border-radius: 18px;
	background: #f8f9fa;
	direction: rtl;
}

.fb-quick-replies-title {
	margin-bottom: 9px;
	font-size: 0.78rem;
	font-weight: 700;
	color: #555b65;
}

.fb-quick-replies-options {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
}

.fb-quick-reply-btn {
	border: 1px solid #d8d8d8;
	border: 1px solid color-mix(in srgb, var(--fb-button-bg) 28%, #d8d8d8);
	border-radius: 999px;
	padding: 7px 12px;
	background: #fff;
	color: var(--fb-button-bg);
	font-family: var(--fb-font);
	font-size: 0.76rem;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.fb-quick-reply-btn:hover {
	background: #f7f0f7;
	background: color-mix(in srgb, var(--fb-button-bg) 9%, #fff);
}

.fb-message-wrapper button:hover,
.fb-message-wrapper .fb-upload-btn:hover {
	transform: none !important;
}

.fb-start-live-chat {
	background: var(--fb-button-bg);
	color: var(--fb-button-text);
	border-color: var(--fb-button-bg);
	box-shadow: 0 6px 18px -11px var(--fb-button-bg);
}

.fb-start-live-chat:hover {
	background: var(--fb-button-bg);
	color: var(--fb-button-text);
	filter: brightness(0.92);
}

.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-guest-login-box {
		grid-template-columns: auto minmax(0, 1fr);
		padding: 16px;
	}

	.fb-guest-login-button {
		grid-column: 1 / -1;
		width: 100%;
	}
	.fb-message-wrapper {
		padding: 0 8px 8px 8px;
	}
	#fb-send-btn {
		width: 60px;
	}

	.fb-upload-btn {
		width: 46px;
		height: 46px;
		flex-basis: 46px;
	}

	.fb-message-text {
		padding-inline: 14px;
	}

	.fb-card-copy {
		align-items: stretch;
		flex-direction: column;
	}

	.fb-guest-profile-head {
		flex-direction: column;
	}

	.fb-guest-profile-step {
		grid-template-columns: 1fr;
	}

	.fb-guest-profile-step label {
		grid-column: auto;
	}

	.fb-guest-profile-step>button,
	.fb-guest-profile-actions,
	.fb-guest-profile-actions button {
		width: 100%;
	}

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


.rtl .woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link--support a:before,
.woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link--support a:before {
    content: "" !important;
    display: inline-block !important;
    width: 18px !important;
    height: 18px !important;
    margin-left: 8px !important;
    vertical-align: -4px !important;
    background: currentColor !important;
    font-family: initial !important;
    font-size: 0 !important;
    line-height: 1 !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' viewBox='0 0 24 24'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5A8.48 8.48 0 0 1 21 11v.5Z' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat !important;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' viewBox='0 0 24 24'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5A8.48 8.48 0 0 1 21 11v.5Z' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat !important;
}
