/* ==========================================================================
   Heather Chatbot v1.1 — Premium Dark/Green Theme
   ========================================================================== */

:root {
	/* Brand palette */
	--heather-accent: #2AB473;
	--heather-accent-hover: #239e64;
	--heather-header-bg: #151515;
	--heather-header-color: #fff;
	--heather-launcher-bg: #151515;
	--heather-gradient: linear-gradient(132deg, #2AB473 0%, #8BC53F 9%, #F8B042 33%, #FDF202 52%, #F06522 71%, #44C6EF 100%);
	--heather-muted: #767676;
	--heather-border-dark: #373737;
	--heather-dark-bg: #1f1f1f;

	/* Customisable via admin */
	--heather-bot-bg: #f4f4f5;
	--heather-bot-color: #262626;
	--heather-user-bg: #2AB473;
	--heather-user-color: #fff;
	--heather-input-border: #e5e5e7;
	--heather-input-focus: #2AB473;
	--heather-max-height: 600px;

	/* Layout */
	--heather-launcher-size: 60px;
	--heather-panel-width: 400px;
	--heather-panel-radius: 16px;
	--heather-bubble-radius: 16px;
	--heather-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
	--heather-font: 'Overpass', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================================================
   LAUNCHER BUTTON
   ========================================================================== */

.heather-floating-bubble {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: var(--heather-launcher-size);
	height: var(--heather-launcher-size);
	border-radius: 50%;
	background: var(--heather-launcher-bg);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
	transition: transform 0.2s ease, box-shadow 0.3s ease;
	padding: 0;
	outline: none;
	font-family: var(--heather-font);
}

/* Gradient glow ring — disabled */
.heather-floating-bubble::before {
	display: none;
}

.heather-floating-bubble:hover {
	transform: scale(1.06);
	box-shadow: 0 6px 32px rgba(0, 0, 0, 0.35);
}

/* Icon crossfade */
.heather-floating-bubble .heather-icon {
	position: absolute;
	width: 28px;
	height: 28px;
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.heather-floating-bubble .heather-icon-chat {
	opacity: 1;
	transform: scale(1) rotate(0deg);
}

.heather-floating-bubble .heather-icon-close {
	opacity: 0;
	transform: scale(0.5) rotate(-90deg);
}

.heather-floating-bubble.active .heather-icon-chat {
	opacity: 0;
	transform: scale(0.5) rotate(90deg);
}

.heather-floating-bubble.active .heather-icon-close {
	opacity: 1;
	transform: scale(1) rotate(0deg);
}

/* Initial pulse — 3 iterations, each a different brand colour */
@keyframes heatherPulseTricolour {
	/* Pulse 1: Green (#2AB473) */
	0%       { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(42, 180, 115, 0.5); }
	23.3%    { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 16px rgba(42, 180, 115, 0); }
	33.33%   { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(42, 180, 115, 0); }
	/* Pulse 2: Orange (#FBAF42) */
	33.34%   { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(251, 175, 66, 0.5); }
	56.6%    { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 16px rgba(251, 175, 66, 0); }
	66.66%   { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(251, 175, 66, 0); }
	/* Pulse 3: Cyan (#44C6EF) */
	66.67%   { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(68, 198, 239, 0.5); }
	90%      { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 16px rgba(68, 198, 239, 0); }
	100%     { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(68, 198, 239, 0); }
}

.heather-floating-bubble.pulse {
	animation: heatherPulseTricolour 6s ease-out 1;
}

/* ==========================================================================
   PANEL (shared container for Welcome + Chat views)
   ========================================================================== */

.heather-floating-panel {
	position: fixed;
	bottom: 96px;
	right: 24px;
	width: var(--heather-panel-width);
	max-height: var(--heather-max-height);
	background: #fff;
	border-radius: var(--heather-panel-radius);
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.1);
	z-index: 99998;
	overflow: hidden;
	font-family: var(--heather-font);
	opacity: 0;
	transform: translateY(16px) scale(0.96);
	pointer-events: none;
	transition: opacity var(--heather-transition), transform var(--heather-transition);
}

.heather-floating-panel.open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* ==========================================================================
   WELCOME PAGE
   ========================================================================== */

.heather-welcome {
	display: flex;
	flex-direction: column;
}

.heather-welcome-header {
	background: #ededef;
	padding: 28px 24px 20px;
	color: var(--heather-bot-color);
}

.heather-welcome-avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	object-fit: cover;
	margin-bottom: 12px;
	border: 2px solid #d4d4d8;
}

.heather-welcome-greeting {
	font-size: 22px;
	font-weight: 700;
	margin: 0 0 6px;
	line-height: 1.2;
}

.heather-welcome-intro {
	font-size: 14px;
	font-weight: 300;
	color: var(--heather-muted);
	line-height: 1.5;
	margin: 0;
}

.heather-welcome-body {
	padding: 20px 24px 8px;
}

.heather-welcome-body > p {
	font-size: 13px;
	color: var(--heather-muted);
	margin: 0 0 14px;
	font-weight: 500;
}

/* Quick reply buttons */
.heather-quick-replies {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.heather-quick-reply {
	display: block;
	width: 100%;
	padding: 11px 20px;
	background: #f0f0f0;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	font-family: var(--heather-font);
	font-size: 14px;
	font-weight: 600;
	color: #333;
	cursor: pointer;
	text-align: center;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
	line-height: 1.4;
	letter-spacing: 0.01em;
}

.heather-quick-reply:active {
	transform: scale(0.97);
}

/* Brand-colour hover cycle — nth-child */
.heather-quick-reply:nth-child(5n+1):hover { background: #2AB473; border-color: #2AB473; color: #fff; }
.heather-quick-reply:nth-child(5n+2):hover { background: #8CC63F; border-color: #8CC63F; color: #fff; }
.heather-quick-reply:nth-child(5n+3):hover { background: #FBAF42; border-color: #FBAF42; color: #262626; }
.heather-quick-reply:nth-child(5n+4):hover { background: #F06522; border-color: #F06522; color: #fff; }
.heather-quick-reply:nth-child(5n+5):hover { background: #44C6EF; border-color: #44C6EF; color: #262626; }

/* "Type a message..." footer link */
.heather-welcome-type-link {
	display: block;
	text-align: center;
	padding: 14px 24px;
	font-size: 13px;
	font-weight: 400;
	color: var(--heather-muted);
	cursor: pointer;
	border-top: 1px solid #f0f0f0;
	margin-top: 12px;
	transition: color 0.2s;
	font-family: var(--heather-font);
	background: none;
	border-left: none;
	border-right: none;
	border-bottom: none;
	width: 100%;
}

.heather-welcome-type-link:hover {
	color: var(--heather-accent);
}

/* ==========================================================================
   CHAT VIEW
   ========================================================================== */

.heather-chat-view {
	display: flex;
	flex-direction: column;
	height: var(--heather-max-height);
	max-height: var(--heather-max-height);
}

/* ---- Header ---- */

.heather-floating-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: #ededef;
	color: var(--heather-bot-color);
	flex-shrink: 0;
}

.heather-floating-header-avatar-wrap {
	position: relative;
	flex-shrink: 0;
}

.heather-floating-header-avatar-wrap::after {
	content: '';
	position: absolute;
	bottom: 1px;
	right: 1px;
	width: 10px;
	height: 10px;
	background: var(--heather-accent);
	border-radius: 50%;
	border: 2px solid #ededef;
}

.heather-floating-header-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}

.heather-floating-header-info {
	flex: 1;
	min-width: 0;
}

.heather-floating-header-name {
	font-size: 15px;
	font-weight: 600;
	margin: 0;
	line-height: 1.2;
	color: var(--heather-bot-color);
}

.heather-floating-header-status {
	font-size: 12px;
	font-weight: 300;
	color: var(--heather-muted);
	margin: 2px 0 0;
}

.heather-floating-close {
	background: none;
	border: none;
	color: var(--heather-muted);
	cursor: pointer;
	padding: 6px;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s, background 0.2s;
}

.heather-floating-close:hover {
	color: var(--heather-bot-color);
	background: rgba(0, 0, 0, 0.06);
}

.heather-floating-close svg {
	width: 20px;
	height: 20px;
}

/* ---- Chat container ---- */

.heather-chat-container {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

/* ---- Messages ---- */

.heather-messages {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #fff;
	scrollbar-width: thin;
	scrollbar-color: #d4d4d8 transparent;
}

.heather-messages::-webkit-scrollbar {
	width: 4px;
}

.heather-messages::-webkit-scrollbar-track {
	background: transparent;
}

.heather-messages::-webkit-scrollbar-thumb {
	background: #d4d4d8;
	border-radius: 2px;
}

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

.heather-message {
	display: flex;
	gap: 10px;
	max-width: 85%;
	animation: heatherSlideIn 0.3s ease-out;
}

.heather-message.bot {
	align-self: flex-start;
}

.heather-message.user {
	align-self: flex-end;
	flex-direction: row-reverse;
}

.heather-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	flex-shrink: 0;
	background-size: cover;
	background-position: center;
	margin-top: 2px;
}

.heather-message.user .heather-avatar {
	display: none;
}

.heather-message-content {
	padding: 10px 14px;
	border-radius: var(--heather-bubble-radius);
	font-size: 14px;
	line-height: 1.55;
	font-weight: 400;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.heather-message.bot .heather-message-content {
	background: var(--heather-bot-bg);
	color: var(--heather-bot-color);
	border-bottom-left-radius: 4px;
}

.heather-message.user .heather-message-content {
	background: var(--heather-user-bg);
	color: var(--heather-user-color);
	border-bottom-right-radius: 4px;
}

/* Links in bot messages */
.heather-message.bot .heather-message-content a {
	color: var(--heather-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
	word-break: break-all;
	transition: color 0.15s;
}

.heather-message.bot .heather-message-content a:hover {
	color: var(--heather-accent-hover);
}

/* ---- Typing indicator ---- */

.heather-typing-indicator {
	display: none;
	align-self: flex-start;
	max-width: 85%;
	gap: 10px;
	padding: 0 16px 12px;
}

.heather-typing-indicator.active {
	display: flex;
	animation: heatherSlideIn 0.2s ease-out;
}

.heather-typing-dots {
	display: flex;
	gap: 4px;
	padding: 12px 16px;
	background: var(--heather-bot-bg);
	border-radius: var(--heather-bubble-radius);
	border-bottom-left-radius: 4px;
}

.heather-typing-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #a0a0a0;
	animation: heatherTyping 1.4s infinite;
}

.heather-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.heather-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes heatherTyping {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
	30%           { transform: translateY(-6px); opacity: 1; }
}

/* ---- Input area ---- */

.heather-input-container {
	padding: 12px 16px;
	background: #fff;
	border-top: 1px solid #f0f0f0;
	flex-shrink: 0;
}

.heather-input-wrapper {
	display: flex;
	gap: 8px;
	align-items: center;
}

.heather-chat-input {
	flex: 1;
	padding: 10px 16px;
	border: 1px solid var(--heather-input-border);
	border-radius: 24px;
	font-family: var(--heather-font);
	font-size: 14px;
	outline: none;
	transition: border-color 0.2s;
	background: #fafafa;
	color: var(--heather-bot-color);
}

.heather-chat-input:focus {
	border-color: var(--heather-input-focus);
	background: #fff;
}

.heather-chat-input::placeholder {
	color: #a0a0a0;
}

.heather-send-button {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--heather-accent);
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.2s, transform 0.15s;
	padding: 0;
}

.heather-send-button:hover {
	background: var(--heather-accent-hover);
	transform: scale(1.05);
}

.heather-send-button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	transform: none;
}

.heather-send-button svg {
	width: 18px;
	height: 18px;
}

/* ---- AI disclaimer ---- */

.heather-disclaimer {
	padding: 4px 16px 2px;
	font-size: 11px;
	color: var(--heather-muted);
	text-align: center;
	background: #fff;
	flex-shrink: 0;
}

/* ==========================================================================
   CONTACT FORM (dark premium style)
   ========================================================================== */

.heather-contact-form {
	background: var(--heather-header-bg);
	padding: 20px;
	border-radius: 14px;
	margin: 4px 0;
	animation: heatherSlideIn 0.4s ease-out;
}

.heather-contact-form h3 {
	font-size: 15px;
	font-weight: 600;
	margin: 0 0 14px;
	color: #fff;
	font-family: var(--heather-font);
}

.heather-contact-form input,
.heather-contact-form select {
	width: 100%;
	padding: 10px 14px;
	margin-bottom: 10px;
	border: 1px solid var(--heather-border-dark);
	border-radius: 10px;
	font-size: 14px;
	font-family: var(--heather-font);
	background: var(--heather-dark-bg);
	color: #fff;
	outline: none;
	transition: border-color 0.2s;
	box-sizing: border-box;
}

.heather-contact-form input::placeholder {
	color: var(--heather-muted);
}

.heather-contact-form input:focus,
.heather-contact-form select:focus {
	border-color: var(--heather-accent);
}

.heather-contact-form select {
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%23767676'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 36px;
}

.heather-contact-form button {
	width: 100%;
	padding: 12px;
	background: var(--heather-accent);
	color: #fff;
	border: none;
	border-radius: 10px;
	font-weight: 600;
	font-size: 14px;
	font-family: var(--heather-font);
	cursor: pointer;
	transition: background 0.2s, transform 0.15s;
	margin-top: 4px;
}

.heather-contact-form button:hover {
	background: var(--heather-accent-hover);
	transform: translateY(-1px);
}

/* ==========================================================================
   INLINE SHORTCODE MODE
   ========================================================================== */

.heather-chat-wrapper {
	font-family: var(--heather-font);
	border: 1px solid var(--heather-input-border);
	border-radius: var(--heather-panel-radius);
	overflow: hidden;
	background: #fff;
}

.heather-chat-wrapper .heather-chat-container {
	display: flex;
	flex-direction: column;
	max-height: var(--heather-max-height);
}

/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
	.heather-floating-panel {
		right: 0;
		left: 0;
		bottom: 80px;
		width: 100%;
		max-height: calc(100vh - 100px);
		border-radius: var(--heather-panel-radius) var(--heather-panel-radius) 0 0;
	}

	.heather-floating-bubble {
		bottom: 16px;
		right: 16px;
	}

	.heather-welcome-header {
		padding: 24px 20px 16px;
	}

	.heather-welcome-greeting {
		font-size: 20px;
	}

	.heather-welcome-body {
		padding: 16px 20px 8px;
	}

	.heather-messages {
		padding: 12px;
	}

	.heather-message {
		max-width: 90%;
	}
}

@media (max-width: 480px) {
	.heather-floating-panel {
		bottom: 76px;
	}

	.heather-floating-bubble {
		width: 54px;
		height: 54px;
	}

	.heather-floating-bubble .heather-icon {
		width: 24px;
		height: 24px;
	}
}
