.sparkchat-widget {
	position: fixed;
	bottom: var(--sparkchat-offset-y, 20px);
	z-index: 999999;
	display: flex;
	flex-direction: column;
	align-items: center;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.sparkchat-pos-right { right: var(--sparkchat-offset-x, 20px); align-items: flex-end; }
.sparkchat-pos-left  { left: var(--sparkchat-offset-x, 20px); align-items: flex-start; }

.sparkchat-items {
	display: flex;
	flex-direction: column;
	align-items: inherit;
	gap: 10px;
	margin-bottom: 12px;
	opacity: 0;
	transform: translateY(10px) scale(.95);
	pointer-events: none;
	transition: opacity .18s ease, transform .18s ease;
}

.sparkchat-widget.sparkchat-open .sparkchat-items {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.sparkchat-item {
	position: relative;
	width: var(--sparkchat-icon-size, 30px);
	height: var(--sparkchat-icon-size, 30px);
	padding: 9px;
	border-radius: 50%;
	background: #fff;
	color: var(--sparkchat-item-color, #333);
	box-shadow: 0 4px 14px rgba(0,0,0,.18);
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	transition: transform .15s ease, box-shadow .15s ease;
	transition-delay: var(--sparkchat-item-delay, 0s);
}

.sparkchat-item:hover {
	transform: scale(1.1);
	box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

.sparkchat-item-icon { width: 100%; height: 100%; display: flex; }
.sparkchat-item-icon svg { width: 100%; height: 100%; }

.sparkchat-tooltip {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: #1f1f1f;
	color: #fff;
	font-size: 12.5px;
	line-height: 1.2;
	padding: 6px 10px;
	border-radius: 6px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s ease;
}

.sparkchat-item:hover .sparkchat-tooltip { opacity: 1; }

.sparkchat-tooltip-left .sparkchat-tooltip { right: calc(100% + 10px); }
.sparkchat-tooltip-right .sparkchat-tooltip { left: calc(100% + 10px); }

.sparkchat-panel {
	width: 320px;
	max-width: calc(100vw - 32px);
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 12px 32px rgba(0,0,0,.22);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.sparkchat-panel-header {
	padding: 16px 18px;
	color: #fff;
}
.sparkchat-panel-header strong { display: block; font-size: 15px; }
.sparkchat-panel-header span { font-size: 12.5px; opacity: .9; }

.sparkchat-chat { display: flex; flex-direction: column; border-bottom: 1px solid #eee; }

.sparkchat-chat-messages {
	max-height: 240px;
	min-height: 90px;
	overflow-y: auto;
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: #f7f7fa;
}

.sparkchat-msg {
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 13.5px;
	line-height: 1.4;
	word-wrap: break-word;
}
.sparkchat-msg-bot {
	align-self: flex-start;
	background: #fff;
	color: #222;
	border: 1px solid #ececef;
	border-bottom-left-radius: 3px;
}
.sparkchat-msg-user {
	align-self: flex-end;
	background: var(--sparkchat-main-color, #6C3CE0);
	color: #fff;
	border-bottom-right-radius: 3px;
}

.sparkchat-chat-typing {
	display: flex;
	gap: 4px;
	padding: 0 14px 8px;
	background: #f7f7fa;
}
.sparkchat-chat-typing span {
	width: 6px; height: 6px; border-radius: 50%;
	background: #b3b3bd;
	animation: sparkchat-typing 1s infinite ease-in-out;
}
.sparkchat-chat-typing span:nth-child(2) { animation-delay: .15s; }
.sparkchat-chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes sparkchat-typing {
	0%, 60%, 100% { transform: translateY(0); opacity: .5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.sparkchat-chat-form { display: flex; gap: 8px; padding: 10px 12px; }
.sparkchat-chat-input {
	flex: 1;
	border: 1px solid #ddd;
	border-radius: 20px;
	padding: 8px 14px;
	font-size: 13.5px;
	outline: none;
}
.sparkchat-chat-input:focus { border-color: var(--sparkchat-main-color, #6C3CE0); }
.sparkchat-chat-send {
	width: 36px; height: 36px; border-radius: 50%;
	border: none; background: var(--sparkchat-main-color, #6C3CE0); color: #fff;
	display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.sparkchat-chat-send svg { width: 16px; height: 16px; }

.sparkchat-lead { border-bottom: 1px solid #eee; }
.sparkchat-lead-toggle {
	width: 100%;
	text-align: left;
	background: #fbfbfd;
	border: none;
	padding: 12px 16px;
	font-size: 13px;
	cursor: pointer;
	color: #333;
}
.sparkchat-lead-toggle:hover { background: #f2f2f6; }

.sparkchat-lead-form {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 4px 16px 14px;
}
.sparkchat-lead-form input,
.sparkchat-lead-form textarea {
	border: 1px solid #ddd;
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 13px;
	font-family: inherit;
	outline: none;
	resize: vertical;
}
.sparkchat-lead-form input:focus,
.sparkchat-lead-form textarea:focus { border-color: var(--sparkchat-main-color, #6C3CE0); }

.sparkchat-lead-submit {
	border: none;
	background: var(--sparkchat-main-color, #6C3CE0);
	color: #fff;
	padding: 9px 14px;
	border-radius: 8px;
	font-size: 13px;
	cursor: pointer;
}
.sparkchat-lead-submit:disabled { opacity: .7; cursor: default; }

.sparkchat-lead-status { font-size: 12px; margin: 2px 0 0; min-height: 14px; }
.sparkchat-lead-success { color: #1a8a4c; }
.sparkchat-lead-error { color: #c0392b; }

.sparkchat-panel-icons { padding: 12px 16px 16px; }
.sparkchat-panel-icons-label { font-size: 11.5px; color: #888; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.sparkchat-panel-icons-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sparkchat-panel-icons-row .sparkchat-item {
	position: relative;
	width: 34px; height: 34px; padding: 8px;
	box-shadow: 0 2px 8px rgba(0,0,0,.14);
}

.sparkchat-has-panel .sparkchat-items { align-items: stretch; }

.sparkchat-credit {
	font-size: 10.5px;
	color: rgba(90,90,90,.85);
	background: rgba(255,255,255,.9);
	padding: 3px 8px;
	border-radius: 10px;
	text-decoration: none;
	box-shadow: 0 2px 8px rgba(0,0,0,.12);
	margin-top: 2px;
}
.sparkchat-credit:hover { color: #333; }

.sparkchat-toggle {
	width: var(--sparkchat-btn-size, 60px);
	height: var(--sparkchat-btn-size, 60px);
	border-radius: 50%;
	background: var(--sparkchat-main-color, #25D366);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 6px 18px rgba(0,0,0,.28);
	color: #fff;
	position: relative;
}

.sparkchat-toggle-icon {
	position: absolute;
	width: 55%;
	height: 55%;
	display: flex;
	transition: opacity .15s ease, transform .2s ease;
}
.sparkchat-toggle-icon svg { width: 100%; height: 100%; }

.sparkchat-icon-close { opacity: 0; transform: rotate(-45deg) scale(.6); }
.sparkchat-icon-open  { opacity: 1; transform: rotate(0) scale(1); }

.sparkchat-widget.sparkchat-open .sparkchat-icon-open  { opacity: 0; transform: rotate(45deg) scale(.6); }
.sparkchat-widget.sparkchat-open .sparkchat-icon-close { opacity: 1; transform: rotate(0) scale(1); }

.sparkchat-anim-pulse::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--sparkchat-main-color, #25D366);
	animation: sparkchat-pulse 2.2s ease-out infinite;
	z-index: -1;
}
.sparkchat-widget.sparkchat-open .sparkchat-anim-pulse::before { animation: none; }

@keyframes sparkchat-pulse {
	0%   { transform: scale(1); opacity: .55; }
	100% { transform: scale(1.9); opacity: 0; }
}

.sparkchat-anim-shake { animation: sparkchat-shake 4.5s ease-in-out infinite; }
.sparkchat-widget.sparkchat-open .sparkchat-anim-shake { animation: none; }

@keyframes sparkchat-shake {
	0%, 88%, 100% { transform: rotate(0); }
	89% { transform: rotate(-8deg); }
	90% { transform: rotate(8deg); }
	91% { transform: rotate(-6deg); }
	92% { transform: rotate(6deg); }
	93% { transform: rotate(0); }
}

@media (max-width: 480px) {
	:root { }
	.sparkchat-widget { bottom: max(12px, var(--sparkchat-offset-y, 20px)); }
}
