@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@300;500;700&display=swap');

:root {
    --primary-color: #00d95f;
    /* Melon Green-ish */
    --text-color: #ffffff;
    --bg-gradient-start: #1e1e1e;
    --bg-gradient-end: #000000;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --glass-blur: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 400px;
    height: 90vh;
    max-height: 800px;
    display: flex;
    align-items: center;
}

.music-player {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--card-border);
    border-radius: 30px;
    padding: 2rem;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    position: relative;
}

.player-header {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: center;
    /* Centered visually */
    align-items: center;
    position: relative;
}

.player-header h3 {
    flex-grow: 1;
    /* Take up space */
}

/* Header Button */
.header-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    cursor: pointer;
    position: absolute;
    right: 0;
    top: 0;
    transition: color 0.3s;
    padding: 0 10px;
}

.header-btn:hover {
    color: var(--primary-color);
}

/* Minimized State */
.music-player.minimized {
    height: auto;
    min-height: auto;
    padding-bottom: 2rem;
}

.music-player.minimized .album-art-container,
.music-player.minimized .lyrics-container {
    display: none;
}

.music-player.minimized .player-header {
    margin-bottom: 1rem;
}

.album-art-container {
    width: 250px;
    height: 250px;
    margin: 0 auto 2rem;
    position: relative;
    border-radius: 50%;
    /* Match album art boundary for clean overlay if needed, or square */
}

.album-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.5s ease;
}

/* Playlist Overlay Styles */
.playlist-overlay {
    position: absolute;
    top: auto;
    bottom: 0;
    width: 100%;
    height: 100%;
    /* Revert to full cover as requested */
    background: rgba(0, 0, 0, 0.95);
    /* Darker bg */
    border-radius: 30px;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow-y: auto;
    z-index: 10;
    backdrop-filter: blur(10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.album-art-container:has(.playlist-overlay:not(.hidden)) .album-art {
    display: none;
    /* Hide art when playlist is open if we want full replacement */
}

/* Actually, let's make it a square overlay covering the art circle */
.playlist-overlay {
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.playlist-overlay.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    /* display: none; - Removing display none for animation */
}

.playlist-overlay.full {
    height: 100%;
    border-radius: 30px;
}

.playlist-overlay ul {
    list-style: none;
    padding: 0;
}

.playlist-overlay li {
    padding: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    border-radius: 8px;
}

.playlist-overlay li:hover {
    background: rgba(255, 255, 255, 0.1);
}

.playlist-overlay li.active {
    color: var(--primary-color);
    font-weight: bold;
    background: rgba(0, 217, 95, 0.1);
}

.playlist-overlay li .artist {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 0.5rem;
}

.playlist-overlay::-webkit-scrollbar {
    width: 4px;
}

.playlist-overlay::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.album-art.rotate {
    animation: rotateArt 20s linear infinite;
}

@keyframes rotateArt {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.song-info {
    text-align: center;
    margin-bottom: 2rem;
}

#songTitle {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#artistName {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Lyrics Area */
.lyrics-container {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    margin-bottom: 2rem;
    text-align: center;
    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
}

.lyrics-content {
    height: 150px;
    /* Viewable area */
    overflow-y: scroll;
    scrollbar-width: none;
    /* Firefox */
}

.lyrics-content::-webkit-scrollbar {
    display: none;
    /* Chrome */
}

.lyrics-content p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.3);
    margin: 1rem 0;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.lyrics-content p.active {
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 217, 95, 0.5);
}

/* Progress Bar */
.progress-container {
    margin-bottom: 2rem;
}

.time-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.5rem;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    background: var(--primary-color);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: -4px;
    box-shadow: 0 0 10px var(--primary-color);
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.control-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
}

.control-btn:hover {
    transform: scale(1.1);
}

.control-btn.sm {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.6);
}

.control-btn.sm:hover {
    color: var(--primary-color);
}

.main-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

.control-btn.play {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 20px rgba(0, 217, 95, 0.4);
}

.volume-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
}

.vol-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.vol-btn:hover {
    color: white;
}

.volume-container input {
    width: 100px;
}

/* Playlist Overlay specific additions */
.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
}

.playlist-header h4 {
    margin: 0;
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: white;
}

/* Reverted playlist resize styles */

/* Mobile Responsiveness */
@media (max-width: 480px) {
    body {
        align-items: flex-start;
        /* Prevent centering cutoff */
    }

    .container {
        max-width: 100%;
        height: 100vh;
        max-height: none;
    }

    .music-player {
        border-radius: 0;
        height: 100%;
    }

    .album-art-container {
        width: 200px;
        height: 200px;
        margin-bottom: 1.5rem;
    }
}