/**
 * WorkDo Live Cart Assist — Public Chat Popup Styles
 *
 * @package WorkDo_Live_Cart_Assist
 */

/* ---- Launcher Button (bottom-right chat bubble) ---- */
#wlca-pub-launcher {
	position: fixed;
	bottom: 50px;
	right: 30px;
	z-index: 100;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--primary-dark);
	border: 1px solid var(--border-color);
	cursor: pointer;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.3s ease;
}

#wlca-pub-launcher:before,
#wlca-pub-launcher:after {
	content: "";
	position: absolute;
	z-index: -1;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	pointer-events: none;
	transition: all .2s;
	background-color: var(--primary-dark);
	box-shadow: inset 0 0 1rem rgba(0, 0, 0, .125);
	transform-origin: 50% 50%;
	animation: grow 3s infinite;
	animation-timing-function: ease-out;
}

@keyframes grow {
	0% {
		transform: none;
		opacity: 1;
	}

	50% {
		transform: scale(1.3);
		-webkit-transform: scale(1.3);
		-moz-transform: scale(1.3);
		-ms-transform: scale(1.3);
		-o-transform: scale(1.3);
	}

	70% {
		transform: scale(1.3);
		opacity: 0;
		-webkit-transform: scale(1.3);
		-moz-transform: scale(1.3);
		-ms-transform: scale(1.3);
		-o-transform: scale(1.3);
	}

	100% {
		transform: scale(1.3);
		opacity: 0;
		-webkit-transform: scale(1.3);
		-moz-transform: scale(1.3);
		-ms-transform: scale(1.3);
		-o-transform: scale(1.3);
	}
}

/* Shown only when a cart session is active */
#wlca-pub-launcher.wlca-launcher-visible {
	display: flex;
}

#wlca-pub-launcher svg {
	height: 23px;
	width: 23px;
	display: block;
}

/* Launcher text styling */
#wlca-pub-launcher .wlca-launcher-text {
	display: none;
}

/* Icon states — chat icon shown when closed, X shown when open */
#wlca-pub-launcher .wlca-launcher-icon-chat {
	display: block;
}

#wlca-pub-launcher .wlca-launcher-icon-close {
	display: none;
}

#wlca-pub-launcher.wlca-launcher-open .wlca-launcher-icon-chat {
	display: none;
}

#wlca-pub-launcher.wlca-launcher-open .wlca-launcher-icon-close {
	display: block;
}

/* ---- Chat Widget (sits above launcher) ---- */
#wlca-pub-modal {
	position: fixed;
	bottom: 130px;
	right: 60px;
	z-index: 999999;
	width: 381px;
	max-width: calc(100vw - 32px);
	display: flex;
	flex-direction: column;
	pointer-events: none;
	transform: translateY(16px);
	opacity: 0;
	transition: transform .2s ease, opacity .2s ease;
}

#wlca-pub-modal.wlca-pub-modal-open {
	pointer-events: auto;
	transform: translateY(0);
	opacity: 1;
}

#wlca-pub-modal.wlca-pub-modal-hidden {
	display: none;
}

/* No overlay — widget floats freely */
.wlca-pub-overlay {
	display: none;
}

/* ---- Chat Box ---- */
.wlca-pub-box {
	background: var(--white);
	border-radius: 12px;
	width: 100%;
	height: 550px;
	max-height: calc(100vh - 160px);
	display: flex;
	flex-direction: column;
	box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
	border: 1px solid #D7D9DC;
	overflow: hidden;
	font-size: 14px;
}

/* ---- Header ---- */
.wlca-pub-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 15px;
	flex-shrink: 0;
	color: var(--black);
	border-bottom: 1px solid var(--border-color);
}

.wlca-pub-header-info {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

/* ---- Avatar with status dot ---- */
.wlca-pub-header-avatar {
	position: relative;
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	background: rgba(255, 255, 255, .2);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wlca-pub-avatar {
	border-radius: 50%;
}

.wlca-pub-status-dot {
	position: absolute;
	bottom: 1px;
	right: 1px;
	width: 11px;
	height: 11px;
	border-radius: 50%;
	border: 2px solid var(--theme-color);
}

.wlca-pub-status-dot.wlca-pub-status-online {
	background: var(--white);
}

/* ---- Header text block ---- */

.wlca-pub-header-name {
	font-size: 14px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.2;
}

#wlca-pub-modal-title {
	font-size: 15px;
	font-weight: 600;
}

.wlca-pub-close {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 18px;
	color: var(--black);
	padding: 4px 8px;
	line-height: 1;
	border-radius: 4px;
	min-width: 36px;
	min-height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.wlca-pub-close:hover {
	background-color: rgb(9 14 21 / 10%);
	color: var(--black);
}

/* ---- Messages Area ---- */
.wlca-pub-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	-webkit-overflow-scrolling: touch;
}

/* ---- Message Bubbles ---- */
.wlca-pub-msg {
	padding: 12px 16px;
	border-radius: 12px;
	font-size: 15px;
	line-height: 1.6;
	word-break: break-word;
	display: flex;
	flex-direction: column;
}

.wlca-pub-msg.admin {
	background: #f0f0f0;
	color: #2c2c2c;
	border-radius: 12px;
	max-width: 100%;
	align-self: flex-start;
}

.wlca-pub-msg.visitor {
	align-self: flex-end;
	background: var(--primary-dark);
	color: var(--white);
	border-bottom-right-radius: 3px;
	max-width: 75%;
}

.wlca-pub-msg.system {
	align-self: center;
	background: #e9e9e9;
	font-style: italic;
	font-size: 11px;
	padding: 8px 12px;
	border-radius: 10px;
	max-width: 90%;
	text-align: center;
}

/* ---- Admin Message Wrapper (Avatar outside bubble) ---- */
.wlca-pub-msg-wrapper {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.wlca-pub-msg-wrapper.admin {
	align-self: flex-start;
}

.wlca-pub-msg-avatar {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	margin-top: 0;
}

.wlca-pub-msg-avatar-spacer {
	width: 30px;
	height: 30px;
	flex-shrink: 0;
}

.wlca-pub-msg-content {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

.wlca-pub-msg .wlca-pub-text {
	display: block;
	word-break: break-word;
	margin: 0;
	line-height: 1.6;
	white-space: pre-wrap;
}

.wlca-pub-msg .wlca-pub-time {
	font-size: 11px;
	margin-top: 6px;
	align-self: flex-start;
	line-height: 1;
}

.wlca-pub-empty {
	color: #5c5c5c;
	font-size: 16px;
	text-align: center;
	margin: auto;
}

/* ---- Typing Indicator ---- */
.wlca-pub-typing {
	display: none;
	width: 100%;
}

.wlca-pub-typing.wlca-typing-visible {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.wlca-pub-typing.wlca-typing-visible::before {
	content: '';
	display: block;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background-image: var(--typing-avatar, url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><circle cx="16" cy="16" r="16" fill="%23ddd"/></svg>'));
	background-size: cover;
	background-position: center;
	flex-shrink: 0;
}

.wlca-pub-typing.wlca-typing-visible::after {
	content: 'typing…';
	background: #f0f0f0;
	border-radius: 12px;
	padding: 12px 16px;
	font-size: 14px;
	font-style: italic;
	color: #888;
	line-height: 1.6;
	max-width: 75%;
}

/* ---- Auto-linked URLs in chat ---- */
.wlca-chat-link {
	color: inherit;
	text-decoration: underline;
	word-break: break-all;
}

/* ---- Public Chat Offer Card Styles ---- */
/* Placed as a beautiful floating premium card between messages and input */
.wlca-pub-offer-box {
	background: #107f5a;
	border: 1px solid rgba(16, 185, 129, 0.25);
	border-radius: 12px;
	padding: 16px;
	margin: 8px 14px 12px 14px;
	flex-shrink: 0;
	animation: wlcaFadeIn 0.3s ease-out;
	color: #ffffff;
	-webkit-animation: wlcaFadeIn 0.3s ease-out;
}

.wlca-offer-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}

.wlca-offer-gift-icon {
	animation: wlcaFloat 3s ease-in-out infinite;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.wlca-offer-gift-icon svg {
	height: 26px;
	width: 26px;
}

.wlca-offer-title {
	font-size: 14px;
	font-weight: 600;
	color: #ffffff;
	letter-spacing: 0.1px;
}

/* Email Input + Button Row */
.wlca-offer-form-row {
	display: flex;
	gap: 8px;
}

.wlca-offer-form-row .secondary-btn {
	padding: 10px 16px;
	border-radius: 8px;
	-webkit-border-radius: 8px;
	-moz-border-radius: 8px;
	-ms-border-radius: 8px;
	-o-border-radius: 8px;
}

.wlca-offer-form-row .secondary-btn:hover,
.wlca-offer-form-row .secondary-btn:focus {
	background-color: var(--accent-color);
}

.wlca-offer-input-group {
	flex: 1;
	display: flex;
	align-items: center;
	background: var(--white);
	border: 1px solid var(--theme-color);
	border-radius: 8px;
	padding: 0 10px;
	transition: all 0.25s ease;
}

.wlca-offer-input-group:focus-within {
	border-color: var(--theme-color);
}

.wlca-offer-email-icon {
	color: rgba(255, 255, 255, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-right: 10px;
	flex-shrink: 0;
}

.wlca-offer-email-icon svg {
	stroke: var(--theme-color);
}

.wlca-offer-input-group:focus-within .wlca-offer-email-icon {
	color: var(--theme-color);
}

#wlca-offer-email {
	flex: 1;
	background: transparent !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	font-size: 13px !important;
	padding: 9px 0 !important;
	height: auto !important;
	min-height: 0 !important;
}

#wlca-offer-email:-webkit-autofill,
#wlca-offer-email:-webkit-autofill:hover,
#wlca-offer-email:-webkit-autofill:focus,
#wlca-offer-email:-webkit-autofill:active {
	-webkit-box-shadow: 0 0 0 1000px transparent inset !important;
	box-shadow: 0 0 0 1000px transparent inset !important;
	-webkit-text-fill-color: var(--black) !important;
	background-color: transparent !important;
	transition: background-color 5000s ease-in-out 0s;
}

#wlca-offer-email::placeholder {
	color: #636363;
}

#wlca-offer-msg {
	color: var(--white) !important;
	text-align: center;
	font-size: 12px;
	font-weight: 500;
	border-radius: 6px;
	-webkit-border-radius: 6px;
	-moz-border-radius: 6px;
	-ms-border-radius: 6px;
	-o-border-radius: 6px;
}

#wlca-offer-msg:not(:has(.wlca-offer-success-message)) {
	background-color: var(--red-color);
	padding: 5px 8px;
	margin: 10px auto 0;
}

/* Success Message - Horizontal Layout with Icon on Left */
.wlca-offer-success-message {
	display: flex;
	align-items: center;
	gap: 12px;
	animation: wlcaFadeIn 0.4s ease-out;
}

.wlca-success-icon {
	width: 20px;
	height: 20px;
	background: var(--theme-color);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.wlca-success-icon svg {
	stroke: var(--white);
	stroke-width: 3;
	height: 14px;
	width: 14px;
}

.wlca-success-text {
	text-align: start;
	font-size: 15px;
	color: var(--white);
	font-weight: 400;
}

/* Legacy success state (keep for compatibility) */
.wlca-offer-success {
	display: flex;
	align-items: center;
	gap: 10px;
	animation: wlcaFadeIn 0.3s ease-out;
}

.wlca-offer-success-icon {
	font-size: 22px;
	line-height: 1;
	flex-shrink: 0;
}

.wlca-offer-success-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--theme-color);
	margin: 0;
}

/* Micro-Animations */
@keyframes wlcaFloat {

	0%,
	100% {
		transform: translateY(0);
	}

	50% {
		transform: translateY(-4px);
	}
}

@keyframes wlcaFadeIn {
	from {
		opacity: 0;
		transform: translateY(4px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ---- Offer Banner Container ---- */
.wlca-offer-banner {
	padding: 0;
	border-top: none;
	background: transparent;
	flex-shrink: 0;
}

/* ---- Input Row ---- */
.wlca-pub-input-wrap {
	padding: 15px;
	border-top: 1px solid var(--border-color);
	background: var(--white);
	flex-shrink: 0;
	border-radius: 0 0 12px 12px;
}

.wlca-pub-input-container {
	display: flex;
	align-items: center;
	gap: 8px;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	background: #f9fafb;
	padding: 0px 4px 0px 16px;
	transition: all 0.2s ease;
}

.wlca-pub-input-container:focus-within {
	border-color: var(--primary-dark);
	background: #fff;
}

#wlca-pub-input {
	flex: 1;
	resize: none;
	min-height: 41px;
	max-height: 120px;
	overflow-y: auto;
	line-height: 1.5;
	padding: 10px 0;
	border: none;
	font-size: 14px;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	background: transparent;
	color: #1f2937;
	outline: none;
}

#wlca-pub-input::placeholder {
	color: #9ca3af;
}

#wlca-pub-send {
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	background: transparent;
	color: #9ca3af;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: all 0.2s ease;
	font-size: 20px;
	flex-shrink: 0;
}

#wlca-pub-send:disabled {
	background-color: rgba(9, 14, 21, 0.1);
	cursor: not-allowed;
	pointer-events: none;
}

#wlca-pub-send.wlca-has-text {
	background: var(--primary-dark);
	color: #ffffff;
	opacity: 1;
}

#wlca-pub-send:not(:disabled):active {
	transform: scale(0.95);
}

#wlca-pub-send svg {
	fill: currentColor;
}

/* ---- Mobile: full-width sheet from bottom ---- */
@media screen and (max-width: 480px) {
	#wlca-pub-modal {
		bottom: 0;
		right: 0;
		left: 0;
		width: 100%;
		max-width: 100%;
	}

	.wlca-pub-box {
		max-height: calc(100vh - 30px);
	}

	.wlca-pub-header {
		border-radius: 16px 16px 0 0;
	}

	.wlca-pub-input-wrap {
		border-radius: 0;
		padding: 12px;
	}

	#wlca-pub-launcher {
		right: 15px;
		bottom: 30px;
		height: 47px;
		width: 47px;
	}

	#wlca-pub-launcher svg {
		height: 20px;
		width: 20px;
	}

	#wlca-pub-modal {
		right: 15px;
		bottom: 15px;
		width: 100%;
		margin: 0 15px;
		max-width: calc(100% - 30px);
	}

	/* Offer banner mobile adjustments */
	.wlca-pub-offer-box {
		padding: 14px;
		margin: 8px 10px 10px 10px;
	}

	.wlca-offer-header {
		gap: 8px;
		margin-bottom: 10px;
	}

	.wlca-offer-gift-icon svg {
		height: 24px;
		width: 24px;
	}

	.wlca-offer-form-row {
		gap: 5px;
	}

	.wlca-offer-form-row .secondary-btn {
		padding: 9px 10px;
	}

	.wlca-offer-input-group {
		padding: 0 10px;
	}

	#wlca-offer-email {
		font-size: 12px !important;
		padding: 8px 0 !important;
	}
}