<template>
  <div v-if="visible" class="monitor-detail">
    <dv-border-box-11 :title="monitor.location">
      <div class="detail-content">
        <div class="video-container">
          <video autoplay loop muted controls>
            <source :src="monitor.videoSrc" type="video/mp4">
          </video>
        </div>  
      </div>
    </dv-border-box-11>
    <button class="close-btn" @click="close">×</button>
  </div>
</template>

<script setup>
defineProps({
  visible: Boolean,
  monitor: {
    type: Object,
    required: true,
    default: () => ({
      location: '港口区',
      videoSrc: ''
    })
  }
})

const emit = defineEmits(['close'])

const close = () => {
  emit('close')
}
</script>

<style scoped>
.monitor-detail {
  width: 60vw;
  height: 70vh;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}
/* 关键修改：使边框背景不透明 */
::v-deep .dv-border-box-11 {
  background-color: #0a1d3c !important; /* 使用与界面一致的深蓝色 */
  background-image: none !important;
}

/* 调整边框内部内容样式 */
::v-deep .border-box-content {
  padding: 0;
  background: transparent;
}
.close-btn {
  position: absolute;
  top: 35px;
  right: 10px;
  font-size: 28px;
  color: white;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 15px;
  z-index: 1001;
  
  &:hover {
    color: #ff4d4f;
  }
}

.detail-content {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  
  .video-container {
    width: 96%;
    height: 88%;
    background: #000;
    margin-bottom: 10px;
    border-radius: 0 7px 7px 0;
    overflow: hidden;
    
    video {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
}
</style>