/* ============================================================
   El widget vive dentro de una web con su propio tema, que suele
   aplicar estilos globales a <button>, <input>, <textarea> y <a>
   (mayúsculas, padding grande, bordes, sombras...). Para no
   depender del orden de carga ni de la especificidad del CSS del
   tema, los elementos interactivos del widget llevan !important
   en sus propiedades visuales — es la única forma de garantizar
   que se ven igual en cualquier tema.
   ============================================================ */

#cp-chatbot-root,
#cp-chatbot-root * {
	box-sizing: border-box !important;
	margin: 0 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	text-shadow: none !important;
}

#cp-chatbot-root {
	position: fixed;
	/* Subido desde 20px para no pisar el badge de reCAPTCHA de Google,
	   que ocupa la esquina inferior derecha en casi todo WooCommerce. */
	bottom: 96px;
	right: 20px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#cp-chatbot-root button,
#cp-chatbot-root input,
#cp-chatbot-root textarea,
#cp-chatbot-root a {
	all: revert;
}

:where(#cp-chatbot-root) button,
:where(#cp-chatbot-root) input,
:where(#cp-chatbot-root) textarea,
:where(#cp-chatbot-root) a {
	border: none !important;
	outline: none !important;
	background: none !important;
	box-shadow: none !important;
	border-radius: 0 !important;
	font-family: inherit !important;
	line-height: 1.4 !important;
	cursor: pointer !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

#cp-chatbot-root textarea {
	cursor: text !important;
}

#cp-chatbot-toggle {
	width: 56px !important;
	height: 56px !important;
	border-radius: 50% !important;
	background: linear-gradient(145deg, #a3b587, #7f9060) !important;
	color: #fff !important;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	position: relative;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#cp-chatbot-toggle:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2) !important;
}

.cp-status-dot {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #4caf50;
	border: 2px solid #fff;
	animation: cp-pulse 2s infinite;
}

@keyframes cp-pulse {
	0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.55); }
	70% { box-shadow: 0 0 0 6px rgba(76, 175, 80, 0); }
	100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

/* Burbuja de invitación automática */
#cp-chatbot-invite {
	position: absolute;
	bottom: 68px;
	right: 0;
	background: #fff;
	color: #2b2b2b;
	padding: 10px 30px 10px 14px;
	border-radius: 12px;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
	font-size: 12.5px;
	max-width: 200px;
	line-height: 1.35;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
	cursor: pointer;
}

#cp-chatbot-invite.cp-visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

#cp-chatbot-invite.cp-hidden {
	display: none;
}

#cp-chatbot-invite-close {
	position: absolute !important;
	top: 4px !important;
	right: 6px !important;
	font-size: 15px !important;
	color: #999 !important;
	width: auto !important;
	height: auto !important;
}

#cp-chatbot-window {
	position: absolute;
	bottom: 70px;
	right: 0;
	width: 340px;
	max-width: 90vw;
	height: 460px;
	max-height: 70vh;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 34px rgba(0, 0, 0, 0.16);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease;
}

#cp-chatbot-window.cp-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

#cp-chatbot-window.cp-hidden {
	display: none;
}

.cp-chatbot-header {
	background: linear-gradient(120deg, #93A374, #7f9060) !important;
	color: #fff !important;
	padding: 14px !important;
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 14px;
	flex-shrink: 0;
}

.cp-header-title {
	display: flex;
	align-items: center;
	gap: 8px;
}

.cp-header-mascot {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	border: 2px solid rgba(255, 255, 255, 0.5);
}

.cp-chatbot-header small {
	display: flex;
	align-items: center;
	gap: 4px;
	font-weight: 400;
	opacity: 0.9;
	font-size: 11px;
	margin-top: 2px !important;
}

.cp-header-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #b7e4a1;
	display: inline-block;
}

#cp-chatbot-close {
	color: #fff !important;
	font-size: 26px !important;
	width: 30px !important;
	height: 30px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex-shrink: 0;
}

.cp-chatbot-messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: #f7f7f5;
}

.cp-msg {
	max-width: 85%;
	padding: 8px 12px !important;
	border-radius: 12px !important;
	font-size: 13.5px !important;
	line-height: 1.4 !important;
	white-space: pre-wrap;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

.cp-msg-bot {
	background: #eceee7 !important;
	color: #2b2b2b !important;
	align-self: flex-start;
	border-bottom-left-radius: 4px !important;
}

.cp-msg-user {
	background: #93A374 !important;
	color: #fff !important;
	align-self: flex-end;
	border-bottom-right-radius: 4px !important;
	box-shadow: none !important;
}

.cp-msg-error {
	background: #f8d7da !important;
	color: #58151c !important;
	align-self: flex-start;
}

/* Indicador de "escribiendo..." con puntos animados */
.cp-typing {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 10px 12px !important;
}

.cp-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #a3a89a;
	animation: cp-bounce 1.2s infinite ease-in-out;
}

.cp-typing span:nth-child(2) { animation-delay: 0.15s; }
.cp-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes cp-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.cp-chatbot-input-row {
	display: grid !important;
	grid-template-columns: 1fr auto;
	align-items: flex-end;
	gap: 6px;
	padding: 8px;
	border-top: 1px solid #eee;
	flex-shrink: 0;
}

#cp-chatbot-input {
	width: 100%;
	min-width: 0;
	resize: none;
	border: 1px solid #ddd !important;
	border-radius: 8px !important;
	padding: 8px 10px !important;
	font-size: 13.5px !important;
	max-height: 90px;
	background: #fff !important;
	color: #2b2b2b !important;
}

#cp-chatbot-send {
	background: #93A374 !important;
	color: #fff !important;
	border-radius: 8px !important;
	width: 38px !important;
	height: 38px !important;
	flex-shrink: 0;
	font-size: 15px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
}

#cp-chatbot-send:disabled {
	opacity: 0.5 !important;
	cursor: default !important;
}

.cp-products {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 2px !important;
}

.cp-product-card {
	display: flex;
	gap: 10px;
	background: #fff;
	border: 1px solid #e5e5e0;
	border-radius: 10px;
	padding: 8px;
	align-self: stretch;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.cp-product-card:hover {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

.cp-product-card img {
	width: 56px !important;
	height: 56px !important;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
	background: #f0f0ec;
}

.cp-product-info {
	flex: 1;
	min-width: 0;
}

.cp-product-name {
	font-size: 13px !important;
	font-weight: 600 !important;
	color: #2b2b2b !important;
	line-height: 1.3 !important;
	margin-bottom: 2px !important;
}

.cp-product-price {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px !important;
	color: #93A374 !important;
	font-weight: 600 !important;
	margin-bottom: 6px !important;
}

.cp-stock-badge {
	font-size: 10px !important;
	font-weight: 600 !important;
	color: #3f7a3f !important;
	background: #e5f2e0 !important;
	padding: 1px 6px !important;
	border-radius: 8px !important;
}

.cp-product-actions {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.cp-btn {
	font-size: 11.5px !important;
	padding: 5px 9px !important;
	border-radius: 6px !important;
	font-weight: 600 !important;
	line-height: 1.2 !important;
	display: inline-block;
}

.cp-btn-primary {
	background: #93A374 !important;
	color: #fff !important;
}

.cp-invoice-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: #fff;
	border: 1px solid #e5e5e0;
	border-radius: 10px;
	padding: 10px 12px;
	align-self: stretch;
}

.cp-invoice-label {
	font-size: 13px !important;
	font-weight: 600 !important;
	color: #2b2b2b !important;
}

@media (max-width: 480px) {
	#cp-chatbot-window {
		width: 92vw;
		right: -4px;
	}
}
