/* WP AI Chatbot v1.0.0 — Chat Widget Styles (Style B: Clean White Minimal) */
/* ZERO hardcoded theme colors — all themeable colors use CSS variables */

:root {
	--wpac-white: #ffffff;
	--wpac-body-bg: #F9FAFB;
	--wpac-border: #E5E7EB;
	--wpac-border-soft: #F3F4F6;
	--wpac-text: #111827;
	--wpac-text-muted: #6B7280;
	--wpac-bot-bubble: #ffffff;
}

/* ── Floating Toggle Button ── */

.wpac-toggle {
	position: fixed;
	bottom: 24px;
	z-index: 99998;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--wpac-theme);
	color: var(--wpac-theme-text);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	transition: background 0.2s, transform 0.2s;
	animation: wpac-pulse 2s ease-in-out 1;
	padding: 0;
}

.wpac-toggle:hover {
	background: var(--wpac-theme-hover);
	transform: scale(1.05);
}

.wpac-toggle svg {
	width: 24px;
	height: 24px;
}

@keyframes wpac-pulse {
	0%, 100% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
	50% { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3); }
}

/* ── Widget Container ── */

.wpac-widget {
	position: fixed;
	bottom: 92px;
	z-index: 99999;
	width: 360px;
	max-height: 520px;
	border-radius: 20px;
	border: 1px solid var(--wpac-border);
	background: var(--wpac-white);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(20px) scale(0.95);
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.wpac-widget[data-position="bottom-right"] {
	right: 24px;
}

.wpac-widget[data-position="bottom-left"] {
	left: 24px;
}

.wpac-toggle[data-position="bottom-right"] {
	right: 24px;
}

.wpac-toggle[data-position="bottom-left"] {
	left: 24px;
}

.wpac-widget.wpac-open {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.wpac-hidden {
	display: none !important;
}

/* ── Header ── */

.wpac-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var(--wpac-white);
	border-bottom: 1px solid var(--wpac-border);
	flex-shrink: 0;
}

.wpac-avatar {
	width: 38px;
	height: 38px;
	border-radius: 12px;
	background: var(--wpac-theme-light);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	flex-shrink: 0;
	line-height: 1;
}

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

.wpac-bot-name {
	font-size: 14px;
	font-weight: 500;
	color: var(--wpac-text);
	line-height: 1.3;
}

.wpac-bot-subtext {
	font-size: 11px;
	color: var(--wpac-text-muted);
	line-height: 1.3;
}

.wpac-close {
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px;
	color: var(--wpac-text-muted);
	line-height: 1;
	flex-shrink: 0;
	transition: color 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wpac-close:hover {
	color: var(--wpac-text);
}

/* ── Chat Body ── */

.wpac-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: var(--wpac-body-bg);
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-height: 280px;
	max-height: 340px;
}

/* Custom scrollbar */
.wpac-body::-webkit-scrollbar {
	width: 4px;
}

.wpac-body::-webkit-scrollbar-track {
	background: transparent;
}

.wpac-body::-webkit-scrollbar-thumb {
	background: var(--wpac-border);
	border-radius: 4px;
}

/* ── Message Bubbles ── */

.wpac-msg {
	max-width: 82%;
	font-size: 14px;
	line-height: 1.5;
	padding: 9px 12px;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.wpac-msg--bot {
	align-self: flex-start;
	background: var(--wpac-bot-bubble);
	color: var(--wpac-text);
	border: 1px solid var(--wpac-border);
	border-radius: 4px 16px 16px 16px;
}

.wpac-msg--user {
	align-self: flex-end;
	background: var(--wpac-theme);
	color: var(--wpac-theme-text);
	border-radius: 16px 4px 16px 16px;
}

/* ── Typing Indicator ── */

.wpac-typing {
	align-self: flex-start;
	display: none;
	align-items: center;
	gap: 5px;
	padding: 10px 14px;
	background: var(--wpac-bot-bubble);
	border: 1px solid var(--wpac-border);
	border-radius: 4px 16px 16px 16px;
}

.wpac-typing--visible {
	display: flex;
}

.wpac-typing__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--wpac-text-muted);
	animation: wpac-bounce 1.4s infinite ease-in-out both;
}

.wpac-typing__dot:nth-child(1) {
	animation-delay: 0s;
}

.wpac-typing__dot:nth-child(2) {
	animation-delay: 0.2s;
}

.wpac-typing__dot:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes wpac-bounce {
	0%, 80%, 100% {
		transform: scale(0.6);
		opacity: 0.4;
	}
	40% {
		transform: scale(1);
		opacity: 1;
	}
}

/* ── Input Bar ── */

.wpac-input-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	background: var(--wpac-white);
	border-top: 0.5px solid var(--wpac-border-soft);
	flex-shrink: 0;
}

.wpac-input {
	flex: 1;
	border: none;
	outline: none;
	font-size: 14px;
	color: var(--wpac-text);
	background: transparent;
	padding: 6px 4px;
	line-height: 1.4;
	font-family: inherit;
}

.wpac-input::placeholder {
	color: var(--wpac-text-muted);
}

.wpac-input:focus {
	box-shadow: none;
}

.wpac-send {
	width: 36px;
	height: 36px;
	border-radius: 8px;
	background: var(--wpac-theme);
	color: var(--wpac-theme-text);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.2s, opacity 0.2s;
	padding: 0;
}

.wpac-send:hover {
	background: var(--wpac-theme-hover);
}

.wpac-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.wpac-send svg {
	width: 16px;
	height: 16px;
}

/* ── Handoff Card ── */

.wpac-handoff-card {
	max-width: 90%;
	padding: 12px 14px;
}

.wpac-handoff-msg {
	margin: 0 0 10px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--wpac-text);
}

.wpac-handoff-buttons {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.wpac-handoff-buttons a {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 16px;
	color: #ffffff;
	border-radius: 10px;
	font-size: 13px;
	font-weight: 500;
	text-decoration: none;
	cursor: pointer;
	transition: opacity 0.2s;
}

.wpac-handoff-buttons a:hover {
	opacity: 0.9;
}

.wpac-handoff-buttons a svg {
	flex-shrink: 0;
}

.wpac-btn-whatsapp {
	background: #25D366;
}

.wpac-btn-whatsapp:hover {
	background: #1fb855;
}

.wpac-btn-call {
	background: #3B82F6;
}

.wpac-btn-call:hover {
	background: #2563EB;
}

.wpac-btn-email {
	background: #EA4335;
}

.wpac-btn-email:hover {
	background: #d33426;
}

/* ── Responsive / Mobile ── */

@media (max-width: 480px) {
	.wpac-widget {
		width: 100%;
		right: 0 !important;
		left: 0 !important;
		bottom: 0;
		max-height: 85vh;
		border-radius: 20px 20px 0 0;
	}

	.wpac-toggle {
		bottom: 16px;
	}

	.wpac-toggle[data-position="bottom-right"] {
		right: 16px;
	}

	.wpac-toggle[data-position="bottom-left"] {
		left: 16px;
	}

	.wpac-body {
		max-height: none;
		min-height: 200px;
	}
}

/* ── Body scroll lock (applied by JS when widget open on mobile) ── */

.wpac-body-locked {
	overflow: hidden !important;
	position: fixed;
	width: 100%;
}
