<template>
	<view class="deepmate">
		<view class="deepmate-container">
			<view class="deepmate-header">
				<view class="title-container">
					<view class="title-left">
						<text class="deepmate-title">DeepMate</text>
						<text class="deepmate-subtitle">您的市场最佳顾问~</text>
					</view>
					<view class="title-right">
						<image class="deepmate-icon" src="https://d31zlh4on95l9h.cloudfront.net/images/7faa683450cc071bcc746fea8191ff6b.png" mode="aspectFit"></image>
					</view>
				</view>
			</view>
			<view class="deepmate-content">
				<view class="deepmate-hotspots">
					<view class="deepmate-question">
						<text class="question-text">今日股票策略晨报</text>
					</view>
					<view class="hotspot-item">
						<text>热门股票分析</text>
					</view>
					<view class="hotspot-item">
						<text>行业趋势预测</text>
					</view>
					<view class="hotspot-item">
						<text>市场风险提示</text>
					</view>
					<!-- <view class="hotspot-item">
						<text>投资策略建议</text>
					</view>
					<view class="hotspot-item">
						<text>财经新闻解读</text>
					</view> -->
				</view>
				<view class="deepmate-action">
					<input 
						class="stock-input" 
						type="text" 
						placeholder="请输入股票代码/名称，获取AI洞察" 
						placeholder-style="color:#fff;opacity:1"
						v-model="inputValue"
						@confirm="handleSend"
					/>
					<view class="send-button-container" @click="handleSend">
						<image class="send-button" src="https://d31zlh4on95l9h.cloudfront.net/images/3da018821a5c82b06a1d6ddc81b960ac.png" mode="aspectFit"></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'DeepMate',
		data() {
			return {
				inputValue: ''
			}
		},
		methods: {
			handleSend() {
				// 检查输入是否为空
				if (!this.inputValue.trim()) {
					uni.showToast({
						title: '请输入股票代码或名称',
						icon: 'none',
						duration: 2000
					})
					return
				}
				
				// 跳转到deepMate页面，并传递输入的内容
				uni.navigateTo({
					url: `/pages/deepMate/deepMate?query=${encodeURIComponent(this.inputValue.trim())}`
				})
				
				// 清空输入框
				this.inputValue = ''
			}
		}
	}
</script>

<style>
/* DeepMate样式 */
.deepmate-container {
	background-color: #ffe6e6;
	border-radius: 10px;
	padding: 15px 15px 15px 15px;
	margin: 0;
	width: 100%;
	box-sizing: border-box;
	overflow: hidden;
}

.deepmate-header {
	margin-bottom: 10px;
}

.title-container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
}

.title-left {
	width: 50%;
	display: flex;
	flex-direction: column;
}

.title-right {
	width: 50%;
	display: flex;
	justify-content: center;
	align-items: center;
}

.deepmate-title {
	font-size: 18px;
	font-weight: bold;
	color: #ff4d4f;
	display: block;
}

.deepmate-icon {
	width: 50px;
	height: 50px;
	margin-left: 0;
}

.deepmate-subtitle {
	font-size: 12px;
	color: #666;
	display: block;
	margin-top: 5px;
}

.deepmate-hotspots {
	margin: 10px 0;
	background-color: #ffffff;
	border-radius: 10px;
	padding: 10px;
}

.deepmate-question {
	display: flex;
	align-items: center;
	margin-bottom: 10px;
	padding-left: 10px;
	position: relative;
}

.deepmate-question:before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background-color: #ff4d4f;
	border-radius: 2px;
}

.question-text {
	font-size: 16px;
	font-weight: bold;
	color: #333;
}

.hotspot-item {
	background-color: #f5f5f5;
	padding: 8px 12px;
	border-radius: 6px;
	margin-bottom: 8px;
}

.hotspot-item text {
	font-size: 14px;
	color: #333;
}

.deepmate-action {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background-color: #ff4d4f;
	padding: 8px 15px;
	border-radius: 25px;
	margin-top: 10px;
	border: none;
}

.stock-input {
	flex: 1;
	height: 36px;
	font-size: 13px;
	color: #ffffff;
	padding: 0 8px;
	border: none;
	background-color: transparent;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* .stock-input::placeholder {
	color: rgba(255, 255, 255, 0.8);
} */

.send-button-container {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 36px;
	height: 36px;
	background-color: #ffffff;
	border-radius: 50%;
	margin-left: 10px;
}

.send-button {
	width: 20px;
	height: 20px;
}

.icon-container {
	position: relative;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #f0f8ff;
}

.deepmate-icon {
	width: 40px;
	height: 40px;
	border-radius: 50%;
}

.ripple-effect {
	position: absolute;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 0, 0, 0.4) 0%, rgba(255, 0, 0, 0.1) 70%);
	animation-name: ripple;
	animation-duration: 3s;
	animation-timing-function: ease-out;
	animation-iteration-count: infinite;
}

.ripple-1 {
	width: 100%;
	height: 100%;
	animation-delay: 0s;
}

.ripple-2 {
	width: 100%;
	height: 100%;
	animation-delay: 1s;
}

.ripple-3 {
	width: 100%;
	height: 100%;
	animation-delay: 2s;
}

@keyframes ripple {
	0% {
		transform: scale(0.8);
		opacity: 1;
	}
	100% {
		transform: scale(1.5);
		opacity: 0;
	}
}

/* 小屏幕设备优化 */
@media screen and (max-width: 375px) {
	.stock-input {
		font-size: 12px;
		padding: 0 6px;
	}
	
	.deepmate-action {
		padding: 6px 12px;
	}
}

/* 超小屏幕设备优化 */
@media screen and (max-width: 320px) {
	.stock-input {
		font-size: 11px;
		padding: 0 4px;
	}
	
	.deepmate-action {
		padding: 5px 10px;
	}
}
</style>