/* BioChat widget — RTL, Persian. Colours tuned for a calm herbal/consultation feel. */

#biochat-root {
	--bc-green: #1f6e4a;
	--bc-green-dark: #164f36;
	--bc-bg: #f4f8f5;
	--bc-user: #dcefe3;
	--bc-admin: #ffffff;
	--bc-text: #22302a;
	--bc-muted: #6b7f75;
	--bc-radius: 14px;
	position: fixed;
	inset-inline-start: 20px; /* bottom-left on RTL pages */
	bottom: 20px;
	z-index: 99999;
	font-family: Vazirmatn, Vazir, IRANSans, Tahoma, sans-serif;
	direction: rtl;
	text-align: right;
}

#biochat-root * { box-sizing: border-box; }

.bc-launcher {
	width: 56px;
	height: 56px;
	border: 0;
	border-radius: 50%;
	background: var(--bc-green);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(22, 79, 54, 0.35);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease, background 0.15s ease;
	position: relative;
}
.bc-launcher:hover { background: var(--bc-green-dark); transform: translateY(-2px); }
.bc-launcher:focus-visible { outline: 3px solid #9ed3b6; outline-offset: 2px; }
.bc-launcher svg { width: 26px; height: 26px; }

.bc-badge {
	position: absolute;
	top: -4px;
	inset-inline-end: -4px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #d23b3b;
	color: #fff;
	font-size: 12px;
	line-height: 20px;
	text-align: center;
	display: none;
}
.bc-badge.bc-show { display: block; }

.bc-panel {
	position: absolute;
	bottom: 70px;
	inset-inline-start: 0;
	width: min(360px, calc(100vw - 32px));
	height: min(520px, calc(100vh - 120px));
	background: var(--bc-bg);
	border-radius: var(--bc-radius);
	box-shadow: 0 12px 40px rgba(20, 40, 30, 0.25);
	display: none;
	flex-direction: column;
	overflow: hidden;
}
.bc-panel.bc-open { display: flex; }

.bc-header {
	background: var(--bc-green);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.bc-header .bc-title { font-size: 15px; font-weight: 700; }
.bc-header .bc-sub { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.bc-close {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 4px;
}

.bc-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.bc-msg {
	max-width: 82%;
	padding: 9px 12px;
	border-radius: 12px;
	font-size: 13.5px;
	line-height: 1.7;
	color: var(--bc-text);
	white-space: pre-wrap;
	word-break: break-word;
}
.bc-msg.bc-user {
	align-self: flex-start; /* user's own messages on the right visually in RTL flex */
	background: var(--bc-user);
	border-bottom-inline-start-radius: 4px;
}
.bc-msg.bc-admin {
	align-self: flex-end;
	background: var(--bc-admin);
	border: 1px solid #e2ebe5;
	border-bottom-inline-end-radius: 4px;
}
.bc-time {
	display: block;
	margin-top: 4px;
	font-size: 10.5px;
	color: var(--bc-muted);
}

.bc-empty, .bc-login {
	margin: auto;
	text-align: center;
	color: var(--bc-muted);
	font-size: 13.5px;
	padding: 0 24px;
	line-height: 2;
}
.bc-login a {
	display: inline-block;
	margin-top: 10px;
	background: var(--bc-green);
	color: #fff;
	padding: 8px 18px;
	border-radius: 8px;
	text-decoration: none;
	font-size: 13.5px;
}

.bc-composer {
	display: flex;
	gap: 8px;
	padding: 10px;
	background: #fff;
	border-top: 1px solid #e2ebe5;
}
.bc-input {
	flex: 1;
	border: 1px solid #d5e2da;
	border-radius: 10px;
	padding: 9px 12px;
	font: inherit;
	font-size: 13.5px;
	resize: none;
	max-height: 96px;
	direction: rtl;
}
.bc-input:focus { outline: 2px solid var(--bc-green); border-color: transparent; }
.bc-send {
	border: 0;
	background: var(--bc-green);
	color: #fff;
	border-radius: 10px;
	padding: 0 16px;
	font: inherit;
	font-size: 13.5px;
	cursor: pointer;
}
.bc-send:disabled { opacity: 0.5; cursor: default; }
.bc-error {
	padding: 6px 12px;
	background: #fdecec;
	color: #a33;
	font-size: 12px;
	display: none;
}
.bc-error.bc-show { display: block; }

@media (prefers-reduced-motion: reduce) {
	.bc-launcher { transition: none; }
}
