/* CSS Variables for colors and common values */
:root {
    --color-gray-900: #111827;
    --color-black: #000000;
    --color-gray-100: #f3f4f6;
    --color-gray-800: #1f2937;
    --color-gray-700: #374151;
    --color-gray-600: #4b5563;
    --color-gray-400: #9ca3af;
    --color-gray-300: #d1d5db;
    --color-gray-950: #030712;

    --color-purple-600: #9333ea;
    --color-purple-500: #a855f7;
    --color-purple-400: #c084fc;

    --color-blue-600: #2563eb;
    --color-blue-500: #3b82f6;
    --color-blue-400: #60a5fa;
    --color-blue-300: #93c5fd;

    --color-green-600: #16a34a;
    --color-green-500: #22c55e;
    --color-green-400: #4ade80;

    --color-teal-400: #2dd4bf;
    --color-cyan-500: #06b6d4;

    --color-pink-400: #f472b6;
    --color-red-500: #ef4444;

    --color-white: #ffffff;
}

#footerMusicPlayer {
    position: fixed;
    /* fixed */
    bottom: 0;
    /* bottom-0 */
    left: 0;
    /* left-0 */
    right: 0;
    /* right-0 */
    z-index: 50;
    /* z-50 */
    width: 100%;
    /* w-full */
    max-width: 42rem;
    /* max-w-2xl */
    margin-left: auto;
    /* mx-auto */
    margin-right: auto;
    /* mx-auto */
    background-color: #f4f3e2;
    /* bg-gray-800 bg-opacity-90 */
    backdrop-filter: blur(8px);
    /* backdrop-filter backdrop-blur-lg */
    border-top-left-radius: 1rem;
    /* rounded-t-2xl */
    border-top-right-radius: 1rem;
    /* rounded-t-2xl */
    box-shadow: 0 -10px 15px -3px rgba(0, 0, 0, 0.1), 0 -4px 6px -2px rgba(0, 0, 0, 0.05);
    /* shadow-2xl */
    /* border-t border-gray-700 */
    padding: 1rem;
    /* p-4 */
    transform: translateY(0);
    /* transform */
    transition: all 0.5s ease-in-out;
    /* transition-all duration-500 */

    /* Initial State: Launch Button */
    #initialPlayerState {
        display: flex;
        /* flex */
        flex-direction: column;
        /* flex-col */
        align-items: center;
        /* items-center */
        justify-content: center;
        /* justify-center */
        padding: 0.5rem;
        /* p-2 */
    }

    #launchPlayerButton {
        background: #FF847C;
        /* bg-gradient-to-r from-green-400 to-blue-500 */
        color: var(--color-white);
        /* text-white */
        font-weight: 700;
        /* font-bold */
        padding: 0.5rem 1.5rem;
        /* py-2 px-6 */
        border-radius: 9999px;
        /* rounded-full */
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        /* shadow-md */
        transform: scale(1);
        /* transform */
        transition: transform 0.3s ease-in-out;
        /* transition-transform duration-300 */
        outline: none;
        /* focus:outline-none */
        position: relative;
        /* relative */
        overflow: hidden;
        /* overflow-hidden */
        cursor: pointer;
        border: none;
    }

    #launchPlayerButton:hover {
        /* hover:from-green-500 hover:to-blue-600 */
        transform: scale(1.05);
        /* hover:scale-105 */
    }

    #launchPlayerButton:focus {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.75);
        /* focus:ring-4 focus:ring-blue-300 focus:ring-opacity-75 */
    }

    #launchPlayerButton span {
        position: relative;
        /* relative */
        z-index: 10;
        /* z-10 */
        font-size: 12pt;
        /* text-sm */
    }

    #launchPlayerButton div {
        position: absolute;
        /* absolute */
        inset: 0;
        /* inset-0 */
        background-color: var(--color-white);
        /* bg-white */
        opacity: 0;
        /* opacity-0 */
        transition: opacity 0.3s ease-in-out;
        /* transition-opacity duration-300 */
    }

    #launchPlayerButton:hover div {
        opacity: 0.2;
        /* group-hover:opacity-20 */
    }

    /* Active Player State (Initially Hidden) */
    #activePlayerState {
        display: none;
        /* hidden */
        align-items: center;
        /* items-center */
        gap: 1rem;
        /* gap-4 */
    }

    @media (min-width: 768px) {

        /* md:flex-row */
        #activePlayerState {
            flex-direction: row;
        }
    }

    /* Album Art */
    #activePlayerState>div:first-child {
        /* flex-shrink-0 w-16 h-16 bg-gray-700 rounded-lg overflow-hidden shadow-md border border-purple-500 */
        flex-shrink: 0;
        width: 4rem;
        height: 4rem;
        background-color: var(--color-gray-700);
        border-radius: 0.5rem;
        overflow: hidden;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        border: 1px solid var(--color-purple-500);
    }

    #albumArt {
        /* w-full h-full object-cover */
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* Song Info & Controls */
    #activePlayerState>div:nth-child(2) {
        /* flex-grow flex flex-col justify-center text-center md:text-left */
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }

    @media (min-width: 768px) {
        #activePlayerState>div:nth-child(2) {
            text-align: left;
        }
    }

    #songTitle {
        /* text-lg font-bold text-transparent bg-clip-text bg-gradient-to-r from-blue-400 to-green-400 truncate */
        font-size: 18pt;
        font-weight: 700;
        color: #FF847C;
        background-clip: text;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #songArtist {
        /* text-gray-400 text-sm truncate */
        color: var(--color-gray-400);
        font-size: 12pt;
        margin-top: 0.25rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Progress Bar & Time */
    #activePlayerState>div:nth-child(2)>div {
        /* w-full mt-2 flex items-center gap-2 */
        width: 100%;
        margin-top: 0.5rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    #currentTime,
    #duration {
        /* text-xs text-gray-400 */
        font-size: 0.75rem;
        color: var(--color-gray-400);
    }

    #progressBar {
        /* flex-grow h-1 bg-gray-700 rounded-lg appearance-none cursor-pointer */
        flex-grow: 1;
        height: 0.25rem;
        background-color: var(--color-gray-700);
        border-radius: 0.5rem;
        -webkit-appearance: none;
        appearance: none;
        cursor: pointer;
        outline: none;
    }

    /* Playback & Volume Controls */
    #activePlayerState>div:nth-child(3) {
        /* flex-shrink-0 flex items-center justify-center gap-3 mt-4 md:mt-0 */
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        margin-top: 1rem;
    }

    @media (min-width: 768px) {
        #activePlayerState>div:nth-child(3) {
            margin-top: 0;
        }
    }

    #prevButton,
    #nextButton,
    #playPauseButton,
    #togglePlaylistButton {
        padding: 0.25rem;
        /* p-1 or p-2 */
        border-radius: 9999px;
        /* rounded-full */
        background-color: var(--color-gray-700);
        /* bg-gray-700 */
        transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
        /* transition-colors duration-200 shadow-md transform hover:scale-110 */
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        outline: none;
        /* focus:outline-none */
        cursor: pointer;
        border: none;
    }

    #prevButton:hover,
    #nextButton:hover,
    #togglePlaylistButton:hover {
        background-color: var(--color-gray-600);
        /* hover:bg-gray-600 */
        transform: scale(1.1);
        /* hover:scale-110 */
    }

    #prevButton:focus,
    #nextButton:focus {
        box-shadow: 0 0 0 2px var(--color-purple-400);
        /* focus:ring-2 focus:ring-purple-400 */
    }

    #playPauseButton {
        padding: 0.5rem;
        /* p-2 */
        background-color: #FF847C;
        /* bg-blue-600 */
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
        /* shadow-lg */
    }

    #playPauseButton:hover {
        background-color: #FF847C;
        /* hover:bg-blue-500 */
        transform: scale(1.1);
        /* hover:scale-110 */
    }

    #playPauseButton:focus {
        box-shadow: 0 0 0 3px var(--color-blue-300);
        /* focus:ring-3 focus:ring-blue-300 */
    }

    #playIcon,
    #pauseIcon {
        width: 1.25rem;
        /* w-20 */
        height: 1.25rem;
        /* h-20 */
        color: var(--color-white);
        /* text-white */
    }

    #pauseIcon.hidden,
    #playIcon.hidden {
        display: none;
    }

    #volumeIcon {
        /* ml-2 */
        margin-left: 0.5rem;
    }

    #volumeIcon svg {
        width: 1rem;
        /* w-16 */
        height: 1rem;
        /* h-16 */
        color: var(--color-gray-400);
        /* text-gray-400 */
    }

    #volumeBar {
        /* w-20 h-1 bg-gray-700 rounded-lg appearance-none cursor-pointer volume-slider */
        width: 5rem;
        height: 0.25rem;
        background-color: var(--color-gray-700);
        border-radius: 0.5rem;
        -webkit-appearance: none;
        appearance: none;
        cursor: pointer;
        outline: none;
    }

    #togglePlaylistButton {
        /* ml-auto */
        margin-left: auto;
    }

    #togglePlaylistButton svg {
        width: 1.25rem;
        /* w-20 */
        height: 1.25rem;
        /* h-20 */
        color: var(--color-pink-400);
        /* text-pink-400 */
    }

    #togglePlaylistButton:focus {
        box-shadow: 0 0 0 2px var(--color-pink-400);
        /* focus:ring-2 focus:ring-pink-400 */
    }

    /* Playlist (Initially Hidden) */
    #playlistContainer {
        display: none;
        /* hidden */
        margin-top: 1rem;
        /* mt-4 */
        padding: 1rem;
        /* p-4 */
        background-color: rgba(55, 65, 81, 0.5);
        /* bg-gray-700 bg-opacity-50 */
        border-radius: 0.75rem;
        /* rounded-xl */
        border: 1px solid var(--color-gray-600);
        /* border border-gray-600 */
        max-height: 12rem;
        /* max-h-48 */
        overflow-y: auto;
        /* overflow-y-auto */
    }

    #playlistContainer h3 {
        /* text-lg font-bold text-transparent bg-clip-text bg-gradient-to-r from-pink-400 to-red-500 mb-3 text-center */
        font-size: 1.125rem;
        font-weight: 700;
        background: linear-gradient(to right, var(--color-pink-400), var(--color-red-500));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        color: transparent;
        margin-bottom: 0.75rem;
        text-align: center;
    }

    /* Playlist item */
    #playlist>div {
        /* flex items-center p-2 mb-2 rounded-lg cursor-pointer transition-all duration-200 bg-gray-800 hover:bg-gray-700 border border-transparent */
        display: flex;
        align-items: center;
        padding: 0.5rem;
        margin-bottom: 0.5rem;
        border-radius: 0.5rem;
        cursor: pointer;
        transition: all 0.2s ease-in-out;
        background-color: var(--color-gray-800);
        border: 1px solid transparent;
    }

    #playlist>div:hover {
        background-color: var(--color-gray-700);
    }

    #playlist>div img {
        /* w-8 h-8 rounded-md mr-2 object-cover */
        width: 2rem;
        height: 2rem;
        border-radius: 0.375rem;
        margin-right: 0.5rem;
        object-fit: cover;
    }

    #playlist>div>div {
        /* flex-grow */
        flex-grow: 1;
    }

    #playlist>div p:first-child {
        /* text-gray-100 font-semibold text-sm truncate */
        color: var(--color-gray-100);
        font-weight: 600;
        font-size: 0.875rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #playlist>div p:last-child {
        /* text-gray-400 text-xs truncate */
        color: var(--color-gray-400);
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .playing-indicator {
        /* text-green-400 ml-2 animate-pulse */
        color: var(--color-green-400);
        margin-left: 0.5rem;
        animation: pulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    }

    .playing-indicator.hidden {
        display: none;
    }

    /* Active playlist item */
    #playlist>div.active {
        /* bg-blue-600 bg-opacity-40 border border-blue-400 shadow-lg */
        background-color: rgba(37, 99, 235, 0.4);
        border: 1px solid var(--color-blue-400);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    }

    /* Custom scrollbar for playlist */
    .custom-scrollbar::-webkit-scrollbar {
        width: 8px;
    }

    .custom-scrollbar::-webkit-scrollbar-track {
        background: rgba(45, 55, 72, 0.5);
        /* gray-800 with opacity */
        border-radius: 10px;
    }

    .custom-scrollbar::-webkit-scrollbar-thumb {
        background: linear-gradient(135deg, var(--color-purple-500), var(--color-blue-500));
        border-radius: 10px;
    }

    .custom-scrollbar::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(135deg, var(--color-purple-400), var(--color-blue-400));
    }

    /* Blob animation */
    @keyframes blob {
        0% {
            transform: translate(0px, 0px) scale(1);
        }

        33% {
            transform: translate(30px, -50px) scale(1.1);
        }

        66% {
            transform: translate(-20px, 20px) scale(0.9);
        }

        100% {
            transform: translate(0px, 0px) scale(1);
        }
    }

    /* Pulse animation for text and indicator */
    @keyframes pulse {

        0%,
        100% {
            opacity: 1;
        }

        50% {
            opacity: 0.5;
        }
    }
}