.bsp-wrapper {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	z-index: 999999;
	display: flex;
	align-items: center;
	font-family: inherit !important;
	direction: ltr; /* keeps "left:0 / right:0" pixel-exact even on RTL pages
	                   where some browsers offset fixed elements by the
	                   (left-side) scrollbar width otherwise. */
}
.bsp-wrapper * {
	font-family: inherit !important;
	box-sizing: border-box;
}

.bsp-wrapper.pos-right { right: 0; left: auto; flex-direction: row-reverse; }
.bsp-wrapper.pos-left  { left: 0; right: auto; flex-direction: row; }

.bsp-btn {
	direction: rtl; /* restore normal Persian text shaping inside the button */
	background: var(--bsp-primary, #1e293b);
	color: #fff;
	border: none;
	padding: 15px 8px;
	cursor: pointer;
	writing-mode: vertical-rl;
	text-orientation: mixed;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	font-weight: bold;
	font-size: 15px;
	box-shadow: 0 4px 15px rgba(0,0,0,.3);
	transition: .3s;
	z-index: 2;
	user-select: none;
}
.bsp-wrapper.pos-right .bsp-btn { border-radius: 8px 0 0 8px; }
.bsp-wrapper.pos-left .bsp-btn  { border-radius: 0 8px 8px 0; flex-direction: row-reverse; }
.bsp-btn:hover { background: var(--bsp-primary-hover, #334155); }
.bsp-btn svg { width: 22px; height: 22px; fill: #fff; margin-bottom: 5px; }

.bsp-panel {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0,0,0,.15);
	width: 0;
	opacity: 0;
	visibility: hidden;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: all .35s cubic-bezier(.25,.8,.25,1);
	z-index: 1;
	white-space: nowrap;
}
.bsp-wrapper.is-open .bsp-panel { width: 320px; opacity: 1; visibility: visible; }
.bsp-wrapper.pos-right.is-open .bsp-panel { margin-right: 15px; }
.bsp-wrapper.pos-left.is-open .bsp-panel  { margin-left: 15px; }

.bsp-panel-content { padding: 15px; width: 320px; max-height: 420px; overflow-y: auto; white-space: normal; }
.bsp-panel-content::-webkit-scrollbar { width: 5px; }
.bsp-panel-content::-webkit-scrollbar-track { background: #f1f1f1; }
.bsp-panel-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; }

/* ----- Person card ----- */
.bsp-card {
	position: relative;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	margin-bottom: 12px;
	overflow: hidden;
	transition: box-shadow .2s;
}
.bsp-card:hover { box-shadow: 0 5px 15px rgba(0,0,0,.06); }

.bsp-card-main {
	display: flex;
	align-items: center;
	padding: 12px;
	gap: 12px;
}
.bsp-card-main.no-avatar { padding: 14px 12px; }
.bsp-card-main.no-avatar .bsp-info { padding-right: 2px; }
.bsp-info { text-align: right; flex-grow: 1; min-width: 0; }
.bsp-info h4 { margin: 0 0 4px; font-size: 14px; color: #334155; overflow: hidden; text-overflow: ellipsis; }
.bsp-info p { margin: 0; font-size: 12px; color: #64748b; overflow: hidden; text-overflow: ellipsis; }
.bsp-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.1); flex-shrink: 0; }

.bsp-card-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.bsp-social-toggle,
.bsp-chat-toggle {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 1px solid #e2e8f0;
	background: #fff;
	color: #64748b;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: .2s;
}
.bsp-social-toggle:hover { background: #eef2f7; color: #1e293b; }
.bsp-social-toggle svg, .bsp-chat-toggle svg { width: 18px; height: 18px; }
.bsp-chat-toggle { color: var(--bsp-accent, #2563eb); border-color: color-mix(in srgb, var(--bsp-accent, #2563eb) 35%, #e2e8f0); }
.bsp-chat-toggle:hover { background: var(--bsp-accent, #2563eb); color: #fff; }

/* Solid overlay that reveals the social icons — replaces the old
   "icons floating over the text on hover" behaviour. Click toggled. */
.bsp-socials-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--bsp-overlay-start, #1e293b), var(--bsp-overlay-end, #334155));
	opacity: 0;
	visibility: hidden;
	transform: scale(.96);
	transition: opacity .22s ease, transform .22s ease, visibility .22s;
}
.bsp-card.is-open .bsp-socials-overlay {
	opacity: 1;
	visibility: visible;
	transform: scale(1);
}
.bsp-socials { display: flex; align-items: center; gap: 12px; }

.bsp-social-icon {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	background: rgba(255,255,255,.12);
	text-decoration: none;
	transition: transform .18s, background .18s;
}
.bsp-social-icon:hover { transform: translateY(-3px); background: rgba(255,255,255,.22); }
.bsp-social-icon svg { width: 19px; height: 19px; }
.bsp-social-icon.tel  { color: #4fc3f7; }
.bsp-social-icon.wa   { color: #4ade80; }
.bsp-social-icon.ig   { color: #f472b6; }
.bsp-social-icon.bale { color: #fb923c; }

.bsp-empty { text-align: center; color: #64748b; padding: 20px 0; font-size: 14px; }

.bsp-closing-note {
	margin-top: 4px;
	padding: 10px 12px;
	background: #f1f5f9;
	border: 1px dashed #cbd5e1;
	border-radius: 8px;
	color: #475569;
	font-size: 12px;
	line-height: 1.9;
	text-align: center;
}

.bsp-footer { display: flex; border-top: 1px solid #e2e8f0; background: #f8fafc; width: 320px; }
.bsp-footer a { flex: 1; text-align: center; padding: 15px; color: #334155; text-decoration: none; font-size: 13px; font-weight: bold; transition: .2s; cursor: pointer; }
.bsp-footer a:hover { background: #e2e8f0; color: #1e293b; }
.bsp-footer a:first-child { border-left: 1px solid #e2e8f0; }

/* ----- Ticket / contact forms ----- */
.bsp-view[hidden] { display: none !important; }

.bsp-view-head {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid #e2e8f0;
}
.bsp-view-head h3 {
	margin: 0;
	font-size: 15px;
	font-weight: bold;
	color: #1e293b;
	text-align: center;
}
.bsp-back {
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 1px solid #e2e8f0;
	background: #f8fafc;
	color: #334155;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: .2s;
}
.bsp-back:hover { background: #e2e8f0; }
.bsp-back svg { width: 16px; height: 16px; transform: scaleX(-1); } /* points right, matching RTL "back" */

.bsp-form { display: flex; flex-direction: column; gap: 10px; }
.bsp-form-row { display: flex; gap: 10px; }
.bsp-form-row input { width: 50%; }
.bsp-form input, .bsp-form textarea {
	width: 100%;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 13px;
	resize: vertical;
}
.bsp-form input:focus, .bsp-form textarea:focus { outline: none; border-color: var(--bsp-accent, #2563eb); }
.bsp-form input[type="tel"] { text-align: right; direction: rtl; }
.bsp-chat-input-row input { text-align: right; direction: rtl; }
.bsp-submit {
	background: var(--bsp-primary, #1e293b);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 11px 12px;
	font-size: 13px;
	font-weight: bold;
	cursor: pointer;
	transition: .2s;
}
.bsp-submit:hover { background: var(--bsp-primary-hover, #334155); }
.bsp-submit:disabled { opacity: .6; cursor: not-allowed; }
.bsp-form-msg { font-size: 12px; text-align: center; min-height: 16px; }
.bsp-form-msg.success { color: #16a34a; }
.bsp-form-msg.error { color: #dc2626; }

/* ----- Live chat ----- */
.bsp-chat-panel { display: flex; flex-direction: column; }
.bsp-chat-pre .bsp-form-row { margin-bottom: 2px; }
.bsp-chat-intro {
	margin: 0 0 12px;
	font-size: 12.5px;
	color: #475569;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bsp-chat-window { display: flex; flex-direction: column; height: 340px; }
.bsp-chat-thread-front {
	flex: 1;
	overflow-y: auto;
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 10px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 10px;
}
.bsp-fbubble {
	max-width: 78%;
	padding: 7px 11px;
	border-radius: 12px;
	font-size: 12.5px;
	line-height: 1.7;
}
.bsp-fbubble-user {
	align-self: flex-end;
	background: var(--bsp-accent, #2563eb);
	color: #fff;
	border-bottom-right-radius: 3px;
}
.bsp-fbubble-admin {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e2e8f0;
	color: #334155;
	border-bottom-left-radius: 3px;
}
.bsp-fbubble-system {
	align-self: center;
	max-width: 92%;
	background: #eef2ff;
	border: 1px dashed #c7d2fe;
	color: #3730a3;
	text-align: center;
	border-radius: 12px;
	font-size: 12px;
	line-height: 1.9;
	padding: 10px 14px;
}

/* ----- FAQ accordion message ----- */
.bsp-fbubble-faq {
	align-self: stretch;
	max-width: 100%;
	width: 100%;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 14px;
	padding: 12px;
	box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.bsp-faq-msg-title {
	font-size: 13px;
	font-weight: bold;
	color: #1e293b;
	margin-bottom: 4px;
}
.bsp-faq-msg-text {
	font-size: 12px;
	color: #64748b;
	line-height: 1.8;
	margin-bottom: 10px;
}
.bsp-faq-accordion { display: flex; flex-direction: column; gap: 6px; }
.bsp-faq-entry {
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	overflow: hidden;
	background: #f8fafc;
	transition: border-color .2s, background .2s;
}
.bsp-faq-entry.is-open { border-color: var(--bsp-accent, #2563eb); background: #fff; }

.bsp-faq-q-btn {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	background: none;
	border: none;
	padding: 10px 12px;
	font-size: 12.5px;
	font-weight: 600;
	color: #334155;
	text-align: right;
	cursor: pointer;
}
.bsp-faq-q-text { flex: 1; }
.bsp-faq-caret {
	width: 15px;
	height: 15px;
	flex-shrink: 0;
	color: #94a3b8;
	transition: transform .25s ease, color .25s ease;
}
.bsp-faq-entry.is-open .bsp-faq-caret {
	transform: rotate(180deg);
	color: var(--bsp-accent, #2563eb);
}

/* Smooth height animation without JS measuring: grid-rows 0fr -> 1fr */
.bsp-faq-a-wrap {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows .28s ease;
}
.bsp-faq-entry.is-open .bsp-faq-a-wrap { grid-template-rows: 1fr; }
.bsp-faq-a-inner {
	overflow: hidden;
	font-size: 12px;
	color: #475569;
	line-height: 1.9;
	padding: 0 12px;
}
.bsp-faq-entry.is-open .bsp-faq-a-inner { padding: 0 12px 12px; }

.bsp-fbubble-time { display: block; margin-top: 3px; font-size: 9px; opacity: .65; }

.bsp-chat-input-row { display: flex; gap: 8px; }
.bsp-chat-input-row input {
	flex: 1;
	border: 1px solid #e2e8f0;
	border-radius: 20px;
	padding: 9px 14px;
	font-size: 13px;
}
.bsp-chat-input-row input:focus { outline: none; border-color: var(--bsp-accent, #2563eb); }
.bsp-chat-input-row button {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: none;
	background: var(--bsp-accent, #2563eb);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
}
.bsp-chat-input-row button svg { width: 17px; height: 17px; }

@media (max-width: 480px) {
	.bsp-wrapper.is-open .bsp-panel,
	.bsp-panel-content,
	.bsp-footer { width: 88vw; max-width: 320px; }
}
