/* BB音乐播放器 - iOS 风格全局样式 */

/* ========== 基础重置 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: #f2f2f7;
  color: #1c1c1e;
  transition: background 0.3s ease, color 0.3s ease;
}

.dark body {
  background: #000000;
  color: #ffffff;
}

/* ========== SVG 图标通用 ========== */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon svg {
  width: 1em;
  height: 1em;
  display: block;
}

/* ========== iOS 毛玻璃 ========== */
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.dark .glass {
  background: rgba(28, 28, 30, 0.72);
}

.ios-card {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.dark .ios-card {
  background: rgba(28, 28, 30, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ========== 顶部导航栏 ========== */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 47px 16px 8px;
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

.nav-bar.scrolled {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
}

.dark .nav-bar.scrolled {
  background: rgba(28, 28, 30, 0.72);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.nav-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.37px;
  line-height: 1.2;
}

/* ========== 底部标签栏 ========== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 6px 0 22px;
  display: flex;
  justify-content: space-around;
  border-top: 0.5px solid rgba(0, 0, 0, 0.1);
}

.dark .tab-bar {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 16px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
}

.tab-item:active { opacity: 0.5; }

.tab-icon {
  line-height: 1;
}

.tab-icon svg {
  width: 24px;
  height: 24px;
}

.tab-label {
  font-size: 10px;
  font-weight: 500;
}

.tab-item.active .tab-icon,
.tab-item.active .tab-label {
  color: #ff2d55;
}

.dark .tab-item.active .tab-icon,
.dark .tab-item.active .tab-label {
  color: #ff375f;
}

/* ========== 页面容器 ========== */
.pages-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.page {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: 90px;
  padding-bottom: 140px;
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.page.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* ========== 迷你播放条 ========== */
.mini-player {
  position: fixed;
  bottom: 70px;
  left: 8px;
  right: 8px;
  z-index: 90;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 10px;
  transform: translateY(200%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.mini-player.show { transform: translateY(0); }

.mini-player-cover {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.mini-player-info { flex: 1; min-width: 0; }

.mini-player-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player-artist {
  font-size: 13px;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.mini-player-btn svg { width: 22px; height: 22px; }

.mini-player-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: #ff2d55;
  border-radius: 0 0 16px 16px;
  transition: width 0.3s linear;
}

.dark .mini-player-progress { background: #ff375f; }

/* ========== 搜索栏 ========== */
.search-bar {
  margin: 0 16px;
  height: 40px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  cursor: pointer;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 17px;
  outline: none;
  color: inherit;
}

.search-bar input::placeholder { color: rgba(60, 60, 67, 0.6); }
.dark .search-bar input::placeholder { color: rgba(235, 235, 245, 0.6); }
.search-bar .icon svg { width: 18px; height: 18px; }

/* ========== 歌曲列表项 ========== */
.song-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
  overflow: hidden;
}

.song-item:active { background: rgba(0, 0, 0, 0.04); }
.dark .song-item:active { background: rgba(255, 255, 255, 0.06); }

.song-cover {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.song-info { flex: 1; min-width: 0; }

.song-name {
  font-size: 17px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-artist {
  font-size: 15px;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.song-index {
  width: 28px;
  text-align: center;
  font-size: 17px;
  opacity: 0.4;
  flex-shrink: 0;
}

/* ========== 横滑卡片 ========== */
.scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.scroll-row::-webkit-scrollbar { display: none; }

.scroll-card {
  flex-shrink: 0;
  width: 140px;
  scroll-snap-align: start;
  cursor: pointer;
}

.scroll-card-title {
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scroll-card-subtitle {
  font-size: 12px;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== 区块标题 ========== */
.section-title {
  font-size: 22px;
  font-weight: 700;
  padding: 20px 16px 12px;
}

/* ========== 全屏播放页 ========== */
.fullscreen-player {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  visibility: hidden;
  transform: translateY(100%);
  transition: visibility 0s 0.45s, transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.fullscreen-player.show {
  visibility: visible;
  transform: translateY(0);
  transition: visibility 0s, transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.player-bg {
  position: absolute;
  top: -10%;
  left: -10%;
  width: 120%;
  height: 120%;
  background-size: cover;
  background-position: center;
  filter: blur(60px) brightness(0.6);
  transform: scale(1.2);
}

.player-bg-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.35);
}

.cover-container { perspective: 1000px; }

.cover-disc {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: disc-rotate 20s linear infinite;
  animation-play-state: paused;
}

.cover-disc.playing { animation-play-state: running; }

.cover-disc img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes disc-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ========== 歌词面板 ========== */
.lyrics-panel {
  position: absolute;
  top: 100%;
  left: 0; right: 0; bottom: 0;
  transition: top 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.lyrics-panel.show { top: 0; }

.lyrics-container {
  height: 100%;
  overflow-y: auto;
  padding: 50% 0;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.lyrics-line {
  padding: 12px 24px;
  font-size: 18px;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
  cursor: pointer;
}

.lyrics-line.active {
  font-size: 22px;
  font-weight: 600;
  color: #ffffff;
}

.lyrics-empty {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  color: rgba(255, 255, 255, 0.5);
}

/* ========== 进度条 ========== */
.progress-bar {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: #ffffff;
  transition: width 0.1s linear;
}

.progress-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.progress-bar:active .progress-thumb { opacity: 1; }
.progress-bar:active .progress-fill { background: #ff2d55; }

/* ========== 搜索页 ========== */
.search-page {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 150;
  background: #f2f2f7;
  visibility: hidden;
  transform: translateX(100%);
  transition: visibility 0s 0.35s, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.dark .search-page { background: #000000; }

.search-page.show {
  visibility: visible;
  transform: translateX(0);
  transition: visibility 0s, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-header {
  position: sticky;
  top: 0; z-index: 10;
  padding: 47px 16px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input-wrap {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 6px;
  background: rgba(118, 118, 128, 0.12);
}

.search-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 17px;
  outline: none;
  color: inherit;
}

.search-input-wrap .icon svg { width: 16px; height: 16px; }

.search-cancel {
  font-size: 17px;
  color: #ff2d55;
  cursor: pointer;
  white-space: nowrap;
}

/* ========== 队列抽屉 ========== */
.queue-drawer {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 180;
  pointer-events: none;
  visibility: hidden;
}

.queue-drawer.show {
  pointer-events: auto;
  visibility: visible;
}

.queue-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.queue-drawer.show .queue-overlay { opacity: 1; }

.queue-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  max-height: 75vh;
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.queue-drawer.show .queue-panel { transform: translateY(0); }

.queue-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.dark .queue-header { border-bottom-color: rgba(255, 255, 255, 0.1); }

.queue-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(75vh - 56px);
}

.queue-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 12px;
  cursor: pointer;
}

.queue-item.current { background: rgba(255, 45, 85, 0.08); }
.dark .queue-item.current { background: rgba(255, 55, 95, 0.12); }

.queue-item-name {
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item.current .queue-item-name { color: #ff2d55; font-weight: 600; }
.dark .queue-item.current .queue-item-name { color: #ff375f; }

.queue-item-artist {
  font-size: 15px;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== 长按菜单 ========== */
.context-menu {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 300;
  pointer-events: none;
  visibility: hidden;
}

.context-menu.show {
  pointer-events: auto;
  visibility: visible;
}

.context-menu-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.context-menu.show .context-menu-overlay { opacity: 1; }

.context-menu-sheet {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  border-radius: 16px 16px 0 0;
  padding: 8px 0 34px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.context-menu.show .context-menu-sheet { transform: translateY(0); }

.context-menu-item {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 14px;
  font-size: 17px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.context-menu-item:active { background: rgba(0, 0, 0, 0.04); }
.dark .context-menu-item:active { background: rgba(255, 255, 255, 0.06); }
.context-menu-item-icon { font-size: 22px; }
.context-menu-item-icon svg { width: 22px; height: 22px; }

.context-menu-cancel {
  margin-top: 8px;
  border-top: 0.5px solid rgba(0, 0, 0, 0.1);
}

.dark .context-menu-cancel { border-top-color: rgba(255, 255, 255, 0.1); }

/* ========== 我的页卡片 ========== */
.my-card {
  margin: 0 16px 12px;
  padding: 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.my-card:active { transform: scale(0.98); }

.my-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.my-card-icon svg { width: 28px; height: 28px; }
.my-card-title { font-size: 17px; font-weight: 600; }
.my-card-subtitle { font-size: 15px; opacity: 0.6; margin-top: 2px; }

/* ========== 设置项 ========== */
.setting-group {
  margin: 20px 16px 0;
  border-radius: 16px;
  overflow: hidden;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
}

.setting-item + .setting-item { border-top: 0.5px solid rgba(0, 0, 0, 0.1); }
.dark .setting-item + .setting-item { border-top-color: rgba(255, 255, 255, 0.1); }
.setting-label { font-size: 17px; }
.setting-value { font-size: 17px; opacity: 0.6; }
.setting-value svg { width: 16px; height: 16px; }

/* ========== 搜索历史标签 ========== */
.history-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px;
}

.history-tag {
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 15px;
  cursor: pointer;
}

.history-tag:active { opacity: 0.6; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 500;
  padding: 12px 24px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ========== 控制按钮 ========== */
.control-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.control-btn:active {
  opacity: 0.6;
  transform: scale(0.9);
}

.control-btn svg { width: 28px; height: 28px; }
.play-btn { width: 68px; height: 68px; }
.play-btn svg { width: 36px; height: 36px; }

/* ========== 工具类 ========== */
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 22px);
}

/* ==================================================================
   桌面端响应式 (>=768px)：
   body 横向 flex 居中，.pages-container 不用 transform
   ================================================================== */
@media (min-width: 768px) {
  body {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* 导航栏：绝对定位居中 */
  .nav-bar {
    max-width: 480px;
    width: 100%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-radius: 0 0 16px 16px;
  }

  .nav-bar.scrolled {
    border-radius: 0;
  }

  /* 页面容器：用 body 的 flex 居中，不用 transform */
  .pages-container {
    position: relative;
    max-width: 480px;
    width: 100%;
    flex: 1;
    border-left: 0.5px solid rgba(0, 0, 0, 0.08);
    border-right: 0.5px solid rgba(0, 0, 0, 0.08);
    overflow: hidden;
  }

  .dark .pages-container {
    border-color: rgba(255, 255, 255, 0.08);
  }

  /* 底部标签栏：绝对定位居中 */
  .tab-bar {
    max-width: 480px;
    width: 100%;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }

  /* 迷你播放条 */
  .mini-player {
    max-width: 464px;
    width: calc(100% - 16px);
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(200%);
  }

  .mini-player.show {
    transform: translateX(-50%) translateY(0);
  }

  /* 搜索页居中 */
  .search-page {
    max-width: 480px;
    width: 100%;
    left: 50%;
    right: auto;
    transform: translateX(calc(-50% + 100%));
    border-radius: 16px;
    top: 8vh;
    bottom: 8vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  }

  .dark .search-page {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  }

  .search-page.show {
    transform: translateX(-50%);
  }

  /* 全屏播放页居中 */
  .fullscreen-player {
    max-width: 480px;
    width: 100%;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(100%);
    border-radius: 16px 16px 0 0;
    top: 5vh;
    bottom: 0;
  }

  .fullscreen-player.show {
    transform: translateX(-50%) translateY(0);
  }

  .cover-disc {
    width: 320px;
    height: 320px;
  }

  /* 队列抽屉居中 */
  .queue-drawer .queue-panel {
    max-width: 400px;
    width: 100%;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(100%);
    bottom: 15vh;
    border-radius: 16px;
  }

  .queue-drawer.show .queue-panel {
    transform: translateX(-50%) translateY(0);
  }

  /* 长按菜单居中 */
  .context-menu-sheet {
    max-width: 360px;
    width: 100%;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(100%);
    bottom: 15vh;
    border-radius: 16px;
  }

  .context-menu.show .context-menu-sheet {
    transform: translateX(-50%) translateY(0);
  }

  .toast { max-width: 360px; }
  .song-cover { width: 56px; height: 56px; }
  .scroll-card { width: 180px; }
}
