#phs-ai-widget {
	position: fixed;
	z-index: 999999;
	font-family: Arial, sans-serif;
}

#phs-ai-toggle {
	position: fixed;
	right: 24px;
	bottom: 24px;
	width: auto;
	min-height: 54px;
	padding: 0 20px 0 16px;
	display: flex;
	align-items: center;
	gap: 10px;
	border: 0;
	border-radius: 50px;
	background: #1476d4;
	color: #fff;
	font: 700 14px Arial, sans-serif;
	cursor: pointer;
	box-shadow: 0 4px 18px rgba(0,0,0,.2);
	transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}

#phs-ai-toggle:hover {
	background: #0f5eaa;
	box-shadow: 0 6px 24px rgba(20,118,212,.3);
	transform: translateY(-2px);
}

#phs-ai-toggle::before {
	content: '\2022\2022\2022';
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 23px;
	background: #fff;
	color: #1476d4;
	border-radius: 9px;
	font-size: 14px;
	letter-spacing: 1px;
	line-height: 1;
}

#phs-ai-toggle::after {
	content: '';
	width: 8px;
	height: 8px;
	flex-shrink: 0;
	background: #43d98b;
	border-radius: 50%;
	box-shadow: 0 0 0 3px rgba(67,217,139,.2);
}

#phs-ai-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(11, 24, 39, .48);
}

section#phs-ai-window {
	position: fixed;
	right: 24px;
	bottom: 96px;
	width: min(420px, calc(100vw - 32px));
	height: min(620px, calc(100vh - 128px));
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 10px 40px rgba(0,0,0,.2);
	display: flex !important;
	flex-direction: column;
	overflow: hidden;
}

#phs-ai-window.phs-ai-hidden {
	display: none !important;
}

.phs-ai-hidden {
	display: none !important;
}

.phs-ai-header {
	padding: 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid #eee;
	background: #1476d4;
	color: #fff;
	position: sticky;
	top: 0;
	box-shadow: 0 5px 5px rgba(100, 100, 100, 0.5);
}

.phs-ai-header small {
	display: block;
	margin-top: 4px;
	opacity: .85;
}

#phs-ai-close {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
}

#phs-ai-messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 16px;
	background: #f5f7fa;
}

.phs-message {
	width: fit-content;
	max-width: 85%;
	margin-bottom: 12px;
	padding: 10px 13px;
	border-radius: 14px;
	line-height: 1.45;
	word-break: break-word;
}

.phs-message-user {
	margin-left: auto;
	background: #1476d4;
	color: #fff;
}

.phs-message-assistant {
	margin-right: auto;
	background: #fff;
	color: #263238;
	box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

#phs-ai-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #eee;
	background: #fff;
}

#phs-ai-input {
	flex: 1;
	min-height: 42px;
	max-height: 100px;
	padding: 10px 12px;
	border: 1px solid #cbd5df;
	border-radius: 10px;
	font: inherit;
	resize: vertical;
}

#phs-ai-submit {
	align-self: stretch;
	padding: 0 16px;
	border: 0;
	border-radius: 10px;
	background: #1476d4;
	color: #fff;
	font-weight: 700;
	cursor: pointer;
}

#phs-ai-submit:disabled {
	opacity: .65;
	cursor: wait;
}

.phs-ai-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 767px) {
	section#phs-ai-window {
		position: fixed;
		top: max(12px, env(safe-area-inset-top));
		right: 8px;
		bottom: max(12px, env(safe-area-inset-bottom));
		left: 8px;
		width: auto;
		min-height: 0;
		height: auto;
		max-height: none;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		overflow: hidden;
	}

	#phs-ai-messages {
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
	}

	#phs-ai-form {
		flex: 0 0 auto;
	}

	.phs-ai-header {
		flex: 0 0 auto;
	}
}

#phs-ai-messages .phs-product-card {
	display: block; box-sizing: border-box; width: 100%; max-width: 100%;
	margin: 10px 0; padding: 12px; border: 1px solid #e1e7ed;
	border-radius: 15px; background: #fff; color: #182b3e;
	box-shadow: 0 3px 9px rgba(24,42,62,.06);
	font-size: 13px; line-height: 1.35; overflow: hidden;
}
#phs-ai-messages .phs-product-card,
#phs-ai-messages .phs-product-card * { box-sizing: border-box; }
#phs-ai-messages .phs-product-card__main { display: flex; gap: 13px; align-items: center; min-height: 82px; }
#phs-ai-messages .phs-product-card__image { display: flex; flex: 0 0 90px; width: 90px; height: 80px; align-items: center; justify-content: center; text-decoration: none; }
#phs-ai-messages .phs-product-card__image img { display: block; width: 100%; height: 100%; object-fit: contain; }
#phs-ai-messages .phs-product-card__image--missing::after,
#phs-ai-messages .phs-product-card__image:not(:has(img))::after { content: 'F?r? imagine'; font-size: 11px; color: #8794a3; text-align: center; }
#phs-ai-messages .phs-product-card__info { flex: 1; min-width: 0; }
#phs-ai-messages .phs-product-card__name { display: block; color: #12263a; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
#phs-ai-messages .phs-product-card__name:hover { color: #1476d4; text-decoration: underline; }
#phs-ai-messages .phs-product-card__pricing { margin-top: 7px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
#phs-ai-messages .phs-product-card__old-price { text-decoration: line-through; font-size: 11px; color: #8b96a3; }
#phs-ai-messages .phs-product-card__price { color: #e63930; font-size: 17px; font-weight: 750; }
#phs-ai-messages .phs-product-card__availability { margin-top: 6px; font-size: 12px; color: #198343; }
#phs-ai-messages .phs-product-card__availability[data-availability="unavailable"] { color: #bf2525; }
#phs-ai-messages .phs-product-card__availability[hidden] { display: none; }
#phs-ai-messages .phs-product-card__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
#phs-ai-messages .phs-product-card__cart-form { display: block; margin: 0; min-width: 0; }
#phs-ai-messages .phs-product-card__btn { display: flex; width: 100%; min-width: 0; min-height: 39px; justify-content: center; align-items: center; padding: 8px 5px; border: 1px solid #d1e0ed; border-radius: 9px; text-align: center; font: 700 11px/1.2 Arial,sans-serif; text-decoration: none; cursor: pointer; }
#phs-ai-messages .phs-product-card__btn--details { background: #fff; color: #1476d4; }
#phs-ai-messages .phs-product-card__btn--cart { background: #1476d4; border-color: #1476d4; color: #fff; }
#phs-ai-messages .phs-product-card__btn--cart:hover { background: #0f5eaa; color: #fff; }
#phs-ai-messages .phs-product-card__btn--details:hover { background: #f3f8ff; }
/* A card is block-level content and should not overflow the assistant message. */
#phs-ai-messages .phs-message-assistant:has(.phs-product-card) { width: 100%; max-width: 100%; }
@media (max-width: 400px) {
	#phs-ai-messages .phs-product-card { padding: 9px; }
	#phs-ai-messages .phs-product-card__image { flex-basis: 72px; width: 72px; }
}

/* Variant controls for PrestaShop combinations */
#phs-ai-messages .phs-product-card__variants { margin-top: 9px; }
#phs-ai-messages .phs-product-card__variants label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 700; }
#phs-ai-messages .phs-product-card__select { width: 100%; max-width: 100%; min-height: 34px; padding: 5px 7px; border: 1px solid #d1e0ed; border-radius: 7px; background: #fff; color: #182b3e; font-size: 12px; }
#phs-ai-messages .phs-product-card__swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
#phs-ai-messages .phs-product-card__swatch { display: inline-flex; width: 28px; height: 28px; padding: 3px; border: 2px solid #d1e0ed; border-radius: 50%; background: #fff; cursor: pointer; }
#phs-ai-messages .phs-product-card__swatch span { display: block; width: 100%; height: 100%; border: 1px solid #ddd; border-radius: 50%; }
#phs-ai-messages .phs-product-card__swatch.is-selected { border-color: #1476d4; }
#phs-ai-messages .phs-product-card__btn:disabled { opacity: .55; cursor: not-allowed; }
#phs-ai-messages .phs-product-card__old-price[hidden] { display: none; }

/* Hide variant dropdown visually when using color swatches */
#phs-ai-messages .phs-product-card__select--sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Color swatches */
#phs-ai-messages .phs-product-card__swatches {
	margin-top: 5px;
	gap: 9px;
}

#phs-ai-messages .phs-product-card__swatch {
	width: 32px;
	height: 32px;
	flex: none;
}

#phs-ai-messages .phs-product-card__swatch:focus-visible {
	outline: 2px solid #1476d4;
	outline-offset: 2px;
}

#phs-ai-messages .phs-product-card__swatch:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

/* Inline AJAX cart confirmation/error under the card actions. */
#phs-ai-messages .phs-product-card__cart-status { grid-column: 1 / -1; margin-top: 4px; font-size: 11px; line-height: 1.35; }
#phs-ai-messages .phs-product-card__cart-status:empty { display: none; }
#phs-ai-messages .phs-product-card__cart-status.is-success { color: #198343; }
#phs-ai-messages .phs-product-card__cart-status.is-error { color: #bf2525; }

@media (max-width: 767px) {
	#phs-ai-toggle {
		right: 12px;
		bottom: 16px;
		min-height: 50px;
		padding: 0 14px;
		font-size: 13px;
		gap: 8px;
	}

	body.phs-ai-open {
		overflow: hidden;
		overscroll-behavior: none;
	}

	body.phs-ai-open #phs-ai-backdrop {
		touch-action: none;
	}

	body.phs-ai-open #phs-ai-window {
		touch-action: pan-y;
		overscroll-behavior: contain;
	}

	body.phs-ai-open #phs-ai-messages {
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		touch-action: pan-y;
	}

	#phs-ai-input {
		font-size: 16px;
	}
}

/* AI typing indicator */
#phs-ai-messages .phs-typing-indicator {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	min-width: 150px;
}

.phs-typing-label {
	display: block;
	font-size: 12px;
	color: #64748b;
}

.phs-typing-dots {
	display: flex;
	align-items: center;
	gap: 5px;
	height: 12px;
}

.phs-typing-dots span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #1476d4;
	animation: phs-typing-bounce 1.2s infinite ease-in-out;
}

.phs-typing-dots span:nth-child(2) {
	animation-delay: 0.2s;
}

.phs-typing-dots span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes phs-typing-bounce {
	0%, 60%, 100% {
		transform: translateY(0) scale(0.85);
		opacity: 0.35;
	}

	30% {
		transform: translateY(-4px) scale(1.15);
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.phs-typing-dots span {
		animation: none;
		opacity: 1;
	}
}