/* 全局音樂播放器樣式 */
.global-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to top, #2c3e50, #34495e);
    border-top: 1px solid #3498db;
    z-index: 9999;
    display: none;
    align-items: center;
    padding: 0 5px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}

.global-player.active {
    display: flex;
}

/* 播放器內容 */
.player-content {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* 專輯封面 */
.player-album-cover {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    margin-right: 15px;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
}

.player-album-cover img {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    object-fit: cover;
}

/* 歌曲資訊 */
.player-track-info {
    flex: 1;
    margin-right: 20px;
    min-width: 0;
}

.player-track-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-track-meta {
    color: #bdc3c7;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 播放控制按鈕 */
.player-controls {
    display: flex;
    align-items: center;
    margin-right: 20px;
}

.player-btn {
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 18px;
    margin: 0 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-btn:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.1);
}

.player-btn.play-btn {
    background: #3498db;
    color: white;
    font-size: 16px;
}

.player-btn.play-btn:hover {
    background: #2980b9;
}

/* 進度條總容器：確保它是橫向的一直線 */
/* 進度條 */

.player-progress {
    flex: 2;
    margin-right: 20px;
    display: flex;
    align-items: center;
}

/* 進度條本體：讓它自動伸展填滿中間 */
.progress-bar {
    flex: 1 !important;           /* 這是關鍵：讓條狀物填滿時間中間的空隙 */
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;           /* 內部進度填充需要相對定位 */
    cursor: pointer;
}

.progress-fill {
    height: 100%;
    background: #3498db;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.progress-buffer {
    height: 100%;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    width: 0%;
    position: absolute;
    top: 0;
    left: 0;
}

/* 時間文字：防止被擠壓或飄移 */
.time-display {
    color: #bdc3c7;
    font-size: 11px;
    min-width: 40px;             /* 固定寬度防止跳動 */
    flex-shrink: 0;              /* 強制不准被擠壓，防止它飄出去 */
    position: static !important; /* 確保它沒有被奇怪的定位屬性帶走 */
    margin: 0 !important;
}

/* 音量控制 */
.player-volume {
    display: flex;
    align-items: center;
    margin-right: 20px;
}

.volume-slider {
    width: 80px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin-left: 8px;
    cursor: pointer;
    position: relative;
}

.volume-fill {
    height: 100%;
    background: #3498db;
    border-radius: 2px;
    width: 70%;
}

/* 其他控制按鈕 */
.player-extra {
    display: flex;
    align-items: center;
}

.player-extra .player-btn {
    font-size: 14px;
    margin: 0 4px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .global-player {
        height: 70px;
        padding: 0 3px;
    }
    
    .player-track-info {
        margin-right: 10px;
    }
    
    .player-controls {
        margin-right: 15px;
    }
    
    .player-progress {
        margin-right: 15px;
    }
    
    .player-volume {
        display: none;
    }
    
    .player-extra .player-btn {
        font-size: 12px;
        margin: 0 2px;
    }
}

@media (max-width: 480px) {
    .global-player {
        height: 60px;
        padding: 0 2px;
    }
    
    .player-album-cover {
        width: 40px;
        height: 40px;
        margin-right: 8px;
    }
    
    .player-track-title {
        font-size: 12px;
    }
    
    .player-track-meta {
        font-size: 10px;
    }
    
    .player-btn {
        font-size: 16px;
        margin: 0 4px;
        width: 32px;
        height: 32px;
    }
    
    .player-progress {
        flex: 1;
        margin-right: 10px;
    }
    
    .time-display {
        font-size: 10px;
        min-width: 35px;
    }
}

/* 為全局播放器騰出空間 */
body.has-global-player {
    padding-bottom: 80px;
}

@media (max-width: 768px) {
    body.has-global-player {
        padding-bottom: 70px;
    }
}

@media (max-width: 480px) {
    body.has-global-player {
        padding-bottom: 60px;
    }
}

/* 動畫效果 */
.global-player {
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.global-player.active {
    transform: translateY(0);
}

/* 載入動畫 */
.player-loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #3498db;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
