:root {
    --primary-text: #ffffff;
    --secondary-text: rgba(255, 255, 255, 0.6);
    --highlight-text: #ffffff;
    --blur-intensity: 60px;
    --art-size: 400px;
    --art-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: #1a1a1a;
    color: var(--primary-text);
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

/* Backgrounds */
/* Backgrounds */
.background-blur {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-size: cover;
    background-position: center;
    filter: blur(var(--blur-intensity)) brightness(0.6);
    z-index: -2;
    transition: background-image 0.5s ease-in-out;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    /* Slight darken */
    z-index: -1;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.player-layout {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 200px;
    /* Reduced from 260px to give lyrics room */
    margin-bottom: 20px;
    min-height: 0;
    padding-left: 100px;
    /* Shift content right */
    /* Important for flex child scrolling */
}

/* Album Art */
.album-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 60px;
    /* Push album art down */
}

.album-art-wrapper {
    width: var(--art-size);
    height: var(--art-size);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--art-shadow);
    transition: transform 0.3s ease;
}

/* Animation for playing state could happen here */
.album-art-wrapper:hover {
    transform: scale(1.02);
}

.album-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.track-info-mobile {
    display: block;
    text-align: center;
    margin-top: 25px;
    /* Keep this */
}

/* Lyrics */
.lyrics-section {
    flex: 2;
    /* Give more space relative to album */
    max-width: 800px;
    /* Explicitly wider */
    height: 100%;
    /* Fill available height */
    max-height: 600px;
    /* Arbitrary cap for very large screens */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Align lyrics to top or center? Center usually looks better */
    position: relative;
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}

.lyrics-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 50% 0;
    /* Add padding to scroll first/last lines to center */
    text-align: left;
    scrollbar-width: none;
    /* Firefox */
}

.lyrics-container::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.lyric-line {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 24px;
    color: var(--secondary-text);
    transition: all 0.3s ease;
    cursor: pointer;
    filter: blur(0.5px);
    transform-origin: left center;
}

.lyric-line.active {
    color: var(--highlight-text);
    /* transform: scale(1.05); */
    filter: blur(0);
}

.lyric-line:hover {
    color: rgba(255, 255, 255, 0.8);
}

.placeholder-text {
    text-align: center;
    color: var(--secondary-text);
    margin-top: 40%;
}

/* Compact Controls under Album */
.controls-compact {
    width: 100%;
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    position: relative;
    /* Ensure stacking context */
    z-index: 10;
}

.progress-area-compact {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    /* Increased contrast */
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    opacity: 1 !important;
    /* Force visible */
    visibility: visible !important;
}

.progress-bar-wrapper {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    /* More visible track */
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    padding: 8px 0;
    box-sizing: content-box;
    /* Fix missing height */
    /* Hit area */
    margin: -8px 0;
    background-clip: content-box;
    transition: background-color 0.2s;
}

.progress-bar-wrapper:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: #e3e3e3;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    width: 100%;
    /* Auto-hide logic */
    opacity: 0;
    transform: translateY(10px);
    /* Optional: slide up slightly */
    transition: all 0.5s ease 1s;
    /* 1s delay before hiding */
    pointer-events: none;
    /* Prevent clicks when hidden */
}

/* Show controls when hovering the container area */
.controls-compact:hover .controls-row {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease 0s;
    /* Immediate show */
    pointer-events: auto;
}

.main-controls-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    /* Reduced from 30px */
}

.control-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn i,
.control-btn svg {
    font-size: 1.4rem;
    /* Reduced from 1.8rem */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    fill: currentColor;
}

.control-btn:hover {
    color: #fff;
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
    opacity: 0.7;
}

.play-btn {
    width: 60px;
    /* Fixed width to prevent shift */
    display: flex;
    justify-content: center;
}

.play-btn i {
    font-size: 2.2rem;
    /* Reduced from 3.5rem to be more balanced */
}

.action-buttons-compact {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 18px;
    /* Slightly more padding */
    border-radius: 24px;
    backdrop-filter: blur(10px);
}

/* Secondary buttons */
.action-buttons-compact .control-btn i,
.action-buttons-compact .control-btn svg,
.action-buttons-compact .control-btn img {
    font-size: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
    object-fit: contain;
}

.custom-icon {
    filter: invert(1);
    /* Make black SVG white */
}


/* Custom Range Slider (Volume) */
input[type=range] {
    -webkit-appearance: none;
    /* Hides the slider so that custom slider can be made */
    width: 80px;
    /* Specific width */
    background: transparent;
    /* Otherwise white in Chrome */
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
}

input[type=range]:focus {
    outline: none;
    /* Removes the blue border. You should probably do some kind of focus styling for accessibility reasons though. */
}

input[type=range]::-ms-track {
    width: 100%;
    cursor: pointer;
    /* Hides the slider so custom styles can be added */
    background: transparent;
    border-color: transparent;
    color: transparent;
}

/* WebKit/Blink (Chrome/Safari/Edge) */
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    margin-top: -4px;
    /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

input[type=range]:focus::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.4);
}

.track-info-mobile {
    display: block;
    /* Always visible now */
    text-align: center;
    margin-top: 25px;
}

.track-info-mobile h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.track-info-mobile p {
    font-size: 1rem;
    color: var(--secondary-text);
}


/* Responsive */
@media (max-width: 900px) {
    .player-layout {
        flex-direction: column;
        gap: 30px;
        padding-left: 0;
    }

    .album-section {
        margin-top: 20px;
        width: 100%;
    }

    :root {
        --art-size: 280px;
    }

    .controls-compact {
        width: 100%;
        max-width: 400px;
    }

    .lyrics-section {
        max-height: 300px;
        mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
    }

    .lyric-line {
        font-size: 1.5rem;
        text-align: center;
    }

    .lyrics-container {
        text-align: center;
    }
}

/* Playlist Drawer */
/* Playlist Popover */
.playlist-drawer {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    width: 360px;
    height: 60vh;
    max-height: 500px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom center;
}

.playlist-drawer.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

.playlist-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.playlist-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

#close-playlist-btn {
    background: none;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
}

#close-playlist-btn:hover {
    color: #fff;
}

.playlist-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Scrollbar for playlist */
.playlist-list::-webkit-scrollbar {
    width: 6px;
}

.playlist-list::-webkit-scrollbar-track {
    background: transparent;
}

.playlist-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.playlist-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.playlist-item.active {
    background: rgba(255, 255, 255, 0.15);
}

.playlist-item-img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
}

.playlist-item-info {
    flex: 1;
    min-width: 0;
    /* truncate text */
}

.playlist-item-title {
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.playlist-item-artist {
    font-size: 0.8rem;
    color: var(--secondary-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-playing-icon {
    font-size: 0.8rem;
    color: #1ed760;
    /* Spotify Green */
    display: none;
}

.playlist-item.active .playlist-item-playing-icon {
    display: block;
}

/* Mobile Playlist Override */
@media (max-width: 900px) {
    .playlist-drawer {
        top: auto;
        bottom: 0px;
        right: 0px;
        left: 0px;
        width: 100%;
        height: 70vh;
        transform: translateY(100%);
        border-radius: 20px 20px 0 0;
    }

    .playlist-drawer.open {
        transform: translateY(0);
    }
}