/*
 * Website Chat Assistant 2.1.0
 * Colours come from --wca-primary (#010300) and --wca-secondary (#BADAEC),
 * set from the plugin settings. No pink or old theme colours are used.
 */

#wca-chat-root {
	position: fixed;
	bottom: var(--wca-bottom, 24px);
	right: var(--wca-right, 20px);
	width: 60px;
	height: 60px;
	z-index: 999998;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-sizing: border-box;
}

#wca-chat-root *,
#wca-chat-root *::before,
#wca-chat-root *::after {
	box-sizing: border-box;
}

#wca-chat-root button,
#wca-chat-root input {
	font-family: inherit;
}

/* ---------- Launcher ---------- */

#wca-chat-root .wca-bubble {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	padding: 0;
	margin: 0;
	background: var(--wca-primary, #010300);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(1, 3, 0, 0.28);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	animation: wca-pulse 2.6s ease-in-out infinite;
}
#wca-chat-root .wca-bubble:hover {
	transform: scale(1.06);
	animation: none;
}
#wca-chat-root .wca-bubble:focus-visible,
#wca-chat-root .wca-close:focus-visible,
#wca-chat-root .wca-quick-btn:focus-visible,
#wca-chat-root .wca-send:focus-visible,
#wca-chat-root .wca-input:focus-visible {
	outline: 2px solid var(--wca-secondary, #BADAEC);
	outline-offset: 2px;
}
#wca-chat-root .wca-bubble svg {
	width: 28px;
	height: 28px;
}

@keyframes wca-pulse {
	0%, 100% {
		box-shadow: 0 6px 18px rgba(1, 3, 0, 0.28), 0 0 0 0 rgba(186, 218, 236, 0.7);
	}
	50% {
		box-shadow: 0 6px 18px rgba(1, 3, 0, 0.28), 0 0 0 9px rgba(186, 218, 236, 0);
	}
}

/* ---------- Greeting beside the launcher ---------- */

#wca-chat-root .wca-greeting {
	position: absolute;
	right: 74px;
	bottom: 18px;
	max-width: 220px;
	padding: 9px 14px;
	background: #ffffff;
	color: var(--wca-primary, #010300);
	border: 1px solid var(--wca-secondary, #BADAEC);
	border-radius: 16px 16px 4px 16px;
	box-shadow: 0 6px 18px rgba(1, 3, 0, 0.14);
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	cursor: pointer;
	opacity: 1;
	visibility: visible;
	transform: translateX(0);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}
#wca-chat-root .wca-greeting.wca-hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateX(8px);
}

/* ---------- Chat window ---------- */

#wca-chat-root .wca-window {
	position: fixed;
	right: var(--wca-right, 20px);
	bottom: calc(var(--wca-bottom, 24px) + 76px);
	width: min(360px, calc(100vw - 2 * var(--wca-right, 20px)));
	height: min(540px, calc(100vh - var(--wca-bottom, 24px) - 110px));
	min-height: 300px;
	background: #ffffff;
	border-radius: 18px;
	box-shadow: 0 12px 40px rgba(1, 3, 0, 0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(12px) scale(0.98);
	transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}
#wca-chat-root .wca-window.wca-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateY(0) scale(1);
}

/* Header */

#wca-chat-root .wca-header {
	flex-shrink: 0;
	background: var(--wca-primary, #010300);
	color: #ffffff;
	padding: 14px 14px 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
#wca-chat-root .wca-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}
#wca-chat-root .wca-avatar {
	width: 38px;
	height: 38px;
	flex-shrink: 0;
	border-radius: 50%;
	background: rgba(186, 218, 236, 0.16);
	display: flex;
	align-items: center;
	justify-content: center;
}
#wca-chat-root .wca-avatar svg {
	width: 22px;
	height: 22px;
}
#wca-chat-root .wca-header-title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
#wca-chat-root .wca-header-sub {
	font-size: 12px;
	color: var(--wca-secondary, #BADAEC);
	margin-top: 2px;
}
#wca-chat-root .wca-close {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none;
	padding: 0;
	background: rgba(255, 255, 255, 0.12);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.15s ease;
}
#wca-chat-root .wca-close:hover {
	background: rgba(255, 255, 255, 0.24);
}

/* Messages */

#wca-chat-root .wca-messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 14px;
	background: #f5f9fb;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
#wca-chat-root .wca-msg {
	max-width: 85%;
	padding: 10px 12px;
	border-radius: 12px;
	font-size: 13.5px;
	line-height: 1.45;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
#wca-chat-root .wca-msg a {
	color: var(--wca-primary, #010300);
	text-decoration: underline;
	font-weight: 600;
}
#wca-chat-root .wca-msg strong {
	font-weight: 700;
}
#wca-chat-root .wca-msg-bot {
	background: #ffffff;
	color: #1c2530;
	border: 1px solid #e3ebf0;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}
#wca-chat-root .wca-msg-user {
	background: var(--wca-primary, #010300);
	color: #ffffff;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
}
#wca-chat-root .wca-msg-user,
#wca-chat-root .wca-msg-bot {
	margin: 0;
}
#wca-chat-root .wca-msg-typing {
	background: #ffffff;
	border: 1px solid #e3ebf0;
	align-self: flex-start;
	display: inline-flex;
	gap: 4px;
	padding: 12px 14px;
	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, #010300);
	opacity: 0.35;
	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 (always visible, above the input) */

#wca-chat-root .wca-quick {
	flex-shrink: 0;
	padding: 10px 12px 10px;
	background: #ffffff;
	border-top: 1px solid #e3ebf0;
}
#wca-chat-root .wca-quick-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}
#wca-chat-root .wca-quick-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	min-height: 36px;
	padding: 7px 9px;
	margin: 0;
	background: #f3f8fb;
	color: var(--wca-primary, #010300);
	border: 1px solid var(--wca-secondary, #BADAEC);
	border-radius: 10px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	text-align: left;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}
#wca-chat-root .wca-quick-btn span {
	min-width: 0;
}
#wca-chat-root .wca-quick-btn svg {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	color: var(--wca-primary, #010300);
}
#wca-chat-root .wca-quick-btn:hover {
	background: rgba(186, 218, 236, 0.5);
	border-color: var(--wca-primary, #010300);
}

/* Input row */

#wca-chat-root .wca-input-row {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 10px 12px;
	border-top: 1px solid #e3ebf0;
	background: #ffffff;
}
#wca-chat-root .wca-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 40px;
	border: 1px solid #d5e0e7;
	border-radius: 20px;
	padding: 8px 14px;
	font-size: 14px;
	color: #1c2530;
	background: #ffffff;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#wca-chat-root .wca-input:focus {
	border-color: var(--wca-primary, #010300);
	box-shadow: 0 0 0 3px rgba(186, 218, 236, 0.55);
}
#wca-chat-root .wca-send {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--wca-primary, #010300);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: opacity 0.15s ease;
}
#wca-chat-root .wca-send:hover {
	opacity: 0.88;
}
#wca-chat-root .wca-send:disabled {
	opacity: 0.45;
	cursor: default;
}
#wca-chat-root .wca-send svg {
	width: 16px;
	height: 16px;
}

/* ---------- Responsive ---------- */

@media (max-width: 420px) {
	#wca-chat-root .wca-input {
		font-size: 16px; /* prevents iOS zoom on focus */
	}
}

@media (max-width: 340px) {
	#wca-chat-root .wca-quick-grid {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	#wca-chat-root .wca-bubble,
	#wca-chat-root .wca-msg-typing span {
		animation: none;
	}
	#wca-chat-root .wca-window,
	#wca-chat-root .wca-greeting,
	#wca-chat-root .wca-bubble {
		transition: none;
	}
}
