.aipc-root {
	position: fixed;
	bottom: 20px;
	inset-inline-end: 20px;
	z-index: 999999;
	direction: rtl;
	font-family: Tahoma, "Segoe UI", sans-serif;
}

.aipc-toggle-btn {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	background: var(--aipc-color, #76b900);
	color: #fff;
	border: none;
	box-shadow: 0 4px 14px rgba(0,0,0,.25);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 26px;
	transition: transform .15s ease;
}
.aipc-toggle-btn:hover {
	transform: scale(1.06);
}

.aipc-panel {
	position: absolute;
	bottom: 72px;
	inset-inline-end: 0;
	width: 340px;
	max-width: 92vw;
	height: 460px;
	max-height: 75vh;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 40px rgba(0,0,0,.25);
	display: none;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid #e5e5e5;
}
.aipc-panel.aipc-open {
	display: flex;
}

.aipc-header {
	background: var(--aipc-color, #76b900);
	color: #fff;
	padding: 12px 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 15px;
	font-weight: bold;
}
.aipc-header button {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 18px;
	cursor: pointer;
	line-height: 1;
}

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

.aipc-msg {
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 13.5px;
	line-height: 1.6;
	white-space: pre-wrap;
	word-wrap: break-word;
	align-self: flex-start; /* از کشیده‌شدن آیتم در محور عرضی جلوگیری می‌کند؛ موقعیت واقعی با margin زیر تعیین می‌شود */
}
/* کاربر واقعی همیشه سمت راست؛ از margin فیزیکی استفاده می‌کنیم تا مستقل از RTL/LTR درست کار کند */
.aipc-msg.aipc-user {
	margin-left: auto;
	margin-right: 0;
	background: var(--aipc-color, #76b900);
	color: #fff;
	border-bottom-right-radius: 3px;
}
/* هوش مصنوعی همیشه سمت چپ */
.aipc-msg.aipc-assistant {
	margin-right: auto;
	margin-left: 0;
	background: #fff;
	color: #222;
	border: 1px solid #e5e5e5;
	border-bottom-left-radius: 3px;
}
.aipc-msg.aipc-error {
	align-self: center;
	background: #fdecea;
	color: #b3261e;
	border: 1px solid #f5c6c3;
	font-size: 12.5px;
}
.aipc-msg.aipc-typing {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e5e5e5;
	color: #999;
	font-style: italic;
}

.aipc-input-wrap {
	border-top: 1px solid #eee;
	background: #fff;
}

.aipc-attach-preview {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px 0 10px;
	font-size: 12px;
	color: #444;
}
.aipc-attach-preview .aipc-attach-name {
	background: #f0f0f0;
	border-radius: 8px;
	padding: 3px 8px;
	max-width: 200px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.aipc-attach-preview button {
	background: transparent;
	border: none;
	color: #b3261e;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
}
.aipc-attach-preview.aipc-uploading .aipc-attach-name {
	color: #888;
}

.aipc-input-row {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px;
	background: #fff;
}
.aipc-input-row textarea {
	flex: 1;
	resize: none;
	border: 1px solid #ddd;
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 13.5px;
	font-family: inherit;
	max-height: 80px;
	min-height: 38px;
}
.aipc-attach-btn {
	background: #f0f0f0;
	color: #555;
	border: none;
	border-radius: 10px;
	width: 38px;
	height: 38px;
	cursor: pointer;
	font-size: 17px;
	flex-shrink: 0;
}
.aipc-attach-btn:hover {
	background: #e5e5e5;
}
.aipc-send-btn {
	background: var(--aipc-color, #76b900);
	color: #fff;
	border: none;
	border-radius: 10px;
	width: 40px;
	height: 38px;
	cursor: pointer;
	font-size: 16px;
	flex-shrink: 0;
}
.aipc-send-btn:disabled {
	opacity: .5;
	cursor: not-allowed;
}

.aipc-msg-attachment {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 6px;
	font-size: 12px;
	padding-top: 6px;
	border-top: 1px solid rgba(0,0,0,.08);
}
.aipc-msg.aipc-user .aipc-msg-attachment {
	border-top-color: rgba(255,255,255,.3);
}
.aipc-msg-attachment a {
	color: inherit;
	text-decoration: underline;
}
.aipc-msg-image-preview {
	max-width: 180px;
	max-height: 180px;
	border-radius: 8px;
	display: block;
	margin-top: 6px;
}

@media (max-width: 480px) {
	.aipc-panel {
		width: 88vw;
	}
}
