/* Website Chat Assistant 2.0.0 - Preference Construction theme.
   Colours come from the variables set on #wca-chat-root (settings). */

#wca-chat-root {
	--wca-primary: #03A951;
	--wca-accent: #A0CE66;
	--wca-accent-soft: #f1f9e4;
	--wca-text: #1d2b22;
	--wca-muted: #5d6f63;
	--wca-line: #e3ebe6;
	--wca-bg: #ffffff;
	position: fixed !important;
	z-index: 2147483000 !important;
	bottom: var(--wca-bottom, 96px);
	right: var(--wca-right, 20px);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--wca-text);
	color-scheme: light;
	line-height: 1.4;
	max-width: calc(100vw - 16px);
}
#wca-chat-root *,
#wca-chat-root *::before,
#wca-chat-root *::after { box-sizing: border-box; }
/* Normalize common theme styles that otherwise leak into embedded controls. */
#wca-chat-root button,
#wca-chat-root input {
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	line-height: normal;
	box-shadow: none;
}
#wca-chat-root button { margin: 0; }
#wca-chat-root input { appearance: none; -webkit-appearance: none; }
#wca-chat-root .wca-window { isolation: isolate; }

/* Launcher bubble */
#wca-chat-root .wca-bubble {
	position: relative;
	z-index: 2;
	width: 60px;
	height: 60px;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--wca-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 8px 22px rgba(3, 169, 81, 0.35);
	transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
#wca-chat-root .wca-bubble:hover { transform: translateY(-2px); filter: brightness(0.95); }
#wca-chat-root .wca-bubble svg { width: 28px; height: 28px; }

/* Greeting beside the launcher */
#wca-chat-root .wca-greeting {
	position: absolute;
	right: 74px;
	bottom: 12px;
	z-index: 3;
	padding: 9px 14px;
	background: var(--wca-bg);
	color: var(--wca-text);
	border: 1px solid var(--wca-accent);
	border-radius: 14px;
	box-shadow: 0 6px 18px rgba(20, 60, 35, 0.14);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
	transition: opacity 0.2s ease, transform 0.2s ease;
}
#wca-chat-root .wca-greeting::after {
	content: "";
	position: absolute;
	right: -6px;
	top: 50%;
	margin-top: -5px;
	width: 10px;
	height: 10px;
	background: var(--wca-bg);
	border-top: 1px solid var(--wca-accent);
	border-right: 1px solid var(--wca-accent);
	transform: rotate(45deg);
}
#wca-chat-root .wca-greeting {
	display: flex;
	align-items: center;
	gap: 9px;
}
#wca-chat-root .wca-greeting-icon {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border-radius: 9px;
	background: var(--wca-accent-soft);
	color: var(--wca-primary);
	display: flex;
	align-items: center;
	justify-content: center;
}
#wca-chat-root .wca-greeting-icon svg { width: 18px; height: 18px; }
#wca-chat-root .wca-greeting.wca-hidden {
	opacity: 0;
	transform: translateX(6px);
	pointer-events: none;
}

/* Chat window */
#wca-chat-root .wca-window {
	position: absolute;
	bottom: 74px;
	right: 0;
	width: 370px;
	max-width: calc(100vw - 24px);
	height: 600px;
	max-height: calc(100dvh - 110px);
	max-height: calc(100vh - 110px);
	background: var(--wca-bg);
	border: 1px solid var(--wca-line);
	border-radius: 18px;
	box-shadow: 0 16px 44px rgba(20, 60, 35, 0.2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
}
#wca-chat-root .wca-window.wca-open {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

/* Header */
#wca-chat-root .wca-header {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 14px 16px;
	background: var(--wca-primary);
	color: #fff;
}
#wca-chat-root .wca-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
#wca-chat-root .wca-header-icon {
	width: 38px;
	height: 38px;
	flex-shrink: 0;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.18);
	display: flex;
	align-items: center;
	justify-content: center;
}
#wca-chat-root .wca-header-text { min-width: 0; }
#wca-chat-root .wca-header-title {
	font-size: 15px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#wca-chat-root .wca-header-sub { font-size: 12px; opacity: 0.92; margin-top: 2px; }
#wca-chat-root .wca-close {
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
#wca-chat-root .wca-close:hover { background: rgba(255, 255, 255, 0.28); }
#wca-chat-root .wca-close svg { width: 18px; height: 18px; }

/* Conversation */
#wca-chat-root .wca-messages {
	flex: 1 1 auto;
	min-height: 120px;
	overflow-y: auto;
	padding: 14px;
	background: #fafcfa;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
#wca-chat-root .wca-msg {
	max-width: 92%;
	padding: 10px 12px;
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.5;
	overflow-wrap: anywhere;
}
#wca-chat-root .wca-msg a {
	color: var(--wca-primary);
	font-weight: 600;
	text-decoration: underline;
	overflow-wrap: anywhere;
}
#wca-chat-root .wca-msg strong { font-weight: 700; }
#wca-chat-root .wca-msg-bot {
	align-self: flex-start;
	background: var(--wca-bg);
	color: var(--wca-text);
	border: 1px solid var(--wca-line);
	border-bottom-left-radius: 4px;
}
#wca-chat-root .wca-msg-user {
	align-self: flex-end;
	background: var(--wca-primary);
	color: #fff;
	border-bottom-right-radius: 4px;
}
#wca-chat-root .wca-msg-typing {
	align-self: flex-start;
	display: inline-flex;
	gap: 4px;
	padding: 12px 14px;
	background: var(--wca-bg);
	border: 1px solid var(--wca-line);
	border-radius: 12px;
	border-bottom-left-radius: 4px;
}
#wca-chat-root .wca-msg-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--wca-primary);
	display: inline-block;
	animation: wca-blink 1.2s infinite ease-in-out;
}
#wca-chat-root .wca-msg-typing span:nth-child(2) { animation-delay: 0.2s; }
#wca-chat-root .wca-msg-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wca-blink {
	0%, 80%, 100% { opacity: 0.25; }
	40% { opacity: 1; }
}

/* Service quick buttons: two-column grid, above the input, no inner scrolling */
#wca-chat-root .wca-quickbar {
	flex-shrink: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
	padding: 10px 12px;
	background: var(--wca-bg);
	border-top: 1px solid var(--wca-line);
}
#wca-chat-root .wca-service-btn {
	display: flex;
	align-items: center;
	gap: 7px;
	min-width: 0;
	height: 36px;
	padding: 0 8px;
	border: 1px solid var(--wca-line);
	border-radius: 10px;
	background: var(--wca-bg);
	color: var(--wca-text);
	font-size: 12px;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
#wca-chat-root .wca-service-btn:hover {
	border-color: var(--wca-primary);
	background: #f3fbf6;
	color: var(--wca-primary);
}
#wca-chat-root .wca-service-btn:disabled { opacity: 0.6; cursor: default; }
#wca-chat-root .wca-service-ico {
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	border-radius: 7px;
	background: var(--wca-accent-soft);
	color: var(--wca-primary);
	display: flex;
	align-items: center;
	justify-content: center;
}
#wca-chat-root .wca-service-label {
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Input row */
#wca-chat-root .wca-input-row {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: var(--wca-bg);
	border-top: 1px solid var(--wca-line);
}
#wca-chat-root .wca-input {
	flex: 1;
	min-width: 0;
	height: 42px;
	padding: 0 14px;
	border: 1px solid #d5e3da;
	border-radius: 22px;
	background: var(--wca-bg);
	color: var(--wca-text);
	font-size: 14px; /* 14px avoids iOS zoom on focus */
	outline: none;
}
#wca-chat-root .wca-input::placeholder { color: var(--wca-muted); }
#wca-chat-root .wca-input:focus {
	border-color: var(--wca-primary);
	box-shadow: 0 0 0 3px rgba(160, 206, 102, 0.35);
}
#wca-chat-root .wca-send {
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--wca-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
#wca-chat-root .wca-send:hover { filter: brightness(0.95); }
#wca-chat-root .wca-send:disabled { opacity: 0.55; cursor: default; }

/* Focus states */
#wca-chat-root .wca-bubble:focus-visible,
#wca-chat-root .wca-close:focus-visible,
#wca-chat-root .wca-send:focus-visible,
#wca-chat-root .wca-service-btn:focus-visible,
#wca-chat-root .wca-greeting:focus-visible {
	outline: 3px solid var(--wca-accent);
	outline-offset: 2px;
}

/* Mobile */
@media (max-width: 420px) {
	#wca-chat-root {
		right: 8px !important;
		bottom: max(12px, env(safe-area-inset-bottom)) !important;
		max-width: calc(100vw - 16px);
	}
	#wca-chat-root .wca-window {
		width: calc(100vw - 16px);
		max-width: calc(100vw - 16px);
		right: 0;
		bottom: 72px;
		height: min(600px, calc(100dvh - 100px));
		height: min(600px, calc(100vh - 100px));
	}
	#wca-chat-root .wca-greeting {
		right: 68px;
		max-width: calc(100vw - 110px);
		white-space: normal;
		font-size: 12px;
		padding: 8px 11px;
	}
}

@media (prefers-reduced-motion: reduce) {
	#wca-chat-root *,
	#wca-chat-root *::before,
	#wca-chat-root *::after {
		transition: none !important;
		animation: none !important;
	}
}
