/* AI Site Assistant — chat widget styles */

#asa-root {
	--asa-accent: #4f46e5;
	--asa-accent-contrast: #ffffff;
	--asa-bg: #ffffff;
	--asa-fg: #1f2433;
	--asa-muted: #6b7280;
	--asa-bot-bubble: #f1f3f9;
	--asa-border: #e6e8ef;
	--asa-radius: 18px;
	--asa-shadow: 0 18px 50px rgba(17, 24, 39, 0.18);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.asa-launcher {
	position: fixed;
	bottom: 22px;
	z-index: 999990;
	display: flex;
	align-items: center;
	gap: 10px;
	border: none;
	cursor: pointer;
	padding: 0;
	background: transparent;
}

.asa-pos-right { right: 22px; }
.asa-pos-left { left: 22px; }

.asa-launcher-btn {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--asa-accent);
	color: var(--asa-accent-contrast);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--asa-shadow);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	flex-shrink: 0;
	position: relative;
	animation: asa-attention 5s ease-in-out 1.5s infinite;
}
.asa-launcher-btn:hover { transform: translateY(-2px) scale(1.04); animation-play-state: paused; }
.asa-launcher-btn svg { width: 28px; height: 28px; position: relative; z-index: 1; }

/* expanding pulse ring to draw the eye */
.asa-launcher-btn::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--asa-accent);
	z-index: 0;
	animation: asa-pulse-ring 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes asa-pulse-ring {
	0% { transform: scale(1); opacity: 0.5; }
	70% { transform: scale(1.9); opacity: 0; }
	100% { transform: scale(1.9); opacity: 0; }
}

/* periodic gentle wiggle (idle most of the cycle) */
@keyframes asa-attention {
	0%, 84%, 100% { transform: translateY(0) rotate(0deg); }
	87% { transform: translateY(-7px) rotate(-9deg); }
	89% { transform: translateY(0) rotate(8deg); }
	91% { transform: translateY(-5px) rotate(-6deg); }
	93% { transform: translateY(0) rotate(4deg); }
	95% { transform: translateY(-2px) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
	.asa-launcher-btn { animation: none; }
	.asa-launcher-btn::before { animation: none; }
}

.asa-teaser {
	max-width: 230px;
	background: var(--asa-bg);
	color: var(--asa-fg);
	border: 1px solid var(--asa-border);
	border-radius: 14px;
	padding: 10px 13px;
	font-size: 13.5px;
	line-height: 1.4;
	box-shadow: var(--asa-shadow);
	position: relative;
	animation: asa-pop 0.35s ease;
}
.asa-pos-left .asa-teaser { order: 2; }
.asa-teaser-close {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 20px; height: 20px;
	border-radius: 50%;
	border: none;
	background: #111827;
	color: #fff;
	font-size: 12px;
	cursor: pointer;
	line-height: 1;
}

@keyframes asa-pop {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Panel */
.asa-panel {
	position: fixed;
	bottom: 22px;
	z-index: 999991;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 580px;
	max-height: calc(100vh - 44px);
	background: var(--asa-bg);
	border-radius: 20px;
	box-shadow: var(--asa-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--asa-border);
	animation: asa-slide 0.22s ease;
}
.asa-panel.asa-pos-right { right: 22px; }
.asa-panel.asa-pos-left { left: 22px; }

@keyframes asa-slide {
	from { opacity: 0; transform: translateY(16px); }
	to { opacity: 1; transform: translateY(0); }
}

.asa-header {
	background: var(--asa-accent);
	color: var(--asa-accent-contrast);
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.asa-header-title { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 9px; }
.asa-status-dot { width: 9px; height: 9px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(255,255,255,0.25); }
.asa-close { background: transparent; border: none; color: inherit; cursor: pointer; opacity: 0.85; padding: 4px; }
.asa-close:hover { opacity: 1; }
.asa-close svg { width: 20px; height: 20px; }

.asa-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #fafbfd;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.asa-msg { display: flex; max-width: 88%; }
.asa-msg-bot { align-self: flex-start; }
.asa-msg-user { align-self: flex-end; }
.asa-bubble {
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14.5px;
	line-height: 1.5;
	word-wrap: break-word;
	white-space: pre-wrap;
}
.asa-msg-bot .asa-bubble { background: var(--asa-bot-bubble); color: var(--asa-fg); border-bottom-left-radius: 5px; }
.asa-msg-user .asa-bubble { background: var(--asa-accent); color: var(--asa-accent-contrast); border-bottom-right-radius: 5px; }
.asa-bubble a { color: inherit; text-decoration: underline; }
.asa-msg-bot .asa-bubble a { color: var(--asa-accent); }

/* product cards */
.asa-products { display: flex; flex-direction: column; gap: 8px; align-self: flex-start; max-width: 88%; }
.asa-products-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--asa-muted); margin: 2px 0; }
.asa-product {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	background: #fff; border: 1px solid var(--asa-border); border-radius: 12px;
	padding: 10px 12px; font-size: 13.5px; color: var(--asa-fg); text-decoration: none;
	transition: border-color 0.15s ease, transform 0.15s ease;
}
.asa-product:hover { border-color: var(--asa-accent); transform: translateX(2px); }
.asa-product span { font-weight: 500; }
.asa-product em { color: var(--asa-accent); font-style: normal; font-weight: 600; white-space: nowrap; }

/* typing indicator */
.asa-typing { display: flex; gap: 4px; padding: 12px 14px; background: var(--asa-bot-bubble); border-radius: 16px; border-bottom-left-radius: 5px; align-self: flex-start; }
.asa-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa3b2; animation: asa-blink 1.2s infinite ease-in-out; }
.asa-typing span:nth-child(2) { animation-delay: 0.2s; }
.asa-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes asa-blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

/* inline forms */
.asa-form {
	background: #fff; border: 1px solid var(--asa-border); border-radius: 14px;
	padding: 13px; display: flex; flex-direction: column; gap: 9px; align-self: flex-start; width: 88%;
}
.asa-form-title { font-weight: 600; font-size: 14px; color: var(--asa-fg); }
.asa-form input, .asa-form textarea {
	width: 100%; box-sizing: border-box; border: 1px solid var(--asa-border);
	border-radius: 9px; padding: 9px 11px; font-size: 14px; font-family: inherit; color: var(--asa-fg);
	background: #fff;
}
.asa-form textarea { resize: vertical; min-height: 64px; }
.asa-form input:focus, .asa-form textarea:focus { outline: none; border-color: var(--asa-accent); }
.asa-form-submit {
	background: var(--asa-accent); color: var(--asa-accent-contrast); border: none;
	border-radius: 9px; padding: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.asa-form-submit:disabled { opacity: 0.6; cursor: default; }
.asa-form-error { color: #dc2626; font-size: 12.5px; }
.asa-form-done { color: #059669; font-size: 13.5px; font-weight: 500; }

/* footer input */
.asa-footer { border-top: 1px solid var(--asa-border); padding: 12px; background: #fff; }
.asa-input-row { display: flex; gap: 8px; align-items: flex-end; }
.asa-input {
	flex: 1; resize: none; border: 1px solid var(--asa-border); border-radius: 12px;
	padding: 10px 13px; font-size: 14.5px; font-family: inherit; max-height: 110px; line-height: 1.4;
	color: var(--asa-fg); background: #fff;
}
.asa-input:focus { outline: none; border-color: var(--asa-accent); }
.asa-send {
	width: 42px; height: 42px; flex-shrink: 0; border: none; border-radius: 50%;
	background: var(--asa-accent); color: var(--asa-accent-contrast); cursor: pointer;
	display: flex; align-items: center; justify-content: center;
}
.asa-send:disabled { opacity: 0.5; cursor: default; }
.asa-send svg { width: 19px; height: 19px; }
.asa-credit { text-align: center; font-size: 10.5px; color: var(--asa-muted); margin-top: 7px; }

@media (max-width: 480px) {
	.asa-panel,
	.asa-panel.asa-pos-right,
	.asa-panel.asa-pos-left {
		left: 12px;
		right: 12px;
		bottom: 12px;
		width: auto;
		max-width: none;
		height: 72vh;
		max-height: 560px;
		min-height: 380px;
		border-radius: 18px;
	}
	.asa-teaser { max-width: calc(100vw - 110px); padding: 9px 11px; }
}

/* suggestions marquee */
.asa-suggest {
	background: #fff;
	border-bottom: 1px solid var(--asa-border);
	padding: 9px 0;
	overflow: hidden;
	position: relative;
	-webkit-mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
	mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.asa-suggest-track {
	display: flex;
	gap: 8px;
	width: max-content;
	padding: 0 12px;
	animation: asa-marquee 22s linear infinite;
}
.asa-suggest:hover .asa-suggest-track { animation-play-state: paused; }
@keyframes asa-marquee {
	from { transform: translateX(0); }
	to { transform: translateX(-50%); }
}
.asa-chip {
	flex: 0 0 auto;
	background: var(--asa-bot-bubble);
	color: var(--asa-fg);
	border: 1px solid var(--asa-border);
	border-radius: 999px;
	padding: 7px 14px;
	font-size: 13px;
	font-family: inherit;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s ease, border-color 0.15s ease;
}
.asa-chip:hover { background: var(--asa-accent); color: var(--asa-accent-contrast); border-color: var(--asa-accent); }

/* rating */
.asa-rating .asa-stars { display: flex; gap: 6px; justify-content: center; margin: 4px 0 2px; }
.asa-star {
	background: none; border: none; cursor: pointer; font-size: 30px; line-height: 1;
	color: #d6d9e0; padding: 0; transition: color 0.12s ease, transform 0.12s ease;
}
.asa-star:hover { transform: scale(1.12); }
.asa-star.on { color: #f5b50a; }

@media (prefers-reduced-motion: reduce) {
	.asa-suggest-track { animation: none; flex-wrap: wrap; width: auto; }
	.asa-suggest { mask-image: none; -webkit-mask-image: none; }
}
