/* 弹窗遮罩层 */
.video-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
}

/* 弹窗显示状态 */
.video-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* 弹窗容器 */
.video-modal {
  max-width: 1200px;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  position: relative;
  background-color: #000;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  /* 为关闭按钮预留空间 */
  padding-top: 10px;
}

.video-modal-overlay.active .video-modal {
  transform: scale(1);
}

/* 关闭按钮 - 修复显示问题 */
.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 24px;
  transition: all 0.3s ease;
  z-index: 100; /* 确保层级最高 */
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.close-btn:hover {
  background-color: rgba(0, 102, 204, 0.8);
  transform: scale(1.1);
}

/* 视频容器样式 */
.video-container {
  width: 100%;
  aspect-ratio: 16/9; /* 固定16:9比例 */
  position: relative;
  cursor: pointer;
}

/* 视频元素样式 - 显示原生控件 */
.demo-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* 显示原生播放控件 */
  controls: controls;
}

/* 自定义播放控件层 - 初始展示 */
.video-controls {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 10;
}

/* 播放按钮样式 */
.play-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  pointer-events: auto;
}

.play-btn:hover {
  transform: scale(1.1);
  background-color: #ffffff;
}

.play-btn::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 15px 0 15px 25px;
  border-color: transparent transparent transparent #333;
  margin-left: 5px;
}

/* 视频标题 */
.video-title {
  color: #ffffff;
  font-size: 20px;
  text-align: center;
  padding: 0 20px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* 加载状态 */
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 1s ease-in-out infinite;
  display: none;
  z-index: 15;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 播放状态下隐藏自定义控件，显示原生控件 */
.video-container.playing .video-controls {
  opacity: 0;
  pointer-events: none;
}

.video-container.playing .loading {
  display: block;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .play-btn {
      width: 60px;
      height: 60px;
  }
  
  .video-title {
      font-size: 16px;
  }
  
  .close-btn {
      width: 36px;
      height: 36px;
      font-size: 20px;
      top: 10px;
      right: 10px;
  }
}

@media (max-width: 480px) {
  .play-btn {
      width: 50px;
      height: 50px;
  }
  
  .video-title {
      font-size: 14px;
  }
}