/* 音乐播放器主样式文件 - 修复版 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    color: white;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden; /* 防止整个页面滚动 */
}

.music-player {
    width: 100%;
    max-width: 800px;
    max-height: 95vh; /* 限制最大高度 */
    background: rgba(0, 0, 0, 0.85);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 防止溢出 */
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0; /* 防止压缩 */
}

.player-header h1 {
    font-size: 24px;
    font-weight: 600;
    background: linear-gradient(45deg, #ff6b6b, #ffa726);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.upload-btn, .download-btn, .refresh-btn, .select-all-btn, .delete-selected-btn, .download-selected-btn {
    background: linear-gradient(45deg, #ff6b6b, #ffa726);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.upload-btn:hover, .download-btn:hover, .refresh-btn:hover, 
.select-all-btn:hover, .delete-selected-btn:hover, .download-selected-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.upload-btn:active, .download-btn:active, .refresh-btn:active,
.select-all-btn:active, .delete-selected-btn:active, .download-selected-btn:active {
    transform: translateY(0);
}

.download-btn:disabled, .delete-selected-btn:disabled, .download-selected-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.upload-progress {
    width: 250px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 10px;
}

.upload-progress .progress-bar {
    height: 8px;
    background: #555;
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
    position: relative;
}

.upload-progress .progress {
    height: 100%;
    background: linear-gradient(45deg, #4CAF50, #45a049);
    transition: width 0.3s ease;
    border-radius: 4px;
}

#uploadStatus {
    font-size: 12px;
    color: #ddd;
    font-weight: 500;
}

.now-playing {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0; /* 防止压缩 */
}

.album-art {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    margin-right: 20px;
    background: #333;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.album-art img:hover {
    transform: scale(1.05);
}

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

.song-info h2 {
    font-size: 20px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.song-info p {
    font-size: 14px;
    color: #bbb;
    margin-bottom: 4px;
}

.song-info .song-duration {
    color: #ff6b6b;
    font-weight: 500;
}

.player-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
    flex-shrink: 0; /* 防止压缩 */
}

.progress-container {
    display: flex;
    align-items: center;
    position: relative;
}

.progress-container span {
    font-size: 12px;
    width: 45px;
    font-weight: 500;
    color: #ddd;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: #555;
    border-radius: 3px;
    margin: 0 15px;
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.progress {
    height: 100%;
    background: linear-gradient(45deg, #ff6b6b, #ffa726);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    z-index: 10;
}

.progress-thumb:hover {
    transform: translateY(-50%) scale(1.2);
    background: #ff6b6b;
}

.progress-thumb:active {
    cursor: grabbing;
    transform: translateY(-50%) scale(1.3);
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 50%;
}

.control-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
}

.control-btn.play {
    background: linear-gradient(45deg, #ff6b6b, #ffa726);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.control-btn.play:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.5);
}

.play-mode-container {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.play-mode-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.play-mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.mode-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 150px;
    z-index: 1000;
    display: none;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s ease;
    border: none;
    background: none;
    color: white;
    width: 100%;
    text-align: left;
    font-size: 14px;
}

.mode-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mode-option.active {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
}

.mode-option .mode-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 15px;
    border-radius: 20px;
}

.volume-control span {
    font-size: 16px;
    color: #ff6b6b;
    min-width: 20px;
}

#volumeSlider {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    background: #555;
    border-radius: 2px;
    outline: none;
}

#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff6b6b;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

#volumeSlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #ff5252;
}

.volume-value {
    font-size: 12px;
    color: #bbb;
    min-width: 30px;
    text-align: center;
}

.playlist-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 1; /* 占据剩余空间 */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 防止溢出 */
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0; /* 防止压缩 */
}

.playlist-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #ff6b6b;
}

.playlist-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.playlist {
    list-style: none;
    flex: 1; /* 占据剩余空间 */
    overflow-y: auto;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    margin: 0;
    padding: 0;
}

.playlist-item {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
    gap: 10px;
}

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

.playlist-item.playing {
    background: linear-gradient(45deg, rgba(255, 107, 107, 0.15), rgba(255, 167, 38, 0.15));
    border-left: 4px solid #ff6b6b;
}

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

.playlist-item.dragging {
    opacity: 0.5;
    background: rgba(255, 107, 107, 0.2);
}

.playlist-item .item-select {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.song-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.playlist-item .item-drag {
    color: #666;
    cursor: grab;
    font-size: 14px;
    padding: 0 5px;
}

.playlist-item .item-drag:active {
    cursor: grabbing;
}

.playlist-item .song-number {
    font-size: 14px;
    color: #888;
    width: 25px;
    text-align: center;
    font-weight: 500;
}

.playlist-item.playing .song-number {
    color: #ff6b6b;
    font-weight: 600;
}

.playlist-item .song-details {
    flex: 1;
    min-width: 0;
    margin-right: 15px;
}

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

.playlist-item .song-artist {
    font-size: 12px;
    color: #aaa;
}

.playlist-item.playing .song-artist {
    color: #ff9999;
}

.playlist-item .file-size {
    font-size: 11px;
    color: #666;
    margin-right: 15px;
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

.playlist-item .song-duration {
    font-size: 11px;
    color: #888;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

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

.playlist::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.playlist::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #ff6b6b, #ffa726);
    border-radius: 4px;
}

.playlist::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #ff5252, #ff9800);
}

/* 空状态提示 */
.playlist-empty {
    text-align: center;
    color: #888;
    padding: 40px 20px;
    font-style: italic;
    font-size: 14px;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #ff6b6b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 消息提示 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.message-info {
    background: rgba(76, 175, 80, 0.9);
}

.message-error {
    background: rgba(244, 67, 54, 0.9);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .music-player {
        margin: 10px;
        padding: 20px;
        max-height: 90vh;
    }
    
    .player-header {
        flex-direction: column;
        text-align: center;
    }
    
    .upload-section {
        align-items: center;
    }
    
    .now-playing {
        flex-direction: column;
        text-align: center;
    }
    
    .album-art {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .playlist-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .playlist-actions {
        justify-content: center;
    }
    
    .playlist-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .playlist-item .song-details {
        min-width: 150px;
    }
    
    .controls-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .play-mode-container {
        justify-content: center;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.music-player {
    animation: fadeIn 0.5s ease-out;
}

/* 选择文本样式 */
::selection {
    background: rgba(255, 107, 107, 0.3);
    color: white;
}