/**
 * 音乐播放器样式
 * PC端：环形进度条 + 拖拽
 * 移动端：悬浮面板
 */

/* ===== 全局主题变量 ===== */
:root {
    --music-primary: #FF7BAC;
    --music-secondary: #FFB6C1;
    --music-accent: #FFD700;
    --music-text: #5D4037;
    --music-bg: #FFF9F9;
    --music-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --music-transition: all 0.3s ease;
}

/* 禁止文本选择 */
.cxj-no-select,
#cxj-music-container,
#cxj-music-btn,
#cxj-lrc-single,
#cxj-lrc-translation,
#cxj-floating-btn,
#cxj-floating-panel,
#cxj-floating-album,
#cxj-floating-title,
#cxj-floating-artist,
#cxj-floating-lyrics,
#cxj-floating-translation,
.cxj-floating-control-btn {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ===== PC端样式 ===== */
.desktop-ui #cxj-music-container {
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 80px;
    height: 80px;
    z-index: 9999;
    cursor: pointer;
    touch-action: none;
    transition: cursor 0.2s ease;
}

.desktop-ui #cxj-music-container.dragging {
    cursor: grabbing !important;
    opacity: 0.9;
    filter: drop-shadow(0 0 10px rgba(255, 123, 172, 0.5));
}

.desktop-ui #cxj-music-container.at-boundary {
    animation: boundary-bounce 0.3s ease;
}

@keyframes boundary-bounce {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(5px, 0); }
    50% { transform: translate(-5px, 0); }
    75% { transform: translate(0, 5px); }
}

.desktop-ui #cxj-music-container:hover::after {
    content: '长按拖动';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.desktop-ui #cxj-music-container:hover::after {
    opacity: 0.7;
}

.desktop-ui #cxj-music-container.long-press-active::after {
    content: '拖动移动';
    opacity: 1;
    color: #fff;
    background: rgba(255, 123, 172, 0.9);
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 10px;
    top: -25px;
}

.desktop-ui #cxj-progress-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.desktop-ui #cxj-progress-ring-bg {
    fill: none;
    stroke: #FFE4E1;
    stroke-width: 6;
}

.desktop-ui #cxj-progress-ring-fg {
    fill: none;
    stroke: var(--music-primary);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 226;
    stroke-dashoffset: 226;
    transition: stroke-dashoffset 0.1s linear;
}

.desktop-ui #cxj-music-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--music-primary), var(--music-secondary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--music-shadow);
    font-size: 24px;
    transition: var(--music-transition);
    border: 2px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    z-index: 10;
}

.desktop-ui #cxj-music-btn:hover {
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 6px 15px rgba(255, 123, 172, 0.3);
}

.desktop-ui #cxj-music-btn.playing {
    background: linear-gradient(135deg, #FF6B6B, #FF8E8E);
}

.desktop-ui #cxj-ui-panel {
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: opacity .3s, visibility .3s;
    opacity: 0;
    visibility: hidden;
    z-index: 9998;
    width: clamp(300px, 50vw, 600px);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 15px 20px;
    box-shadow: var(--music-shadow);
    border: 1px solid rgba(255, 182, 193, 0.3);
    pointer-events: none;
}

.desktop-ui #cxj-ui-panel.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.desktop-ui #cxj-lrc-single {
    padding: 10px 20px;
    background: rgba(255, 182, 193, 0.85);
    color: var(--music-text);
    font-size: 16px;
    border-radius: 15px;
    margin-bottom: 8px;
    white-space: nowrap;
    font-weight: 500;
    box-shadow: inset 0 0 10px rgba(255, 182, 193, 0.05);
    border: 1px solid rgba(255, 182, 193, 0.2);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.desktop-ui #cxj-lrc-translation {
    padding: 5px 20px;
    background: rgba(255, 182, 193, 0.7);
    color: var(--music-text);
    font-size: 14px;
    border-radius: 10px;
    white-space: nowrap;
    font-weight: 400;
    box-shadow: inset 0 0 10px rgba(255, 182, 193, 0.05);
    border: 1px solid rgba(255, 182, 193, 0.2);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== 移动端样式 ===== */
.mobile-ui {
    display: none;
}

@media (max-width: 768px) {
    .desktop-ui {
        display: none;
    }
    
    .mobile-ui {
        display: block;
    }
    
    #cxj-floating-btn {
        position: fixed;
        left: 15px;
        bottom: 80px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--music-primary), var(--music-secondary));
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: var(--music-shadow);
        z-index: 9998;
        font-size: 22px;
        transition: var(--music-transition);
        border: 2px solid rgba(255, 255, 255, 0.5);
    }
    
    #cxj-floating-btn:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 15px rgba(255, 123, 172, 0.3);
    }
    
    #cxj-floating-btn.playing {
        background: linear-gradient(135deg, #FF6B6B, #FF8E8E);
    }
    
    #cxj-floating-panel {
        position: fixed;
        left: 15px;
        bottom: 140px;
        width: 260px;
        background: rgba(255, 249, 249, 0.95);
        border-radius: 25px;
        box-shadow: var(--music-shadow);
        padding: 20px;
        z-index: 9997;
        transform: translateY(20px);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        border: 1px solid rgba(255, 182, 193, 0.3);
    }
    
    #cxj-floating-panel.visible {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    
    #cxj-floating-album {
        width: 70px;
        height: 70px;
        border-radius: 15px;
        background: linear-gradient(135deg, var(--music-primary), var(--music-accent));
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 30px;
        margin: 0 auto 15px;
        box-shadow: 0 5px 15px rgba(255, 123, 172, 0.3);
        border: 2px solid rgba(255, 255, 255, 0.5);
    }
    
    #cxj-floating-track {
        text-align: center;
        margin-bottom: 15px;
    }
    
    #cxj-floating-title {
        font-size: 18px;
        font-weight: 600;
        margin-bottom: 5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--music-text);
    }
    
    #cxj-floating-artist {
        font-size: 14px;
        color: #D87093;
    }
    
    #cxj-floating-progress {
        height: 8px;
        background: #FFE4E1;
        border-radius: 10px;
        margin-bottom: 15px;
        position: relative;
        cursor: pointer;
    }
    
    #cxj-floating-progress-bar {
        height: 100%;
        border-radius: 10px;
        background: linear-gradient(90deg, var(--music-primary), var(--music-accent));
        width: 0;
        box-shadow: 0 0 8px rgba(255, 123, 172, 0.4);
    }
    
    #cxj-floating-controls {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .cxj-floating-control-btn {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        color: var(--music-text);
        background: rgba(255, 182, 193, 0.2);
        transition: var(--music-transition);
        box-shadow: var(--music-shadow);
        border: 1px solid rgba(255, 182, 193, 0.3);
    }
    
    .cxj-floating-control-btn:active {
        transform: scale(0.95);
        background: rgba(255, 182, 193, 0.3);
    }
    
    #cxj-floating-play {
        width: 50px;
        height: 50px;
        background: linear-gradient(135deg, var(--music-primary), var(--music-secondary));
        color: white;
        font-size: 22px;
        box-shadow: 0 5px 15px rgba(255, 123, 172, 0.3);
        border: 2px solid rgba(255, 255, 255, 0.5);
    }
    
    #cxj-floating-play.playing {
        background: linear-gradient(135deg, #FF6B6B, #FF6B6B);
    }
    
    #cxj-floating-lyrics {
        background: rgba(255, 182, 193, 0.1);
        color: var(--music-text);
        font-size: 14px;
        padding: 10px 15px;
        border-radius: 15px;
        margin-top: 15px;
        text-align: center;
        line-height: 1.5;
        max-height: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        font-weight: 500;
        box-shadow: inset 0 0 10px rgba(255, 182, 193, 0.05);
        border: 1px solid rgba(255, 182, 193, 0.2);
    }
    
    #cxj-floating-translation {
        background: rgba(255, 182, 193, 0.1);
        color: var(--music-text);
        font-size: 12px;
        padding: 8px 15px;
        border-radius: 12px;
        margin-top: 8px;
        text-align: center;
        line-height: 1.4;
        max-height: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        font-weight: 400;
        box-shadow: inset 0 0 10px rgba(255, 182, 193, 0.05);
        border: 1px solid rgba(255, 182, 193, 0.2);
    }
    
    #cxj-floating-close {
        position: absolute;
        top: 15px;
        right: 15px;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: rgba(255, 182, 193, 0.2);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        color: var(--music-text);
        transition: var(--music-transition);
        box-shadow: var(--music-shadow);
        border: 1px solid rgba(255, 182, 193, 0.3);
    }
    
    #cxj-floating-close:active {
        transform: scale(0.95);
        background: rgba(255, 182, 193, 0.3);
    }
}

/* 小屏幕优化 */
@media (max-width: 480px) {
    #cxj-floating-btn {
        width: 45px;
        height: 45px;
        font-size: 20px;
        left: 10px;
        bottom: 70px;
    }
    
    #cxj-floating-panel {
        width: 240px;
        left: 10px;
        bottom: 125px;
        padding: 15px;
    }
    
    #cxj-floating-album {
        width: 60px;
        height: 60px;
        font-size: 26px;
    }
    
    #cxj-floating-title {
        font-size: 16px;
    }
    
    #cxj-floating-artist {
        font-size: 13px;
    }
    
    .cxj-floating-control-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    #cxj-floating-play {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    
    #cxj-floating-lyrics {
        font-size: 13px;
        padding: 8px 12px;
        max-height: 90px;
    }
    
    #cxj-floating-translation {
        font-size: 11px;
        padding: 6px 12px;
        max-height: 70px;
    }
}