/**
 * KMusicPlugin Expandable Style CSS
 * 可展开式音乐播放器样式 - 方形缩小状态，展开后标题在上专辑居中
 */

/* ==================== 主容器 ==================== */
.music-plugin-container {
  position: fixed;
  bottom: 24px;
  z-index: 9999;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.music-plugin-position-left {
  left: 24px;
}

.music-plugin-position-right {
  right: 24px;
}

/* ==================== 缩小状态 - 方形音乐播放器 ==================== */
.music-plugin-mini {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.music-plugin-mini:hover {
  transform: scale(1.08);
}

.music-plugin-mini-square {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 
    0 6px 24px rgba(102, 126, 234, 0.4),
    0 0 0 3px rgba(255, 255, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  background: linear-gradient(145deg, #7b8fe8, #5a6fd6);
}

.music-plugin-mini:hover .music-plugin-mini-square {
  box-shadow: 
    0 8px 32px rgba(102, 126, 234, 0.5),
    0 0 0 3px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.music-plugin-mini-square img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

/* CSS生成的备用图标 - 缩小状态 */
.music-plugin-fallback-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  background: linear-gradient(145deg, #7b8fe8, #5a6fd6);
}

.fallback-music-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.fallback-note {
  font-size: 22px;
  color: #fff;
  font-weight: bold;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: notePulse 2s ease-in-out infinite;
}

@keyframes notePulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* 播放状态指示器 - 始终可见 */
.mini-playing-indicator {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 2px;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.3s;
}

.music-plugin-container.playing .mini-playing-indicator {
  opacity: 1;
}

.mini-bar {
  width: 3px;
  background: linear-gradient(180deg, #fff, rgba(255,255,255,0.7));
  border-radius: 2px;
  animation: soundBar 1s ease-in-out infinite;
}

.mini-bar:nth-child(1) {
  height: 8px;
  animation-delay: 0s;
}

.mini-bar:nth-child(2) {
  height: 12px;
  animation-delay: 0.2s;
}

.mini-bar:nth-child(3) {
  height: 6px;
  animation-delay: 0.4s;
}

@keyframes soundBar {
  0%, 100% { transform: scaleY(0.6); opacity: 0.7; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* 音乐播放器遮罩层 */
.music-plugin-mini-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.3s;
}

.music-plugin-mini:hover .music-plugin-mini-overlay,
.music-plugin-container.playing .music-plugin-mini-overlay {
  opacity: 1;
}

.mini-icon {
  color: #fff;
  margin-bottom: 4px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* 音频波形动画 */
.mini-wave {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.mini-wave span {
  width: 3px;
  background: #fff;
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}

.mini-wave span:nth-child(1) {
  height: 6px;
  animation-delay: 0s;
}

.mini-wave span:nth-child(2) {
  height: 12px;
  animation-delay: 0.2s;
}

.mini-wave span:nth-child(3) {
  height: 8px;
  animation-delay: 0.4s;
}

.music-plugin-container.playing .mini-wave span {
  animation-play-state: running;
}

.music-plugin-container:not(.playing) .mini-wave span {
  animation-play-state: paused;
  height: 4px;
}

@keyframes wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

.music-plugin-mini-glow {
  position: absolute;
  inset: -4px;
  border-radius: 16px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  opacity: 0;
  z-index: -1;
  filter: blur(8px);
  transition: opacity 0.3s;
}

.music-plugin-mini:hover .music-plugin-mini-glow {
  opacity: 0.6;
}

.music-plugin-container.playing .music-plugin-mini-glow {
  opacity: 0.8;
}

/* ==================== 展开状态 ==================== */
.music-plugin-expanded {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 400px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 16px;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8) translateY(20px);
  transform-origin: bottom left;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  display: none; /* 初始完全隐藏，防止闪烁 */
}

.music-plugin-container.expanded .music-plugin-expanded {
  display: block; /* 展开时显示 */
}

.music-plugin-position-right .music-plugin-expanded {
  left: auto;
  right: 0;
  transform-origin: bottom right;
}

.music-plugin-container.expanded .music-plugin-expanded {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}

.music-plugin-container.expanded .music-plugin-mini {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
}

/* 背景模糊影子 */
.music-plugin-bg-shadow {
  position: absolute;
  right: -60px;
  top: 40%;
  transform: translateY(-50%);
  width: 280px;
  height: 280px;
  background-size: cover;
  background-position: center;
  opacity: 0.06;
  filter: blur(60px);
  pointer-events: none;
  border-radius: 50%;
  z-index: 0;
}

/* 收起按钮 */
.expanded-collapse-btn {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 2;
}

.expanded-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ==================== 紧凑布局 ==================== */
.expanded-body-compact {
  display: flex;
  gap: 12px;
  position: relative;
  z-index: 1;
}

/* 左侧：专辑封面（垂直居中） */
.expanded-left-compact {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.expanded-cover-compact {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  position: relative;
}

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

/* CSS生成的备用图标 - 展开状态 */
.expanded-fallback-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.expanded-fallback-icon .fallback-music-icon {
  width: 50px;
  height: 50px;
}

.expanded-fallback-icon .fallback-note {
  font-size: 28px;
}

/* 右侧：标题+歌词+控件 */
.expanded-right-compact {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* 标题和歌手 */
.expanded-header-compact {
  margin-bottom: 8px;
  text-align: center;
}

.expanded-title-compact {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
  line-height: 1.3;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expanded-artist-compact {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

/* 歌词区域 */
.expanded-lyrics-compact {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 10px 12px;
  position: relative;
}

/* 歌词按钮 - 固定在右上角 */
.btn-lyrics-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 2;
  font-size: 11px;
}

.btn-lyrics-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-lyrics-toggle.active {
  background: rgba(102, 126, 234, 0.3);
  color: #667eea;
}

.lyric-text-compact {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  line-height: 1.5;
  text-align: center;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

/* 控制区域 */
.expanded-controls-compact {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-buttons-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.ctrl-btn-compact {
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: #fff;
}

.ctrl-btn-compact:hover {
  transform: scale(1.1);
}

.btn-prev,
.btn-next,
.btn-list {
  width: 28px;
  height: 28px;
  opacity: 0.7;
}

.btn-prev:hover,
.btn-next:hover,
.btn-list:hover {
  opacity: 1;
}

.btn-play {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-play:hover {
  box-shadow: 0 6px 18px rgba(102, 126, 234, 0.5);
}

/* 进度条 */
.progress-section-compact {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-bar-compact {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.progress-fill-compact {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
  position: relative;
}

.progress-fill-compact::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s;
}

.progress-bar-compact:hover .progress-fill-compact::after {
  opacity: 1;
}

.time-display-compact {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-family: 'SF Mono', monospace;
}

.time-separator {
  margin: 0 4px;
}

/* ==================== 音量控制（点击展开，上下滑动） ==================== */
.volume-control-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.volume-btn-compact {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.3s;
  opacity: 0.7;
}

.volume-btn-compact:hover {
  color: #fff;
  opacity: 1;
}

/* 音量弹窗 - 默认隐藏 */
.volume-popup {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  margin-bottom: 8px;
  padding: 12px 8px;
  background: rgba(30, 30, 50, 0.95);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 100;
}

.volume-popup.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* 上下滑动条 */
.volume-slider-vertical {
  width: 4px;
  height: 80px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.volume-fill-vertical {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30%;
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
  transition: height 0.1s linear;
}

.volume-fill-vertical::after {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s;
}

.volume-slider-vertical:hover .volume-fill-vertical::after {
  opacity: 1;
}

/* ==================== 播放列表 ==================== */
.expanded-playlist {
  position: absolute;
  top: 0;
  right: 0;
  width: 220px;
  height: 100%;
  background: rgba(20, 20, 40, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 0 20px 20px 0;
  padding: 16px;
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 10;
  overflow: hidden;
}

.expanded-playlist.show {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
}

.playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.playlist-header span {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.playlist-close {
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.playlist-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.playlist-items {
  max-height: calc(100% - 50px);
  overflow-y: auto;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.playlist-item.active {
  background: rgba(102, 126, 234, 0.3);
}

/* 播放列表封面 */
.playlist-item-cover {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.playlist-item-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

/* 播放列表备用图标 */
.playlist-fallback-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.fallback-note-small {
  font-size: 16px;
  color: #fff;
  font-weight: bold;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

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

.playlist-item-title {
  font-size: 12px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-artist {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 600px) {
  .music-plugin-container {
    bottom: 16px;
  }
  
  .music-plugin-position-left {
    left: 16px;
  }
  
  .music-plugin-position-right {
    right: 16px;
  }
  
  .music-plugin-mini-square {
    width: 56px;
    height: 56px;
    border-radius: 10px;
  }
  
  .music-plugin-expanded {
    width: calc(100vw - 32px);
    max-width: 360px;
    padding: 14px;
  }
  
  .expanded-body-compact {
    flex-direction: column;
    gap: 12px;
  }
  
  .expanded-left-compact {
    display: flex;
    justify-content: center;
    padding-top: 0;
  }
  
  .expanded-cover-compact {
    width: 120px;
    height: 120px;
  }
  
  .expanded-header-compact {
    text-align: center;
  }
  
  .expanded-lyrics-compact {
    min-height: 45px;
  }
  
  .expanded-playlist {
    width: 100%;
    border-radius: 20px 20px 0 0;
    top: auto;
    bottom: 0;
    height: 70%;
    transform: translateY(100%);
  }
  
  .expanded-playlist.show {
    transform: translateY(0);
  }
}

/* ==================== 全局歌词显示 ==================== */
.music-plugin-global-lyric {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.music-plugin-global-lyric.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.global-lyric-wrapper {
  border-radius: 50px;
  padding: 10px 32px;
}

.global-lyric-text {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  text-shadow: 
    -1px -1px 0 rgba(0, 0, 0, 0.5),
    1px -1px 0 rgba(0, 0, 0, 0.5),
    -1px 1px 0 rgba(0, 0, 0, 0.5),
    1px 1px 0 rgba(0, 0, 0, 0.5),
    0 0 10px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  min-width: 200px;
  max-width: 600px;
}



/* 响应式 - 全局歌词 */
@media (max-width: 600px) {
  .music-plugin-global-lyric {
    bottom: 16px;
    left: 20px;
    right: 20px;
    transform: translateY(20px);
  }
  
  .music-plugin-global-lyric.show {
    transform: translateY(0);
  }
  
  .global-lyric-wrapper {
    padding: 8px 20px;
    border-radius: 30px;
  }
  
  .global-lyric-text {
    font-size: 15px;
    min-width: auto;
    max-width: none;
  }
}

/* ==================== 滚动条样式 ==================== */
.playlist-items::-webkit-scrollbar {
  width: 3px;
}

.playlist-items::-webkit-scrollbar-track {
  background: transparent;
}

.playlist-items::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}
