/* ============================================
   小念云 · 音乐悬浮球播放器
   默认圆形泡泡 → 点击展开完整播放器
   ============================================ */

/* ===== 悬浮球容器 ===== */
.music-bubble-wrap {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
}

/* ===== 展开后的播放器卡片 ===== */
.music-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    width: 0;
    height: 48px;
    overflow: hidden;
    background: rgba(25, 20, 40, 0.9);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(255, 200, 220, 0.15);
    border-radius: 26px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 40px rgba(255, 141, 181, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px) scale(0.8);
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
                opacity 0.3s ease, 
                visibility 0.3s ease,
                transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                padding 0.4s ease,
                margin-bottom 0.4s ease;
    margin-bottom: 0;
    white-space: nowrap;
}

/* ===== 展开状态 ===== */
.music-player.expanded {
    width: 310px;
    max-width: calc(100vw - 50px);
    padding: 8px 14px;
    opacity: 1;
    visibility: visible;
    transform: translateX(0) scale(1);
    margin-bottom: 14px;
}

/* show-progress 状态（播放时显示进度条） */
.music-player.show-progress {
    padding-bottom: 26px;
}

/* ===== 封面图（小圆圈） ===== */
.music-cover {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 141, 181, 0.2);
}

.music-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.music-cover img.loaded {
    opacity: 1;
}

.music-cover-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 200, 220, 0.4);
}

.music-cover-placeholder svg {
    width: 14px;
    height: 14px;
}

/* 播放时封面旋转 */
.music-player.playing .music-cover img {
    animation: musicCoverSpin 10s linear infinite;
}

@keyframes musicCoverSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== 歌曲信息 ===== */
.music-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.music-title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-artist {
    font-size: 10px;
    color: rgba(255, 200, 220, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* ===== 控制按钮 ===== */
.music-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.music-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.music-btn:hover {
    color: #fff;
    background: rgba(255, 141, 181, 0.15);
}

.music-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.music-btn svg {
    width: 15px;
    height: 15px;
}

.music-play-btn {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, rgba(255,141,181,0.3), rgba(179,136,255,0.2));
    color: #fff;
    border: 1px solid rgba(255, 141, 181, 0.3);
}

.music-play-btn:hover {
    background: linear-gradient(135deg, rgba(255,141,181,0.45), rgba(179,136,255,0.3));
    box-shadow: 0 0 14px rgba(255, 141, 181, 0.3);
}

.music-play-btn svg {
    width: 16px;
    height: 16px;
}

/* ===== 收起按钮 ===== */
.music-collapse-btn {
    width: 26px;
    height: 26px;
    opacity: 0.5;
}

.music-collapse-btn:hover {
    opacity: 1;
}

/* ===== 进度条 ===== */
.music-progress-wrap {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 7px;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(2px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    z-index: 20;
}

.music-player.show-progress .music-progress-wrap {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.music-progress-bar {
    height: 100%;
    width: 0%;
    min-width: 4px;
    background: linear-gradient(90deg, #ff8db5, #c77dff);
    border-radius: 999px;
    transition: width 0.3s linear;
    position: relative;
}

.music-progress-bar::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 6px rgba(255, 141, 181, 0.5);
    transition: transform 0.2s ease;
}

.music-player.show-progress .music-progress-bar::after {
    transform: translateY(-50%) scale(1);
}

.music-progress-wrap:hover {
    height: 6px;
}

/* =============================================
   悬浮球核心（泡泡）
   ============================================= */
.music-bubble {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(25, 20, 40, 0.92), rgba(35, 25, 50, 0.95));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 2px solid rgba(255, 180, 210, 0.25);
    box-shadow: 
        0 6px 24px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(255, 141, 181, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.music-bubble:hover {
    transform: scale(1.1);
    border-color: rgba(255, 141, 181, 0.5);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(255, 141, 181, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.music-bubble:active {
    transform: scale(0.95);
}

/* ===== 泡泡内的默认音乐图标 ===== */
.music-bubble-icon {
    width: 26px;
    height: 26px;
    color: rgba(255, 200, 220, 0.9);
    transition: all 0.3s ease;
    z-index: 1;
    filter: drop-shadow(0 0 4px rgba(255, 141, 181, 0.4));
}

.music-bubble:hover .music-bubble-icon {
    color: #fff;
    filter: drop-shadow(0 0 8px rgba(255, 141, 181, 0.6));
}

/* ===== 泡泡内的自定义图片 ===== */
.music-bubble-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transition: opacity 0.3s ease;
    z-index: 0;
}

/* ===== 泡泡旋转光环（播放时） ===== */
.music-bubble.playing .music-bubble-img {
    animation: bubbleSpin 8s linear infinite;
}

@keyframes bubbleSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== 泡泡脉冲动画（播放时图标不旋转的情况下） ===== */
.music-bubble.playing {
    animation: bubblePulse 2s ease-in-out infinite;
}

@keyframes bubblePulse {
    0%, 100% { 
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), 0 0 30px rgba(255, 141, 181, 0.15);
    }
    50% { 
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), 0 0 50px rgba(255, 141, 181, 0.35), 0 0 70px rgba(179, 136, 255, 0.2);
    }
}

/* ===== 泡泡光环装饰（外圈） ===== */
.music-bubble::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff8db5, #c77dff, #7ec8e3, #ff8db5);
    background-size: 300% 300%;
    animation: bubbleGlow 4s ease infinite;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.music-bubble.playing::before {
    opacity: 1;
}

@keyframes bubbleGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ===== 展开状态下隐藏泡泡 ===== */
.music-bubble-wrap.expanded .music-bubble {
    display: none;
}

/* =============================================
   响应式 & 移动端
   ============================================= */
@media (max-width: 480px) {
    .music-player.expanded {
        width: 280px;
        max-width: calc(100vw - 40px);
        padding: 6px 10px;
    }

    .music-bubble {
        width: 48px;
        height: 48px;
    }

    .music-bubble-icon {
        width: 22px;
        height: 22px;
    }

    .music-title {
        font-size: 11px;
    }

    .music-artist {
        font-size: 9px;
    }

    .music-btn {
        width: 26px;
        height: 26px;
    }

    .music-play-btn {
        width: 30px;
        height: 30px;
    }

    .music-btn svg {
        width: 13px;
        height: 13px;
    }

    .music-play-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* =============================================
   减少动效偏好
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    .music-player,
    .music-bubble,
    .music-bubble.playing {
        transition: none !important;
        animation: none !important;
    }

    .music-player.expanded {
        transition: opacity 0.1s ease, visibility 0.1s ease !important;
    }

    .music-bubble::before {
        animation: none !important;
        opacity: 0 !important;
    }

    .music-bubble-img {
        animation: none !important;
    }

    .music-cover img {
        animation: none !important;
    }
}
