/* 全局重置与基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: url('./images/bj.webp') no-repeat center center fixed;
  background-size: cover;
}

/* ================= 轮播图修复 ================= */
.carousel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 20vh;
  background: #0c0c0c;
  overflow: hidden;
  z-index: 1000;
}

.carousel-slide {
  position: absolute;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1s ease;
}

.carousel-slide.active {
  opacity: 1;
}

.carousel-text {
  color: #fa0606;
  background: rgba(0,0,0,0.5);
  padding: 8px 16px;
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
  border-radius: 6px;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================= 音乐播放器 - 轮播图左下角半透明样式 ================= */

.nav-right {
  position: absolute;          /* 相对于轮播图定位 */
  bottom: 15px;                /* 距离底部 15px */
  left: 20px;                  /* 距离左侧 20px */
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(250, 248, 248, 0.6);
  backdrop-filter: blur(5px);
  padding: 8px 15px;
  border-radius: 30px;
  border: 1px solid rgb(248, 243, 243);
  box-shadow: 0 2px 10px rgb(247, 244, 244);
  z-index: 1001;
}

/* 原生音频控件美化 */
.nav-right audio {
  width: 120px; /* 缩小控件宽度 */
  height: 32px;
  opacity: 0.9;
  transition: opacity 0.5s;
}

/* 隐藏不需要的控件元素 */
.nav-right audio::-webkit-media-controls-panel {
  background: transparent;
}
.nav-right audio::-webkit-media-controls-current-time-display,
.nav-right audio::-webkit-media-controls-time-remaining-display {
  display: none;
}

/* 歌曲名称样式 */
#song-name h6 {
  margin: 0;
  color: white;
  font-size: 14px;
  font-weight: normal;
  text-shadow: 0 1px 2px rgb(247, 246, 246);
}

/* 悬停效果 */
.nav-right:hover {
  background: rgba(250, 5, 5, 0.8);
}
.nav-right:hover audio {
  opacity: 1;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .nav-right {
    right: 10px;
    bottom: 10px;
    padding: 6px 12px;
  }
  .nav-right audio {
    width: 100px;
  }
  #song-name h6 {
    font-size: 12px;
  }
}

/* ================= 顶部导航栏 ================= */
.top-nav {
  position: fixed;
  top: 20vh;
  left: 0;
  width: 100%;
  background: #cac8c8;
  display: flex;
  justify-content: space-between;
  padding: 8px 15px;
  z-index: 999;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-menu {
  display: flex;
  list-style: none;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 5px;
  scrollbar-width: none;
}

.nav-menu::-webkit-scrollbar {
  display: none;
}

.nav-menu li {
  margin-right: 15px;
}

.nav-menu a {
  padding: 5px 10px;
  color: #333;
  text-decoration: none;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.nav-menu a:hover {
  color: #3498db;
}


/* ================= 侧边导航栏修复 ================= */
.side-nav {
  position: fixed;
  top: calc(20vh + 46px);
  left: 0;
  width: 160px;
  height: calc(100vh - (20vh + 46px));
  background: #f7f3f3;
  padding: 15px;
  overflow-y: auto;
  z-index: 998;
  transition: transform 0.3s ease;
}

.side-nav ul {
  list-style: none;
}

.side-nav li {
  margin: 12px 0;
}

.side-nav a {
  display: block;
  padding: 8px 0;
  color: #333;
  text-decoration: none;
  transition: all 0.2s;
}

.side-nav a:hover {
  color: #3498db;
  transform: translateX(5px);
}

/* ================= 主内容区 ================= */
.main-content {
  margin-left: 160px;
  padding: calc(20vh + 50px) 15px 20px;
  min-height: 100vh;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 15px;
}

.grid-item {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s;
}

.grid-item:hover {
  transform: translateY(-5px);
}

.grid-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

/* ================= 弹窗修复 ================= */
/* ================= 弹窗系统修复 ================= */
/* 所有弹窗默认隐藏 */
.detail-page,
.contact-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 2000;
  overflow-y: auto;
}

/* 弹窗激活状态 */
.detail-page.active,
.contact-modal.active {
  display: block;
}

/* 详情弹窗容器 */
.detail-container {
  max-width: 900px;
  margin: 50px auto;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

/* 联系我们弹窗-居中版 */
.contact-modal:not(.top-contact) {
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 详情弹窗容器优化 */
.detail-container {
  max-width: 90vw;  /* 改为视窗单位 */
  max-height: 90vh;
  margin: 5vh auto;
  overflow-y: auto;  /* 添加滚动条 */
  position: relative;
  box-sizing: border-box;
}

/* 详情图片优化 */
.detail-img {
  max-width: 100%;
  height: auto;
  max-height: 50vh;  /* 限制图片高度 */
  display: block;
  margin: 0 auto;
}

/* 内容区域优化 */
.detail-content {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(90vh - 300px); /* 计算剩余空间 */
}

/* 移动端适配 */
@media (max-width: 768px) {
  .detail-container {
    max-width: 95vw;
    max-height: 95vh;
    margin: 2vh auto;
  }
  
  .detail-img {
    max-height: 40vh;
  }
}
.contact-modal:not(.top-contact) img {
  max-width: 80vw;
  max-height: 80vh;
  border: 3px solid white;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* 联系我们弹窗-顶部版 */
.contact-modal.top-contact {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 50px;
}

.contact-modal.top-contact img {
  max-width: 90vw;
  max-height: 60vh;
  border: 3px solid white;
  border-radius: 10px;
}

/* 关闭按钮 */
.close-detail,
.close-contact {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  font-size: 1.2rem;
  border: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .contact-modal:not(.top-contact) img {
    max-width: 95vw;
  }
  
  .contact-modal.top-contact {
    padding-bottom: 20px;
  }
  
  .contact-modal.top-contact img {
    max-width: 95vw;
  }
  
  .detail-container {
    width: 95%;
    margin: 20px auto;
  }
}
/* ================= 响应式设计 ================= */
@media (max-width: 768px) {
  .carousel {
    height: 18vh;
  }
  
  .top-nav {
    top: 18vh;
    padding: 8px 10px;
  }
  
  .side-nav {
    width: 120px;
    top: calc(18vh + 44px);
    height: calc(100vh - (18vh + 44px));
    transform: translateX(-120px);
  }
  
  .side-nav.active {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: calc(18vh + 50px) 10px 15px;
  }
  
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }
  
  .grid-item img {
    height: 120px;
  }
  
  .carousel-text {
    font-size: 0.9rem;
  }
}