:root {
    --bg-black: #000000;
    --bg-dark: #121212;
    --bg-light: #282828;
    --bg-highlight: #181818;
    --text-white: #ffffff;
    --text-gray: #b3b3b3;
    --brand-green: #1db954;
    --brand-green-hover: #1ed760;
}

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

body {
    font-family: 'Circular', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-black);
    color: var(--text-white);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-black);
    padding: 24px;
    padding-bottom: 110px; /* Space for fixed player bar */
    grid-column: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100vh;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 30px;
    color: var(--text-white);
}

.logo i {
    font-size: 40px;
}

.nav-links {
    list-style: none;
    margin-bottom: 30px;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
    color: var(--text-gray);
    cursor: pointer;
    transition: color 0.3s;
    font-weight: bold;
}

.nav-links li:hover, .nav-links li.active {
    color: var(--text-white);
}

.playlist-section {
    flex: 1;
    border-top: 1px solid #282828;
    padding-top: 20px;
    overflow-y: auto;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--text-gray);
    margin-bottom: 15px;
}

.create-playlist-btn {
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 14px;
}

.create-playlist-btn:hover {
    color: var(--text-white);
}

.playlist-list {
    list-style: none;
}

.playlist-list li {
    padding: 8px 0;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-list li:hover {
    color: var(--text-white);
}

#currentPlaylistName {
    cursor: pointer;
}

.user-profile-section {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #282828;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.logout-btn {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 12px;
}

.logout-btn:hover {
    color: var(--text-white);
}

/* Main Content */
.main-content {
    background-color: var(--bg-dark);
    grid-column: 2;
    overflow-y: auto;
    position: relative;
    border-radius: 8px 8px 0 0;
    height: 100vh;
    padding-bottom: 110px; /* Space for fixed player bar */
}

.top-bar {
    position: sticky;
    top: 0;
    background-color: rgba(18, 18, 18, 0.95);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.nav-arrows {
    display: flex;
    gap: 16px;
}

.arrow-btn {
    background-color: rgba(0,0,0,0.7);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
}

.search-container {
    flex: 1;
    margin: 0 20px;
    position: relative;
    max-width: 364px;
}

.search-container input {
    width: 100%;
    padding: 10px 40px;
    border-radius: 500px;
    border: none;
    background-color: white;
    color: black;
    font-size: 14px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #121212;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

.upgrade-btn {
    background-color: transparent;
    border: 1px solid #727272;
    color: white;
    padding: 8px 16px;
    border-radius: 500px;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
}

.upgrade-btn:hover {
    border-color: white;
    transform: scale(1.04);
}

.profile-btn {
    width: 32px;
    height: 32px;
    background-color: #535353;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.content-area {
    padding: 20px 32px;
    padding-bottom: 100px; /* Space for player bar */
}

h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

/* Updated Home Section Styles */
.home-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--text-white);
}

.show-all {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-gray);
    text-transform: uppercase;
    cursor: pointer;
    letter-spacing: 1px;
}

.show-all:hover {
    text-decoration: underline;
    color: var(--text-white);
}

.card-scroll-container {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    padding-bottom: 20px; /* Space for scrollbar */
    scroll-behavior: smooth;
    /* Hide scrollbar for clean look */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}

.card-scroll-container::-webkit-scrollbar {
    display: none;
}

.card {
    min-width: 180px; /* Fixed width for scrolling */
    width: 180px;
    background-color: #181818;
    padding: 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.card:hover {
    background-color: #282828;
}

.card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.card h3 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-white);
}

.card p {
    font-size: 14px;
    color: var(--text-gray);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* Artist Card Specifics */
.artist-card img {
    border-radius: 50%; /* Circle */
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.artist-card {
    text-align: center;
}

/* Song List Styles */
.song-list {
    display: flex;
    flex-direction: column;
}

.song-row {
    display: grid;
    grid-template-columns: 50px 4fr 3fr 1fr;
    padding: 10px 16px;
    border-radius: 4px;
    color: var(--text-gray);
    align-items: center;
}

.song-row:hover {
    background-color: rgba(255,255,255,0.1);
    color: var(--text-white);
}

.song-row img {
    width: 40px;
    height: 40px;
    margin-right: 16px;
}

.song-title-col {
    display: flex;
    align-items: center;
}

.song-info-text {
    display: flex;
    flex-direction: column;
}

.song-name {
    color: var(--text-white);
    font-size: 16px;
}

.song-artist {
    font-size: 14px;
}

/* Player Bar */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background-color: #181818;
    border-top: 1px solid #282828;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 999999; /* Extremely high z-index */
    box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
}

.now-playing {
    display: flex;
    align-items: center;
    width: 30%;
    min-width: 180px;
}

.now-playing-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Prevent buttons from shrinking */
    margin-left: 10px;
    z-index: 202; /* Higher than other elements */
}

.album-art {
    width: 56px !important;
    height: 56px !important;
    margin-right: 14px;
    background-color: #282828;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 4px;
}

.track-info {
    display: flex;
    flex-direction: column;
    margin-right: 14px;
    overflow: hidden;
    flex: 1; /* Allow it to take available space */
    min-width: 0; /* Enable truncation in flex item */
}

.track-name {
    color: var(--text-white);
    font-size: 14px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    font-size: 12px;
    color: var(--text-gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.like-btn, .add-to-playlist-btn {
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 16px;
    margin-left: 10px;
    position: relative; /* Enable z-index */
    z-index: 201;
    pointer-events: auto; /* Force clickable */
}

.like-btn:hover, .add-to-playlist-btn:hover {
    color: var(--text-white);
    transform: scale(1.1);
}

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

/* Player Controls */
.player-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40%;
    max-width: 722px;
}

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

.control-btn {
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.2s;
    position: relative; /* Enable z-index */
    z-index: 201;
    pointer-events: auto; /* Force clickable */
}

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

.control-btn.active {
    color: var(--brand-green);
}

.play-pause-btn {
    font-size: 32px;
    color: var(--text-white);
}

.play-pause-btn:hover {
    transform: scale(1.05);
}

.control-btn.small {
    font-size: 14px;
}

.add-to-playlist-btn {
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 16px;
    margin-left: 10px;
    position: relative; /* Enable z-index */
    z-index: 201;
    pointer-events: auto; /* Force clickable */
}

.add-to-playlist-btn:hover {
    color: var(--text-white) !important;
    transform: scale(1.1);
}

.playback-bar {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
    font-size: 11px;
    color: var(--text-gray);
}

.progress-bar-container {
    flex: 1;
    height: 4px;
    background-color: #535353;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.progress-bar {
    height: 100%;
    background-color: var(--text-white);
    border-radius: 2px;
    width: 0%;
}

.progress-bar-container:hover .progress-bar {
    background-color: var(--brand-green);
}

.volume-controls {
    width: 30%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.volume-bar-container {
    width: 100px;
    height: 4px;
    background-color: #535353;
    border-radius: 2px;
    margin-left: 10px;
    cursor: pointer;
}

.volume-bar {
    height: 100%;
    width: 70%;
    background-color: var(--text-white);
    border-radius: 2px;
}

.volume-bar-container:hover .volume-bar {
    background-color: var(--brand-green);
}

/* Playlist Header in View */
.playlist-header-view {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 24px;
    padding-bottom: 24px;
}

.playlist-cover-large {
    width: 232px;
    height: 232px;
    background: linear-gradient(135deg, #450af5, #c4efd9);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 60px rgba(0,0,0,0.5);
    font-size: 64px;
}

.playlist-details h1 {
    font-size: 80px; /* Big title */
    font-weight: 900;
    margin: 0.1em 0;
    line-height: 1;
}

.playlist-type {
    text-transform: uppercase;
    font-size: 12px;
    font-weight: bold;
}

/* Modal Styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 9999999; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.8); 
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #282828;
    margin: auto;
    padding: 20px;
    border: 1px solid #181818;
    width: 80%;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    text-align: center;
}

.modal-content h3 {
    color: white;
    margin-bottom: 20px;
}

#modalPlaylistList {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

#modalPlaylistList li {
    padding: 12px;
    border-bottom: 1px solid #3e3e3e;
    color: var(--text-gray);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
}

#modalPlaylistList li i {
    margin-right: 10px;
    font-size: 1.2rem;
}

#modalPlaylistList li:hover {
    background-color: #3e3e3e;
    color: white;
}

.modal-close-btn {
    background-color: transparent;
    color: white;
    padding: 10px 20px;
    border: 1px solid #727272;
    border-radius: 500px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

.modal-close-btn:hover {
    border-color: white;
    transform: scale(1.05);
}
