:root {
    --bg-base: #000000;
    --bg-side: #121212;
    --bg-card: #181818;
    --bg-card-hover: #282828;
    --primary-color: #1DB954;
    --text-main: #ffffff;
    --text-dim: #b3b3b3;
    --glass: rgba(255, 255, 255, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    overflow: hidden; /* Maintains the "App" feel */
    height: 100vh;
}

.app-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 1fr 90px;
    height: 100vh;
    transition: all 0.3s ease;
}

/* --- SIDEBAR --- */
.sidebar {
    background-color: #000;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid #282828;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.nav-item {
    text-decoration: none;
    color: var(--text-dim);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    transition: 0.3s;
    cursor: pointer;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
}

.nav-item i { font-size: 20px; }

.section-title {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

/* --- MAIN CONTENT --- */
.main-view {
    background: linear-gradient(to bottom, #222, var(--bg-base));
    overflow-y: auto;
    padding: 20px 32px;
    scroll-behavior: smooth;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 25px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: transparent;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-container input {
    width: 100%;
    padding: 12px 45px;
    border-radius: 500px;
    border: none;
    background: var(--bg-card-hover);
    color: white;
    font-size: 14px;
}

.search-container i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}

/* --- SONG GRID --- */
.section-header {
    margin-top: 30px;
    margin-bottom: 15px;
}

.song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
}

.song-card {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 12px;
    transition: background 0.3s ease, transform 0.3s ease;
    cursor: pointer;
}

.song-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-5px);
}

.song-card img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    margin-bottom: 16px;
}

.song-card h4 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

/* --- PLAYER BAR --- */
.player-bar {
    grid-column: 1 / -1;
    background-color: #121212;
    border-top: 1px solid #282828;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

.current-track-info {
    width: 30%;
    display: flex;
    align-items: center;
    gap: 15px;
}

.current-track-info img {
    width: 56px;
    height: 56px;
    border-radius: 6px;
}

.track-details p {
    font-size: 14px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#now-playing-artist {
    font-size: 12px;
    color: var(--text-dim);
}

.player-controls {
    flex: 1;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 25px;
}

.control-buttons button {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
}

.control-buttons button:hover { color: white; }

#play-pause-btn {
    background: white;
    color: black;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: var(--text-dim);
}

.progress-bar-bg {
    flex: 1;
    height: 4px;
    background: #4f4f4f;
    border-radius: 10px;
    cursor: pointer;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    border-radius: 10px;
}

.volume-controls {
    width: 30%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

input[type="range"] {
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* --- RESPONSIVE DESIGN --- */

/* Tablets & Small Desktops */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 80px 1fr; /* Slimmer sidebar */
    }
    .sidebar span, .sidebar .section-title, .sidebar .create-btn span {
        display: none; /* Hide text, keep icons */
    }
    .logo i { font-size: 28px; }
}
/* --- IMPROVED RESPONSIVE DESIGN --- */

/* Tablets & Small Desktops (MD) */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 80px 1fr; 
    }
    /* Hide text labels in sidebar to save space */
    .sidebar span, 
    .sidebar .section-title, 
    .sidebar .nav-item {
        justify-content: center;
        font-size: 0; 
    }
    .sidebar .nav-item i {
        font-size: 24px;
        margin: 0;
    }
    .logo span { display: none; }
}

/* Mobile Devices (SM) */
@media (max-width: 768px) {
    body {
        overflow-y: auto; /* Allow scrolling on body if needed */
    }

    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 110px; /* Slightly taller player for touch targets */
    }

    .sidebar {
        display: none; /* Hide sidebar; consider adding a bottom-nav for mobile later */
    }

    .main-view {
        padding: 15px;
        padding-bottom: 120px; /* Prevent content from being hidden by player */
    }

    .top-bar {
        background: var(--bg-base);
        padding: 10px;
        flex-direction: column;
        gap: 10px;
    }

    .song-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    /* Player Bar Mobile Overhaul */
    .player-bar {
        flex-wrap: wrap;
        height: 110px;
        padding: 10px;
    }

    .current-track-info {
        width: 100%; /* Take full top row of player bar */
        justify-content: flex-start;
        margin-bottom: 5px;
    }

    .player-controls {
        width: 100%;
        order: 2;
    }

    .volume-controls {
        display: none; /* Usually handled by physical phone buttons */
    }

    .progress-container {
        width: 100%;
    }

    .control-buttons {
        gap: 40px; /* Wider gaps for thumbs */
    }
}

/* Very Small Phones (XS) */
@media (max-width: 480px) {
    .song-grid {
        grid-template-columns: 1fr 1fr; /* Stay 2-wide but smaller */
    }

    .song-card {
        padding: 10px;
    }

    .song-card h4 {
        font-size: 14px;
    }

    .track-details p {
        max-width: 200px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #666; }

.dev {
    text-decoration: none;
    color: var(--text-dim);
    font-size: 12px;
    transition: 0.3s;
}

.dev:hover {
    color: var(--text-main);
    transform: scale(1.05);
}
