/* 
 * Audio Player V2.0 Styles
 * 独立的播放器样式文件，采用深色玻璃拟态风格
 */

/* 全局容器：覆盖层 */
.audio-player-wrapper.v2 {
    pointer-events: none; /* 允许点击穿透 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 0; /* 不占据垂直空间 */
    z-index: 9999;
    display: block;
    overflow: visible;
}

/* 播放器主体 */
.audio-player-wrapper.v2 .audio-player {
    display: none; /* 默认隐藏，active时显示 */
    pointer-events: auto; /* 恢复自身点击 */
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px; /* 更圆润的边角 */
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    border: 1px solid rgba(255,255,255,0.08);
    position: fixed; /* 确保拖拽定位生效 */
    /* transition: all 0.3s; 禁用以保证拖拽流畅 */
}

/* 激活状态 */
.audio-player-wrapper.v2.active .audio-player {
    display: block;
}

/* 状态：展开视图 */
.audio-player:not(.minimized) {
    width: 320px;
    min-width: 280px;
    max-width: 90vw;
}

/* 移动端适配 */
@media (max-width: 480px) {
    .audio-player:not(.minimized) {
        width: 90vw;
        right: 5% !important; /* 强制右侧间距，防止贴边 */
    }
}

/* 状态：最小化视图 */
.audio-player.minimized {
    width: auto;
    height: auto;
    border-radius: 28px; /* 胶囊形状 */
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
}

/* 视图切换控制 */
.audio-player:not(.minimized) .player-mini { display: none !important; }
.audio-player:not(.minimized) .player-expanded { display: block; }
.audio-player.minimized .player-expanded { display: none !important; }
.audio-player.minimized .player-mini { display: flex !important; }

/* -------------------
   最小化视图 (Capsule FAB)
   ------------------- */
.player-mini {
    display: flex;
    align-items: center;
    padding: 4px;
    height: 56px; /* 略微增大高度 */
}

.mini-btn {
    background: none;
    border: none;
    color: #fff;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.mini-btn:active {
    background: rgba(255,255,255,0.1);
}

.mini-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.mini-separator {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.15);
    margin: 0 2px;
}

/* -------------------
   展开视图 (Card)
   ------------------- */
.audio-header {
    padding: 16px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.05), transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: move; /* 明确指示可拖拽 */
}

.track-info {
    flex: 1;
    overflow: hidden;
    margin-right: 12px;
}

.audio-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.time-display-sm {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    font-variant-numeric: tabular-nums; /* 等宽数字，防止跳动 */
}

.window-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-control {
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-control:active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* 仅在 PC 端启用 Hover */
@media (hover: hover) {
    .btn-control:hover {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }
}

.audio-body {
    padding: 20px 16px;
}

/* -------------------
   进度条
   ------------------- */
.progress-container {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin-bottom: 24px;
    cursor: pointer;
    position: relative;
    padding: 10px 0; /* 增大点击热区 */
    background-clip: content-box;
}

.progress-bar {
    height: 4px;
    background: #1aad19; /* 微信绿 */
    border-radius: 2px;
    width: 0%;
    position: relative;
    transition: background 0.2s;
}

/* 拖拽滑块 - 默认隐藏，交互时显示 */
.progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -4px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.progress-container:active .progress-bar::after {
    opacity: 1;
    transform: scale(1);
}

@media (hover: hover) {
    .progress-container:hover .progress-bar::after {
        opacity: 1;
        transform: scale(1);
    }
}

/* -------------------
   播放控制区
   ------------------- */
.audio-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

/* 通用控制按钮 (上一曲/下一曲/模式) */
.control-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    transform: scale(0.95);
}

@media (hover: hover) {
    .control-btn:hover {
        background: rgba(255,255,255,0.1);
        color: #fff;
    }
}

/* 主播放按钮 */
.play-btn-main {
    width: 64px;
    height: 64px;
    background: #fff;
    color: #000 !important; /* 强制黑色，防止被 control-btn 样式覆盖 */
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
    outline: none; /* 移除 focus 轮廓 */
}

/* 移除 focus 时的默认样式干扰 */
.play-btn-main:focus {
    background: #fff;
    color: #000 !important;
    outline: none;
}

.play-btn-main:active {
    background: #e0e0e0;
    color: #000 !important; /* 确保按下时图标依然是黑色 */
    transform: scale(0.95);
}

@media (hover: hover) {
    .play-btn-main:hover {
        background: #f0f0f0;
        color: #000 !important;
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(255,255,255,0.35);
    }
}

.play-btn-main svg {
    fill: currentColor; /* 使用 currentColor 跟随 color 属性 */
    width: 32px;
    height: 32px;
    margin-left: 2px; /* 视觉修正：播放图标通常偏左 */
}
.play-btn-main .pause-icon {
    margin-left: 0;
}

/* -------------------
   音量控制
   ------------------- */
.volume-container {
    position: relative;
    display: flex;
    align-items: center;
}

.volume-slider-wrapper {
    width: 0;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    margin-left: 4px;
}

/* 激活或 Hover 时展开 */
.volume-container.active .volume-slider-wrapper,
.volume-container:focus-within .volume-slider-wrapper {
    width: 60px;
}

@media (hover: hover) {
    .volume-container:hover .volume-slider-wrapper {
        width: 60px;
    }
}

.volume-slider {
    width: 50px;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}
