/* ==========================================================
   Website Chat Assistant - launcher + chat window
   Colours come from the plugin settings:
   --wca-primary  (button background, header, visitor messages)
   --wca-accent   (icon inside the button, highlights, send button)
   ========================================================== */

#wca-chat-root {
	position: fixed;
	z-index: 999998;
	bottom: var(--wca-bottom, 24px);
	right: var(--wca-right, 24px);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}
#wca-chat-root *,
#wca-chat-root *::before,
#wca-chat-root *::after {
	box-sizing: border-box;
}
#wca-chat-root button {
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
}

/* ---------- Launcher ---------- */
#wca-chat-root .wca-welcome-prompt {
	position: absolute;
	right: 76px;
	bottom: 7px;
	width: 230px;
	padding: 13px 15px 14px;
	border: 1px solid rgba(15, 42, 71, 0.10);
	border-radius: 14px;
	background: #fff;
	color: #182433;
	box-shadow: 0 12px 30px rgba(10, 25, 45, 0.16), 0 2px 7px rgba(10, 25, 45, 0.08);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
	transform-origin: right bottom;
	animation: wca-prompt-in 0.45s ease both;
}
#wca-chat-root .wca-welcome-prompt[aria-hidden="true"] {
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px) scale(0.97);
	pointer-events: none;
}
#wca-chat-root .wca-prompt-eyebrow {
	margin-bottom: 4px;
	color: var(--wca-accent, #E8801A);
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 1.2px;
}
#wca-chat-root .wca-prompt-title {
	font-size: 15px;
	font-weight: 750;
	line-height: 1.25;
}
#wca-chat-root .wca-prompt-sub {
	margin-top: 4px;
	color: #667281;
	font-size: 11.5px;
	line-height: 1.4;
}
#wca-chat-root .wca-prompt-tail {
	position: absolute;
	right: -6px;
	bottom: 17px;
	width: 12px;
	height: 12px;
	border-top: 1px solid rgba(15, 42, 71, 0.10);
	border-right: 1px solid rgba(15, 42, 71, 0.10);
	background: #fff;
	transform: rotate(45deg);
}
@keyframes wca-prompt-in {
	from { opacity: 0; transform: translateY(7px) scale(0.96); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}
#wca-chat-root .wca-bubble {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 3px solid #fff;
	border-radius: 50%;
	background: var(--wca-primary, #0F2A47);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(15, 42, 71, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	animation: wca-pulse 2.8s ease-in-out infinite;
}
#wca-chat-root .wca-bubble:hover,
#wca-chat-root .wca-bubble:focus-visible {
	background: var(--wca-primary, #0F2A47);
	color: #fff;
	transform: translateY(-2px) scale(1.05);
	box-shadow: 0 12px 28px rgba(15, 42, 71, 0.42), 0 2px 8px rgba(0, 0, 0, 0.22);
	animation: none;
}
#wca-chat-root .wca-bubble:focus-visible {
	outline: 3px solid var(--wca-accent, #E8801A);
	outline-offset: 3px;
}
#wca-chat-root .wca-bubble svg {
	position: absolute;
	width: 35px;
	height: 35px;
	transition: opacity 0.18s ease, transform 0.22s ease;
}
#wca-chat-root .wca-icon-chat { color: #fff; }
#wca-chat-root .wca-icon-close {
	width: 26px;
	height: 26px;
	opacity: 0;
	transform: rotate(-60deg) scale(0.6);
}
#wca-chat-root.wca-is-open .wca-icon-chat {
	opacity: 0;
	transform: rotate(60deg) scale(0.6);
}
#wca-chat-root.wca-is-open .wca-icon-close {
	opacity: 1;
	transform: rotate(0) scale(1);
}
#wca-chat-root.wca-is-open .wca-bubble { animation: none; }
@keyframes wca-pulse {
	0%, 100% { box-shadow: 0 8px 24px rgba(15, 42, 71, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(232, 128, 26, 0.45); }
	50% { box-shadow: 0 8px 24px rgba(15, 42, 71, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2), 0 0 0 11px rgba(232, 128, 26, 0); }
}

/* ---------- Window ---------- */
#wca-chat-root .wca-window {
	position: absolute;
	right: 0;
	bottom: 80px;
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - var(--wca-bottom, 24px) - 104px);
	overflow: hidden;
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 18px 50px rgba(10, 25, 45, 0.28), 0 2px 10px rgba(10, 25, 45, 0.12);
	opacity: 0;
	visibility: hidden;
	transform: translateY(14px) scale(0.98);
	transform-origin: bottom right;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}
#wca-chat-root .wca-window.wca-open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}

/* ---------- Header ---------- */
#wca-chat-root .wca-header {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
	padding: 14px 14px 14px 16px;
	background: var(--wca-primary, #0F2A47);
	border-bottom: 4px solid var(--wca-accent, #E8801A);
	color: #fff;
}
#wca-chat-root .wca-avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #fff;
	color: var(--wca-accent, #E8801A);
}
#wca-chat-root .wca-avatar svg {
	width: 22px;
	height: 22px;
}
#wca-chat-root .wca-header-text {
	flex: 1;
	min-width: 0;
}
#wca-chat-root .wca-header-title {
	overflow: hidden;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.25;
	white-space: nowrap;
	text-overflow: ellipsis;
}
#wca-chat-root .wca-header-sub {
	margin-top: 2px;
	font-size: 12px;
	line-height: 1.3;
	opacity: 0.82;
}
#wca-chat-root .wca-call,
#wca-chat-root .wca-close {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s ease;
}
#wca-chat-root .wca-call:hover,
#wca-chat-root .wca-close:hover {
	background: var(--wca-accent, #E8801A);
	color: #fff;
}
#wca-chat-root .wca-call svg {
	width: 17px;
	height: 17px;
}
#wca-chat-root .wca-close {
	font-size: 22px;
	line-height: 1;
}

/* ---------- Messages ---------- */
#wca-chat-root .wca-messages {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
	overflow-y: auto;
	padding: 16px 14px;
	background: #f3f5f8;
	position: relative;
	scroll-behavior: smooth;
}
#wca-chat-root .wca-msg {
	max-width: 90%;
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.5;
	overflow-wrap: anywhere;
}
#wca-chat-root .wca-msg-bot {
	align-self: flex-start;
	border: 1px solid #e3e8ee;
	border-bottom-left-radius: 4px;
	background: #fff;
	color: #1b2430;
	box-shadow: 0 1px 2px rgba(10, 25, 45, 0.05);
}
#wca-chat-root .wca-msg-user {
	align-self: flex-end;
	border-bottom-right-radius: 4px;
	background: var(--wca-primary, #0F2A47);
	color: #fff;
}
#wca-chat-root .wca-msg strong {
	font-weight: 700;
	color: var(--wca-primary, #0F2A47);
}
#wca-chat-root .wca-msg-user strong {
	color: #fff;
}
#wca-chat-root .wca-msg a {
	color: var(--wca-primary, #0F2A47);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: var(--wca-accent, #E8801A);
	text-underline-offset: 2px;
	word-break: break-all;
}
#wca-chat-root .wca-msg a strong {
	color: inherit;
}
#wca-chat-root .wca-msg a:hover {
	color: var(--wca-accent, #E8801A);
}

/* Typing indicator */
#wca-chat-root .wca-msg-typing {
	display: inline-flex;
	align-self: flex-start;
	gap: 4px;
	padding: 13px 15px;
	border: 1px solid #e3e8ee;
	border-radius: 14px;
	border-bottom-left-radius: 4px;
	background: #fff;
}
#wca-chat-root .wca-msg-typing span {
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--wca-primary, #0F2A47);
	opacity: 0.3;
	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; }
}

/* ---------- Quick buttons ---------- */
#wca-chat-root .wca-chips {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	flex-shrink: 0;
	gap: 7px;
	padding: 10px 14px 9px;
	border-top: 1px solid #e3e8ee;
	background: #fff;
}
#wca-chat-root .wca-chip {
	min-width: 0;
	min-height: 34px;
	padding: 7px 10px;
	border: 1px solid #dbe2e9;
	border-radius: 9px;
	background: #f8fafc;
	color: var(--wca-primary, #0F2A47);
	font-size: 11.5px;
	font-weight: 650;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
#wca-chat-root .wca-chip:last-child { grid-column: 1 / -1; }
#wca-chat-root .wca-chip:hover,
#wca-chat-root .wca-chip:focus-visible {
	border-color: var(--wca-primary, #0F2A47);
	background: var(--wca-primary, #0F2A47);
	color: #fff;
	outline: none;
	transform: translateY(-1px);
}

/* ---------- Input ---------- */
#wca-chat-root .wca-input-row {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	gap: 8px;
	padding: 4px 12px 14px;
	background: #fff;
}
#wca-chat-root .wca-input {
	flex: 1;
	min-width: 0;
	height: 42px;
	padding: 0 16px;
	border: 1.5px solid #d9dfe6;
	border-radius: 999px;
	background: #f7f9fb;
	color: #1b2430;
	font-family: inherit;
	font-size: 14px;
	box-shadow: none;
	outline: none;
	transition: border-color 0.15s ease, background 0.15s ease;
}
#wca-chat-root .wca-input::placeholder {
	color: #8a95a3;
}
#wca-chat-root .wca-input:focus {
	border-color: var(--wca-primary, #0F2A47);
	background: #fff;
}
#wca-chat-root .wca-send {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--wca-accent, #E8801A);
	color: #fff;
	cursor: pointer;
	transition: transform 0.15s ease, filter 0.15s ease;
}
#wca-chat-root .wca-send:hover {
	background: var(--wca-accent, #E8801A);
	color: #fff;
	filter: brightness(1.08);
	transform: scale(1.05);
}
#wca-chat-root .wca-send:disabled {
	opacity: 0.55;
	cursor: default;
	transform: none;
}
#wca-chat-root .wca-send svg {
	width: 18px;
	height: 18px;
	margin-left: 2px;
}

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
	#wca-chat-root .wca-welcome-prompt { right: 72px; width: 205px; }
	#wca-chat-root .wca-window {
		right: calc(var(--wca-right, 24px) * -1 + 12px);
		width: calc(100vw - 24px);
		max-width: none;
		height: 75vh;
	}
}

@media (prefers-reduced-motion: reduce) {
	#wca-chat-root .wca-bubble,
	#wca-chat-root .wca-window,
	#wca-chat-root .wca-bubble svg {
		animation: none;
		transition: none;
	}
	#wca-chat-root .wca-messages {
		scroll-behavior: auto;
	}
}
