#ksac-chat-widget {
	--ksac-background: #ffffff;
	--ksac-header: #4f67f6;
	--ksac-header-accent: #6a9efb;
	--ksac-user: #4c6ef5;
	--ksac-bot: #eff2ff;

	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 9999;
}

#ksac-chat-widget,
#ksac-chat-widget * {
	box-sizing: border-box;
	font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

#ksac-chat-widget .ksac-chat-toggle {
	background-color: var(--ksac-header);
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 12px 20px;
	cursor: pointer;
	box-shadow: 0 10px 20px rgba(15, 23, 42, 0.25);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	font-size: 15px;
	display: flex;
	align-items: center;
	gap: 8px;
}

#ksac-chat-widget .ksac-chat-toggle__label {
	font-weight: 600;
}

#ksac-chat-widget.ksac-chat-widget--open .ksac-chat-toggle {
	transform: translateY(10px);
	box-shadow: 0 15px 25px rgba(15, 23, 42, 0.3);
}

#ksac-chat-widget .ksac-chat-window {
	position: absolute;
	right: 0;
	bottom: 72px;
	width: 380px;
	max-height: 560px;
	display: flex;
	flex-direction: column;
	background-color: var(--ksac-background);
	border-radius: 20px;
	box-shadow: 0 20px 55px rgba(15, 23, 42, 0.35);
	opacity: 0;
	pointer-events: none;
	transform: translateY(20px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	overflow: hidden;
}

#ksac-chat-widget .ksac-quick-replies {
	display: none;
	flex-direction: column;
	align-items: flex-end;
	justify-content: flex-start;
	gap: 10px;
	padding: 12px;
	background: transparent;
	border: none;
	width: 100%;
	text-align: right;
	margin-top: 6px;
}

#ksac-chat-widget .ksac-quick-reply {
	border: 1px solid #cbd5e1;
	background: #fff;
	color: #0f172a;
	padding: 9px 14px;
	border-radius: 18px;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
	box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
	align-self: flex-end;
	max-width: 220px;
	text-align: center;
	margin-left: auto;
}

#ksac-chat-widget .ksac-quick-reply:hover {
	background: #f8fafc;
	border-color: #d5ddeb;
	box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

#ksac-chat-widget .ksac-start-card {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 20px;
}

#ksac-chat-widget .ksac-start-card__body {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 14px;
	padding: 20px;
	max-width: 320px;
	text-align: center;
	box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

#ksac-chat-widget .ksac-start-card__title {
	font-weight: 700;
	font-size: 16px;
	margin-bottom: 6px;
	color: #0f172a;
}

#ksac-chat-widget .ksac-start-card__text {
	margin: 0 0 16px;
	color: #475569;
	font-size: 14px;
}

#ksac-chat-widget .ksac-start-card__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 16px;
	border-radius: 10px;
	border: none;
	background: linear-gradient(135deg, var(--ksac-header-accent), var(--ksac-header));
	color: #fff;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(79, 103, 246, 0.35);
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}

#ksac-chat-widget .ksac-start-card__btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 14px 32px rgba(79, 103, 246, 0.45);
}


#ksac-chat-widget.ksac-chat-widget--open .ksac-chat-window {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
}

#ksac-chat-widget .ksac-chat-header {
	background: linear-gradient(135deg, var(--ksac-header), var(--ksac-header-accent));
	color: #fff;
	padding: 8px 20px 20px;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
}

#ksac-chat-widget .ksac-chat-header__branding {
	display: flex;
	align-items: center;
	gap: 12px;
}

#ksac-chat-widget .ksac-chat-header__avatar {
	width: 48px;
	height: 48px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

#ksac-chat-widget .ksac-chat-header__avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 10px;
}

#ksac-chat-widget .ksac-chat-header__text {
	display: flex;
	flex-direction: column;
}

#ksac-chat-widget .ksac-chat-header__subtitle {
	font-size: 13px;
	opacity: 0.9;
	margin-bottom: 2px;
}

#ksac-chat-widget .ksac-chat-header__title {
	font-size: 20px;
	line-height: 1.2;
}

#ksac-chat-widget .ksac-chat-close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 22px;
	cursor: pointer;
	padding: 6px;
}

#ksac-chat-widget .ksac-chat-messages {
	flex: 1;
	padding: 20px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #f6f7fb;
}

#ksac-chat-widget .ksac-chat-message {
	display: flex;
	gap: 8px;
	align-items: flex-start;
}

#ksac-chat-widget .ksac-chat-message__avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	overflow: hidden;
	flex-shrink: 0;
	box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

#ksac-chat-widget .ksac-chat-message__avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

#ksac-chat-widget .ksac-chat-message__body {
	padding: 12px 16px;
	border-radius: 18px;
	max-width: 360px;
	font-size: 14px;
	line-height: 1.5;
	background: #fff;
	box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

#ksac-chat-widget .ksac-chat-message__time {
	margin-top: 6px;
	font-size: 11px;
	color: #94a3b8;
	text-align: right;
}

#ksac-chat-widget .ksac-chat-message--user {
	justify-content: flex-end;
}

#ksac-chat-widget .ksac-chat-message--user .ksac-chat-message__body {
	background-color: var(--ksac-user);
	color: #fff;
	margin-left: auto;
}

#ksac-chat-widget .ksac-chat-message--assistant .ksac-chat-message__body {
	background-color: var(--ksac-bot);
	color: #0f172a;
}

#ksac-chat-widget .ksac-chat-item {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	margin-bottom: 6px;
}

#ksac-chat-widget .ksac-chat-item--user {
	align-items: flex-end;
}

#ksac-chat-widget .ksac-chat-item {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
}

#ksac-chat-widget .ksac-chat-item--user {
	align-items: flex-end;
}

#ksac-chat-widget .ksac-chat-message--system {
	font-size: 12px;
	text-align: center;
	color: #64748b;
	width: 100%;
}

#ksac-chat-widget .ksac-chat-time {
	display: none;
}

#ksac-chat-widget .ksac-chat-time {
	font-size: 11px;
	color: #94a3b8;
}

#ksac-chat-widget .ksac-chat-time--user {
	text-align: right;
}

#ksac-chat-widget .ksac-chat-time--assistant {
	text-align: left;
}

#ksac-chat-widget .ksac-chat-typing {
	opacity: 0.9;
}

#ksac-chat-widget .ksac-chat-typing__bubble {
	background-color: var(--ksac-bot);
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 70px;
}

#ksac-chat-widget .ksac-typing-dots {
	display: inline-flex;
	gap: 6px;
	align-items: center;
	justify-content: center;
}

#ksac-chat-widget .ksac-typing-dots span {
	display: block;
	width: 8px;
	height: 8px;
	border-radius: 999px;
	background: #475569;
	animation: ksac-typing 1.2s infinite ease-in-out;
}

#ksac-chat-widget .ksac-typing-dots span:nth-child(2) {
	animation-delay: 0.15s;
}

#ksac-chat-widget .ksac-typing-dots span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes ksac-typing {
	0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
	40% { transform: scale(1); opacity: 1; }
}

#ksac-chat-widget .ksac-chat-input {
	padding: 18px 20px 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fff;
}

#ksac-chat-widget .ksac-chat-input__actions {
	font-size: 12px;
	color: #94a3b8;
	min-height: 16px;
}

#ksac-chat-widget .ksac-chat-input__composer {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #f0f2ff;
	border-radius: 16px;
	padding: 10px 12px;
	border: 1px solid #dfe1f5;
}

#ksac-chat-widget .ksac-emoji-picker {
	position: relative;
	display: flex;
	align-items: center;
}

#ksac-chat-widget .ksac-emoji-toggle {
	border: none;
	background: transparent;
	color: #6b7280;
	padding: 4px;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: color 0.15s ease, transform 0.1s ease;
}

#ksac-chat-widget .ksac-emoji-toggle:hover,
#ksac-chat-widget .ksac-emoji-toggle:focus {
	color: #4b5563;
	transform: translateY(-1px);
}

#ksac-chat-widget .ksac-emoji-panel[hidden] {
	display: none !important;
}

#ksac-chat-widget .ksac-emoji-panel {
	position: absolute;
	bottom: 46px;
	left: 0;
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 6px;
	background: #fff;
	border: 1px solid #dfe1f5;
	border-radius: 12px;
	padding: 8px;
	box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
	z-index: 10;
}

#ksac-chat-widget .ksac-emoji-item {
	border: none;
	background: #f8f9ff;
	border-radius: 8px;
	cursor: pointer;
	font-size: 18px;
	padding: 6px;
	transition: background 0.15s ease;
}

#ksac-chat-widget .ksac-emoji-item:hover,
#ksac-chat-widget .ksac-emoji-item:focus {
	background: #e8ecff;
}

#ksac-chat-widget .ksac-chat-input textarea {
	resize: none;
	min-height: 50px;
	border-radius: 12px;
	border: none;
	background: transparent;
	padding: 0 8px;
	font-size: 14px;
	width: 100%;
	font-family: inherit;
	color: #0f172a;
}

#ksac-chat-widget .ksac-chat-input textarea:focus {
	outline: none;
}

#ksac-chat-widget .ksac-chat-send {
	background: linear-gradient(135deg, var(--ksac-header-accent), var(--ksac-header));
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 0;
	cursor: pointer;
	box-shadow: 0 8px 20px rgba(79, 103, 246, 0.35);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	flex-shrink: 0;
	height: 48px;
	width: 48px;
}

#ksac-chat-widget .ksac-chat-send svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: #fff;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

#ksac-chat-widget .ksac-chat-footer {
	padding: 10px 20px 20px;
	background: #f6f7fb;
	font-size: 12px;
	color: #94a3b8;
	text-align: center;
}

@media (max-width: 600px) {
	#ksac-chat-widget {
		right: 16px;
		bottom: 16px;
	}

	#ksac-chat-widget .ksac-chat-window {
		width: calc(100vw - 32px);
		max-height: calc(100vh - 120px);
	}
}
