/* 全局样式和重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #0c0c0c;
    color: #fff;
    overflow-x: hidden;
}

/* 背景动画 */
.bg-animation {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    z-index: -2;
}

.bg-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    z-index: -1;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; }
}

/* 顶部导航 */
.navbar {
    background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 0; position: sticky; top: 0; z-index: 100;
}
.nav-container {
    max-width: 1600px; margin: 0 auto; padding: 0 30px; display: flex;
    align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: bold; }
.logo i { color: #ff6b6b; font-size: 28px; }
.search-container { flex: 1; max-width: 600px; margin: 0 40px; }
.search-wrapper { display: flex; background: rgba(255, 255, 255, 0.15); border-radius: 25px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.2); transition: all 0.3s ease; }
.search-wrapper:focus-within { background: rgba(255, 255, 255, 0.2); border-color: #ff6b6b; box-shadow: 0 0 20px rgba(255, 107, 107, 0.3); }
.search-input { flex: 1; padding: 12px 20px; background: transparent; border: none; color: #fff; font-size: 16px; outline: none; min-width: 50px; }
.search-input::placeholder { color: rgba(255, 255, 255, 0.6); }
.source-select { background: rgba(255, 255, 255, 0.1); border: none; color: #fff; padding: 12px 15px; outline: none; cursor: pointer; flex-shrink: 0; }
.source-select option { background: #2a2a2a; color: #fff; }
.search-btn { background: #ff6b6b; border: none; color: #fff; padding: 12px 20px; cursor: pointer; transition: all 0.3s ease; flex-shrink: 0; }
.search-btn:hover { background: #ff5252; }
.loading i, .error i, .empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
}

/* 主要内容区域 */
.main-container {
    max-width: 1600px; margin: 30px auto; padding: 0 30px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 25px;
    align-items: stretch;
}

/* 内容区域通用样式 */
.content-section, .player-section, .lyrics-section {
    background: rgba(255, 255, 255, 0.05); border-radius: 20px;
    padding: 25px; backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1); min-width: 0; overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 125px);
}
.section-title { font-size: 20px; font-weight: 600; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.search-results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.song-item { display: flex; align-items: center; padding: 15px 10px; border-radius: 12px; cursor: pointer; transition: all 0.3s ease; margin-bottom: 8px; }
.song-item:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }
.song-item.active { background: linear-gradient(135deg, rgba(255, 107, 107, 0.3), rgba(255, 107, 107, 0.1)); border-left: 3px solid #ff6b6b; }
.song-index { width: 40px; text-align: center; margin-right: 15px; font-size: 14px; color: rgba(255, 255, 255, 0.7); }
.song-item.active .song-index { color: #ff6b6b; }
.song-info { flex: 1; min-width: 0; }
.song-name { font-weight: 600; margin-bottom: 5px; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { color: rgba(255, 255, 255, 0.7); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-actions { margin-left: 15px; display: flex; gap: 8px; }
.action-btn { width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); border: none; color: rgba(255, 255, 255, 0.7); cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.action-btn:hover { background: rgba(255, 107, 107, 0.3); color: #ff6b6b; }

/* 播放器区域 */
.player-section, .lyrics-section {
    position: sticky; top: 95px; height: calc(100vh - 125px);
    display: flex; flex-direction: column;
}
.current-song { text-align: center; margin-bottom: 25px; flex-shrink: 0; }
.current-cover { width: 200px; height: 200px; border-radius: 50%; object-fit: cover; box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5); transition: all 0.3s ease; border: 6px solid rgba(255, 255, 255, 0.1); margin: 0 auto 20px; display: block; }
.current-cover.playing {
    animation: rotate 20s linear infinite;
    will-change: transform; /* 提升动画性能 */
}
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.current-info h3 { font-size: 20px; margin-bottom: 8px; }
.current-info p { color: rgba(255, 255, 255, 0.7); font-size: 16px; }

/* 播放控制 */
.player-controls { display: flex; justify-content: center; align-items: center; gap: 20px; margin-bottom: 25px; flex-shrink: 0; }
.control-btn { background: rgba(255, 255, 255, 0.1); border: none; border-radius: 50%; color: #fff; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; }
.control-btn:hover { background: rgba(255, 255, 255, 0.2); transform: scale(1.1); }
.control-btn.small { width: 45px; height: 45px; font-size: 18px; }
.play-btn { width: 65px; height: 65px; font-size: 28px; background: linear-gradient(135deg, #ff6b6b, #ff5252); box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4); }

/* 进度条 */
.progress-container { margin-bottom: 20px; flex-shrink: 0; border-radius: 8px; }
.progress-bar { width: 100%; height: 6px; background: rgba(255, 255, 255, 0.2); border-radius: 3px; cursor: pointer; margin-bottom: 10px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #ff6b6b, #ff8a80); border-radius: 3px; width: 0%; position: relative; }
.progress-fill::after { content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%); width: 12px; height: 12px; background: #fff; border-radius: 50%; opacity: 0; transition: opacity 0.2s; }
.progress-bar:hover .progress-fill::after { opacity: 1; }
.time-info { display: flex; justify-content: space-between; font-size: 13px; color: rgba(255, 255, 255, 0.7); }

/* 音量和音质 */
.quality-container, .volume-container { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-shrink: 0; }
.quality-label { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.quality-select { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px; color: #fff; padding: 8px 12px; outline: none; cursor: pointer; font-size: 14px; margin-left: auto; }
.volume-slider { -webkit-appearance: none; appearance: none; flex: 1; width: 100%; outline: none; background: transparent; cursor: pointer; }
.volume-slider::-webkit-slider-runnable-track { height: 4px; background: rgba(255, 255, 255, 0.2); border-radius: 2px; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; margin-top: -5px; width: 14px; height: 14px; background: #ff6b6b;; border-radius: 50%; border: 2px solid #ff6b6b; box-shadow: 0 0 5px rgba(255, 107, 107, 0.5); }
.quality-select option { background: #2a2a2a; color: #fff; padding: 8px; }

/* 下载 */
.download-container { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex-shrink: 0; margin-top: auto; }
.download-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 10px; color: #fff; cursor: pointer; transition: all 0.3s ease; font-size: 14px; }
.download-btn:hover:not(:disabled) { background: #ff6b6b; border-color: #ff6b6b; }
.download-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 歌词区域 */
.lyrics-container { flex: 1; overflow-y: auto; }
.lyric-line { padding: 12px 10px; transition: all 0.3s ease; cursor: pointer; border-radius: 8px; margin-bottom: 4px; color: rgba(255, 255, 255, 0.6); line-height: 1.6; text-align: center; }
.lyric-line.active { color: #ff6b6b; font-weight: 600; background: rgba(255, 107, 107, 0.1); }

/* 状态提示 */
.loading, .error, .empty-state { text-align: center; padding: 40px 20px; color: rgba(255, 255, 255, 0.7); }
.loading i { font-size: 48px; margin-bottom: 15px; display: block; animation: spin 1.5s linear infinite; color: #ff6b6b; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* 增强键盘导航的可访问性 */
:is(button, a, select, input[type=range], .song-item, .progress-container):focus-visible {
    outline: 2px solid #ff8a80;
    outline-offset: 2px;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.4);
    border-radius: 4px;
}

/* 自定义滚动条 (兼容 Webkit 和 Firefox) */
:root {
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    scrollbar-width: thin;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.3); border-radius: 3px; }

/* 移动端 Tab 菜单 */
.mobile-tabs {
    display: none; position: fixed; bottom: 0; left: 0; width: 100%;
    background: rgba(10, 10, 10, 0.8); backdrop-filter: blur(15px);
    border-top: 1px solid rgba(255, 255, 255, 0.1); z-index: 200; padding: 5px 0;
}
.tab-nav { display: flex; justify-content: space-around; }
.tab-btn {
    background: none; border: none; color: rgba(255, 255, 255, 0.6);
    cursor: pointer; font-size: 12px; display: flex; flex-direction: column;
    align-items: center; gap: 4px; padding: 8px 12px;
    transition: color 0.3s ease; flex-grow: 1;
}
.tab-btn i { font-size: 20px; }
.tab-btn.active { color: #ff6b6b; }

/* 响应式设计 */
@media (max-width: 1400px) {
    .mobile-tabs { display: block; }
    .main-container {
        display: block; padding: 0; margin-top: 20px; padding-bottom: 80px;
    }
    .content-section, .player-section, .lyrics-section {
        display: none; position: static; height: auto; border-radius: 0;
        border: none; background: none; margin-bottom: 0;
    }
    .player-section { margin-bottom: 0; }
    .content-section.active, .player-section.active, .lyrics-section.active {
        display: flex; flex-direction: column;
    }
    .lyrics-section.active, .content-section.active {
        height: calc(100vh - 160px);
    }
    .search-results {
        flex: 1; max-height: none; min-height: 0;
    }
}

@media (max-width: 768px) {
    .nav-container { flex-direction: column; gap: 15px; }
    .search-container { width: 100%; max-width: none; margin: 0; }
    .content-section, .player-section, .lyrics-section { padding: 20px; }
    .current-cover { width: 160px; height: 160px; }
    .play-btn { width: 60px; height: 60px; font-size: 24px; }
    .control-btn.small { width: 40px; height: 40px; font-size: 16px; }
}

@media (max-width: 480px) {
    .nav-container { padding: 0 15px; }
    .search-input { font-size: 14px; }
}