/* CSS Custom Properties - overridden dynamically via wp_head */
:root {
	--hg-chat-primary: #2d5168;
	--hg-chat-primary-dark: #1a3a52;
}

/* Container for the whole chat system */
#ai-chat-wrapper {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 9999;
	font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* The Floating Action Button (Launcher) */
#ai-chat-launcher {
	width: 280px;
	height: 60px;
	border-radius: 30px;
	background: linear-gradient(135deg, var(--hg-chat-primary) 0%, var(--hg-chat-primary-dark) 100%);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 20px;
	transition: all 0.3s ease;
	position: relative;
}

#ai-chat-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

#ai-chat-launcher:active {
	transform: scale(0.98);
}

#ai-chat-launcher-text {
	color: white;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	flex: 1;
}

#ai-chat-launcher-logo {
	width: 32px;
	height: 32px;
	flex-shrink: 0;
}

#ai-chat-launcher-logo svg {
	width: 100%;
	height: 100%;
}

/* Notification badge */
#ai-chat-badge {
	position: absolute;
	top: -5px;
	right: -5px;
	background: #e74c3c;
	color: white;
	border-radius: 50%;
	width: 22px;
	height: 22px;
	display: none;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: bold;
	border: 2px solid white;
}

/* The Chat Window */
#ai-chat-box {
	width: 420px;
	max-height: 700px;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
	display: none;
	flex-direction: column;
	overflow: hidden;
	position: absolute;
	bottom: 80px;
	right: 0;
	animation: slideUp 0.3s ease-out;
	z-index: 2;
}

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

/* Header */
#ai-chat-header {
	background: linear-gradient(135deg, var(--hg-chat-primary) 0%, var(--hg-chat-primary-dark) 100%);
	color: #fff;
	padding: 20px 24px;
	font-weight: 600;
	font-size: 13px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

#ai-chat-header-title {
	display: flex;
	align-items: center;
	gap: 15px;
	flex: 1;
}

#ai-chat-header-logo {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
}

#ai-chat-header-logo svg {
	width: 100%;
	height: 100%;
}

#ai-chat-status-dot {
	width: 8px;
	height: 8px;
	background: #ffd700;
	border-radius: 50%;
	animation: pulse 2s infinite;
	margin-right: 5px;
}

@keyframes pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.5; }
}

#ai-chat-close {
	cursor: pointer;
	font-size: 28px;
	line-height: 1;
	opacity: 0.9;
	transition: opacity 0.2s;
	padding: 0 5px;
}

#ai-chat-close:hover {
	opacity: 1;
}

/* Status Bar - moved to top */
#ai-chat-status-bar {
	padding: 12px 20px;
	font-size: 12px;
	color: #fff;
	background: linear-gradient(rgba(255,255,255,0.28), rgba(255,255,255,0.28)),
	            linear-gradient(135deg, var(--hg-chat-primary) 0%, var(--hg-chat-primary-dark) 100%);
	border-bottom: 1px solid rgba(255, 255, 255, 0.15);
	display: flex;
	justify-content: space-between;
	align-items: center;
	min-height: 44px;
	letter-spacing: 0.3px;
	text-transform: uppercase;
	font-weight: 600;
}

.status-left {
	display: flex;
	align-items: center;
	gap: 8px;
}

.status-actions {
	display: flex;
	gap: 10px;
}

.status-action {
	color: #ffd700;
	cursor: pointer;
	text-decoration: none;
	transition: color 0.2s;
	text-transform: capitalize;
}

.status-action:hover {
	color: #fff;
	text-decoration: underline;
}

/* Quick Actions Bar */
#ai-chat-quick-actions {
	padding: 16px 20px;
	background: #ffffff;
	border-bottom: 1px solid #e0e0e0;
	display: flex;
	gap: 10px;
	overflow-x: auto;
	scrollbar-width: none;
	flex-shrink: 0;
	align-items: center;
}

#ai-chat-quick-actions::-webkit-scrollbar {
	display: none;
}

.quick-action-btn {
	padding: 10px 18px;
	background: white;
	border: 1px solid #d0d0d0;
	border-radius: 24px;
	font-size: 12px;
	color: #4a5568;
	cursor: pointer;
	white-space: nowrap;
	transition: all 0.2s;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 40px;
	font-weight: 500;
	letter-spacing: 0.3px;
	text-transform: uppercase;
}

.quick-action-btn:hover {
	background: var(--hg-chat-primary);
	color: white;
	border-color: var(--hg-chat-primary);
	transform: translateY(-1px);
}

/* Message Log */
#ai-chat-log {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 20px 20px;
	background: #f5f7fa;
	display: flex;
	flex-direction: column;
	gap: 16px;
	scroll-behavior: smooth;
}

#ai-chat-log::-webkit-scrollbar {
	width: 6px;
}

#ai-chat-log::-webkit-scrollbar-track {
	background: transparent;
}

#ai-chat-log::-webkit-scrollbar-thumb {
	background: #cbd5e0;
	border-radius: 3px;
}

#ai-chat-log::-webkit-scrollbar-thumb:hover {
	background: #a0aec0;
}

/* Individual Message Container */
.chat-msg-container {
	display: flex;
	gap: 10px;
	align-items: flex-end;
	animation: fadeIn 0.3s ease-out;
}

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

.msg-user-container {
	flex-direction: row-reverse;
}

/* Avatar */
.chat-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	flex-shrink: 0;
}

.avatar-user {
	background: var(--hg-chat-primary);
	color: white;
}

.avatar-ai {
	background: var(--hg-chat-primary-dark);
	color: white;
	padding: 8px;
}

.avatar-ai svg {
	width: 100%;
	height: 100%;
}

/* Message Wrapper */
.chat-msg-wrapper {
	display: flex;
	flex-direction: column;
	max-width: 75%;
	gap: 6px;
}

/* Message Bubbles */
.chat-msg {
	padding: 14px 18px;
	border-radius: 20px;
	font-size: 14px;
	line-height: 1.6;
	word-wrap: break-word;
	position: relative;
}

/* Markdown formatting inside messages */
.msg-ai strong {
	font-weight: 600;
	color: #1a202c;
}

.msg-ai em {
	font-style: italic;
	color: #4a5568;
}

.msg-ai ol, .msg-ai ul {
	margin: 8px 0;
	padding-left: 20px;
}

.msg-ai ol {
	list-style: decimal;
}

.msg-ai ul {
	list-style: disc;
}

.msg-ai li {
	margin: 6px 0;
	line-height: 1.6;
}

.msg-ai br {
	display: block;
	content: "";
	margin: 4px 0;
}

.msg-ai a {
	color: var(--hg-chat-primary);
	text-decoration: underline;
	font-weight: 500;
	transition: color 0.2s;
}

.msg-ai a:hover {
	color: var(--hg-chat-primary-dark);
}

.msg-user {
	background: linear-gradient(135deg, var(--hg-chat-primary) 0%, var(--hg-chat-primary-dark) 100%);
	color: white;
	border-bottom-right-radius: 6px;
	margin-left: auto;
}

.msg-ai {
	background: white;
	color: #2d3748;
	border-bottom-left-radius: 6px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Timestamp */
.chat-timestamp {
	font-size: 11px;
	color: #a0aec0;
	padding: 0 4px;
}

.msg-user-container .chat-timestamp {
	text-align: right;
}

/* Typing Indicator */
.typing-indicator {
	display: flex;
	gap: 4px;
	padding: 14px 18px;
	background: white;
	border-radius: 20px;
	border-bottom-left-radius: 6px;
	width: fit-content;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.typing-dot {
	width: 8px;
	height: 8px;
	background: #cbd5e0;
	border-radius: 50%;
	animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
	0%, 60%, 100% {
		transform: translateY(0);
	}
	30% {
		transform: translateY(-10px);
	}
}

/* Copy Button */
.copy-btn {
	position: absolute;
	top: 10px;
	right: 10px;
	background: rgba(0, 0, 0, 0.05);
	border: none;
	border-radius: 4px;
	padding: 5px 10px;
	font-size: 11px;
	cursor: pointer;
	opacity: 0;
	transition: all 0.2s;
	color: #2d3748;
}

.msg-ai:hover .copy-btn {
	opacity: 1;
}

.copy-btn:hover {
	background: rgba(0, 0, 0, 0.1);
}

.copy-btn.copied {
	background: #2ecc71;
	color: white;
}

/* Input Area */
#ai-chat-footer {
	padding: 18px 20px;
	border-top: 1px solid #e9ecef;
	background: white;
}

#ai-chat-input-wrapper {
	display: flex;
	gap: 12px;
	align-items: center;
	background: #f5f7fa;
	border: 2px solid #e0e0e0;
	border-radius: 26px;
	padding: 6px 8px 6px 18px;
	transition: all 0.2s;
}

#ai-chat-input-wrapper:focus-within {
	border-color: var(--hg-chat-primary);
	background: white;
}

#ai-chat-input {
	flex: 1;
	border: none;
	background: transparent;
	padding: 8px 4px;
	outline: none;
	font-size: 14px;
	color: #2d3748;
}

#ai-chat-input::placeholder {
	color: #a0aec0;
}

#ai-chat-send-btn {
	background: var(--hg-chat-primary);
	color: white;
	border: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	flex-shrink: 0;
}

#ai-chat-send-btn:hover:not(:disabled) {
	background: var(--hg-chat-primary-dark);
	transform: scale(1.05);
}

#ai-chat-send-btn:disabled {
	background: #cbd5e0;
	cursor: not-allowed;
}

#ai-chat-send-btn svg {
	width: 18px;
	height: 18px;
}

/* Scroll to bottom button */
#scroll-to-bottom {
	position: absolute;
	bottom: 95px;
	right: calc(50% - 20px);
	width: 40px;
	height: 40px;
	background: white;
	border: 1px solid #e0e0e0;
	border-radius: 50%;
	display: none;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
	transition: all 0.2s;
}

#scroll-to-bottom:hover {
	background: #f5f7fa;
	transform: translateY(-2px);
}

#scroll-to-bottom svg {
	width: 20px;
	height: 20px;
	color: var(--hg-chat-primary);
}

/* Mobile Responsive */
@media (max-width: 480px) {
	#ai-chat-wrapper {
		bottom: 0;
		right: 0;
		left: 0;
	}
	
	#ai-chat-box {
		width: 100%;
		max-height: 100vh;
		height: 100vh;
		bottom: 0;
		border-radius: 0;
	}
	
	#ai-chat-launcher {
		position: absolute;
		bottom: 20px;
		right: 20px;
		left: auto;
		width: 60px;
		height: 60px;
		padding: 0;
		justify-content: center;
		border-radius: 50%;
	}
	
	#ai-chat-launcher-text {
		display: none;
	}
	
	#ai-chat-log {
		height: calc(100vh - 280px);
	}
}

/* Lead Capture Form Styling */
.lead-form-container {
	padding: 5px 0;
}

.lead-form-title {
	margin: 0 0 8px 0;
	font-size: 18px;
	font-weight: 700;
	color: #1a202c;
}

.lead-form-subtitle {
	margin: 0 0 20px 0;
	font-size: 13px;
	color: #718096;
	line-height: 1.4;
}

.form-group {
	margin-bottom: 12px;
}

.lead-form-container input,
.lead-form-container textarea {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	transition: all 0.2s;
	background: #f8fafc;
	box-sizing: border-box;
}

.lead-form-container input:focus,
.lead-form-container textarea:focus {
	outline: none;
	border-color: var(--hg-chat-primary);
	background: #fff;
	box-shadow: 0 0 0 3px rgba(45, 81, 104, 0.1);
}

.form-actions {
	display: flex;
	gap: 10px;
	margin-top: 20px;
}

.btn-submit, 
.btn-cancel {
	flex: 1;
	padding: 10px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
	border: none;
	text-align: center;
}

.btn-submit {
	background: var(--hg-chat-primary);
	color: white;
}

.btn-submit:hover:not(:disabled) {
	background: var(--hg-chat-primary-dark);
	transform: translateY(-1px);
}

.btn-submit:disabled {
	background: #cbd5e0;
	cursor: not-allowed;
}

.btn-cancel {
	background: #edf2f7;
	color: #4a5568;
}

.btn-cancel:hover {
	background: #e2e8f0;
}

/* Ensure the AI bubble can accommodate the form width */
.lead-form-msg {
	width: 100%;
	max-width: 320px;
	padding: 20px !important;
}

.checkbox-group {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-top: 15px;
}

.checkbox-group input[type="checkbox"] {
	width: 16px;
	height: 16px;
	margin-top: 2px;
	cursor: pointer;
}

.checkbox-group label {
	font-size: 12px;
	color: #4a5568;
	line-height: 1.4;
	cursor: pointer;
}

.checkbox-group label a {
	color: var(--hg-chat-primary);
	text-decoration: underline;
}

/* Avatar image support */
.avatar-ai.avatar-img {
	padding: 0;
	overflow: hidden;
}
