/* ==========================================
   Maniesta Play — Global Player Styles
   ========================================== */

#player-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    pointer-events: none;
}

.player {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background-color: rgba(10, 10, 10, 0.95);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-sm) var(--space-md);
    min-height: 72px;
}

/* Now Playing Section */
.player__now-playing {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    min-width: 0;
}

.player__cover {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.player__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.player__title {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.player__favorite {
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    margin-left: auto;
    padding: 4px;
}

/* Controls Section */
.player__controls {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
}

.player__buttons {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.player__btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    transition: color var(--transition-fast), transform var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
}

.player__btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.player__btn--play {
    width: 40px;
    height: 40px;
    background-color: var(--accent-green);
    border-radius: 50%;
    color: var(--text-inverse);
}

.player__btn--active {
    color: var(--accent-green);
}

.player__progress {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    max-width: 400px;
}

.player__progress span {
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 35px;
    text-align: center;
}

.player__progress input[type="range"] {
    flex: 1;
    accent-color: var(--accent-green);
    cursor: pointer;
}

/* Volume Section */
.player__volume {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    justify-content: flex-end;
}

.player__volume input[type="range"] {
    width: 80px;
    accent-color: var(--accent-green);
    cursor: pointer;
}

/* Queue Panel */
.queue-panel {
    pointer-events: auto;
    position: fixed;
    bottom: 72px;
    right: 0;
    width: 300px;
    max-height: 50vh;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg) 0 0 0;
    overflow-y: auto;
    z-index: 201;
}

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

.queue-panel__header h3 {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.queue-panel__close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.queue-panel__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

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

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

.queue-item--active {
    background-color: var(--accent-green-dim);
}

.queue-item__title {
    font-size: var(--fs-xs);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item__artist {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item__remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

/* Ensure SVG icons display correctly inside buttons */
.player__btn svg,
.track-card__play svg,
.track-card__download svg,
.track-card__favorite svg,
.queue-item__remove svg,
.track-card__add-to-playlist svg,
.track-card__remove-local svg {
    display: block;
    margin: 0 auto;
}

/* Remove button for downloaded tracks */
.track-card__remove-local {
    position: absolute;
    top: 8px;
    right: 40px; /* next to favorite */
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

/* Spinner animation */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Download button in player */
.player__btn#player-download {
    font-size: 16px;
}

/* Responsive Player */
@media (max-width: 767px) {
    .player {
        flex-wrap: wrap;
        padding: var(--space-xs);
        gap: var(--space-xs);
    }

    .player__now-playing {
        flex: 2;
    }

    .player__controls {
        order: 3;
        flex: 1 1 100%;
        padding-top: var(--space-xs);
    }

    .player__volume {
        flex: 1;
        justify-content: center;
    }

    .player__cover {
        width: 36px;
        height: 36px;
    }

    .queue-panel {
        width: 100%;
        right: 0;
        bottom: 72px;
        border-radius: 0;
    }
}