/* Supportivo AI sales chat widget — floating bubble + panel */

.chat-widget {
	position: fixed;
	z-index: 9999;
	right: 24px;
	bottom: calc(24px + var(--cookie-banner-offset, 0px));
}

.chat-widget__toggle {
	position: fixed;
	right: 24px;
	bottom: calc(24px + var(--cookie-banner-offset, 0px));
	z-index: 9999;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	background: var(--accent);
	color: #fff;
	box-shadow: var(--shadow-lg);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .18s ease, transform .18s ease;
}

.chat-widget__toggle:hover {
	background: var(--accent-dark);
}

.chat-widget__toggle:focus-visible {
	outline: 2px solid var(--accent-dark);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
	.chat-widget__toggle:hover {
		transform: scale(1.05);
	}
}

.chat-widget__toggle svg {
	width: 26px;
	height: 26px;
}

.chat-widget__toggle-icon-close {
	display: none;
}

.chat-widget__toggle.is-open .chat-widget__toggle-icon-open {
	display: none;
}

.chat-widget__toggle.is-open .chat-widget__toggle-icon-close {
	display: block;
}

.chat-widget__panel {
	position: fixed;
	right: 24px;
	bottom: calc(96px + var(--cookie-banner-offset, 0px));
	z-index: 9999;
	width: 360px;
	height: 500px;
	max-height: calc(100dvh - 120px - var(--cookie-banner-offset, 0px));
	background: var(--paper-2);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font-family: var(--font);
}

.chat-widget__panel[hidden] {
	display: none;
}

@media (prefers-reduced-motion: no-preference) {
	.chat-widget__panel {
		animation: chat-widget-in .22s cubic-bezier(.2,.7,.2,1);
		transform-origin: bottom right;
	}
}

@keyframes chat-widget-in {
	from { opacity: 0; transform: scale(.94) translateY(8px); }
	to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 480px) {
	.chat-widget__panel {
		right: 0;
		bottom: 0;
		width: 100vw;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
	}
}

.chat-widget__header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 18px;
	background: var(--accent);
	color: #fff;
}

.chat-widget__title {
	font-weight: 700;
	font-size: 15px;
	letter-spacing: -0.01em;
}

.chat-widget__close {
	background: transparent;
	border: none;
	color: #fff;
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	opacity: .85;
	transition: background .15s ease, opacity .15s ease;
}

.chat-widget__close:hover {
	background: rgba(255, 255, 255, .18);
	opacity: 1;
}

.chat-widget__close svg {
	width: 16px;
	height: 16px;
}

.chat-widget__messages {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--panel);
}

.chat-widget__msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.5;
	white-space: pre-line;
	word-break: break-word;
}

.chat-widget__msg--user {
	align-self: flex-end;
	background: var(--accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.chat-widget__msg--bot {
	align-self: flex-start;
	background: var(--paper-2);
	color: var(--ink);
	border: 1px solid var(--grey-2);
	border-bottom-left-radius: 4px;
}

.chat-widget__msg--error {
	align-self: flex-start;
	background: rgba(176, 65, 62, .1);
	color: var(--danger);
	border: 1px solid rgba(176, 65, 62, .25);
	border-bottom-left-radius: 4px;
}

.chat-widget__msg a {
	color: inherit;
	text-decoration: underline;
}

.chat-widget__typing {
	align-self: flex-start;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 12px 14px;
	border-radius: 14px;
	border-bottom-left-radius: 4px;
	background: var(--paper-2);
	border: 1px solid var(--grey-2);
}

.chat-widget__typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--muted);
	display: inline-block;
}

@media (prefers-reduced-motion: no-preference) {
	.chat-widget__typing span {
		animation: chat-widget-bounce 1.2s ease-in-out infinite;
	}
	.chat-widget__typing span:nth-child(2) { animation-delay: .15s; }
	.chat-widget__typing span:nth-child(3) { animation-delay: .3s; }
}

@keyframes chat-widget-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: .5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.chat-widget__input-row {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px;
	background: var(--paper-2);
	border-top: 1px solid var(--grey-2);
}

.chat-widget__input {
	flex: 1 1 auto;
	width: 100%;
	padding: 11px 14px;
	border: 1px solid var(--grey-2);
	border-radius: 999px;
	font: inherit;
	font-size: 14px;
	background: var(--paper-2);
	color: var(--ink);
	transition: border-color .2s ease, box-shadow .2s ease;
}

.chat-widget__input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(122, 68, 161, .15);
}

.chat-widget__send {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: var(--accent);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s ease;
}

.chat-widget__send:hover {
	background: var(--accent-dark);
}

.chat-widget__send:disabled {
	background: var(--grey);
	cursor: default;
}

.chat-widget__send svg {
	width: 18px;
	height: 18px;
}
