/* ==========================================================================
   Player — Persistent sticky bottom audio player
   ========================================================================== */

.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    height: var(--player-height);
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
    transition: var(--transition-color);
    display: flex;
    align-items: center;
}

.player-bar.hidden {
    transform: translateY(100%);
}

.player-container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    height: 100%;
}

/* --- Track Info (left) --- */
.player-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 200px;
    flex-shrink: 0;
}

.player-artwork {
    width: 52px;
    height: 52px;
    background-color: var(--color-border);
    overflow: hidden;
    flex-shrink: 0;
}

.player-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.player-title {
    font-family: var(--font-label);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--player-color);
}

.player-artist {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Controls (center) --- */
.player-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.player-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--player-color);
    transition: opacity var(--transition-fast);
    cursor: pointer;
}

.player-btn:hover {
    opacity: 0.6;
}

.player-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.player-btn--play {
    width: 40px;
    height: 40px;
    border: 2px solid var(--player-color);
    border-radius: 50%;
}

.player-btn--play svg {
    width: 16px;
    height: 16px;
}

.player-btn.active {
    opacity: 1;
    color: var(--player-color);
}

.player-btn.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--player-color);
}

/* --- Progress Bar (center-right) --- */
.player-progress {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex: 1;
    min-width: 0;
}

.player-time {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    min-width: 36px;
    text-align: center;
}

.player-progress-bar {
    flex: 1;
    height: 4px;
    background-color: var(--color-border);
    cursor: pointer;
    position: relative;
    border-radius: 2px;
}

.player-progress-fill {
    height: 100%;
    background-color: var(--player-color);
    border-radius: 2px;
    width: 0%;
    position: relative;
    transition: none;
}

.player-progress-fill::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background-color: var(--player-color);
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.player-progress-bar:hover .player-progress-fill::after {
    opacity: 1;
}

/* --- Volume (right) --- */
.player-volume {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-shrink: 0;
}

.player-volume-bar {
    width: 80px;
    height: 4px;
    background-color: var(--color-border);
    cursor: pointer;
    position: relative;
    border-radius: 2px;
}

.player-volume-fill {
    height: 100%;
    background-color: var(--player-color);
    border-radius: 2px;
    width: 80%;
}

/* --- Queue Toggle (far right) --- */
.player-queue-btn {
    flex-shrink: 0;
}

/* --- Queue Panel --- */
.player-queue {
    position: fixed;
    bottom: var(--player-height);
    right: 0;
    width: 360px;
    max-height: 50vh;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-bottom: none;
    z-index: 199;
    display: none;
    flex-direction: column;
    transition: var(--transition-color);
}

.player-queue.open {
    display: flex;
}

.queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.queue-header h3 {
    font-family: var(--font-label);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.queue-clear {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    cursor: pointer;
    text-decoration: underline;
}

.queue-list {
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.queue-item:hover {
    background-color: var(--color-hover);
}

.queue-item.playing {
    background-color: var(--color-hover);
}

.queue-item__artwork {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    overflow: hidden;
}

.queue-item__artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.queue-item__info {
    flex: 1;
    overflow: hidden;
}

.queue-item__title {
    font-family: var(--font-label);
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item__artist {
    font-family: var(--font-body);
    font-size: 0.65rem;
    color: var(--color-text-muted);
}

.queue-item__duration {
    font-family: var(--font-body);
    font-size: 0.65rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.queue-item__remove {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0 var(--space-xs);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .player-bar {
        height: 64px;
    }

    .player-info {
        min-width: 120px;
    }

    .player-artwork {
        width: 40px;
        height: 40px;
    }

    .player-progress,
    .player-volume {
        display: none;
    }

    .player-queue {
        width: 100%;
        left: 0;
    }
}

@media (max-width: 480px) {
    .player-controls {
        gap: var(--space-xs);
    }

    .player-btn--play {
        width: 36px;
        height: 36px;
    }

    .player-meta {
        max-width: 100px;
    }
}
