#mrabi-root, #mrabi-root * {
	box-sizing: border-box;
}
#mrabi-root {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	direction: rtl;
	font-family: Tahoma, "Vazirmatn", Arial, sans-serif !important;
	font-size: 12px !important;
	line-height: 1.5;
	--mrabi-color: #e6007e;
	--mrabi-text: 12px;
}
#mrabi-root.mrabi-pos-bottom-left { left: 20px; }
#mrabi-root.mrabi-pos-bottom-right { right: 20px; }

#mrabi-bubble {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--mrabi-color);
	border: none;
	box-shadow: 0 4px 14px rgba(0,0,0,.25);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: transform .15s ease;
	padding: 0;
}
#mrabi-bubble:hover { transform: scale(1.06); }
#mrabi-bubble svg { width: 24px; height: 24px; }

#mrabi-panel {
	position: fixed;
	bottom: 86px;
	width: 400px;
	max-width: calc(100vw - 32px);
	height: 620px;
	max-height: 82vh;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 40px rgba(0,0,0,.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
#mrabi-root.mrabi-pos-bottom-left #mrabi-panel { left: 20px; }
#mrabi-root.mrabi-pos-bottom-right #mrabi-panel { right: 20px; }
#mrabi-root .mrabi-hidden { display: none !important; }

.mrabi-header {
	background: var(--mrabi-color);
	color: #fff;
	padding: 12px 14px;
	position: relative;
	flex-shrink: 0;
}
.mrabi-header-title { display: flex; align-items: center; gap: 8px; }
.mrabi-header-title strong { font-size: 14px !important; font-weight: 700; }
.mrabi-subtitle { font-size: 11px !important; opacity: .9; margin-top: 2px; }
.mrabi-avatar {
	width: 30px; height: 30px; border-radius: 50%;
	background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="8" r="4" fill="%23e6007e"/><path d="M4 20c0-4 4-6 8-6s8 2 8 6" fill="%23e6007e"/></svg>') center/60% no-repeat;
	flex-shrink: 0;
}
#mrabi-close {
	position: absolute; top: 8px; left: 10px;
	background: transparent; border: none; color: #fff;
	font-size: 18px !important; line-height: 1; cursor: pointer;
	padding: 4px;
}

.mrabi-body {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	background: #f7f7fb;
}
#mrabi-messages { display: flex; flex-direction: column; gap: 8px; }

/* row wrapper only used for bot messages, to hold avatar + bubble together */
.mrabi-msg-row {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	max-width: 100%;
	width: 100%;
}
.mrabi-msg-row.bot {
	margin-right: 0;
	margin-left: auto;
}
.mrabi-msg-avatar {
	width: 24px; height: 24px; border-radius: 50%;
	background: var(--mrabi-color) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="8" r="4" fill="white"/><path d="M4 20c0-4 4-6 8-6s8 2 8 6" fill="white"/></svg>') center/58% no-repeat;
	flex-shrink: 0;
}

.mrabi-msg {
	width: fit-content;
	max-width: 100%;
	padding: 12px 14px;
	border-radius: 12px;
	font-size: var(--mrabi-text) !important;
	line-height: 1.7;
	white-space: pre-wrap;
	word-break: break-word;
}
.mrabi-msg.bot {
	background: #fff;
	border: 1px solid #eee;
	border-bottom-left-radius: 2px;
	flex: 1;
}
.mrabi-msg.user {
	margin-right: auto;
	margin-left: 0;
	max-width: 85%;
	background: var(--mrabi-color);
	color: #fff;
	border-bottom-right-radius: 2px;
}

.mrabi-options {
	display: flex;
	flex-direction: column;
	gap: 3px;
	margin-top: 4px;
	/* reserve the same space the avatar+gap take up on a bot message row,
	   so button edges line up exactly with the message bubble's edges */
	width: calc(100% - 30px);
	margin-right: 30px;
	margin-left: 0;
}
.mrabi-option-btn {
	display: block;
	width: 100%;
	background: var(--mrabi-color);
	color: #fff;
	border: none;
	border-radius: 9px;
	padding: 7px 12px;
	font-size: var(--mrabi-text) !important;
	line-height: 1.4;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: opacity .15s ease;
}
.mrabi-option-btn:hover { opacity: .88; }
.mrabi-link-btn:visited { color: #fff; }
.mrabi-option-btn.mrabi-back {
	background: #fff;
	color: var(--mrabi-color);
	border: 1px solid var(--mrabi-color);
}

.mrabi-option-btn.mrabi-ai-cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	background: linear-gradient(135deg, var(--mrabi-color), #2b2f77);
	font-weight: 700;
	margin-top: 6px;
	padding: 9px 12px;
}
.mrabi-option-btn.mrabi-ai-cta svg { flex-shrink: 0; width: 15px; height: 15px; }

.mrabi-back-to-faq-wrap {
	width: calc(100% - 30px);
	margin-right: 30px;
	margin-left: 0;
	margin-top: 2px;
}
.mrabi-back-to-faq {
	background: transparent;
	border: none;
	color: #888 !important;
	font-size: 11px !important;
	text-decoration: underline;
	cursor: pointer;
	padding: 4px 2px;
}

.mrabi-typing { font-size: 11px !important; color: #999; padding: 4px 2px; width: fit-content; margin-left: auto; }

.mrabi-input-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid #eee;
	background: #fff;
	flex-shrink: 0;
}
#mrabi-input {
	flex: 1;
	border: 1px solid #ddd;
	border-radius: 20px;
	padding: 9px 14px;
	font-size: var(--mrabi-text) !important;
	outline: none;
	direction: rtl;
	height: auto;
	margin: 0;
}
#mrabi-send {
	background: var(--mrabi-color);
	color: #fff;
	border: none;
	width: 34px; height: 34px;
	border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	padding: 0;
}
#mrabi-send svg { width: 16px; height: 16px; }

@media (max-width: 460px) {
	#mrabi-panel { width: calc(100vw - 24px); height: 75vh; }
}

/* ---------------- Teaser popup (attention bubble above the chat icon) ---------------- */
#mrabi-teaser {
	position: fixed;
	bottom: 86px;
	width: 280px;
	max-width: calc(100vw - 40px);
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(0,0,0,.2);
	padding: 12px 14px 14px;
	z-index: 999998;
	cursor: pointer;
	animation: mrabi-teaser-in .35s ease;
}
#mrabi-root.mrabi-pos-bottom-left #mrabi-teaser { left: 20px; }
#mrabi-root.mrabi-pos-bottom-right #mrabi-teaser { right: 20px; }

.mrabi-teaser-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 6px;
}
.mrabi-teaser-title { display: flex; align-items: center; gap: 8px; }
.mrabi-teaser-title strong { color: var(--mrabi-color); font-size: 13px !important; font-weight: 700; }
#mrabi-teaser-close {
	background: transparent;
	border: none;
	color: #aaa;
	font-size: 16px !important;
	line-height: 1;
	cursor: pointer;
	padding: 2px 4px;
	flex-shrink: 0;
}
.mrabi-teaser-body {
	font-size: var(--mrabi-text) !important;
	line-height: 1.8;
	color: #333;
}

@keyframes mrabi-teaser-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 460px) {
	#mrabi-teaser { bottom: 82px; }
}

/* ---------------- Dedicated full-page mode ---------------- */
#mrabi-root.mrabi-mode-fullpage {
	position: static;
	left: auto;
	right: auto;
	bottom: auto;
	width: 100%;
	display: block;
}
#mrabi-root.mrabi-mode-fullpage #mrabi-panel {
	position: static;
	width: 100%;
	max-width: 100%;
	height: 78vh;
	min-height: 480px;
	max-height: 820px;
	margin: 0;
}

