/* CSS Variables */
:root {
    --bg-color-main: #121212;
    --bg-color-sidebar: #000000;
    --bg-color-playbar: #181818;
    --bg-color-card: #181818;
    --bg-color-card-hover: #282828;
    
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    
    --accent-color: #1db954;
    --accent-hover: #1ed760;
    
    --border-divider: #282828;
    
    --font-family: 'Inter', sans-serif;
    
    --player-height: 90px;
    --sidebar-width: 240px;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color-main);
    color: var(--text-primary);
    overflow: hidden; /* Prevent body scroll, handle in specific containers */
    user-select: none; /* Make it feel more like an app */
}

a {
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

a:hover {
    color: var(--text-primary);
}

ul {
    list-style: none;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

button:hover {
    color: var(--text-primary);
}

/* App Container Layout */
.app-container {
    display: flex;
    height: calc(100vh - var(--player-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-color-sidebar);
    display: flex;
    flex-direction: column;
    padding: 24px 0;
}

.logo-container {
    padding: 0 24px 18px;
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-container i {
    font-size: 32px;
}

.main-nav ul {
    padding: 0 8px;
}

.main-nav li {
    padding: 0 16px;
    height: 40px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.main-nav li.active {
    background-color: var(--bg-color-card-hover);
    color: var(--text-primary);
}

.main-nav li.active a {
    color: var(--text-primary);
}

.main-nav a {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.main-nav i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.playlist-nav {
    margin-top: 24px;
    padding: 0 8px;
}

.playlist-nav li {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
}

.playlist-nav a {
    display: flex;
    align-items: center;
    gap: 16px;
}

.playlist-nav i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.divider {
    border: none;
    height: 1px;
    background-color: var(--border-divider);
    margin: 8px 24px;
}

.playlists-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 24px;
}

.playlists-list p {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 8px 0;
    cursor: pointer;
    transition: color 0.2s;
}

.playlists-list p:hover {
    color: var(--text-primary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #5a5a5a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #b3b3b3;
}

/* Main Content Area */
.main-content {
    flex: 1;
    background: linear-gradient(to bottom, #1f1f1f, var(--bg-color-main));
    overflow-y: auto;
    position: relative;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    position: sticky;
    top: 0;
    background-color: rgba(18, 18, 18, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10;
}

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

.arrow-btn {
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.btn-upgrade {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid #727272;
    padding: 8px 32px;
    border-radius: 500px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

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

.btn-profile {
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content Section */
.content-section {
    padding: 24px 32px;
}

.greeting-container {
    margin-bottom: 24px;
}

.greeting-container h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
}

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

.section-title h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.section-title h2:hover {
    text-decoration: underline;
    cursor: pointer;
}

.see-all {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.see-all:hover {
    text-decoration: underline;
}

/* Grid Layout for Song Cards */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
    padding-bottom: 40px;
}

.card {
    background-color: var(--bg-color-card);
    padding: 16px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    cursor: pointer;
    position: relative;
}

.card:hover {
    background-color: var(--bg-color-card-hover);
}

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

.card-play-btn {
    position: absolute;
    bottom: 85px; /* Adjust based on title/desc height */
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.3s ease;
    box-shadow: 0 8px 8px rgba(0,0,0,0.3);
}

.card:hover .card-play-btn {
    opacity: 1;
    transform: translateY(0);
}

.card-play-btn:hover {
    background-color: var(--accent-hover);
    transform: scale(1.05) translateY(0);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.card.playing .card-title {
    color: var(--accent-color);
}

/* Playbar Styles */
.playbar {
    height: var(--player-height);
    background-color: var(--bg-color-playbar);
    border-top: 1px solid var(--border-divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 100;
}

/* Left: Now Playing Info */
.now-playing {
    display: flex;
    align-items: center;
    width: 30%;
    min-width: 180px;
}

.cover-art {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    margin-right: 14px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.track-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-right: 16px;
    overflow: hidden;
}

.track-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-title:hover {
    text-decoration: underline;
    cursor: pointer;
}

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

.track-artist:hover {
    text-decoration: underline;
    cursor: pointer;
    color: var(--text-primary);
}

.like-btn {
    font-size: 16px;
}

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

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

.control-btn {
    font-size: 16px;
}

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

.play-pause-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--text-primary);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.1s;
}

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

.playback-bar {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.time-current, .time-total {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
}

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

.progress-bar {
    height: 100%;
    background-color: var(--text-primary);
    border-radius: 2px;
    width: 0%;
    transition: background-color 0.2s;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -4px;
    width: 12px;
    height: 12px;
    background-color: var(--text-primary);
    border-radius: 50%;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

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

.progress-bar-container:hover .progress-bar::after {
    display: block;
}

/* Right: Volume Controls */
.extra-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 30%;
    min-width: 180px;
    gap: 16px;
}

.extra-btn {
    font-size: 14px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 120px;
}

.volume-bar-container {
    height: 4px;
    flex-grow: 1;
    background-color: #4d4d4d;
    border-radius: 2px;
    cursor: pointer;
}

.volume-bar {
    height: 100%;
    background-color: var(--text-primary);
    border-radius: 2px;
    width: 100%; /* Default 100% volume */
    position: relative;
}

.volume-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -4px;
    width: 12px;
    height: 12px;
    background-color: var(--text-primary);
    border-radius: 50%;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

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

.volume-bar-container:hover .volume-bar::after {
    display: block;
}

/* Responsive adjustments */
@media (max-width: 800px) {
    .now-playing { width: auto; flex: 1; }
    .extra-controls { display: none; }
    .player-controls { width: 60%; }
}

@media (max-width: 600px) {
    .sidebar { display: none; }
}

/* Admin Styles */
.admin-panel {
    background-color: var(--bg-color-card);
    padding: 32px;
    border-radius: 8px;
    max-width: 600px;
}

.admin-form .form-group {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
}

.admin-form label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.admin-form input {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid transparent;
    color: var(--text-primary);
    padding: 14px;
    border-radius: 4px;
    font-size: 16px;
    font-family: var(--font-family);
    transition: all 0.2s ease;
}

.admin-form input:focus {
    outline: none;
    border-color: #727272;
    background-color: rgba(255, 255, 255, 0.15);
}

.btn-submit {
    background-color: var(--accent-color);
    color: #000;
    font-weight: 700;
    font-size: 16px;
    padding: 14px 32px;
    border-radius: 500px;
    width: 100%;
    margin-top: 8px;
}

.btn-submit:hover {
    background-color: var(--accent-hover);
    transform: scale(1.02);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.admin-table th, .admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-divider);
}

.admin-table th {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.admin-table td {
    font-size: 14px;
}

.btn-delete {
    color: #e22134;
    font-weight: bold;
}
.btn-delete:hover {
    color: #ff4d5e;
    text-decoration: underline;
}

/* Search Input Styles */
.search-container {
    background-color: var(--bg-color-card);
    border-radius: 500px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 300px;
    border: 2px solid transparent;
    transition: all 0.2s;
    margin-left: 8px;
}

.search-container:hover, .search-container:focus-within {
    border-color: #727272;
    background-color: var(--bg-color-card-hover);
}

.search-icon {
    color: var(--text-secondary);
    font-size: 14px;
}

#search-input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    width: 100%;
    outline: none;
}

#search-input::placeholder {
    color: var(--text-secondary);
}

/* Liked Song Active State */
.like-btn.active {
    color: var(--accent-color);
}
.like-btn.active i {
    font-weight: 900; /* FontAwesome solid weight */
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 100px; /* Above playbar */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background-color: #2e77d0;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}
