/* Widget de chat con asistente IA - esquina inferior derecha */
.chatbot-widget {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 9999;
	font-family: inherit;
}

.chatbot-toggle {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(26, 115, 232, 0.45);
	font-size: 26px;
	line-height: 1;
	transition: transform 0.2s, box-shadow 0.2s;
}

.chatbot-toggle:hover {
	transform: scale(1.05);
	box-shadow: 0 6px 18px rgba(26, 115, 232, 0.5);
}

.chatbot-panel {
	position: absolute;
	bottom: 70px;
	right: 0;
	width: 360px;
	max-width: calc(100vw - 40px);
	height: 480px;
	max-height: calc(100vh - 120px);
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid rgba(0, 0, 0, 0.08);
}

.chatbot-header {
	padding: 14px 16px;
	background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
	color: #fff;
	font-weight: 600;
	font-size: 1rem;
}

.chatbot-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f8f9fa;
}

.chatbot-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 0.9rem;
	line-height: 1.4;
	word-wrap: break-word;
	white-space: pre-line;
}

.chatbot-msg.user {
	align-self: flex-end;
	background: #1a73e8;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.chatbot-msg.assistant {
	align-self: flex-start;
	background: #fff;
	color: #333;
	border: 1px solid #e0e0e0;
	border-bottom-left-radius: 4px;
}

.chatbot-msg.assistant.error {
	background: #ffebee;
	border-color: #ef5350;
	color: #c62828;
}

.chatbot-msg.typing {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e0e0e0;
	color: #666;
	font-style: italic;
}

/* Respuesta con lista de productos */
.chatbot-product-response {
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.chatbot-product-response .chatbot-intro,
.chatbot-product-response .chatbot-cierre {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.4;
}
.chatbot-product-list {
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.chatbot-product-card {
	background: #f5f5f5;
	border: 1px solid #e0e0e0;
	border-radius: 10px;
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.chatbot-product-img-wrap {
	width: 100%;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}
.chatbot-product-img {
	display: block;
	width: 100%;
	max-height: 140px;
	object-fit: contain;
}
.chatbot-product-name {
	font-weight: 600;
	font-size: 0.9rem;
	color: #1a1a1a;
	line-height: 1.3;
}
.chatbot-product-meta {
	font-size: 0.8rem;
	color: #555;
}
.chatbot-product-actions {
	margin-top: 4px;
}
.chatbot-addtocart {
	display: inline-flex;
	align-items: center;
	padding: 8px 14px;
	background: #1a73e8;
	color: #fff !important;
	border-radius: 8px;
	font-size: 0.85rem;
	font-weight: 500;
	text-decoration: none;
	cursor: pointer;
	border: none;
	transition: background 0.2s;
}
.chatbot-addtocart:hover {
	background: #1557b0;
	color: #fff !important;
}
.chatbot-addtocart .me-2 {
	margin-right: 6px;
}
.chatbot-product-response .chatbot-cierre {
	margin-top: 4px;
	padding-top: 8px;
	border-top: 1px solid #e8e8e8;
}

.chatbot-input-area {
	display: flex;
	gap: 8px;
	padding: 12px;
	background: #fff;
	border-top: 1px solid #e0e0e0;
}

.chatbot-input-area input {
	flex: 1;
	padding: 10px 14px;
	border: 1px solid #dadce0;
	border-radius: 24px;
	font-size: 0.9rem;
	outline: none;
	transition: border-color 0.2s;
}

.chatbot-input-area input:focus {
	border-color: #1a73e8;
}

.chatbot-input-area button {
	padding: 10px 18px;
	background: #1a73e8;
	color: #fff;
	border: none;
	border-radius: 24px;
	font-weight: 500;
	cursor: pointer;
	font-size: 0.9rem;
	transition: background 0.2s;
}

.chatbot-input-area button:hover {
	background: #1557b0;
}

.chatbot-input-area button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

@media (max-width: 480px) {
	.chatbot-widget {
		bottom: 12px;
		right: 12px;
	}
	.chatbot-panel {
		width: calc(100vw - 24px);
		right: -8px;
		bottom: 64px;
		height: 70vh;
	}
}
