/* Kando AI — live chat widget. Every rule is scoped under .kdai-root so themes are not touched. */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/vazirmatn/Vazirmatn-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
.kdai-root :where(input, select, textarea, button) { font-family: inherit; }
.kdai-root {
	--kdai-accent: #f5b301;
	--kdai-on-accent: #1a1a2e;
	--kdai-bottom: 20px;
	--kdai-ink: #1f2937;
	--kdai-muted: #6b7280;
	--kdai-line: #e5e7eb;
	--kdai-soft: #f6f7f9;
	--kdai-radius: 18px;
	position: fixed;
	bottom: var(--kdai-bottom);
	z-index: 2147483000;
	font-family: "Vazirmatn", Tahoma, sans-serif;
	font-size: 14px;
	line-height: 1.8;
	color: var(--kdai-ink);
	direction: rtl;
	text-align: right;
}
.kdai-root.kdai-right { right: 20px; }
.kdai-root.kdai-left { left: 20px; }
.kdai-root *, .kdai-root *::before, .kdai-root *::after { box-sizing: border-box; }
.kdai-root [hidden] { display: none !important; }
.kdai-root button { font: inherit; cursor: pointer; margin: 0; }
.kdai-root .kdai-icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.kdai-root .kdai-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; } /* themes often set svg { fill } */
.kdai-root .kdai-sr { position: absolute !important; width: 1px !important; height: 1px !important; min-width: 0 !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; border: 0 !important; background: none !important; opacity: 0 !important; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; pointer-events: none; }

/* Launcher */
.kdai-root .kdai-launcher {
	position: relative;
	display: grid;
	place-items: center;
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: var(--kdai-accent);
	color: var(--kdai-on-accent);
	box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .35);
	transition: transform .2s ease, box-shadow .2s ease;
	padding: 0;
}
.kdai-root .kdai-launcher:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 34px -8px rgba(0, 0, 0, .4); }
.kdai-root .kdai-launcher:focus-visible { outline: 3px solid rgba(0, 0, 0, .35); outline-offset: 3px; }
.kdai-root .kdai-launcher .kdai-icon { width: 26px; height: 26px; grid-area: 1 / 1; transition: transform .25s ease, opacity .2s ease; }
.kdai-root .kdai-launcher-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.kdai-root.is-open .kdai-launcher-open { opacity: 0; transform: rotate(90deg) scale(.6); }
.kdai-root.is-open .kdai-launcher-close { opacity: 1; transform: none; }
.kdai-root .kdai-launcher::after {
	content: "";
	position: absolute;
	top: 0; right: 0; bottom: 0; left: 0;
	border-radius: 50%;
	box-shadow: 0 0 0 0 var(--kdai-accent);
	animation: kdai-pulse 2.6s ease-out 1.5s 3;
	pointer-events: none;
}
@keyframes kdai-pulse {
	0% { box-shadow: 0 0 0 0 var(--kdai-accent); opacity: .55; }
	100% { box-shadow: 0 0 0 18px var(--kdai-accent); opacity: 0; }
}
.kdai-root .kdai-badge {
	position: absolute;
	top: -2px;
	left: -2px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 11px;
	background: #e11d48;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
	box-shadow: 0 0 0 2px #fff;
}

/* Teaser */
.kdai-root .kdai-teaser {
	position: absolute;
	bottom: 72px;
	display: flex;
	align-items: flex-start;
	gap: 4px;
	width: max-content;
	max-width: 260px;
	padding: 10px 12px 10px 8px;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .3);
	animation: kdai-rise .35s cubic-bezier(.2, .9, .3, 1.2);
}
.kdai-root.kdai-right .kdai-teaser { right: 0; border-bottom-right-radius: 4px; }
.kdai-root.kdai-left .kdai-teaser { left: 0; border-bottom-left-radius: 4px; }
.kdai-root .kdai-teaser-text { border: 0; background: none; padding: 0; color: var(--kdai-ink); font-weight: 600; text-align: right; line-height: 1.8; }
.kdai-root .kdai-teaser-x { border: 0; background: none; padding: 2px; color: var(--kdai-muted); display: grid; }
.kdai-root .kdai-teaser-x .kdai-icon { width: 16px; height: 16px; }

/* Panel */
.kdai-root .kdai-panel {
	position: absolute;
	bottom: 76px;
	display: flex;
	flex-direction: column;
	width: 380px;
	height: min(620px, calc(100vh - var(--kdai-bottom) - 100px));
	border-radius: var(--kdai-radius);
	background: #fff;
	box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .35), 0 0 0 1px rgba(0, 0, 0, .04);
	overflow: hidden;
	animation: kdai-open .28s cubic-bezier(.2, .9, .3, 1.1);
	transform-origin: bottom right;
}
.kdai-root.kdai-right .kdai-panel { right: 0; }
.kdai-root.kdai-left .kdai-panel { left: 0; transform-origin: bottom left; }
@keyframes kdai-open {
	from { opacity: 0; transform: translateY(14px) scale(.96); }
	to { opacity: 1; transform: none; }
}
@keyframes kdai-rise {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

.kdai-root .kdai-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 14px;
	background: linear-gradient(135deg, #1a1a2e, #2a2a48);
	color: #fff;
	flex: none;
}
.kdai-root .kdai-avatar {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 12px;
	background: var(--kdai-accent);
	color: var(--kdai-on-accent);
	flex: none;
}
.kdai-root .kdai-htext { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.kdai-root .kdai-htext strong { font-size: 15px; font-weight: 800; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kdai-root .kdai-status { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .75; }
.kdai-root .kdai-dot { width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; }
.kdai-root .kdai-dot.is-on { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .25); }
.kdai-root .kdai-dot.is-off { background: #fbbf24; }
.kdai-root .kdai-hbtn {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: rgba(255, 255, 255, .8);
	padding: 0;
}
.kdai-root .kdai-hbtn:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.kdai-root .kdai-menu {
	position: absolute;
	top: 60px;
	left: 12px;
	z-index: 3;
	display: flex;
	flex-direction: column;
	min-width: 210px;
	padding: 6px;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .35), 0 0 0 1px rgba(0, 0, 0, .05);
	animation: kdai-rise .18s ease;
}
.kdai-root .kdai-menu button {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border: 0;
	border-radius: 10px;
	background: none;
	color: var(--kdai-ink);
	text-align: right;
	font-size: 13px;
	font-weight: 600;
}
.kdai-root .kdai-menu button:hover { background: var(--kdai-soft); }
.kdai-root .kdai-menu .kdai-icon { width: 18px; height: 18px; color: var(--kdai-muted); }

/* Intro form */
.kdai-root .kdai-intro { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.kdai-root .kdai-welcome { margin: 0 0 8px; font-weight: 700; font-size: 14px; }
.kdai-root .kdai-offline { margin: 0 0 8px; padding: 8px 10px; border-radius: 10px; background: #fffbeb; color: #92400e; font-size: 12px; }
.kdai-root .kdai-label { display: block; margin-top: 8px; font-size: 12px; font-weight: 700; color: #4b5563; }
.kdai-root .kdai-field {
	display: block;
	width: 100%;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid #d1d5db;
	border-radius: 12px;
	background: #fff;
	color: var(--kdai-ink);
	font: inherit;
	font-size: 16px;
	line-height: 1.7;
	box-shadow: none;
	resize: vertical;
}
.kdai-root .kdai-field:focus { outline: none; border-color: var(--kdai-accent); box-shadow: 0 0 0 3px rgba(0, 0, 0, .08); box-shadow: 0 0 0 3px color-mix(in srgb, var(--kdai-accent) 25%, transparent); }
.kdai-root .kdai-ltr { direction: ltr; text-align: left; }
.kdai-root .kdai-hint { margin: 4px 0 0; font-size: 11px; color: #9ca3af; }
.kdai-root .kdai-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.kdai-root .kdai-error { margin: 6px 0 0; color: #e11d48; font-size: 12px; font-weight: 700; }
.kdai-root .kdai-primary {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 46px;
	margin-top: 12px;
	border: 0;
	border-radius: 12px;
	background: var(--kdai-accent);
	color: var(--kdai-on-accent);
	font-weight: 800;
	transition: filter .15s ease, transform .15s ease;
}
.kdai-root .kdai-primary:hover { filter: brightness(1.05); }
.kdai-root .kdai-primary:active { transform: scale(.98); }
.kdai-root .kdai-primary:disabled { opacity: .6; cursor: default; }
.kdai-root .kdai-primary .kdai-icon { width: 18px; height: 18px; }

/* Conversation */
.kdai-root .kdai-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 12px; background: var(--kdai-soft); }
.kdai-root .kdai-stream { display: flex; flex-direction: column; gap: 8px; }
.kdai-root .kdai-msg {
	max-width: 82%;
	padding: 8px 12px 6px;
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
	animation: kdai-rise .22s ease;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.kdai-root .kdai-msg.is-mine { align-self: flex-start; background: #fff; border-bottom-right-radius: 4px; }
.kdai-root .kdai-msg.is-them { align-self: flex-end; background: var(--kdai-accent); color: var(--kdai-on-accent); border-bottom-left-radius: 4px; }
.kdai-root .kdai-msg.is-pending { opacity: .6; }
.kdai-root .kdai-file { display: block; margin-top: 6px; color: inherit; text-decoration: underline; word-break: break-all; }
.kdai-root .kdai-file img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; }
.kdai-root .kdai-text { white-space: pre-wrap; font-size: 13.5px; line-height: 1.9; }
.kdai-root .kdai-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.kdai-root .kdai-meta { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 10.5px; opacity: .6; }
.kdai-root .kdai-meta .kdai-icon { width: 14px; height: 14px; }
.kdai-root .kdai-meta .kdai-seen { color: #0ea5e9; opacity: 1; }
.kdai-root .kdai-sys { align-self: center; max-width: 90%; padding: 4px 12px; border-radius: 999px; background: #e5e7eb; color: #4b5563; font-size: 11.5px; font-weight: 600; text-align: center; }
.kdai-root .kdai-typing {
	display: flex;
	align-items: center;
	gap: 8px;
	width: fit-content;
	margin: 10px auto 0 0; /* RTL: our side of the conversation is on the left */
	padding: 8px 12px;
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	background: #fdf1cc;
	background: color-mix(in srgb, var(--kdai-accent) 22%, #fff);
	font-size: 12px;
	font-weight: 600;
	animation: kdai-rise .2s ease;
}
.kdai-root .kdai-dots { display: inline-flex; gap: 3px; }
.kdai-root .kdai-dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .3; animation: kdai-blink 1.2s infinite; }
.kdai-root .kdai-dots i:nth-child(2) { animation-delay: .15s; }
.kdai-root .kdai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes kdai-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.kdai-root .kdai-notice { margin: 10px auto 0; padding: 8px 12px; border-radius: 12px; background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 600; text-align: center; }
.kdai-root .kdai-after { margin-top: 14px; text-align: center; }
.kdai-root .kdai-ended, .kdai-root .kdai-rate, .kdai-root .kdai-thanks { margin: 4px 0; font-size: 12.5px; font-weight: 700; color: #4b5563; }
.kdai-root .kdai-stars { display: flex; flex-direction: row-reverse; justify-content: center; gap: 4px; direction: ltr; margin: 6px 0; }
.kdai-root .kdai-stars button { border: 0; background: none; padding: 2px; color: #d1d5db; transition: transform .12s ease, color .12s ease; }
.kdai-root .kdai-stars button .kdai-icon { width: 26px; height: 26px; }
.kdai-root .kdai-stars button:hover, .kdai-root .kdai-stars button:hover ~ button { color: #f59e0b; transform: scale(1.1); }
.kdai-root .kdai-ticket { margin-top: 12px; padding: 12px; border-radius: 14px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* Composer */
.kdai-root .kdai-composer { flex: none; padding: 10px; border-top: 1px solid var(--kdai-line); background: #fff; }
.kdai-root .kdai-crow { display: flex; align-items: flex-end; gap: 8px; }
.kdai-root .kdai-input {
	flex: 1;
	min-height: 44px;
	max-height: 120px;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid #d1d5db;
	border-radius: 14px;
	background: #fff;
	color: var(--kdai-ink);
	font: inherit;
	font-size: 16px;
	line-height: 1.6;
	resize: none;
	box-shadow: none;
}
.kdai-root .kdai-input:focus { outline: none; border-color: var(--kdai-accent); }
.kdai-root .kdai-send {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 14px;
	background: var(--kdai-accent);
	color: var(--kdai-on-accent);
	flex: none;
	padding: 0;
	transition: transform .15s ease;
}
.kdai-root .kdai-send:active { transform: scale(.92); }
.kdai-root .kdai-send .kdai-icon { transform: scaleX(-1); }
.kdai-root .kdai-attach { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 14px; background: transparent; color: inherit; opacity: .7; flex: none; padding: 0; cursor: pointer; }
.kdai-root .kdai-attach:hover { opacity: 1; }
.kdai-root .kdai-attach:disabled { opacity: .35; cursor: progress; }
.kdai-root .kdai-attach[hidden] { display: none; }

/* Phones: the panel becomes a full-screen sheet. */
@media (max-width: 520px) {
	.kdai-root.kdai-right { right: 14px; }
	.kdai-root.kdai-left { left: 14px; }
	.kdai-root .kdai-panel {
		position: fixed;
		top: 0; right: 0; bottom: 0; left: 0;
		width: auto;
		height: auto;
		border-radius: 0;
		animation-name: kdai-sheet;
	}
	.kdai-root .kdai-header { padding-top: max(12px, env(safe-area-inset-top)); }
	.kdai-root .kdai-composer { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
	.kdai-root.is-open .kdai-launcher, .kdai-root.is-open .kdai-teaser { display: none; }
	.kdai-root.kdai-hide-mobile:not(.is-open) { display: none; }
	/* The page behind the full-screen sheet must not scroll with it. */
	html.kdai-open, html.kdai-open body { overflow: hidden; }
}
@keyframes kdai-sheet {
	from { opacity: 0; transform: translateY(24px); }
	to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.kdai-root *, .kdai-root *::before, .kdai-root *::after { animation: none !important; transition: none !important; }
}

/* Archive */
.kdai-root .kdai-archive { flex: 1; overflow-y: auto; padding: 14px 12px; background: var(--kdai-soft); }
.kdai-root .kdai-arch-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.kdai-root .kdai-arch-bar .kdai-primary { width: auto; min-height: 38px; margin: 0; padding: 0 14px; font-size: 13px; }
.kdai-root .kdai-arch-empty { margin: 24px 0; text-align: center; color: var(--kdai-muted); }
.kdai-root .kdai-arch-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.kdai-root .kdai-arch-item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 12px; border: 1px solid var(--kdai-line); border-radius: 12px; background: #fff; color: var(--kdai-ink); text-align: right; }
.kdai-root .kdai-arch-item:hover { border-color: var(--kdai-accent); }
.kdai-root .kdai-arch-item.is-current { border-color: var(--kdai-accent); box-shadow: 0 0 0 2px rgba(0, 0, 0, .05); }
.kdai-root .kdai-arch-title { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kdai-root .kdai-arch-date { font-size: 11px; color: var(--kdai-muted); }

@media print {	.kdai-root { display: none !important; }
}

/* Service buttons under an assistant message */
.kdai-root .kdai-opts { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.kdai-root .kdai-opt {
	display: block;
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--kdai-on-accent);
	border: 1px solid color-mix(in srgb, var(--kdai-on-accent) 35%, transparent);
	border-radius: 10px;
	background: #fff;
	color: #1a1a2e;
	font: inherit;
	font-size: 13px;
	text-align: right;
	cursor: pointer;
	transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.kdai-root .kdai-opt:hover:not(:disabled) { border-color: var(--kdai-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--kdai-accent) 35%, transparent); }
.kdai-root .kdai-opt:disabled { opacity: .55; cursor: default; }
.kdai-root .kdai-opt.is-picked { opacity: 1; border-color: var(--kdai-accent); font-weight: 600; }
/* Same-site link buttons under an assistant message */
.kdai-root .kdai-links { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.kdai-root .kdai-linkbtn {
	display: block;
	padding: 8px 12px;
	border-radius: 10px;
	background: #fff;
	color: #1a1a2e;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	transition: box-shadow .15s;
}
.kdai-root .kdai-linkbtn:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--kdai-on-accent) 35%, transparent); }
/* Brand mark (chat_logo): fills the launcher button and the panel header avatar. */
.kdai-root .kdai-logo { display: block; object-fit: cover; }
.kdai-root .kdai-launcher .kdai-logo { width: 100%; height: 100%; border-radius: 50%; grid-area: 1 / 1; transition: transform .25s ease, opacity .2s ease; }
.kdai-root .kdai-avatar .kdai-logo { width: 100%; height: 100%; border-radius: 12px; }
.kdai-root.has-logo .kdai-launcher, .kdai-root.has-logo .kdai-avatar { background: #fff; }

/* Suggested first questions (chat_suggestions) in the welcome form. */
.kdai-root .kdai-suggests { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.kdai-root .kdai-suggest { padding: 5px 11px; border: 1px solid var(--kdai-line); border-radius: 999px; background: var(--kdai-soft); color: var(--kdai-ink); font-size: 12.5px; font-weight: 600; line-height: 1.7; text-align: right; transition: border-color .15s, background .15s; }
.kdai-root .kdai-suggest:hover { border-color: var(--kdai-accent); background: #fff; }
