<template>
  <div class="device-info-container">
    <!-- 设备基本信息区域 -->
    <div class="device-base-info">
      <div class="info-section-title">
        <div style="background-color: #1e4276;width: 100%;">设备基本信息</div>
      </div>
      <div class="info-content">
        <div class="info-row">
          <div class="info-item">
            <span class="info-label">设备类型：</span>
            <span class="info-value blue-value">{{ props.deviceInfo.deviceType }}</span>
          </div>
          <div class="info-item">
            <span class="info-label">摄像机类型：</span>
            <span class="info-value blue-value">{{ props.deviceInfo.cameraType }}</span>
          </div>
          <div class="info-item">
            <span class="info-label">设备编号：</span>
            <span class="info-value blue-value">{{ props.deviceInfo.deviceId }}</span>
          </div>
        </div>
        <div class="info-row">
          <div class="info-item">
            <span class="info-label">所属路段：</span>
            <span class="info-value blue-value">{{ props.deviceInfo.roadSection }}</span>
          </div>
          <div class="info-item">
            <span class="info-label">所属方向：</span>
            <span class="info-value blue-value">{{ props.deviceInfo.direction }}</span>
          </div>
          <div class="info-item">
            <span class="info-label">桩号：</span>
            <span class="info-value blue-value">{{ props.deviceInfo.pilEnum }}</span>
          </div>
        </div>
        <div class="info-row">
          <div class="info-item">
            <span class="info-label">经度：</span>
            <span class="info-value blue-value">{{ props.deviceInfo.lon }}</span>
          </div>
          <div class="info-item">
            <span class="info-label">维度：</span>
            <span class="info-value blue-value">{{ props.deviceInfo.lat }}</span>
          </div>
          <div class="info-item">
            <span class="info-label">IP：</span>
            <span class="info-value blue-value">{{ props.deviceInfo.ip }}</span>
          </div>
        </div>
      </div>
    </div>

    <!-- 实时视频区域 -->
    <div class="real-time-video">
      <div class="video-section-title">
        <div style="background-color: #1e4276;width: 100%;padding-left: 20px;">实时视频</div>
      </div>
      <div class="video-container">
        <div class="video-player">
          <!-- 这里可以放实际的视频播放器，现在用图片示例 -->
          <img src="@/assets/img/demo.png" alt="实时视频" class="video-placeholder" />
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, nextTick, onMounted } from "vue";
// 设备信息数据，可以通过props传入
const props = defineProps({
  deviceInfo: {
    type: Object,
    default: () => ({
    })
  }
});
onMounted(()=>{
  console.log(props.deviceInfo, 'ddddddddddddd')
})
</script>

<style scoped lang="scss">
.device-info-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(0, 24, 65, 0.7);
  border-radius: 8px;
  padding: 20px 0;
  overflow: hidden;
}

.device-base-info {
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  position: relative;
  margin-bottom: 30px;
  max-height: 40%;
}

.info-section-title,
.video-section-title {
  height: 80px;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  padding: 0 40px;
  display: flex;
  align-items: center;
  position: relative;
  border-bottom: 1px solid rgba(26, 233, 238, 0.2);
}

.info-content {
  padding: 20px 40px;
  background: rgba(15, 43, 89, 0.3);
  max-height: calc(100% - 80px);
  overflow-y: auto;
}

.info-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 10px;

  &:last-child {
    margin-bottom: 0;
  }
}

.info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 33%;
  padding: 8px 15px;
  background-color: #0d2d5f;
  margin-right: 60px;
  border-radius: 2px;
  margin-bottom: 15px;

  &:last-child {
    margin-right: 0;
  }
}

.info-label {
  font-size: 24px;
  color: #fff;
  margin-right: 10px;
  white-space: nowrap;
  position: relative;
  padding-left: 25px;
  display: flex;
  align-items: center;

  &::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background-color: #83b5ff;
    margin-right: 10px;
  }
}

.info-value {
  font-size: 24px;
  white-space: nowrap;

  &.blue-value {
    color: #1ae9ee;
    text-shadow: 0 0 5px rgba(26, 233, 238, 0.5);
  }
}

.real-time-video {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.video-container {
  flex: 1;
  position: relative;
  background: rgba(15, 43, 89, 0.3);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  min-height: 0;
  padding: 20px 40px;
}

.location-marker {
  position: absolute;
  top: 30px;
  right: 30px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50px;
  padding: 15px 30px;
  display: flex;
  align-items: center;
  z-index: 10;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(26, 233, 238, 0.3);
}

.marker-icon {
  width: 30px;
  height: 30px;
  background-color: #1ae9ee;
  border-radius: 50%;
  margin-right: 15px;
  box-shadow: 0 0 10px rgba(26, 233, 238, 0.8);
  position: relative;

  &::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    background-color: rgba(15, 43, 89, 0.9);
    border-radius: 50%;
  }

  &::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: #1ae9ee;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(26, 233, 238, 1);
  }
}

.marker-text {
  font-size: 28px;
  color: #fff;
  margin-right: 15px;
}

.marker-subtext {
  font-size: 24px;
  color: #f56c6c;
}

.video-player {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  border: 2px solid #5a7ba1;
  border-radius: 4px;
  box-shadow: 0 0 15px rgba(26, 233, 238, 0.5), inset 0 0 8px rgba(26, 233, 238, 0.3);
  padding: 10px;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 20px rgba(15, 43, 89, 0.8);
    pointer-events: none;
    z-index: 1;
  }

  &::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 1px solid #5a7ba1;
    border-radius: 5px;
    pointer-events: none;
    z-index: 1;
  }
}

.video-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  position: relative;
  z-index: 0;
}
</style>