/*
 * Mesma posição do ícone flutuante de WhatsApp do plugin "sohorta"
 * (ver sohorta/inc/whatsapp.php -> .bottom_ico_whtsapp), para os dois
 * botões ficarem alinhados/consistentes no ecrã.
 */
.wc-rag-chatbot {
	--wc-rag-accent: #20603f;
	--wc-rag-accent-light: #2f8a5a;
	position: fixed;
	right: 10px;
	bottom: 80px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (min-width: 768px) {
	.wc-rag-chatbot {
		right: 40px;
		bottom: 40px;
	}
}

.wc-rag-chatbot__toggle {
	position: relative;
	width: 62px;
	height: 62px;
	border-radius: 50%;
	border: none;
	background: linear-gradient(145deg, var(--wc-rag-accent-light), var(--wc-rag-accent));
	color: #fff;
	font-size: 22px;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(32, 96, 63, 0.4), 0 2px 6px rgba(0, 0, 0, 0.15);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wc-rag-chatbot__toggle:hover {
	transform: translateY(-2px) scale(1.04);
	box-shadow: 0 12px 28px rgba(32, 96, 63, 0.48), 0 3px 8px rgba(0, 0, 0, 0.18);
}

.wc-rag-chatbot__toggle::after {
	content: "";
	position: absolute;
	top: -2px;
	right: -2px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #3ddc84;
	border: 2px solid #fff;
}

.wc-rag-chatbot.is-open .wc-rag-chatbot__toggle::after {
	display: none;
}

/*
 * !important é necessário aqui: o Font Awesome do tema define ".fas{display:inline-block}"
 * com a mesma especificidade destas regras, e consoante a ordem de carregamento das
 * folhas de estilo essa regra do tema pode sobrepor-se à nossa, fazendo os dois ícones
 * (abrir e fechar) aparecerem ao mesmo tempo em vez de alternarem.
 */
.wc-rag-chatbot__toggle-icon-close {
	display: none !important;
}

.wc-rag-chatbot.is-open .wc-rag-chatbot__toggle-icon-open {
	display: none !important;
}

.wc-rag-chatbot.is-open .wc-rag-chatbot__toggle-icon-close {
	display: inline-block !important;
}

.wc-rag-chatbot__window {
	position: absolute;
	right: 0;
	bottom: 78px;
	width: 340px;
	max-width: calc(100vw - 40px);
	height: 460px;
	max-height: 70vh;
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 20px 56px rgba(0, 0, 0, 0.22), 0 4px 14px rgba(0, 0, 0, 0.08);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: width 0.15s ease, height 0.15s ease;
	animation: wc-rag-chatbot-pop-in 0.18s ease;
}

@keyframes wc-rag-chatbot-pop-in {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.wc-rag-chatbot__window--size-2x {
	width: 680px;
	height: 760px;
}

.wc-rag-chatbot__window--size-3x {
	width: 1020px;
	height: 860px;
}

.wc-rag-chatbot__header {
	background: linear-gradient(135deg, var(--wc-rag-accent-light), var(--wc-rag-accent));
	color: #fff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	font-weight: 600;
	letter-spacing: 0.1px;
}

.wc-rag-chatbot__header-title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wc-rag-chatbot__header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

.wc-rag-chatbot__header-resize,
.wc-rag-chatbot__header-close {
	background: transparent;
	border: none;
	color: #fff;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	padding: 4px;
}

.wc-rag-chatbot__header-resize {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	font-weight: 700;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 6px;
	padding: 3px 8px;
}

.wc-rag-chatbot__header-resize i {
	font-size: 12px;
}

.wc-rag-chatbot__header-resize:hover,
.wc-rag-chatbot__header-close:hover {
	opacity: 0.8;
}

.wc-rag-chatbot__messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px;
	background: #f6faf7;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wc-rag-chatbot__message {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.45;
	word-wrap: break-word;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.wc-rag-chatbot__message p {
	margin: 0 0 6px;
}

.wc-rag-chatbot__message p:last-child {
	margin-bottom: 0;
}

.wc-rag-chatbot__message a {
	color: #20603f;
	font-weight: 600;
}

.wc-rag-chatbot__message--bot {
	background: #fff;
	border: 1px solid #e9f1ec;
	align-self: flex-start;
	border-bottom-left-radius: 4px;
}

.wc-rag-chatbot__message--user {
	background: linear-gradient(135deg, var(--wc-rag-accent-light), var(--wc-rag-accent));
	color: #fff;
	align-self: flex-end;
	border-bottom-right-radius: 4px;
	box-shadow: 0 2px 6px rgba(32, 96, 63, 0.3);
}

.wc-rag-chatbot__message--typing {
	font-style: italic;
	color: #888;
}

.wc-rag-chatbot__products {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-self: flex-start;
	max-width: 85%;
}

.wc-rag-chatbot__product-card {
	background: #fff;
	border: 1px solid #e9f1ec;
	border-radius: 14px;
	padding: 10px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.wc-rag-chatbot__product-link {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	text-decoration: none;
	color: inherit;
}

.wc-rag-chatbot__product-image {
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
	background: #f2f8f4;
}

.wc-rag-chatbot__product-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

.wc-rag-chatbot__product-name {
	font-size: 13px;
	font-weight: 600;
	color: #333;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wc-rag-chatbot__product-desc {
	font-size: 12px;
	color: #777;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wc-rag-chatbot__product-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.wc-rag-chatbot__product-price {
	font-size: 12px;
	color: #20603f;
	font-weight: 700;
	white-space: nowrap;
	flex-shrink: 0;
}

.wc-rag-chatbot__add-to-cart {
	background: var(--wc-rag-accent);
	color: #fff;
	border: none;
	border-radius: 16px;
	padding: 6px 12px;
	font-size: 12px;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.wc-rag-chatbot__add-to-cart i {
	font-size: 11px;
}

.wc-rag-chatbot__add-to-cart:hover:not(:disabled) {
	background: #184a31;
}

.wc-rag-chatbot__add-to-cart:disabled {
	opacity: 0.75;
	cursor: default;
}

.wc-rag-chatbot__form {
	display: flex;
	border-top: 1px solid #e9f1ec;
	padding: 10px;
	gap: 8px;
	background: #fff;
}

.wc-rag-chatbot__input {
	flex: 1;
	border: 1px solid #e2e8e5;
	background: #f6faf7;
	border-radius: 22px;
	padding: 9px 16px;
	font-size: 14px;
	outline: none;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.wc-rag-chatbot__input:focus {
	border-color: var(--wc-rag-accent-light);
	background: #fff;
}

.wc-rag-chatbot__send {
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	background: linear-gradient(135deg, var(--wc-rag-accent-light), var(--wc-rag-accent));
	color: #fff;
	border: none;
	border-radius: 50%;
	font-size: 15px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.wc-rag-chatbot__send:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 10px rgba(32, 96, 63, 0.35);
}

.wc-rag-chatbot__whatsapp-note {
	margin: 0;
	padding: 6px 10px 10px;
	font-size: 12px;
	color: #777;
	text-align: center;
	background: #fff;
}

.wc-rag-chatbot__whatsapp-note a {
	color: #20603f;
	font-weight: 600;
	text-decoration: underline;
}

@media (max-width: 480px) {
	.wc-rag-chatbot__window,
	.wc-rag-chatbot__window--size-2x,
	.wc-rag-chatbot__window--size-3x {
		width: calc(100vw - 24px);
		right: -8px;
	}
}
