/* 媒体控制样式 */

:root {
    --accent: #ff6b6b; /* 播放按钮强调色（可覆盖） */
    --control-btn-bg: rgba(0,0,0,0.04); /* 次级按钮背景 */
    --control-icon-color: #333;
}

/* 三列布局：左（信息） 中（进度） 右（控制） */
.device-media-control {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px; /* 更紧凑的间距 */
    padding: 10px 12px; /* 略微收紧内边距 */
    border-radius: 10px;
    background: var(--card-bg, #e9ecef);
    box-shadow: 0 3px 0 #e74c3c;
}

.device-media-control .media-info {
    flex: 1 1 auto;
    min-width: 0;
}

.media-track-title {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-track-sub {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}
.media-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.media-progress .media-time { font-size: 12px; color: #666; min-width: 36px; text-align: center; }
.media-progress-bar { flex: 1; height: 6px; background: #eee; border-radius: 6px; overflow: hidden; }
.media-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg,#4CAF50,#67D3B8); transition: width 0.12s linear; }
.media-controls { display: flex; gap: 6px; align-items: center; }
.media-controls .media-btn { background: none; border: none; cursor: pointer; padding: 6px; font-size: 14px; color: #333; }
.media-controls .media-btn.media-btn-play.playing i { color: #e85d04; }

.media-col { min-width: 0; }
.media-col-left { display:flex; flex-direction:row; align-items:center; gap:8px; min-width: 200px; max-width: 42%; }
.media-col-center { display:flex; flex-direction:column; align-items:center; width:100%; }
.media-col-right { display:flex; justify-content:flex-end; align-items:center; min-width: 140px; }

.media-track-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary, #111);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.media-track-sub {
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    margin-top: 4px;
}

.media-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    width: 100%;
}

.media-progress-bar {
    position: relative;
    height: 8px;
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    background: rgba(0,0,0,0.06);
    border-radius: 6px;
    overflow: hidden;
}

.media-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #2ebd6e);
    width: 0%;
    transition: width 160ms linear;
}

.media-time {
    font-size: 0.8rem;
    color: var(--text-secondary, #666);
    width: 40px;
    text-align: center;
}

.media-controls-right {
    display: flex;
    align-items: center;
    gap: 6px; /* 更紧凑 */
}

.media-btn {
    background: transparent;
    border: none;
    color: var(--icon-color, #333);
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.06s ease, background-color 0.12s ease, box-shadow 0.12s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 非播放主按钮的固定更大尺寸，便于点击 */
.media-btn.small {
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 1rem;
    border-radius: 50%;
    background: var(--control-btn-bg);
    color: var(--control-icon-color);
}

/* 更大更显眼的播放按钮 */
.media-btn.media-btn-play {
    background: var(--accent, #ff6b6b); /* 播放按钮强调色（可覆盖） */
    color: #fff;
    padding: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.05rem;
    box-shadow: 0 6px 12px rgba(0,0,0,0.12);
}
.media-btn.media-btn-play i { font-size: 1.15rem; line-height:1; }
.media-btn.media-btn-play:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0,0,0,0.16); }

/* 其他控件 hover 效果 */
.media-btn:hover { background: rgba(0,0,0,0.04); transform: translateY(-1px); box-shadow: 0 6px 12px rgba(0,0,0,0.06); }

/* 图标尺寸微调，确保在放大按钮内居中 */
.media-controls .media-btn i { font-size: 1.1rem; line-height:1; }

/* 确保所有控制按钮在小屏与大屏下垂直居中 */
.media-controls { display:flex; align-items:center; gap:8px; }

/* 响应式：移动端堆叠，每部分占一行 */
@media (max-width: 720px) {
    .device-media-control {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        gap: 8px;
        text-align: center;
    }
    /* 移动端保持歌名与艺术家同行显示（行内），整体居中 */
    .media-col-left { width:100%; justify-content:center; align-items:center; display:flex; flex-direction:row; gap:6px; }
    .media-col-center { width:100%; justify-content:center; align-items:center; display:flex; flex-direction:column; }
    .media-col-right { width:100%; justify-content:center; align-items:center; display:flex; }
    .media-progress { width: 100%; }
    .media-time { width: 48px; }
    .media-track-title { font-size: 0.98rem; }
    .media-track-sub { margin-top: 4px; }
}

/* 大号滑块和操作区样式 */
.device-slider-container { margin-top: 12px; display:flex; align-items:center; gap:12px; }
.device-slider-label { min-width: 72px; font-size:0.9rem; color:var(--text-secondary,#666); }
.device-slider { flex:1; }
.device-slider input[type=range] { width:100%; }

.quick-actions { display:grid; grid-template-columns: repeat(4, 1fr); gap:8px; margin-top:12px; }
.quick-action { background:var(--muted,#f7f7f7); border-radius:8px; padding:10px; text-align:center; font-size:0.9rem; color:var(--text-primary,#111); cursor:pointer; }


/* SPA 音乐播放器样式 */
/* 播放器主容器 */
.spa-music-player {
    position: fixed;
    z-index: 9999;
    width: 350px;
    max-width: 90vw;
    background: rgb(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 10px 20px rgba(0, 0, 0, 0.1);
    border: 0px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
    -webkit-user-select: none;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', Arial, sans-serif;
}

/* 播放器位置 */
.spa-music-player.bottom-right {
    bottom: 20px;
    right: 20px;
}

.spa-music-player.bottom-left {
    bottom: 20px;
    left: 20px;
}

.spa-music-player.top-right {
    top: 20px;
    right: 20px;
}

.spa-music-player.top-left {
    top: 20px;
    left: 20px;
}

.spa-music-player.center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spa-music-player.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* 播放器主体 */
.player-main {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
}

/* 歌曲信息区域 */
.song-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.song-cover {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.cover-placeholder {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.cover-placeholder.playing {
    animation: pulse 2s ease-in-out infinite;
    color: #fff;
}

.play-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: ripple 1.5s ease-out infinite;
}

.play-pulse.hidden {
    display: none;
}

.song-details {
    flex: 1;
    min-width: 0;
}

.song-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.song-artist {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-album {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 歌词显示区域 */
.lyrics-display {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.current-lyric {
    font-size: 14px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    min-height: 20px;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease-in-out;
}

/* 进度条区域 */
.progress-section {
    margin-bottom: 15px;
}

.time-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.progress-container {
    position: relative;
    padding: 5px 0;
}

.progress-bar {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    transition: height 0.2s ease;
}

.progress-bar:hover {
    height: 6px;
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #feca57);
    border-radius: 2px;
    transition: width 0.1s linear;
    max-width: 100%;
}

.progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.progress-bar:hover .progress-handle {
    opacity: 1;
}

/* 控制按钮区域 */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    position: relative;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.play-pause-btn {
    width: 54px;
    height: 54px;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
}

.play-pause-btn:hover {
    background: white;
    color: #667eea;
}

/* 音量控制 */
.volume-control {
    position: absolute;
    top: -50px;
    right: 0;
    width: 100px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.volume-control.hidden {
    display: none;
}

.volume-slider {
    position: relative;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    cursor: pointer;
}

.volume-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #667eea;
    border-radius: 2px;
    width: 70%;
    transition: width 0.1s ease;
}

.volume-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    left: 70%;
    transition: left 0.1s ease;
}

/* 播放器控制栏 */
.player-controls {
    display: flex;
    justify-content: space-between;
    padding: 5px 15px;
    background: rgba(0, 0, 0, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.minimize-btn,
.close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.minimize-btn:hover,
.close-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* 迷你播放器 */
.mini-player {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: move;
}

.mini-player.hidden {
    display: none;
}

.mini-song-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.mini-cover {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
}

.mini-details {
    flex: 1;
    min-width: 0;
}

.mini-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.mini-artist {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-controls {
    display: flex;
    gap: 10px;
}

.mini-play-btn,
.mini-favorite-btn,
.expand-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mini-play-btn:hover,
.mini-favorite-btn:hover,
.expand-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 动画效果 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .spa-music-player {
        width: 320px;
        max-width: calc(100vw - 20px);
    }
    
    .spa-music-player.bottom-right,
    .spa-music-player.bottom-left,
    .spa-music-player.top-right,
    .spa-music-player.top-left {
        bottom: 10px;
        left: 10px;
        right: auto;
        top: auto;
    }
    
    /* 添加移动端居中位置 */
    .spa-music-player.center {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        bottom: auto;
        right: auto;
    }
    
    .player-main {
        padding: 15px;
    }
    
    .song-cover {
        width: 50px;
        height: 50px;
    }
    
    .cover-placeholder {
        font-size: 20px;
    }
    
    .song-title {
        font-size: 15px;
    }
    
    .song-artist {
        font-size: 13px;
    }
    
    .current-lyric {
        font-size: 13px;
    }
    
    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .play-pause-btn {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .controls {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .spa-music-player {
        width: 300px;
    }
    
    .song-info {
        gap: 12px;
    }
    
    .lyrics-display {
        padding: 10px;
    }
    
    .current-lyric {
        font-size: 12px;
    }
}

/* 拖拽时的样式 */
.spa-music-player.dragging {
    cursor: grabbing;
    transform: scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .spa-music-player {
        border: 2px solid #000;
        background: rgba(255, 255, 255, 0.98);
    }
    
    .player-main {
        background: #000;
        color: #fff;
    }
    
    .progress-fill {
        background: #fff;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .spa-music-player,
    .control-btn,
    .current-lyric,
    .progress-fill,
    .cover-placeholder {
        transition: none;
        animation: none;
    }
    
    .play-pulse {
        display: none;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .spa-music-player {
        background: rgba(30, 30, 30, 0.95);
        border: 0px solid rgba(255, 255, 255, 0.1);
    }
    
    .volume-control {
        background: rgba(40, 40, 40, 0.95);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .control-btn {
        width: 48px;
        height: 48px;
    }
    
    .play-pause-btn {
        width: 56px;
        height: 56px;
    }
    
    .progress-bar {
        height: 6px;
        padding: 8px 0;
    }
    
    .progress-handle {
        width: 16px;
        height: 16px;
        opacity: 1;
    }
    
    .volume-slider {
        height: 6px;
        padding: 8px 0;
    }
    
    .volume-handle {
        width: 16px;
        height: 16px;
    }
}
