/* SmartPlus Agent chat widget */
.spa-widget {
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 2147483600;
	font-family: var(--sp-font-main, "Noto Sans Georgian", "BPG Arial", "Segoe UI", system-ui, sans-serif);
}
.spa-widget__bubble {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: 0;
	background: #1773ea;
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 20px rgba(23, 115, 234, .35);
	cursor: pointer;
	transition: transform .15s ease;
}
.spa-widget__bubble:hover { transform: scale(1.05); }
.spa-widget__panel {
	position: absolute;
	right: 0;
	bottom: 70px;
	width: min(360px, calc(100vw - 36px));
	height: min(520px, calc(100vh - 100px));
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 20px 60px rgba(15, 23, 42, .18);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid #e2e8f0;
}
/* HTML `hidden` attribute must beat `display: flex` above — keep panel closed on initial load */
.spa-widget__panel[hidden] {
	display: none !important;
}
.spa-widget__head {
	padding: 12px 14px;
	background: linear-gradient(135deg, #1773ea, #1058b8);
	color: #fff;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.spa-widget__head-actions {
	display: inline-flex;
	gap: 4px;
	align-items: center;
}
.spa-widget__close,
.spa-widget__reset {
	background: transparent;
	border: 0;
	color: #fff;
	cursor: pointer;
	line-height: 1;
	padding: 4px 8px;
	border-radius: 6px;
	transition: background .15s ease;
}
.spa-widget__close { font-size: 22px; }
.spa-widget__reset { font-size: 16px; font-weight: 600; }
.spa-widget__close:hover,
.spa-widget__reset:hover { background: rgba(255, 255, 255, .18); }
.spa-widget__log {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	background: #f7fafc;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.spa-msg-bubble {
	max-width: 80%;
	padding: 8px 12px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.4;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.spa-msg-bubble--bot { background: #fff; border: 1px solid #e2e8f0; align-self: flex-start; }
.spa-msg-bubble--me  { background: #1773ea; color: #fff; align-self: flex-end; }

/* Animated 3-dot typing indicator — same pattern as Messenger / iMessage */
.spa-msg-bubble--typing {
	background: #fff;
	border: 1px solid #e2e8f0;
	align-self: flex-start;
	display: inline-flex !important;
	gap: 5px;
	padding: 14px 16px;
	min-width: 52px;
	align-items: center;
	justify-content: center;
	max-width: none;
}
.spa-msg-bubble--typing .spa-dot {
	display: inline-block !important;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #1773ea;
	will-change: transform, opacity;
	animation-name: spa-typing-bounce;
	animation-duration: 1.2s;
	animation-iteration-count: infinite;
	animation-timing-function: ease-in-out;
	animation-fill-mode: both;
}
.spa-msg-bubble--typing .spa-dot:nth-child(1) { animation-delay: 0s;    }
.spa-msg-bubble--typing .spa-dot:nth-child(2) { animation-delay: 0.18s; }
.spa-msg-bubble--typing .spa-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes spa-typing-bounce {
	0%, 60%, 100% { transform: translateY(0);    opacity: 0.35; }
	30%           { transform: translateY(-7px); opacity: 1;    }
}

.spa-widget__form {
	display: flex;
	gap: 6px;
	padding: 10px;
	border-top: 1px solid #e2e8f0;
	background: #fff;
}
.spa-widget__input {
	flex: 1;
	border: 1px solid #cbd5e1;
	border-radius: 10px;
	padding: 10px 12px;
	font: inherit;
	font-size: 14px;
}
.spa-widget__input:focus {
	outline: none;
	border-color: #1773ea;
}
.spa-widget__send {
	background: #1773ea;
	color: #fff;
	border: 0;
	border-radius: 10px;
	width: 42px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.spa-widget__send:hover { background: #1058b8; }

@media (max-width: 480px) {
	.spa-widget { right: 10px; bottom: 10px; }
	.spa-widget__panel { right: 0; bottom: 64px; }
}
