:root {
	--mzn-primary: #2563EB;
	--mzn-dark: #0F172A;
	--mzn-light: #E8EEF9;
	--mzn-on-primary: #ffffff;
	--mzn-on-dark: #ffffff;
}

.mzn-floating-widget {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: inherit;
	direction: rtl;
}
.mzn-floating-widget.mzn-pos-right { right: 20px; }
.mzn-floating-widget.mzn-pos-left { left: 20px; }

.mzn-toggle-btn {
	all: unset;
	box-sizing: border-box;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--mzn-dark);
	color: var(--mzn-primary);
	font-size: 26px;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0,0,0,0.3);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	transition: transform 0.15s ease;
}
.mzn-toggle-btn:hover { transform: scale(1.06); }
.mzn-toggle-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.mzn-toggle-icon { display: block; }

.mzn-floating-panel {
	position: fixed;
	top: 16px;
	bottom: 96px;
	width: 380px;
	max-width: calc(100vw - 32px);
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 40px rgba(0,0,0,0.2);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.mzn-floating-panel[hidden] {
	display: none !important;
}
.mzn-pos-right .mzn-floating-panel { right: 20px; }
.mzn-pos-left .mzn-floating-panel { left: 20px; }

.mzn-inline-chat-root {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 820px;
	margin: 0 auto;
	height: 520px;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 2px 16px rgba(0,0,0,0.12);
	overflow: hidden;
	font-family: inherit;
	direction: rtl;
	border: 1px solid #eee;
}

.mzn-chat-header {
	background: #fff;
	color: var(--mzn-dark);
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	border-bottom: 1px solid #eef1f4;
	flex-shrink: 0;
}
.mzn-header-title {
	display: flex;
	align-items: center;
	gap: 10px;
}
.mzn-header-avatar-wrap {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--mzn-dark);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
}
.mzn-header-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.mzn-header-avatar--emoji { color: var(--mzn-primary); font-size: 18px; }
.mzn-header-texts { display: flex; flex-direction: column; }
.mzn-header-name { font-weight: 700; font-size: 15px; color: var(--mzn-dark); line-height: 1.4; }
.mzn-header-sub { font-size: 11px; color: #8b98a5; margin-top: 2px; }
.mzn-header-close {
	all: unset;
	box-sizing: border-box;
	background: var(--mzn-light);
	color: var(--mzn-dark);
	width: 30px;
	height: 30px;
	border-radius: 50%;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	opacity: 0.9;
}
.mzn-header-close:hover { opacity: 1; }

.mzn-chat-body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 16px 14px;
	background: var(--mzn-light);
}
.mzn-chat-body-inner {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.mzn-msg { display: flex; align-items: flex-end; gap: 6px; }
.mzn-msg--user { justify-content: flex-start; }
.mzn-msg--assistant { justify-content: flex-end; }

.mzn-msg-avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--mzn-dark);
	color: var(--mzn-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	flex-shrink: 0;
	overflow: hidden;
}
.mzn-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.mzn-bubble {
	max-width: 82%;
	min-width: 0;
	padding: 11px 14px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.7;
	word-wrap: break-word;
	overflow-wrap: break-word;
	box-sizing: border-box;
}
.mzn-msg--user .mzn-bubble {
	background: var(--mzn-primary);
	color: var(--mzn-on-primary);
	border-bottom-left-radius: 4px;
	font-weight: 500;
}
.mzn-msg--assistant .mzn-bubble {
	background: #fff;
	color: var(--mzn-dark);
	box-shadow: 0 1px 4px rgba(0,0,0,0.08);
	border-bottom-right-radius: 4px;
}
.mzn-typing .mzn-bubble { opacity: 0.65; font-style: italic; }

.mzn-chat-footer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #eef1f4;
	background: #fff;
	flex-shrink: 0;
}
.mzn-chat-input-wrap {
	flex: 1;
	background: var(--mzn-light);
	border-radius: 22px;
	padding: 6px 14px;
	display: flex;
	align-items: center;
	min-width: 0;
	box-sizing: border-box;
}
/* Many themes style every textarea (min-height, border, padding, resize handle...).
   These resets keep the chat input compact whatever the theme does. */
.mzn-chat-root .mzn-chat-input,
.mzn-chat-root textarea.mzn-chat-input {
	flex: 1 !important;
	display: block !important;
	width: 100% !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-height: 100px !important;
	margin: 0 !important;
	padding: 6px 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	outline: none !important;
	box-shadow: none !important;
	background: transparent !important;
	resize: none !important;
	overflow-y: auto;
	box-sizing: border-box !important;
	-webkit-appearance: none;
	appearance: none;
	font-size: 14px !important;
	line-height: 1.6 !important;
	font-family: inherit;
	direction: rtl;
	color: var(--mzn-dark) !important;
	transition: none !important;
}
.mzn-chat-input::placeholder { color: #9aa5ad; }
.mzn-chat-input:focus { outline: none; }

.mzn-chat-send {
	all: unset;
	box-sizing: border-box;
	background: var(--mzn-primary);
	color: var(--mzn-on-primary);
	border-radius: 50%;
	width: 38px;
	height: 38px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: filter 0.15s ease;
}
.mzn-chat-send svg { transform: scaleX(-1); }
.mzn-chat-send:hover { filter: brightness(0.94); }

/* دکمه و پیش‌نمایش ارسال فیش واریزی */
.mzn-chat-attach {
	all: unset;
	box-sizing: border-box;
	background: var(--mzn-light);
	color: var(--mzn-dark);
	border-radius: 50%;
	width: 38px;
	height: 38px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: filter 0.15s ease;
}
.mzn-chat-attach:hover { filter: brightness(0.94); }
.mzn-attach-preview {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border-top: 1px solid #eef1f4;
	background: #fff;
	flex-shrink: 0;
	direction: rtl;
}
.mzn-attach-thumb {
	width: 40px;
	height: 40px;
	border-radius: 8px;
	background: var(--mzn-light);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	flex-shrink: 0;
	font-size: 20px;
}
.mzn-attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mzn-attach-name {
	flex: 1;
	min-width: 0;
	font-size: 12px;
	color: var(--mzn-dark);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	direction: ltr;
	text-align: right;
}
.mzn-attach-send,
.mzn-attach-cancel {
	all: unset;
	box-sizing: border-box;
	border-radius: 999px;
	padding: 7px 14px;
	font-size: 13px;
	cursor: pointer;
	flex-shrink: 0;
}
.mzn-attach-send { background: var(--mzn-primary); color: var(--mzn-on-primary); font-weight: 600; }
.mzn-attach-cancel { background: var(--mzn-light); color: var(--mzn-dark); }

/* کارت‌های محصول داخل چت */
.mzn-card-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	width: 100%;
	min-width: 0;
}
.mzn-product-card {
	display: block;
	min-width: 0;
	background: #fff;
	border: 1px solid #eee;
	border-radius: 10px;
	padding: 8px;
	text-decoration: none;
	color: #222;
	box-sizing: border-box;
}
.mzn-product-card img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: 80px;
	object-fit: cover;
	border-radius: 6px;
	margin-bottom: 6px;
}
.mzn-pc-name {
	font-size: 12px;
	font-weight: 600;
	margin-bottom: 3px;
	line-height: 1.4;
	overflow-wrap: break-word;
}
.mzn-pc-price { font-size: 12px; color: var(--mzn-primary); font-weight: 700; }

.mzn-cart-success { text-align: center; }
.mzn-btn {
	display: inline-block;
	margin-top: 8px;
	background: var(--mzn-primary);
	color: var(--mzn-on-primary) !important;
	padding: 6px 14px;
	border-radius: 8px;
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
}
.mzn-whatsapp-card { text-align: center; margin-top: 4px; }
.mzn-btn-whatsapp {
	background: #25D366;
	color: #fff !important;
}

.mzn-sales-contact-card {
	text-align: center;
	margin-top: 4px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.mzn-btn-call {
	background: var(--mzn-dark);
	color: var(--mzn-on-dark) !important;
	direction: ltr;
}

@media (max-width: 480px) {
	.mzn-floating-panel {
		top: 12px;
		bottom: 90px;
		width: calc(100vw - 20px);
		right: 10px !important;
		left: 10px !important;
	}
}

/* Fix: make generated chat root the flex container so the body can scroll */
.mzn-chat-root {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	height: 100%;
	overflow: hidden;
}

.mzn-inline-chat-root {
	display: flex;
	flex-direction: column;
}
