.zai-ai-chat-widget,
.zai-ai-chat-widget * {
	box-sizing: border-box;
	font-family: "Cairo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	letter-spacing: 0;
}

.zai-ai-chat-widget {
	--zai-navy: #071432;
	--zai-navy-soft: #0e2048;
	--zai-gold: #d8b96f;
	--zai-white: #ffffff;
	--zai-muted: #d8deec;
	--zai-border: rgba(216, 185, 111, 0.34);
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 99999;
	color: var(--zai-white);
}

.zai-ai-chat-toggle {
	width: 66px;
	height: 66px;
	border: 1px solid rgba(216, 185, 111, 0.72);
	border-radius: 50%;
	background:
		radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.2), transparent 32%),
		linear-gradient(145deg, #0d1f48, var(--zai-navy));
	box-shadow: 0 18px 46px rgba(7, 20, 50, 0.38), 0 0 0 5px rgba(216, 185, 111, 0.14);
	color: var(--zai-gold);
	cursor: pointer;
	display: grid;
	place-items: center;
	padding: 0;
	transition: transform 180ms ease, box-shadow 180ms ease;
}

.zai-ai-chat-toggle:hover,
.zai-ai-chat-toggle:focus-visible {
	box-shadow: 0 22px 54px rgba(7, 20, 50, 0.46), 0 0 0 7px rgba(216, 185, 111, 0.18);
	outline: none;
	transform: translateY(-2px);
}

.zai-ai-chat-toggle-mark {
	font-size: 17px;
	font-weight: 700;
	line-height: 1;
}

.zai-ai-chat-panel {
	position: absolute;
	right: 0;
	bottom: 84px;
	width: min(390px, calc(100vw - 32px));
	height: min(640px, calc(100vh - 128px));
	min-height: 420px;
	border: 1px solid var(--zai-border);
	border-radius: 20px;
	background:
		linear-gradient(180deg, rgba(13, 31, 72, 0.96), rgba(7, 20, 50, 0.98)),
		var(--zai-navy);
	box-shadow: 0 26px 70px rgba(4, 11, 28, 0.42);
	display: grid;
	grid-template-rows: auto 1fr auto;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
	transform: translateY(14px) scale(0.98);
	transform-origin: bottom right;
	transition: opacity 180ms ease, transform 180ms ease;
}

.zai-ai-chat-widget.is-open .zai-ai-chat-panel {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0) scale(1);
}

.zai-ai-chat-header {
	align-items: center;
	background: rgba(255, 255, 255, 0.045);
	border-bottom: 1px solid rgba(216, 185, 111, 0.22);
	display: flex;
	justify-content: space-between;
	padding: 16px 18px;
}

.zai-ai-chat-brand {
	align-items: center;
	display: flex;
	gap: 12px;
	min-width: 0;
}

.zai-ai-chat-brand-mark {
	align-items: center;
	background: linear-gradient(145deg, var(--zai-gold), #f1dda5);
	border-radius: 50%;
	color: var(--zai-navy);
	display: inline-flex;
	flex: 0 0 auto;
	font-size: 17px;
	font-weight: 700;
	height: 38px;
	justify-content: center;
	width: 38px;
}

.zai-ai-chat-brand h2,
.zai-ai-chat-brand p {
	margin: 0;
	min-width: 0;
}

.zai-ai-chat-brand h2 {
	color: var(--zai-white);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.25;
}

.zai-ai-chat-brand p {
	color: var(--zai-muted);
	font-size: 12px;
	line-height: 1.5;
}

.zai-ai-chat-close {
	align-items: center;
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 50%;
	color: var(--zai-white);
	cursor: pointer;
	display: inline-flex;
	font-size: 24px;
	height: 34px;
	justify-content: center;
	line-height: 1;
	padding: 0;
	width: 34px;
}

.zai-ai-chat-close:hover,
.zai-ai-chat-close:focus-visible {
	border-color: rgba(216, 185, 111, 0.72);
	color: var(--zai-gold);
	outline: none;
}

.zai-ai-chat-messages {
	display: flex;
	flex-direction: column;
	gap: 12px;
	overflow-y: auto;
	padding: 18px;
	scrollbar-color: rgba(216, 185, 111, 0.65) rgba(255, 255, 255, 0.08);
}

.zai-ai-message {
	display: flex;
	max-width: 100%;
}

.zai-ai-message-user {
	justify-content: flex-end;
}

.zai-ai-message-assistant {
	justify-content: flex-start;
}

.zai-ai-message-bubble {
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.7;
	max-width: min(84%, 310px);
	overflow-wrap: anywhere;
	padding: 10px 13px;
	white-space: pre-wrap;
}

.zai-ai-message-user .zai-ai-message-bubble {
	background: var(--zai-gold);
	color: #071432;
	border-bottom-right-radius: 6px;
}

.zai-ai-message-assistant .zai-ai-message-bubble {
	background: rgba(255, 255, 255, 0.09);
	border: 1px solid rgba(255, 255, 255, 0.1);
	color: var(--zai-white);
	border-bottom-left-radius: 6px;
}

.zai-ai-message.is-error .zai-ai-message-bubble {
	border-color: rgba(255, 128, 128, 0.5);
	color: #ffd4d4;
}

.zai-ai-typing .zai-ai-message-bubble {
	align-items: center;
	display: inline-flex;
	gap: 9px;
	min-height: 40px;
}

.zai-ai-typing-label {
	color: var(--zai-muted);
	font-size: 12px;
}

.zai-ai-typing-dots {
	align-items: center;
	display: inline-flex;
	gap: 4px;
}

.zai-ai-typing-dots i {
	animation: zai-ai-dot 1s infinite ease-in-out;
	background: var(--zai-gold);
	border-radius: 50%;
	display: block;
	height: 5px;
	opacity: 0.42;
	width: 5px;
}

.zai-ai-typing-dots i:nth-child(2) {
	animation-delay: 120ms;
}

.zai-ai-typing-dots i:nth-child(3) {
	animation-delay: 240ms;
}

@keyframes zai-ai-dot {
	0%,
	80%,
	100% {
		opacity: 0.35;
		transform: translateY(0);
	}
	40% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

.zai-ai-chat-form {
	align-items: flex-end;
	background: rgba(255, 255, 255, 0.045);
	border-top: 1px solid rgba(216, 185, 111, 0.2);
	display: flex;
	gap: 10px;
	padding: 14px;
}

.zai-ai-chat-input {
	background: rgba(255, 255, 255, 0.94);
	border: 1px solid transparent;
	border-radius: 14px;
	color: #071432;
	flex: 1 1 auto;
	font-size: 14px;
	line-height: 1.55;
	max-height: 130px;
	min-height: 46px;
	outline: none;
	padding: 11px 13px;
	resize: none;
	width: 100%;
}

.zai-ai-chat-input:focus {
	border-color: var(--zai-gold);
	box-shadow: 0 0 0 3px rgba(216, 185, 111, 0.2);
}

.zai-ai-chat-send {
	align-items: center;
	background: var(--zai-gold);
	border: 0;
	border-radius: 50%;
	color: var(--zai-navy);
	cursor: pointer;
	display: inline-flex;
	flex: 0 0 auto;
	font-size: 19px;
	font-weight: 700;
	height: 46px;
	justify-content: center;
	padding: 0;
	width: 46px;
}

.zai-ai-chat-send:hover,
.zai-ai-chat-send:focus-visible {
	background: #e7cb85;
	outline: none;
}

.zai-ai-chat-form.is-sending .zai-ai-chat-send {
	cursor: wait;
	opacity: 0.72;
}

body.rtl .zai-ai-message-user .zai-ai-message-bubble,
.zai-ai-chat-widget[dir="rtl"] .zai-ai-message-user .zai-ai-message-bubble {
	border-bottom-left-radius: 6px;
	border-bottom-right-radius: 16px;
}

body.rtl .zai-ai-message-assistant .zai-ai-message-bubble,
.zai-ai-chat-widget[dir="rtl"] .zai-ai-message-assistant .zai-ai-message-bubble {
	border-bottom-left-radius: 16px;
	border-bottom-right-radius: 6px;
}

@media (max-width: 520px) {
	.zai-ai-chat-widget {
		bottom: 14px;
		left: 14px;
		right: 14px;
	}

	.zai-ai-chat-toggle {
		height: 60px;
		margin-inline-start: auto;
		width: 60px;
	}

	.zai-ai-chat-panel {
		bottom: 76px;
		height: min(620px, calc(100vh - 104px));
		min-height: 360px;
		width: 100%;
	}

	.zai-ai-chat-header {
		padding: 14px;
	}

	.zai-ai-chat-messages {
		padding: 14px;
	}

	.zai-ai-message-bubble {
		max-width: 90%;
	}
}
