/**
 * Player Styles - Sticky music player bar at bottom
 */

/* Player Bar Container */
.player-bar {
    grid-column: 1 / 3;
    display: grid;
    grid-template-columns: 30% 40% 30%;
    /* Balanced layout */
    align-items: center;
    padding: 0 16px;
    background-color: #181818;
    /* Solid, slightly lighter than black */
    border-top: 1px solid #282828;
    z-index: 20;
    height: var(--player-height);
    user-select: none;
}

.player-bar.active {
    animation: playerSlideUp 0.3s cubic-bezier(0.3, 0, 0, 1);
}

@keyframes playerSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Buffering State */
.player-bar.buffering::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: buffering 1.5s infinite linear;
    z-index: 25;
}

@keyframes buffering {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Song Info Section (Left) */
.player-song {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding-right: 12px;
}

.player-song img {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: transform var(--transition);
    cursor: pointer;
}

.player-song img:hover {
    transform: scale(1.05);
    /* Quick view trigger hint */
}

.player-song-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.player-song-info .song-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.player-song-info .song-title:hover {
    text-decoration: underline;
}

.player-song-info .song-artist {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    cursor: pointer;
}

.player-song-info .song-artist:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.player-song-info .song-album {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    cursor: pointer;
}

.player-song-info .song-album:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Like Button (Heart) */
.like-btn {
    color: var(--text-secondary);
    margin-left: 8px;
    transition: var(--transition-fast);
}

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

.like-btn.active {
    color: var(--primary);
}

.like-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Controls Section (Center) */
.player-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 722px;
    width: 100%;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 4px;
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    /* Darker grey by default */
    background: transparent;
    transition: color 0.2s ease;
    width: 32px;
    height: 32px;
}

.control-btn:hover {
    color: var(--text-primary);
}

.control-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.control-btn.active {
    color: var(--primary);
    position: relative;
}

.control-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
}

/* Play Button is special */
.play-btn {
    width: 32px;
    height: 32px;
    background: var(--text-primary);
    /* White circle */
    border-radius: 50%;
    color: #000;
    /* Black icon */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease;
}

.play-btn:hover {
    transform: scale(1.05);
    background: var(--text-primary);
    /* Keep white */
}

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

.play-btn svg {
    width: 16px;
    height: 16px;
    fill: #000;
}

.control-btn.disabled {
    opacity: 0.2;
    cursor: default;
}

.control-btn.disabled:hover {
    color: var(--text-secondary);
}

/* Progress Bar Container */
.progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 600px;
}

.time {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Custom Interactive Progress Bar */
.progress-bar {
    flex: 1;
    height: 4px;
    background: #4d4d4d;
    /* Dark grey background */
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    /* Create a hit area */
    padding: 6px 0;
    margin: -6px 0;
    background-clip: content-box;
    /* constrain bg to 4px height */
}

/* The fill of the progress bar */
.progress-fill {
    height: 4px;
    background: var(--text-primary);
    /* White by default */
    border-radius: 2px;
    width: 0%;
    position: absolute;
    top: 6px;
    /* align with padding */
    left: 0;
    pointer-events: none;
    /* Let clicks pass to bar */
}

/* The Thumb (Hidden by default) */
.progress-fill::after {
    content: '';
    position: absolute;
    right: -6px;
    /* center on end */
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Hover States for Progress Bar */
.progress-bar:hover .progress-fill {
    background: var(--primary);
    /* Green on hover */
}

.progress-bar:hover .progress-fill::after {
    opacity: 1;
    /* Show thumb */
    background: var(--text-primary);
    /* Thumb stays white */
}

/* Volume Section (Right) */
.player-volume {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-right: 12px;
}

.player-volume .control-btn {
    width: auto;
    height: auto;
}

/* Volume Slider matching Progress Bar style */
.volume-slider {
    width: 90px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    /* Hit area */
    padding: 6px 0;
    margin: -6px 0;
}

.volume-slider:focus {
    outline: none;
}

.volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, #b3b3b3 var(--volume-percent, 50%), #535353 var(--volume-percent, 50%));
    border-radius: 2px;
}

.volume-slider:hover::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #1DB954 var(--volume-percent, 50%), #535353 var(--volume-percent, 50%));
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    border-radius: 50%;
    background: #fff;
    margin-top: -4px;
    /* (4px track - 12px thumb) / 2 */
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.volume-slider:hover::-webkit-slider-thumb {
    opacity: 1;
}

/* Firefox Styles */
.volume-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: #535353;
    border-radius: 2px;
}

.volume-slider::-moz-range-progress {
    height: 4px;
    background: #b3b3b3;
    border-radius: 2px;
}

.volume-slider:hover::-moz-range-progress {
    background: #1DB954;
}

.volume-slider::-moz-range-thumb {
    height: 12px;
    width: 12px;
    border: none;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    transition: opacity 0.2s;
}

.volume-slider:hover::-moz-range-thumb {
    opacity: 1;
}