/* ========== 音乐播放器 - 极简风格 ========== */
.music-player {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(15px);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: none;  /* 初始禁用过渡 */
    overflow: visible;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    align-items: center;
    padding: 10px 15px;  /* 恢复高度，保持垂直空间 */
    gap: 8px;  /* 减小横向间距 */
    width: auto;
    min-width: 240px;  /* 横向缩短最小宽度 */
    max-width: 340px;  /* 横向缩短最大宽度 */
    opacity: 0 !important;  /* 初始不可见，避免位置跳跃 */
    visibility: hidden !important;  /* 初始隐藏 */
}

/* 播放器加载完成后显示 */
.music-player.loaded {
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.3s ease, all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* 迷你模式 */
.music-player.mini {
    height: 52px;  /* 缩小高度 */
}

/* 展开模式 - 暂时隐藏，保持简洁 */
.music-player.expanded {
    height: 60px;
}

.music-player.expanded .player-content {
    display: none !important;
}

/* 拖拽中 */
.music-player.dragging {
    opacity: 0.95;
    cursor: grabbing !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

/* 默认鼠标样式 */
.music-player {
    cursor: grab;
}

/* 隐藏状态 */
.music-player.hidden {
    display: none;
}

/* 收起状态 - 极简模式 */
.music-player.collapsed {
    max-width: 130px;  /* 增加宽度确保内容不溢出 */
    min-width: 130px;
    transition: all 0.3s ease;
    padding: 10px 12px;  /* 减小左右padding */
    gap: 6px;  /* 减小元素间距 */
    overflow: hidden;  /* 防止内容溢出 */
}

/* 收起状态：隐藏歌曲信息 */
.music-player.collapsed .player-info-mini {
    display: none;
}

/* 收起状态：隐藏控制按钮（除了展开按钮） */
.music-player.collapsed .player-controls-mini .player-btn:not(#toggle-btn) {
    display: none;
}

/* 收起状态：调整按钮容器布局 */
.music-player.collapsed .player-controls-mini {
    margin-left: 0;  /* 取消auto，避免按钮溢出 */
    gap: 0;  /* 收起状态只有一个按钮，不需要gap */
}

/* 收起状态：调整时间显示 */
.music-player.collapsed .player-time-mini {
    flex: 1;  /* 占据剩余空间 */
    text-align: center;  /* 居中显示 */
    margin-left: 0;
}

/* 收起状态：展开按钮图标变化 */
.music-player.collapsed #toggle-btn i {
    transform: rotate(180deg);  /* < 变成 > */
}

/* 收起状态：封面可点击展开 */
.music-player.collapsed .player-cover-mini {
    cursor: pointer;
}

/* ========== 方形封面 + 播放按钮 ========== */
.player-cover-mini {
    position: relative;
    width: 36px;  /* 缩小封面 */
    height: 36px;  /* 缩小封面 */
    border-radius: 6px;  /* 缩小圆角 */
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.player-cover-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-cover-mini.playing img {
    /* 方形封面不旋转 */
    /* animation: rotate 20s linear infinite; */
}

.player-cover-placeholder-mini {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;  /* 缩小图标 */
    color: white;
}

/* 播放按钮叠加在封面上 */
.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.player-cover-mini:hover .play-overlay {
    opacity: 1;
}

.play-overlay i {
    color: white;
    font-size: 16px;  /* 缩小播放图标 */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* ========== 歌曲信息 ========== */
.player-info-mini {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.player-title {
    font-size: 13px;  /* 缩小字体 */
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.player-subtitle {
    font-size: 11px;  /* 缩小字体 */
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== 时间显示 ========== */
.player-time-mini {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    margin-left: 4px;  /* 进一步减小间距 */
}

/* ========== 控制按钮组 ========== */
.player-controls-mini {
    display: flex;
    align-items: center;
    gap: 4px;  /* 进一步减小按钮间距 */
    margin-left: 4px;  /* 进一步减小间距 */
}

.player-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;  /* 缩小圆角 */
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;  /* 缩小按钮 */
    height: 28px;  /* 缩小按钮 */
    font-size: 12px;  /* 缩小图标 */
}

.player-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.player-btn:active {
    transform: scale(0.9);
}

/* ========== 播放器内容区（隐藏） ========== */
.player-content {
    display: none !important;
}

.player-content::-webkit-scrollbar {
    width: 6px;
}

.player-content::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.player-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.player-content::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* ========== 专辑封面 ========== */
.player-cover {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
}

.player-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.player-cover.playing img {
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.player-cover-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    color: white;
}

/* ========== 歌曲信息 ========== */
.player-info {
    text-align: center;
    margin-bottom: 20px;
}

.player-song-name {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-artist-name {
    font-size: 14px;
    color: #666;
}

/* ========== 进度条 ========== */
.player-progress {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    position: relative;
    transition: width 0.1s;
}

.progress-handle {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.progress-bar:hover .progress-handle {
    width: 16px;
    height: 16px;
    right: -8px;
}

.progress-time {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
}

/* ========== 播放控制按钮 ========== */
.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.control-btn {
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.control-btn:hover {
    background: #f0f0f0;
    color: #667eea;
}

.control-btn:active {
    transform: scale(0.9);
}

.control-btn.play-btn {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 24px;
}

.control-btn.play-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4293 100%);
    transform: scale(1.05);
}

.control-btn.active {
    color: #667eea;
}

/* ========== 播放模式和音量 ========== */
.player-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 10px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.volume-icon {
    color: #666;
    font-size: 18px;
    cursor: pointer;
}

.volume-slider {
    flex: 1;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.volume-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    position: relative;
}

.volume-handle {
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.mode-icon {
    color: #666;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}

.mode-icon.active {
    color: #667eea;
}

/* ========== 歌词显示 ========== */
.player-lyrics {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    max-height: 120px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.lyrics-line {
    font-size: 13px;
    line-height: 1.8;
    color: #666;
    text-align: center;
    transition: all 0.3s;
}

.lyrics-line.active {
    color: #667eea;
    font-weight: 600;
    font-size: 14px;
}

/* ========== 播放列表 ========== */
.player-playlist {
    margin-top: 20px;
}

.playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.playlist-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.playlist-count {
    font-size: 12px;
    color: #999;
}

.playlist-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 10px;
    outline: none;
    transition: border-color 0.2s;
}

.playlist-search:focus {
    border-color: #667eea;
}

.playlist-items {
    max-height: 200px;
    overflow-y: auto;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.playlist-item:hover {
    background: #f8f9fa;
}

.playlist-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.playlist-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0 3px 3px 0;
}

.playlist-cover {
    width: 45px;
    height: 45px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.playlist-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.playlist-cover-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.playlist-item-info {
    flex: 1;
    min-width: 0;
}

.playlist-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.playlist-item-artist {
    font-size: 11px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-item-playing {
    color: #667eea;
    font-size: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .music-player {
        min-width: 280px;
        max-width: calc(100vw - 40px);
        padding: 6px 15px 6px 6px;
        gap: 10px;
    }
    
    .player-cover-mini {
        width: 40px;
        height: 40px;
    }
    
    .player-title {
        font-size: 13px;
    }
    
    .player-subtitle {
        font-size: 11px;
    }
    
    .player-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .player-time-mini {
        font-size: 11px;
    }
}

/* ========== 动画 ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.music-player {
    animation: fadeIn 0.3s ease-out;
}
