<template>
	<view>
		<!-- 添加全局加载遮罩 -->
		<view v-if="pageLoading" class="page-loading-mask">
		</view>
		<!-- 使用自定义导航栏 -->
		<view v-show="!pageLoading">
			<custom-navbar :title="navTitle" :showBack="true" color="#FFFFFF" :rightIcons="[
				    {src: '/static/images/210/ls.png'},
				    ...(isRightIconVisible ? [{src: '/static/images/common/shape.png'}] : [])
				  ]" @right-click="shareUp" @icon-click="handleIconClick"></custom-navbar>

			<view class="device-detail-container" :style="{ paddingTop: navBarHeight + 'px' }">
				<!-- 设备电量信息 -->
				<view class="battery-section">
					<view class="battery-sectionLeft">
						<image :src="deviceInfo.devicePic" class="bipImg" mode="aspectFit"></image>
					</view>
					<view>
						<view class="battery-v1">
							<image src="/static/images/common/dl.png" class="dlIMG"></image>
							<view>
								<view class="battery-v2">{{deviceInfo.batteryPercentage}}%</view>
								<view class="battery-v3">电量</view>
							</view>
						</view>
						<view class="battery-v1">
							<image src="/static/images/common/nz.png" class="dlIMG" mode="aspectFit"></image>
							<view>
								<view class="battery-v2">{{deviceInfo.batteryRemainingTime}}分钟</view>
								<view class="battery-v3">续航时间</view>
							</view>
						</view>
					</view>
					<view>
					</view>
				</view>

				<!-- 设备基本信息 -->
				<view class="info-card">
					<view class="info-row">
						<text class="info-label">设备状态</text>
						<text class="info-value status-running">运行中</text>
					</view>
					<view class="info-row">
						<text class="info-label">联机状态</text>
						<text class="info-value status-greend">联机</text>
					</view>
					<view class="info-row">
						<text class="info-label">定位信息</text>
						<view class="info-value status-running" @click="gpsPosition">
							<view class="info-value status-running">114.72 30.28</view>
							<view class="info-value status-running">
								<uni-icons @click="toggleForm" type="location" size="17"
									color="rgba(255, 255, 255, 0.8)" style="vertical-align: bottom;" />
								深圳市龙华区富源晟
							</view>
						</view>
					</view>
				</view>
				<!-- ===========主副机选择============= -->
				<view class="mode-section">
					<view class="radio-group">
						<view v-for="(item, index) in radioList" :key="index" class="group-item">
							<view class="radio-icon" :class="{ 'selected': radioSelected === index }">
								{{ item }}
								<view class="uni-border"></view>
							</view>
						</view>
					</view>
				</view>
				<!-- 灯光模式选择 -->
				<view class="mode-section">
					<view class="mode-buttons">
						<view class="mode-v1">
							<view class="mode-v2" @click="selectMode">
								<image src="/static/images/210/lj.png" class="setIMG"></image>
								<view>
									<view class="battery-v2">联机设备</view>
								</view>
							</view>
						</view>
						<view class="mode-v1">
							<view class="mode-v2" @click="uploadStartup">
								<image src="/static/images/common/path7.png" class="setIMG" mode="aspectFit"></image>
								<view>
									<view class="battery-v2">开机画面</view>
									<view class="mode-v3">上传</view>
								</view>
							</view>
						</view>
						<view class="mode-v1">
							<view class="mode-v2" @click="automaticAlarm">
								<image src="/static/images/210/zd.png" class="setIMG" mode="aspectFit"></image>
								<view>
									<view class="battery-v2">自动报警</view>
								</view>
							</view>
						</view>
						<view class="mode-v1">
							<view class="mode-v2" @click="anualAlarm">
								<image src="/static/images/210/zd-HL.png" class="setIMG" mode="aspectFit"></image>
								<view>
									<view class="battery-v2">手动报警</view>
								</view>
							</view>
						</view>
						<view class="mode-v1">
							<view class="mode-v2">
								<image src="/static/images/210/bj.png" class="setIMG" mode="aspectFit"></image>
								<view>
									<view class="battery-v2">报警声音</view>
									<view class="mode-v3">上传</view>
								</view>
							</view>
						</view>
						<view class="mode-v1">
							<view class="mode-v2" @click="alarmTime">
								<image src="/static/images/210/time.png" class="setIMG" mode="aspectFit"></image>
								<view>
									<view class="battery-v2">报警时长</view>
									<view class="mode-v3">{{alarmTimeDisplay }}</view>
								</view>
							</view>
						</view>

					</view>
				</view>

				<!-- 人员信息登记 -->
				<view class="form-section">
					<view class="mode-buttons">
						<view class="section-title">人员信息登记</view>
						<view class="right-icons">
							<uni-icons @click="toggleForm" :type="isFormExpanded ? 'arrowup' : 'down'" size="20"
								color="rgba(255, 255, 255, 0.87" class="toggle-icon" />
						</view>
					</view>
					<view class="form-content" v-if="isFormExpanded">
						<button class="send-btn1" @click="sendPersonnelInfo">发送</button>
						<view class="form-row">
							<text class="form-label">单位：</text>
							<input class="form-input" placeholder="请输入单位" v-model="personnelInfo.unitName" />
						</view>
						<view class="form-row">
							<text class="form-label">姓名：</text>
							<input class="form-input" placeholder="请输入姓名" v-model="personnelInfo.name" />
						</view>
						<view class="form-row">
							<text class="form-label">职位：</text>
							<input class="form-input" placeholder="请输入职位" v-model="personnelInfo.position" />
						</view>
						<view class="form-row">
							<text class="form-label">ID：</text>
							<input class="form-input" placeholder="请输入ID号" v-model="personnelInfo.code" />
						</view>
					</view>
				</view>
				<!-- 人员信息登记 -->
				<view class="form-section">
					<view class="mode-buttons">
						<view class="section-title">发送信息</view>
						<button class="send-btn" @click="sendTextMessage">发送</button>
					</view>

					<view class="form-row">
						<input class="form-input" placeholder="请输入文字" v-model="messageToSend" />
					</view>
				</view>
				<!-- 产品信息 -->
				<view>
					<view class="section-title">产品信息</view>
					<view class="mode-buttons">
						<view class="mode_1" @click="productparams">
							<image src="/static/images/common/cp.png" mode="" class="cpIMG" mode="aspectFit"></image>
							<view class="">产品参数</view>
						</view>
						<view class="mode_1" @click="operatingInst">
							<image src="/static/images/common/sm.png" mode="" class="cpIMG" mode="aspectFit"></image>
							<view class="">操作说明</view>
						</view>
						<view class="mode_1" @click="operatingVideo">
							<image src="/static/images/common/sp.png" mode="" class="cpIMG" mode="aspectFit"></image>
							<view class="">操作视频</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 弹框 -->
			<view class="agreement-mask" v-if="lightModeA" @click.stop="closePopup">
				<!-- 报警时长弹窗 -->
				<view class="agreement-popup" @click.stop>
					<!-- 标题 -->
					<view class="popup-title">报警时长</view>
					<view class="popup-content">
						<view class="time-picker-container">
							<TimePicker ref="timePicker" :defaultTime="currentAlarmTime" @change="handleTimeChange" />
						</view>
					</view>
					<!-- 按钮组 -->
					<view class="popup-buttons">
						<button class="agree" @click="saveAlarmTime">保存</button>
					</view>
				</view>
			</view>
			<!-- 上传开机画面弹框 -->
			<view class="agreement-mask" v-if="lightModeB" @click.stop="closePopup">
				<!-- 上传画面弹窗 -->
				<view class="agreement-popupB" @click.stop>
					<!-- 标题 -->
					<view class="popup-title">上传开机画面</view>
					<view class="popup-content">
						<view class="example-body">
							<view class="icoContent" @click="checkImgUpload">
								<image v-if="selectedImage" :src="selectedImage" mode="aspectFit" class="img"
									style="width: 100%; height: 100%;"></image>
								<image v-else mode="aspectFit" class="img"
									src="/static/images/6155/DeviceDetail/add.png"></image>
							</view>
						</view>
					</view>
					<!-- 按钮组 -->
					<view class="popup-buttons">
						<button class="agree" @click="handleupload">确定</button>
					</view>
				</view>
			</view>
			<!-- ======各个弹框类型======= -->
			<CustomPopup :show="currentPopup.show" v-bind="currentPopup.config" @confirm="handleConfirm"
				@cancel="handleCancel" />
		</view>
	</view>
</template>

<script>
	// 弹框配置中心
	const POPUP_CONFIGS = {
		person: {
			config: {
				icon: '/static/images/common/sendSucc.png',
				message: '信息发送成功',
				showCancel: false
			},

		},
		// 开机log
		logo: {
			config: {
				icon: '/static/images/common/upload.png',
				message: '上传成功',
				showCancel: false
			},

		},
		bettery: {
			config: {
				title: '设备电量低于20%',
				titleColor: 'rgba(224, 52, 52, 1)',
				message: '请及时充电',
				icon: '/static/images/common/path.png',
				popupBorder: '1rpx solid rgba(224, 52, 52, 0.3)',
				confirmBtnBg: 'rgba(224, 52, 52, 1)',
				showCancel: true
			},
			onConfirm() {
				console.log('确认按钮');
				return true; // 直接关闭
			}
		},

		cancel: {
			config: {
				titleColor: 'rgba(224, 52, 52, 1)',
				icon: '/static/images/common/svg.png',
				popupBorder: '1rpx solid rgba(224, 52, 52, 0.3)',
				confirmBtnBg: 'rgba(224, 52, 52, 1)',
				showCancel: true //取消按钮
			},
			onConfirm() {
				console.log('解除报警确认');
			}
		},
		del: {
			config: {
				message: '确定开启报警?',
				icon: '/static/images/210/bj_1.png',
				popupBorder: '1rpx solid rgba(255, 200, 78, 1)',
				confirmBtnBg: 'rgba(255, 200, 78, 1)',
				showCancel: true
			},
			onConfirm() {
				console.log('删除确认');
			}
		},
		// 自动报警
		autoAlarm: {
			config: {
				icon: '/static/images/6170/svg.png',
				title: '报警信息',
				message: '002号设备(ID:123456)\n出现报警', // 使用\n换行
				showCountdown: true,
				countdownTime: 59,
				confirmText: '解除报警',
				popupBorder: '1rpx solid rgba(224, 52, 52, 0.3)',
				confirmBtnBg: 'rgba(224, 52, 52, 1)',
				confirmBtnColor: "rgba(255, 255, 255, 0.87)",
				showCancel: false,
			},
			onConfirm() {
				console.log('自动报警确认');
				// 这里可以添加自动报警的逻辑
			}
		}


	}
	import MqttClient from '@/utils/mqtt.js';
	import {
		deviceDetail,
		registerPersonInfo,
		deviceSendMessage,
		deviceShareId,
		lightModeSettings, //灯光模式设置
		laserModeSettings, //激光模式设置
		mapReverseGeocoding //地图逆解析
	} from '@/api/6170/deviceControl.js'
	import {
		getDeviceId
	} from '../../../store/BLETools';
	import {
		baseURL,
		getToken,
		clientid
	} from '@/utils/request'
	export default {
		data() {
			return {
				currentPopup: {
					show: false,
					config: {},
					callback: null
				},
				pageLoading: true,
				mainMode: 'string',
				secondaryMode: 'string',
				navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
				navTitle: "",
				lightModeA: false,
				lightModeB: false,
				isFormExpanded: true, // 默认展开
				deviceID: '',
				itemInfo: {},
				alarmTimeDisplay: '',
				currentAlarmTime: {
					minutes: '0',
					seconds: '30'
				},
				mqttClient: null,
				messageToSend: '',
				personnelInfo: {
					unitName: '',
					name: '',
					position: '',
					code: '',
				},
				deviceInfo: {},
				activePermissions: [], // 存储当前设备的权限数组
				isSharedDevice: false, // 标记是否来自分享
				isRightIconVisible: false,
				showPopupFlag: false, //是否显示弹框
				popupMessage: '！',
				popupConfirmText: '确认',
				showUploadPopup: false,
				selectedImage: null, // 添加这个变量来存储选择的图片
				file: '',
				selectedItemIndex: 0,
				radioList: ['M', 'S'],
				radioSelected: 0, // -1表示未选中任何项
				deviceType: '',
				popupType: '', //弹框类型
			}
		},
		methods: {
			// 点击弹框外的区域关闭
			closePopup() {
				this.lightModeA = false;
				this.lightModeB = false;
			},
			// 打开弹框
			showPopup(type) {
				this.currentPopup = {
					show: true,
					config: POPUP_CONFIGS[type].config,
					callback: POPUP_CONFIGS[type].onConfirm
				}
			},
			handleConfirm() {
				this.currentPopup.show = false;
				console.log('这是点击了确认');
			},
			// 统一处理取消
			handleCancel() {
				this.currentPopup.show = false;
			},
			// 手动报警
			anualAlarm() {
				this.showPopup('del');
			},
			handleRadioSelect(index) {
				this.radioSelected = index;
				console.log('选中了单选选项：', this.radioList[index]);
			},
			// 自动报警
			automaticAlarm() {
				this.showPopup('autoAlarm');
			},
			// *******定位******
			gpsPosition() {
				uni.navigateTo({
					url: '/pages/common/map/index'
				})
			},
			// 联机设备
			selectMode() {
				uni.navigateTo({
					url: '/pages/210/onlineDevice/index',
					events: {
						ack: function(data) {}
					},
					success: (res) => {
						// 页面跳转成功后的回调函数
						res.eventChannel.emit('onlineDevice', {
							data: this.deviceType
						});
					}
				})
			},
			// 人员信息登录
			toggleForm() {
				this.isFormExpanded = !this.isFormExpanded;
			},
			// 上传开机画面
			uploadStartup() {
				this.lightModeB = true
			},
			// 上传开机画面
			checkImgUpload() {
				uni.chooseImage({
					count: 1,
					sizeType: ['original', 'compressed'],
					sourceType: ['album', 'camera'],
					success: (res) => {
						// 将选择的图片赋值给selectedImage
						const file = res.tempFiles[0];
						const fileSize = file.size || 0;
						if (fileSize > 2 * 1024 * 1024) {
							console.log(`文件过大: ${fileSize} 字节`); // 调试日志
							uni.showToast({
								title: '图片大小不能超过2MB',
								icon: 'none',
								duration: 3000
							});
							return;
						}
						this.selectedImage = res.tempFilePaths[0];
						console.log('选择的图片:', res);
						//this.file = res.tempFiles[0].file
					},
					fail: (err) => {
						console.error('选择图片失败:', err);
						uni.showToast({
							title: '选择图片失败',
							icon: 'none'
						});
					}
				});
			},
			// 上传开机画面确认按键
			handleupload() {
				if (!this.selectedImage) {
					uni.showToast({
						title: '请上传一张图片',
						icon: 'none'
					});
					return;
				}
				// 显示上传中加载提示
				uni.showLoading({
					title: '上传中...',
					mask: true
				});

				uni.uploadFile({
					url: baseURL + '/app/device/uploadLogo',
					filePath: this.selectedImage,
					name: 'file',
					formData: {
						deviceId: this.deviceID,
					},
					header: {
						'Authorization': 'Bearer ' + getToken(),
						'clientid': clientid(),
					},
					complete: (res) => {
						console.log(res, 'resss');
						try {
							const responseData = JSON.parse(res.data);
							if (responseData.code === 200) {
								this.showPopup('logo');
								this.selectedImage = '';
								this.file = null;
								this.lightModeB = false
							} else {
								uni.showToast({
									title: responseData.msg,
									icon: 'none'
								});
							}
						} catch (e) {
							uni.showToast({
								title: '上传失败',
								icon: 'none'
							});
						} finally {
							uni.hideLoading();
						}
					}
				})
			},
			// 报警时长
			alarmTime() {
				this.lightModeA = true
			},
			handleTimeChange(time) {
				this.currentAlarmTime = time;
			},
			// 保存时间
			saveAlarmTime() {
				const time = this.$refs.timePicker.getCurrentTime();
				this.alarmTimeDisplay = `${time.minutes}分${time.seconds}秒`;
				this.lightModeA = false;
				console.log("保存的时间：", time);
			},
			handleIconClick(index) {
				// 历史记录
				if (index === 0) {
					uni.navigateTo({
						url: '/pages/210/historyRecords/index',
						events: {
							ack: function(data) {}
						},
						success: (res) => {
							res.eventChannel.emit('share', {
								data: this.itemInfo,
							});
						}
					})
				} else {
					uni.navigateTo({
						url: '/pages/6170/share/index',
						events: {
							ack: function(data) {}
						},
						success: (res) => {
							res.eventChannel.emit('share', {
								data: this.itemInfo,
							});
						}
					})
				}
			},

			// 分享
			shareUp() {

			},

			// 操作说明
			operatingInst() {
				uni.navigateTo({
					url: `/pages/common/operatingInstruct/index?id=${this.deviceID}`
				})
			},
			// 产品参数
			productparams() {
				uni.navigateTo({
					url: `/pages/common/productDes/index?id=${this.deviceID}`
				})
			},
			// 操作视频
			operatingVideo() {
				uni.navigateTo({
					url: `/pages/common/operationVideo/index?id=${this.deviceID}`
				})

			},

			// 发送人员信息
			sendPersonnelInfo() {
				if (!this.personnelInfo.unitName) {
					uni.showToast({
						title: '单位名称不能为空',
						icon: 'none'
					});
					return;
				}
				if (!this.personnelInfo.name) {
					uni.showToast({
						title: '姓名不能为空',
						icon: 'none'
					});
					return;
				}
				if (!this.personnelInfo.position) {
					uni.showToast({
						title: '职位不能为空',
						icon: 'none'
					});
					return;
				}
				if (!this.personnelInfo.code) {
					uni.showToast({
						title: 'ID不能为空',
						icon: 'none'
					});
					return;
				}
				uni.showLoading({
					title: '发送中...',
					mask: true
				})
				let data = {
					code: this.personnelInfo.code,
					name: this.personnelInfo.name,
					position: this.personnelInfo.position,
					unitName: this.personnelInfo.unitName,
					deviceId: this.deviceID
				}
				registerPersonInfo(data).then((res) => {
					if (res.code == 200) {
						uni.hideLoading()
						this.showPopup('person');
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				})
			},
			// 发送文本消息
			sendTextMessage() {
				if (!this.messageToSend) {
					uni.showToast({
						title: '请输入要发送的文字',
						icon: 'none'
					});
					return;
				}
				uni.showLoading({
					title: '发送中...',
					mask: true
				})
				let data = {
					sendMsg: this.messageToSend,
					deviceIds: [this.deviceID]
				}
				deviceSendMessage(data).then((res) => {
					if (res.code == 200) {
						uni.hideLoading()
						this.showPopup('person');
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
					}
				})
			},
			// 统一处理返回方法
			handleDeviceData(res, isFromShared = false) {
				if (res.code == 200) {
					// 最后关闭加载状态
					this.pageLoading = false
					this.deviceInfo = res.data
					this.personnelInfo = {
						unitName: res.data.personnelInfo?.unitName || '',
						name: res.data.personnelInfo?.name || '',
						code: res.data.personnelInfo?.code || '',
						position: res.data.personnelInfo?.position || '',
					}
					this.messageToSend = res.data.sendMsg || ''
					// 关闭加载中
					uni.hideLoading()
				}
			},
			// 获取设备详情（普通详情）
			async fetchDeviceDetail(id) {
				try {
					const res = await deviceDetail(id)
					this.handleDeviceData(res, false)
				} catch (error) {
					uni.showToast({
						title: '获取详情失败',
						icon: 'none'
					})
				}
			},
		},
		onLoad(options) {
			const eventChannel = this.getOpenerEventChannel();
			// 监听 'detailData' 事件，获取传过来的数据
			uni.showLoading({
				title: '加载中...'
			})
			eventChannel.on('deviceControl', (data) => {
				console.log(data, '这是传过来的惨呼啊');
				this.itemInfo = data.data;
				this.deviceID = data.data.id;
				this.navTitle = data.data.deviceName;
				this.apiType = data.apiType
				this.deviceType = data.deviceType

				// 根据 apiType 设置右图标的显示状态
				this.isRightIconVisible = this.apiType === 'listA';
				// 初始化并连接MQTT
				this.mqttClient = new MqttClient();
				this.mqttClient.connect(() => {
					console.log('MQTT 连接成功，开始订阅主题');
					// 订阅来自设备的状态更新
					const statusTopic = `A/${this.itemInfo.deviceImei}`;
					this.mqttClient.subscribe(statusTopic, (payload) => {
						console.log(`收到来自 ${statusTopic} 的消息:`, payload);
						// uni.showModal({
						// 	title: '收到设备消息',
						// 	content: payload,
						// 	showCancel: false
						// });
						// ✅ 发送全局事件通知主页面更新
						uni.$emit('deviceStatusUpdate', {
							message: JSON.stringify(payload), // 消息内容
							timestamp: new Date().getTime() // 时间戳
						});
					});
				});
				this.fetchDeviceDetail(data.data.id)

			});
			// 如果需要向调用页面返回数据，可以触发 'ack' 事件
			eventChannel.emit('ack', {

			})

		},
		onUnload() {
			// 页面卸载时断开MQTT连接
			if (this.mqttClient) {
				this.mqttClient.disconnect();
			}
		},

	}
</script>

<style scoped>
	.page-loading-mask {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: #121212;
		display: flex;
		justify-content: center;
		align-items: center;
		z-index: 9999;
	}

	/* 优化权限控制区域的显示 */
	.mode-section,
	.form-section {
		transition: opacity 0.3s ease;
	}

	.device-detail-container {
		padding: 30rpx;
		background: #121212;
		min-height: 100vh;
	}

	.status-bar {
		display: flex;
		justify-content: space-between;
		margin-bottom: 40rpx;
	}

	.time {
		font-size: 36rpx;
		font-weight: bold;
	}

	.battery {
		font-size: 36rpx;
	}

	.battery-section {
		background-color: rgb(26, 26, 26);
		border-radius: 16rpx;
		padding: 30rpx;
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
		align-items: center;
	}

	.battery-info,
	.duration {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.bipImg {
		width: 204rpx;
		height: 144rpx;
		margin-top: 30rpx;
	}

	.dlIMG {
		width: 52rpx;
		height: 52rpx;
	}

	.cpIMG {
		width: 66rpx;
		height: 66rpx;
	}

	.battery-sectionLeft {
		width: 308rpx;
		height: 220rpx;
		background: rgba(42, 42, 42, 0.5);
		border-radius: 16rpx;
		text-align: center;
		align-items: center;
		line-height: 220rpx;
	}

	.percentage {
		font-size: 48rpx;
		font-weight: bold;
		color: #007AFF;
	}

	.label {
		font-size: 28rpx;
		color: #666;
		margin-top: 10rpx;
	}

	.battery-v1 {
		display: flex;
		align-items: center;
		margin-bottom: 10rpx;
	}


	.battery-v2 {
		color: rgba(255, 255, 255, 0.87);
		margin-left: 18rpx;
		font-size: 32rpx;
	}

	.battery-v3 {
		color: rgba(255, 255, 255, 0.6);
		margin-left: 25rpx;
		font-size: 26rpx;
	}

	.mode-v3 {
		color: rgba(255, 255, 255, 0.6);
		font-size: 26rpx;
		padding-top: 10rpx;
	}

	.radio-group {
		display: flex;
		gap: 12px;
		align-items: center;
		margin-bottom: 20rpx;
		font-size: 200rpx;
	}

	.group-item {
		background: rgba(26, 26, 26, 1);
		width: 100%;
		height: 136rpx;
		border-radius: 72rpx;
		text-align: center;
		line-height: 136rpx;
		position: relative;
	}

	.radio-icon.selected {
		background-color: rgba(174, 214, 0, 1);
		transition: background-color 0.3s;
		border-radius: 72rpx;
	}

	.radio-icon {
		font-size: 50rpx;
	}

	.uni-border {
		border: 4rpx solid rgba(26, 26, 26, 1);
		width: 96%;
		height: 123rpx;
		position: absolute;
		top: 7rpx;
		left: 6rpx;
		border-radius: 72rpx;
	}

	.info-card {
		background-color: rgb(26, 26, 26);
		border-radius: 16rpx;
		padding: 10rpx 30rpx 5rpx 30rpx;
		margin-bottom: 20rpx;

	}

	.info-row {
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
	}

	.info-label {
		font-size: 28rpx;
		color: rgba(255, 255, 255, 0.87);
	}

	.info-value {
		font-size: 28rpx;
		color: rgba(255, 255, 255, 0.87);
	}

	.status-running {
		color: rgba(255, 255, 255, 0.6);
		text-align: end;
	}

	.status-greend {
		color: rgba(174, 214, 0, 1);
		text-align: end;
	}

	.light {
		position: absolute;
		/* top:10rpx; */
		color: rgba(74, 74, 74, 0.87);
		top: 58rpx;
		left: 108rpx
	}

	.section-title {
		font-size: 32rpx;
		margin-bottom: 20rpx;
		display: block;
		color: rgba(255, 255, 255, 0.87);
	}

	.slider-container {
		display: flex;
		align-items: center;
	}

	.slider {
		flex: 1;
		margin: 0 20rpx;
	}

	.mode-buttons {
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
	}

	.mode_1 {
		width: 180rpx;
		height: 180rpx;
		border-radius: 16rpx;
		background: rgb(26, 26, 26);
		align-items: center;
		text-align: center;
		color: rgba(255, 255, 255, 0.6);
		padding-top: 37rpx;
	}

	.mode-v1 {
		background: #1A1A1A;
		border-radius: 18rpx;
		height: 150rpx;
		margin-bottom: 20rpx;
		width: 47%;
		display: flex;
		text-align: center;
	}

	.mode-v2 {
		display: flex;
		align-items: center;
		text-align: center;
		margin-left: 40rpx;

	}

	.example-body {
		position: absolute;
		left: 50%;
		top: 65%;
		width: 100%;
		transform: translate(-20%, -100%);
	}

	.icoContent {
		width: 320rpx;
		height: 160rpx;
		border-radius: 8rpx;
		background: rgba(58, 58, 58, 1);
		text-align: center;
		line-height: 200rpx;
	}

	.img {
		width: 62rpx;
		height: 62rpx;
	}

	.example_title {
		color: rgba(255, 255, 255, 0.87);
	}

	.mode-btn {
		width: 48%;
		height: 80rpx;
		line-height: 80rpx;
		background-color: #f5f5f5;
		color: #333;
		border-radius: 8rpx;
		font-size: 28rpx;
		border: none;
	}

	.mode-btn.active {
		background-color: #007AFF;
		color: #fff;
	}

	.form-section {
		background-color: rgb(26, 26, 26);
		border-radius: 16rpx;
		padding: 30rpx;
		margin-bottom: 30rpx;

	}

	.form-row {
		display: flex;
		align-items: center;
		margin-bottom: 20rpx;
		background: rgba(42, 42, 42, 1);
		border-radius: 16rpx;
		padding-left: 20rpx;
	}

	.form-label {
		font-size: 32rpx;
		color: rgba(255, 255, 255, 0.87);
	}

	.form-input {
		height: 80rpx;
		border: 1rpx solid transparent;
		font-size: 32rpx;
		color: rgba(255, 255, 255, 0.87);
	}

	.product-section {
		background-color: #fff;
		border-radius: 16rpx;
		padding: 30rpx;
		margin-bottom: 30rpx;
		box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
	}

	.product-tabs {
		display: flex;
		margin-top: 20rpx;
	}

	.tab {
		padding: 15rpx 30rpx;
		font-size: 28rpx;
		color: #666;
		border-bottom: 4rpx solid transparent;
	}

	.tab.active {
		color: #007AFF;
		border-bottom-color: #007AFF;
	}

	.action-buttons {
		padding: 30rpx 0;
	}

	.send-btn {
		background-color: rgb(187, 230, 0);
		color: rgba(35, 35, 35, 0.87);
		height: 50rpx;
		line-height: 50rpx;
		border-radius: 16rpx;
		font-size: 26rpx;
		width: 112rpx;
		white-space: nowrap;
		text-align: center;
		position: absolute;
		right: 70rpx;

	}

	.send-btn1 {
		background-color: rgb(187, 230, 0);
		color: rgba(35, 35, 35, 0.87);
		height: 50rpx;
		line-height: 50rpx;
		border-radius: 16rpx;
		font-size: 26rpx;
		width: 112rpx;
		white-space: nowrap;
		text-align: center;
		position: absolute;
		right: 0rpx;
		top: -70rpx
	}


	/* 遮罩层 */
	.agreement-mask {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: rgba(0, 0, 0, 0.5);
		display: flex;
		justify-content: center;
		align-items: center;
		z-index: 9999;
	}

	/* 弹窗主体 */
	.agreement-popup {
		width: 100%;
		height: 40%;
		background-color: rgb(42, 42, 42);
		border-radius: 60rpx 60rpx 0rpx 0rpx;
		padding: 40rpx;
		box-sizing: border-box;
		position: absolute;
		bottom: 0rpx;
	}

	.agreement-popupB {
		width: 100%;
		height: 32%;
		background-color: rgb(42, 42, 42);
		border-radius: 60rpx 60rpx 0rpx 0rpx;
		padding: 40rpx;
		box-sizing: border-box;
		position: absolute;
		bottom: 0rpx;
	}

	.agreement-popupC {
		width: 80%;
		background-color: rgb(42, 42, 42);
		border-radius: 40rpx;
		padding: 40rpx;
		box-sizing: border-box;
		border: 1px solid rgba(255, 200, 78, 1);
	}

	.popup-Title {
		color: rgba(255, 200, 78, 1);
	}

	/* 标题 */
	.popup-title {
		font-size: 36rpx;
		text-align: center;
		margin-bottom: 30rpx;
		color: rgba(255, 255, 255, 0.87);
	}

	/* 内容文本 */
	.popup-content {
		font-size: 30rpx;
		line-height: 1.6;
		color: rgba(255, 255, 255, 0.87);
		margin-bottom: 50rpx;
	}

	.item {
		padding: 10px;
		margin: 5px 0;
		display: flex;
		align-items: center;
		cursor: pointer;
		transition: background-color 0.3s;
	}

	.setIMG {
		width: 24px;
		height: 24px;
		margin-right: 10px;
	}

	.item.selected {
		background-color: rgb(58, 58, 58);
		color: rgba(255, 255, 255, 0.87);
		border-radius: 8rpx;
	}

	/* 按钮容器 */
	.popup-buttons {
		display: flex;
		justify-content: space-between;
	}

	/*确定按钮 */
	.agree {
		background-color: rgb(187, 230, 0);
		color: #232323;
		border: none;
		font-size: 24rpx;
		height: 88rpx;
		line-height: 88rpx;
		font-size: 32rpx;
		width: 100%;
		position: absolute;
		bottom: 0rpx;
		left: 0rpx
	}

	/* 通用按钮样式 */
	.btn {
		flex: 1;
		height: 80rpx;
		line-height: 80rpx;
		border-radius: 40rpx;
		font-size: 32rpx;
		margin: 0 20rpx;
	}

	/* 不同意按钮 */
	.disagree {
		background-color: transparent;
		color: rgba(255, 255, 255, 0.87);
		border: 1px solid rgba(255, 200, 78, 0.7);
		font-size: 24rpx;
		color: rgba(255, 200, 78, 1);
	}

	/* 同意按钮 */
	.agreeBtn {
		background-color: rgba(255, 200, 78, 1);
		color: #232323;
		border: none;
		font-size: 24rpx;
	}

	.right-icons {
		/* display: flex; */
		align-items: center;
	}

	.toggle-icon {
		cursor: pointer;
		font-size: 16px;
		margin-top: -40rpx;
	}

	.icon {
		font-size: 14px;
		color: #fff;
	}

	.form-content {
		transition: all 0.3s ease;
		margin-top: 60rpx;
		position: relative;
	}
</style>