/* ============================================================ */
/* 公共UI.css - 音乐播放器样式（液态玻璃效果） */
/* 所有页面共用此文件，与 公共UI.js 配套 */
/* ★ 播放列表可折叠，带过渡动画 */
/* ============================================================ */

/* ===== 音乐播放器容器 ===== */
.music-player {
    position: fixed;
    top: 140px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ----- 迷你按钮（独立固定） ----- */
.player-mini-btn {
    position: fixed;
    top: 140px;
    right: 20px;
    z-index: 10000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3366ff 0%, #1a4bcc 100%);
    border: none;
    box-shadow: 0 4px 20px rgba(51, 102, 255, 0.4);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: playerSlideRightIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.55s both;
}
.player-mini-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(51, 102, 255, 0.6);
}
.player-mini-btn .mini-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #33ff66;
    border: 2px solid #0a0c0f;
    display: none;
}
.player-mini-btn.playing .mini-indicator {
    display: block;
    animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ----- 复位按钮 ----- */
.player-reset-btn {
    position: fixed;
    top: 140px;
    right: 84px;
    z-index: 10000;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.35);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: playerSlideRightIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.65s both;
}
.player-reset-btn:hover {
    color: #5588ff;
    background: rgba(51, 102, 255, 0.12);
    border-color: rgba(51, 102, 255, 0.25);
    transform: scale(1.08);
}
.player-reset-btn:active {
    transform: scale(0.92);
}

@keyframes playerSlideRightIn {
    0% { opacity: 0; transform: translateX(80px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* ----- 展开面板（液态玻璃效果） ----- */
.player-expanded {
    position: absolute;
    top: 0;
    right: 0;
    width: 280px;
    padding: 16px 20px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 
        0 8px 40px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.08);
    transform: translateX(calc(100% + 30px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.4s ease,
                visibility 0.4s ease;
    z-index: 1;
    overflow: hidden;
}

.player-expanded::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, 
        rgba(255, 255, 255, 0.12) 0%, 
        rgba(255, 255, 255, 0.04) 30%, 
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
}

.player-expanded::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: linear-gradient(to top, rgba(51, 102, 255, 0.05), transparent);
    pointer-events: none;
    z-index: 0;
    border-radius: 0 0 20px 20px;
}

.player-expanded.active {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.player-header,
.player-song-info,
.player-progress,
.player-controls,
.player-volume,
.player-mode-container,
.player-playlist-wrap {
    position: relative;
    z-index: 1;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.8);
}
.player-title {
    font-size: 14px;
    font-weight: 600;
    color: #5588ff;
    text-shadow: 0 0 30px rgba(51, 102, 255, 0.15);
}
.player-toggle-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    transition: 0.2s;
}
.player-toggle-btn:hover {
    color: rgba(255, 255, 255, 0.8);
}

.player-song-info {
    text-align: center;
    margin-bottom: 12px;
}
.song-name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
}
.song-artist {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
}

.player-progress {
    margin-bottom: 12px;
}
.player-progress input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    outline: none;
    transition: 0.3s;
}
.player-progress input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #3366ff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.player-progress input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #3366ff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.player-time {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 4px;
}

.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
}
.player-controls button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
    padding: 4px;
}
.player-controls button:hover {
    color: #fff;
    transform: scale(1.1);
}
.player-controls #playBtn {
    font-size: 28px;
    color: #fff;
    background: rgba(51, 102, 255, 0.75);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(51, 102, 255, 0.25);
}
.player-controls #playBtn:hover {
    transform: scale(1.05);
    background: #3366ff;
}

.player-volume {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 14px;
}
.player-volume input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    outline: none;
}
.player-volume input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #3366ff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.player-volume input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #3366ff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.player-mode-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 8px 0;
}
.player-mode-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    cursor: pointer;
    padding: 6px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}
.player-mode-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}
.player-mode-btn.active {
    color: #5588ff;
    background: rgba(51, 102, 255, 0.12);
    border-color: rgba(51, 102, 255, 0.25);
}
.player-mode-btn .mode-label {
    font-size: 12px;
}

/* ============================================================ */
/* ★ 播放列表（可折叠，带过渡动画） */
/* ============================================================ */

/* ---- 包装层 ---- */
.player-playlist-wrap {
    margin: 10px 0 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 4px;
}

/* ---- 标题栏 ---- */
.playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    transition: background 0.2s, color 0.2s;
    outline: none;
}
.playlist-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}
.playlist-header:focus-visible {
    outline: 2px solid rgba(51, 102, 255, 0.6);
    outline-offset: 1px;
}
.playlist-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 500;
}
.playlist-title-index {
    color: rgba(51, 102, 255, 0.85);
    font-size: 11px;
    font-weight: 500;
    min-width: 28px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.playlist-title-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.playlist-arrow {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-left: 8px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

/* ---- 列表主体（关键：用 grid-template-rows 实现真正的平滑过渡） ---- */
.player-playlist {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.32s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease,
                margin-top 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 4px;
    opacity: 1;
    overflow: hidden;
}

/* 用内层包裹来撑开 grid-row 高度 */
.player-playlist > * {
    min-height: 0;
    overflow-y: auto;
    max-height: 150px;
}

/* 滚动条样式（作用于内层） */
.player-playlist > *::-webkit-scrollbar {
    width: 4px;
}
.player-playlist > *::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 2px;
}
.player-playlist > *::-webkit-scrollbar-thumb {
    background: rgba(51, 102, 255, 0.3);
    border-radius: 2px;
}

/* ---- 折叠状态 ---- */
.player-playlist-wrap.collapsed .player-playlist {
    grid-template-rows: 0fr;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}

/* ---- 列表项 ---- */
.playlist-item {
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
}
.playlist-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}
.playlist-item.active {
    background: rgba(51, 102, 255, 0.12);
    color: #5588ff;
    font-weight: 500;
}
.playlist-item .playlist-index {
    color: rgba(255, 255, 255, 0.2);
    font-weight: 400;
    font-size: 11px;
    min-width: 28px;
    text-align: right;
}
.playlist-item.active .playlist-index {
    color: rgba(51, 102, 255, 0.5);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .music-player {
        top: 130px;
        right: 0px;
    }
    .player-expanded {
        width: 260px;
        padding: 14px 16px;
        right: 0px;
    }
    .player-mini-btn {
        top: 130px;
        right: 0px;
        width: 48px;
        height: 48px;
        font-size: 20px;
        border-radius: 12px 0 0 12px;
    }
    .player-reset-btn {
        top: 130px;
        right: 52px;
        width: 32px;
        height: 32px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .music-player {
        top: 120px;
        right: 0px;
    }
    .player-expanded {
        width: 240px;
        padding: 12px 14px;
        right: 0px;
    }
    .player-mini-btn {
        top: 120px;
        right: 0px;
        width: 44px;
        height: 44px;
        font-size: 18px;
        border-radius: 12px 0 0 12px;
    }
    .player-reset-btn {
        top: 120px;
        right: 48px;
        width: 28px;
        height: 28px;
        font-size: 13px;
    }
}