/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sidebar-width: 280px;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.45);
    --accent: #ff4d6d;
    --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text-primary);
    background: #0a0a0a;
}

/* ========== 背景层 ========== */
.bg-layer {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(5px);
    transform: scale(1.1);
    z-index: 0;
    transition: background-image 0.6s ease;
}

.bg-mask {
    display: none;
}

/* ========== 主容器 ========== */
.app-container {
    position: relative;
    z-index: 2;
    display: flex;
    width: 100%;
    height: 100%;
}

/* ========== 左侧播放列表（电脑端） ========== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(30px) saturate(1.5);
    -webkit-backdrop-filter: blur(30px) saturate(1.5);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transition: width var(--transition), min-width var(--transition),
                opacity var(--transition), transform var(--transition);
    overflow: hidden;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collapse-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.collapse-btn:hover {
    color: var(--text-primary);
    background: var(--glass-hover);
}

.playlist-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* 播放列表 */
.playlist {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
}

.playlist::-webkit-scrollbar {
    width: 4px;
}

.playlist::-webkit-scrollbar-track {
    background: transparent;
}

.playlist::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 1px;
}

.playlist-item:hover {
    background: var(--glass-hover);
}

.playlist-item.active {
    background: rgba(255, 77, 109, 0.2);
}

.playlist-item.active .item-index {
    color: var(--accent);
}

.item-index {
    font-size: 12px;
    color: var(--text-muted);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.item-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-artist {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* 收起后展开按钮 */
.expand-btn {
    position: fixed;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
}

.expand-btn:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: translateY(-50%) scale(1.08);
}

.expand-btn.visible {
    display: flex;
}

/* ========== 中心内容区 ========== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    position: relative;
    overflow-y: auto;
    min-height: 0;
}

/* 封面区 */
.cover-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 28px;
    margin-top: -20px;
}

.cover-wrapper {
    position: relative;
    width: 240px;
    height: 240px;
}

.cover-img {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5);
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.cover-wrapper:hover .cover-img {
    transform: scale(1.02);
}

.cover-glow {
    position: absolute;
    inset: -16px;
    border-radius: 20px;
    background: radial-gradient(circle at center, rgba(255, 77, 109, 0.12) 0%, transparent 70%);
    z-index: -1;
    filter: blur(16px);
}

/* 封面旋转容器 */
.cover-rotate {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    overflow: hidden;
}

.cover-rotate.playing {
    animation: coverSpin 20s linear infinite;
}

@keyframes coverSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 环形进度条 */
.cover-ring {
    position: absolute;
    inset: -8px;
    width: calc(100% + 16px);
    height: calc(100% + 16px);
    z-index: 2;
    pointer-events: none;
    filter: drop-shadow(0 0 6px rgba(255, 77, 109, 0.4));
}

.ring-progress {
    transition: stroke-dashoffset 0.3s ease;
}

/* 播放脉冲环 */
.cover-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 18px;
    border: 2px solid rgba(255, 77, 109, 0.5);
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.cover-pulse.playing {
    animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.15);
        opacity: 0;
    }
}

.song-info {
    text-align: center;
    margin-top: 20px;
}

.song-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.song-artist {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ========== 自定义播放器 ========== */
.player-section {
    width: 100%;
    max-width: 460px;
    position: relative;
}

.player-card {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px 20px 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* 进度条 */
.progress-container {
    margin-bottom: 12px;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    cursor: pointer;
    transition: height 0.2s;
}

.progress-bar:hover {
    height: 6px;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.progress-bar:hover .progress-thumb {
    opacity: 1;
}

.time-display {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* 控制按钮 */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ctrl-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ctrl-btn:hover {
    color: var(--text-primary);
    background: var(--glass-hover);
}

.ctrl-btn.active {
    color: var(--accent);
}

.play-btn {
    width: 48px;
    height: 48px;
    background: var(--accent);
    color: #fff;
}

.play-btn:hover {
    background: #ff3358;
    transform: scale(1.06);
}

.mode-btn {
    position: relative;
}

.mode-label {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* 音量 */
.volume-container {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
}

.volume-slider {
    width: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
    transition: width 0.3s;
}

.volume-container:hover .volume-slider {
    width: 60px;
}

.volume-fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: 2px;
    width: 70%;
}

/* ========== 手机端播放列表 ========== */
.mobile-playlist {
    display: none;
}

/* ========== 响应式：手机端 ========== */
@media (max-width: 768px) {
    .sidebar { display: none !important; }
    .expand-btn { display: none !important; }

    .main-content {
        padding: 20px 16px 16px;
        justify-content: flex-start;
        padding-top: 40px;
    }

    .cover-section {
        margin-top: 0;
        margin-bottom: 20px;
    }

    .cover-wrapper {
        width: 200px;
        height: 200px;
    }

    .song-name { font-size: 18px; }
    .song-artist { font-size: 13px; }

    .player-section { max-width: 100%; }

    .volume-container { display: none; }

    .mobile-playlist {
        display: block;
        width: 100%;
        max-width: 460px;
        margin-top: 16px;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 14px;
        overflow: hidden;
    }

    .mobile-playlist-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .mobile-toggle {
        background: none;
        border: none;
        color: var(--text-secondary);
        cursor: pointer;
        padding: 2px;
        display: flex;
        align-items: center;
        transition: transform 0.3s;
    }

    .mobile-toggle.collapsed svg {
        transform: rotate(180deg);
    }

    .mobile-playlist-body {
        list-style: none;
        max-height: 200px;
        overflow-y: auto;
        padding: 4px 8px;
        transition: max-height 0.35s ease, padding 0.35s ease;
    }

    .mobile-playlist-body.collapsed {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        overflow: hidden;
    }

    .mobile-playlist-body::-webkit-scrollbar { width: 3px; }
    .mobile-playlist-body::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.15);
        border-radius: 2px;
    }
}

@media (max-width: 380px) {
    .cover-wrapper { width: 170px; height: 170px; }
    .song-name { font-size: 16px; }
}

/* ========== 动画 ========== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.cover-section { animation: fadeInUp 0.5s ease both; }
.player-section { animation: fadeInUp 0.5s ease 0.1s both; }
