/* General Setup */
body {
    font-family: 'Patrick Hand', cursive;
    background-color: #000;
    color: #fff;
    margin: 0;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Player Column (Center) */
.player-column {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.player-main {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.album-art {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background-color: #111;
    margin: 0 auto 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 5px solid #222;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    background-size: cover;
    background-position: center;
}

.album-art .fa-music {
    font-size: 8rem;
    color: #333;
}

#song-title {
    font-size: 2rem;
    margin: 0;
    color: #fff;
}

#song-artist {
    font-size: 1.2rem;
    color: #999;
    margin-bottom: 2rem;
}

/* Player Controls */
.player-controls {
    background-color: #111;
    border-radius: 20px;
    padding: 1.5rem;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    font-size: 0.9rem;
    color: #999;
}

.progress-bar-wrapper {
    flex-grow: 1;
    background-color: #333;
    border-radius: 5px;
    height: 6px;
    cursor: pointer;
}

.progress-bar {
    background-color: #1DB954;
    width: 0%;
    height: 100%;
    border-radius: 5px;
}

.buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.5rem 0;
}

.control-btn {
    background-color: #222;
    border: 1px solid #333;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    margin: 0 1rem;
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
}

.control-btn:hover {
    background-color: #333;
}

.play-btn {
    font-size: 2.5rem;
    color: #1DB954;
    width: 80px;
    height: 80px;
}

.extra-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    /* NEW: Spacing for shuffle and repeat buttons */
    gap: 1.5rem; 
}

/* NEW: Style for shuffle and repeat buttons */
.extra-controls .control-btn {
    width: 40px; 
    height: 40px;
    font-size: 1rem;
    margin: 0; 
}

/* NEW: Active State for Shuffle and Repeat */
.control-btn.active {
    color: #1DB954; 
    background-color: #333;
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #999;
}

#volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 4px;
    background: #333;
    outline: none;
    border-radius: 2px;
}
#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #1DB954;
    cursor: pointer;
    border-radius: 50%;
}
#volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #1DB954;
    cursor: pointer;
    border-radius: 50%;
}

/* Resizers */
.resizer {
    background-color: #222;
    flex-shrink: 0;
    /* Default hidden, shown by specific resizer classes */
    display: none;
}

.horizontal-resizer {
    width: 10px;
    cursor: ew-resize;
    display: block; /* Show by default for desktop */
}

.vertical-resizer {
    height: 10px;
    cursor: ns-resize;
    display: none; /* Hidden by default, shown on mobile */
}

/* Playlist Column (Right) */
.playlist-column {
    width: 350px; /* Initial width */
    min-width: 200px; /* Minimum width for the playlist */
    max-width: 600px; /* Maximum width for the playlist */
    background-color: #0a0a0a;
    border-left: 1px solid #222;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: auto; /* Allow height to adjust to content */
        min-height: 100vh; /* Ensure it takes at least full viewport height */
        overflow-y: auto; /* Make app-container scrollable on mobile */
    }

    .player-column {
        padding: 1rem;
        order: 1; /* Player appears first */
    }

    .horizontal-resizer {
        display: none; /* Hide horizontal resizer on mobile */
    }

    .vertical-resizer {
        display: block; /* Show vertical resizer on mobile */
        position: absolute; /* Position relative to playlist-column */
        top: 0;
        left: 0;
        width: 100%;
        height: 20px; /* Make it taller for easier dragging */
        background-color: rgba(255, 255, 255, 0.1); /* Semi-transparent for visibility */
        border-bottom: 1px solid #333;
        z-index: 101; /* Above playlist-column */
    }

    .playlist-column {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 90vh; /* Max height for the sheet */
        background-color: #0a0a0a;
        border-top: 1px solid #222;
        display: flex;
        flex-direction: column;
        height: auto; /* Height will be controlled by transform */
        transform: translateY(calc(100% - 150px)); /* Initial peek */
        transition: transform 0.3s ease-out; /* Smooth animation */
        z-index: 100;
    }

    .playlist-column.playlist-expanded {
        transform: translateY(0); /* Fully expanded */
    }

    .playlist-header {
        padding-top: 25px; /* Make space for the vertical resizer */
    }

    .mobile-only-btn {
        display: block; /* Show on mobile */
        margin-left: 0.5rem;
    }

}

.playlist-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: #111;
}

.playlist-header h3 {
    margin: 0;
    flex-grow: 1;
    font-size: 1.5rem;
}

#search-bar {
    background: #222;
    border: 1px solid #333;
    border-radius: 10px;
    color: #fff;
    padding: 0.4rem 0.8rem;
    width: 120px;
    font-family: 'Patrick Hand', cursive;
    margin-left: auto; /* Pushes it to the right */
    margin-right: 1rem;
}

.add-btn {
    color: #1DB954;
    font-size: 1.2rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.playlist-content {
    overflow-y: auto;
    flex-grow: 1;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #1a1a1a;
}

.playlist-item:hover {
    background-color: #1a1a1a;
}

.playlist-item.active {
    background-color: #11381E; /* Dark green for active item */
}

.playlist-item.active .playlist-item-info h4,
.playlist-item.active .playlist-item-info p,
.playlist-item.active .playlist-item-duration {
    color: #fff;
}

.playlist-item-art {
    width: 40px;
    height: 40px;
    background-color: #222;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #555;
}

.playlist-item-info {
    flex-grow: 1;
    overflow: hidden;
}

.playlist-item-info h4 {
    margin: 0;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #999;
}

.playlist-item-duration {
    color: #999;
    font-size: 0.9rem;
}

.empty-playlist-msg {
    text-align: center;
    color: #999;
    margin-top: 2rem;
}

@media (max-width: 480px) {
    .album-art {
        width: 150px;
        height: 150px;
    }

    #song-title {
        font-size: 1.5rem;
    }

    #song-artist {
        font-size: 0.9rem;
    }

    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }

    .play-btn {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .player-column {
        padding: 0.5rem;
    }

    .playlist-column {
        height: 45vh;
    }
}