/* 悬浮音乐播放器样式 - 精简版，移除冗余动画类 */

.music-player {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    width: 420px;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 10000;
    max-height: 700px;
    border: 1px solid #e1e5e9;
    display: none;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.music-player.show {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.music-player:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.music-player.collapsed {
    max-height: 200px;
}

.music-player.hiding {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.6s ease;
}

/* 音乐按钮动画 */
#musicBtn {
    position: relative;
    transition: all 0.3s ease;
}

#musicBtn.active {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

#musicBtn.active::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    animation: pulse 2s infinite;
}

#musicBtn.loading {
    position: relative;
    overflow: hidden;
}

#musicBtn.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 动画关键帧 */
@keyframes slideInUp {
    from {
        transform: translateY(100%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateY(100%) scale(0.9);
        opacity: 0;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes scaleOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.8);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .music-player {
        animation: slideInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }
    .music-player.hiding {
        animation: slideOutDown 0.5s ease forwards;
    }
}

@media (min-width: 769px) {
    .music-player {
        animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }
    .music-player.hiding {
        animation: scaleOut 0.5s ease forwards;
    }
}

/* 播放器内容入场动画 */
.music-player .player-top,
.music-player .progress-section,
.music-player .lyrics-section,
.music-player .bottom-section {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.music-player.show .player-top {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.1s;
}

.music-player.show .progress-section {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.15s;
}

.music-player.show .lyrics-section {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.music-player.show .bottom-section {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.25s;
}

/* 上部：封面和基本信息 */
.player-top {
    display: flex;
    padding: 12px 15px 8px;
    border-bottom: 1px solid #f0f0f0;
}

.cover-section {
    display: flex;
    align-items: center;
    flex: 1;
}

.album-cover {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 50%;
}

.cover-placeholder svg {
    width: 60%;
    height: 60%;
}

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

.song-title-container {
    position: relative;
    overflow: hidden;
    height: 20px;
    margin-bottom: 2px;
}

.song-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
    position: absolute;
    left: 0;
    top: 0;
}

.song-title.scrolling {
    animation: scrollText 10s linear infinite;
}

.song-artist-container {
    position: relative;
    overflow: hidden;
    height: 16px;
}

.song-artist {
    font-size: 12px;
    color: #7f8c8d;
    white-space: nowrap;
    position: absolute;
    left: 0;
    top: 0;
}

.song-artist.scrolling {
    animation: scrollText 12s linear infinite;
}

@keyframes scrollText {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* 控制按钮统一样式（主题色 #3764F4） */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.playback-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.play-mode-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.control-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #5d6d7e;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 36px;
    height: 36px;
    box-sizing: border-box;
}

.control-btn:hover {
    background: rgba(55, 100, 244, 0.1);
    color: #3764F4;
    transform: scale(1.05);
}

.control-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 播放按钮特殊样式 */
.play-btn {
    background: #3764F4;
    color: white;
    padding: 10px;
    width: 40px;
    height: 40px;
}

.play-btn:hover {
    background: #2a50c4;
    color: white;
}

.play-btn svg {
    width: 20px;
    height: 20px;
}

/* 搜索切换按钮图标位置 */
#search-toggle-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#search-toggle-btn .search-icon,
#search-toggle-btn .back-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
    width: 18px;
    height: 18px;
}

/* 音量控制 */
.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.volume-slider {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    padding: 0px 6px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.volume-slider input[type="range"] {
    width: 80px;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    outline: none;
    margin-bottom:12px;
    -webkit-appearance: none;
}

.volume-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #3764F4;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider input[type="range"]::-webkit-slider-thumb:hover {
    background: #2a50c4;
    transform: scale(1.2);
}

/* 进度条区域 */
.progress-section {
    padding: 8px 15px 10px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 35px;
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #7f8c8d;
    font-weight: 500;
}

.time-text {
    background: rgba(55, 100, 244, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

/* 进度条 */
.progress-bar {
    position: relative;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    cursor: pointer;
    width: 100%;
    overflow: hidden;
}

.progress {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, 
        #ff0000, #ff8000, #ffff00, 
        #80ff00, #00ff00, #00ff80,
        #00ffff, #0080ff, #0000ff,
        #8000ff, #ff00ff, #ff0080);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s ease;
    z-index: 2;
}

.progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #ffffff;
    border: 2px solid #3764F4;
    border-radius: 50%;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-bar:hover .progress-handle {
    opacity: 1;
}

.progress-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 播放速度控制 */
.speed-control {
    display: flex;
    align-items: center;
}

.speed-selector {
    width: 55px;
}

.speed-selector select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 11px;
    outline: none;
    background: white;
}

.speed-selector select:focus {
    border-color: #3764F4;
}

/* ==================== 歌词显示（垂直三行，无动态背景） ==================== */
.lyrics-section {
    padding: 8px 15px;
    border-bottom: 1px solid #f0f0f0;
    min-height: 70px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.lyrics-container {
    width: 100%;
    text-align: center;
    position: relative;
    height: 70px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.lyrics-line {
    font-size: 11px;
    color: #7f8c8d;
    line-height: 1.5;
    margin: 2px 0;
    height: auto;
    overflow: hidden;
    white-space: normal;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
    opacity: 0.7;
    padding: 2px 0;
}

.lyrics-line.active {
    color: #3764F4;
    font-weight: 500;
    opacity: 1;
    transform: scale(1.05);
    text-shadow: 0 0 10px rgba(55, 100, 244, 0.3);
}

/* 底部：扩展功能区 */
.bottom-section {
    max-height: 400px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.music-player.collapsed .bottom-section {
    max-height: 0;
}

.bottom-tabs {
    display: flex;
    border-bottom: 1px solid #f0f0f0;
    overflow-x: auto;
    position: sticky;
    top: 0;
    background: white;
    z-index: 5;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.bottom-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 10px 5px;
    font-size: 12px;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    min-width: 80px;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #3764F4;
    background: rgba(55, 100, 244, 0.05);
}

.tab-btn.active {
    color: #3764F4;
    border-bottom-color: #3764F4;
}

.tab-content {
    display: none;
    padding: 0;
    max-height: 350px;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

/* 歌单头部 */
.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px 8px;
    border-bottom: 1px solid #f0f0f0;
    min-height: 36px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    margin-bottom: 0;
}

.playlist-selector {
    flex: 1;
}

.playlist-selector select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    background: white;
}

.playlist-selector select:focus {
    border-color: #3764F4;
}

/* 内容容器 */
.content-container {
    max-height: 280px;
    overflow-y: auto;
    padding: 0 15px 15px;
}

.tab-content::-webkit-scrollbar,
.content-container::-webkit-scrollbar {
    display: none;
}

.tab-content,
.content-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 播放列表样式 */
.playlist-container {
    max-height: 280px;
    overflow-y: auto;
}

.loading {
    text-align: center;
    color: #7f8c8d;
    padding: 20px;
    font-size: 12px;
}

.song-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 2px;
    font-size: 12px;
    min-height: 36px;
}

.song-item:hover {
    background: rgba(55, 100, 244, 0.1);
}

.song-item.active {
    background: rgba(55, 100, 244, 0.15);
    color: #3764F4;
    position: relative;
}

.song-item.active::before {
    content: '▶';
    position: absolute;
    left: 5px;
    color: #3764F4;
    font-size: 10px;
}

.song-item-info {
    flex: 1;
    min-width: 0;
    margin-left: 15px;
}

.song-item-title {
    font-weight: 500;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
}

.song-item-artist {
    color: #7f8c8d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
}

/* 音乐播放器内搜索框样式 */
.music-player .search-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.music-player .search-header {
    padding: 0;
    margin-bottom: 6px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 5;
    margin-top: 8px;
}

.music-player .search-input-group {
    display: flex;
    gap: 0;
    position: relative;
    background: #f8fafc;
    border-radius: 8px;
    padding: 0px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    border: 1px solid transparent;
    height: 24px;
    width: 100%;
}

.music-player .search-input-group:focus-within {
    background: white;
    box-shadow: 0 2px 8px rgba(55, 100, 244, 0.15);
    border-color: #3764F4;
    transform: translateY(-1px);
}

.music-player .search-input-group input {
    flex: 1;
    padding: 4px 12px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    outline: none;
    background: transparent;
    transition: all 0.3s ease;
    color: #2c3e50;
    font-weight: 400;
    height: 100%;
    width: 100%;
}

.music-player .search-input-group input::placeholder {
    color: #9ca3af;
    font-weight: 400;
    transition: color 0.3s ease;
}

.music-player .search-input-group:focus-within input::placeholder {
    color: #cbd5e1;
}

.music-player .search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    transition: all 0.3s ease;
    pointer-events: none;
    width: 14px;
    height: 14px;
}

.music-player .search-input-group:focus-within .search-icon {
    color: #3764F4;
}

.music-player .search-results {
    max-height: 240px;
    overflow-y: auto;
    width: 100%;
}

/* 搜索结果的下载按钮样式 */
.music-player .search-download-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #5d6d7e;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    margin-left: 8px;
    width: 36px;
    height: 36px;
    box-sizing: border-box;
}

.music-player .song-item:hover .search-download-btn {
    opacity: 1;
}

.music-player .search-download-btn:hover {
    background: rgba(55, 100, 244, 0.1);
    color: #3764F4;
    transform: scale(1.05);
}

.music-player .search-download-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 滚动条样式 */
.playlist-container::-webkit-scrollbar,
.music-player .search-results::-webkit-scrollbar {
    width: 4px;
}

.playlist-container::-webkit-scrollbar-track,
.music-player .search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.playlist-container::-webkit-scrollbar-thumb,
.music-player .search-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.playlist-container::-webkit-scrollbar-thumb:hover,
.music-player .search-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 移动端优化 */
@media (max-width: 480px) {
    .music-player {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        max-height: 80vh;
    }
    
    .playlist-header {
        flex-direction: row;
        gap: 10px;
        padding: 10px 12px 8px;
    }
    
    .bottom-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    
    .tab-btn {
        min-width: 70px;
        font-size: 11px;
        padding: 8px 4px;
    }
    
    .play-mode-controls {
        flex-wrap: nowrap;
        justify-content: center;
        gap: 4px;
    }
    
    .play-mode-controls .control-btn {
        padding: 8px;
        transform: scale(0.9);
        margin: 0 2px;
        width: 32px;
        height: 32px;
    }
    
    .play-mode-controls .control-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .playback-controls {
        gap: 4px;
    }
    
    .playback-controls .control-btn {
        padding: 8px;
        transform: scale(0.9);
        margin: 0 2px;
        width: 32px;
        height: 32px;
    }
    
    .playback-controls .control-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .play-btn {
        padding: 10px;
        transform: scale(1.1);
        margin: 0 2px;
        width: 36px;
        height: 36px;
    }
    
    .play-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .volume-control {
        gap: 4px;
    }
    
    .volume-control .control-btn {
        padding: 8px;
        transform: scale(0.9);
        margin: 0 2px;
        width: 32px;
        height: 32px;
    }
    
    .volume-control .control-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .music-player .search-download-btn {
        padding: 8px;
        transform: scale(0.9);
        opacity: 1;
        margin: 0 2px;
        width: 32px;
        height: 32px;
    }
    
    .music-player .search-download-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .content-container {
        max-height: 220px;
        padding: 0 12px 12px;
    }
    
    .playlist-container,
    .music-player .search-results {
        max-height: 220px;
    }
    
    .progress-section {
        padding: 6px 12px 8px;
    }
    
    .time-text {
        font-size: 10px;
        padding: 1px 4px;
    }
    
    .progress-actions {
        gap: 6px;
    }
    
    .song-title-container {
        height: 22px;
        width: 80px;
        max-width: 80px;
    }
    
    .song-artist-container {
        height: 18px;
        width: 70px;
        max-width: 70px;
    }
    
    .lyrics-section {
        min-height: 60px;
    }
    
    .lyrics-container {
        height: 60px;
    }
    
    .lyrics-line {
        font-size: 10px;
    }
    
    .music-player .search-input-group {
        height: 28px;
        border-radius: 8px;
    }
    
    .music-player .search-input-group input {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 8px;
    }
    
    .music-player .search-header {
        margin-top: 6px;
    }
    
    #search-toggle-btn .search-icon,
    #search-toggle-btn .back-icon {
        width: 16px;
        height: 16px;
    }
}

/* 动画 */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.album-cover.playing img {
    animation: rotate 20s linear infinite;
}

/* 已删除旧的 .notification 样式 */

/* 错误消息样式 */
.error-message {
    text-align: center;
    color: #e74c3c;
    padding: 15px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    margin: 10px 0;
}

.retry-btn {
    background: #3764F4;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    transition: background 0.3s ease;
}

.retry-btn:hover {
    background: #2a50c4;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3764F4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 下载按钮样式 */
.download-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #5d6d7e;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    box-sizing: border-box;
}

.download-btn:hover {
    background: rgba(55, 100, 244, 0.1);
    color: #3764F4;
    transform: scale(1.05);
}

.download-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 下载进度条 */
.download-progress {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10002;
    min-width: 200px;
}

.download-progress-bar {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 5px;
}

.download-progress-fill {
    height: 100%;
    background: #3764F4;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .album-cover.playing img {
        animation: none;
    }
}