:root {
    --bg-base: #000000;
    --bg-elevated: #121212;
    --bg-highlight: #282828;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-color: #1db954;
    /* Spotify Green */
    --accent-hover: #1ed760;
    --sidebar-width: 240px;
    --player-height: 90px;
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

#app-wrapper {
    width: 100%;
    min-height: 100vh;
}

.app-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 1fr var(--player-height);
    height: 100vh;
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-base);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid #222;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
    transition: color 0.3s;
}

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

.playlists h3 {
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

#playlist-list {
    list-style: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    background: linear-gradient(to bottom, #1e1e1e, var(--bg-elevated));
    overflow-y: auto;
    padding: 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-highlight) transparent;
}

header {
    margin-bottom: 32px;
    position: sticky;
    top: 0;
    background: transparent;
    z-index: 10;
}

.search-container {
    background-color: var(--bg-highlight);
    border-radius: 500px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 400px;
}

.search-container input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    outline: none;
    font-family: inherit;
}

/* Live Search Suggestions (NEW) */
.live-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #282828;
    border-radius: 8px;
    margin-top: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    list-style: none;
    padding: 8px 0;
    z-index: 2000;
    max-height: 400px;
    overflow-y: auto;
}

.live-suggestion-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.live-suggestion-item:hover {
    background: #3e3e3e;
}

.live-suggestion-item img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
}

.live-suggestion-info {
    flex: 1;
    min-width: 0;
}

.live-suggestion-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.live-suggestion-author {
    font-size: 0.75rem;
    color: #b3b3b3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

.hero {
    background: linear-gradient(135deg, #1db954 0%, #177a3d 100%);
    padding: 40px;
    border-radius: 8px;
    margin-bottom: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 12px;
}

.song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.song-card {
    background-color: #181818;
    padding: 16px;
    border-radius: 8px;
    transition: background-color 0.3s, transform 0.3s;
    cursor: pointer;
    position: relative;
}

.song-card:hover {
    background-color: #282828;
    transform: translateY(-5px);
}

.song-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);
}

.song-card h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.play-badge {
    position: absolute;
    bottom: 80px;
    right: 24px;
    width: 48px;
    height: 48px;
    background-color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
}

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

/* Player Bar */
.player-bar {
    grid-column: 1 / -1;
    background-color: #181818;
    border-top: 1px solid #282828;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

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

.now-playing img {
    width: 56px;
    height: 56px;
    border-radius: 4px;
}

.song-info .title {
    font-size: 0.9rem;
    font-weight: 600;
}

.song-info .artist {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.player-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 40%;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 24px;
}

.control-buttons button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.3s;
}

.control-buttons button:hover,
.control-buttons button.active {
    color: var(--text-primary);
}

.control-buttons button.active {
    color: var(--accent-color);
    filter: drop-shadow(0 0 5px var(--accent-color));
}

.main-play {
    width: 32px;
    height: 32px;
    background-color: white !important;
    border-radius: 50%;
    color: black !important;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem !important;
    transition: transform 0.1s !important;
}

.main-play:active {
    transform: scale(0.9);
}

.progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

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

#progress-bar {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
}

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

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

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

#volume-bar {
    width: 100px;
    accent-color: var(--accent-color);
}

/* Playlist Management Styles */
.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#create-playlist-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s;
}

#create-playlist-btn:hover {
    color: var(--text-primary);
}

.playlist-item {
    padding: 10px 0;
    cursor: pointer;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item:hover {
    color: var(--text-primary);
}

.playlist-item i {
    color: var(--text-secondary);
}

.playlist-item:hover i {
    color: var(--accent-color);
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
    margin-left: 10px;
}

.add-to-playlist-trigger {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.add-to-playlist-trigger:hover {
    color: var(--accent-color);
}

.dropdown-content {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    background-color: #282828;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    border-radius: 4px;
    margin-bottom: 10px;
}

.dropdown-content a {
    color: var(--text-secondary);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
}

.dropdown-content a:hover {
    background-color: #3e3e3e;
    color: var(--text-primary);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal {
    background-color: var(--bg-elevated);
    padding: 30px;
    border-radius: 8px;
    width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

.modal input {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-highlight);
    border: 1px solid #333;
    border-radius: 4px;
    color: white;
    margin-bottom: 20px;
    outline: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.modal-actions button {
    padding: 10px 20px;
    border-radius: 500px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

#cancel-modal {
    background-color: transparent;
    color: var(--text-primary);
}

.primary-btn {
    background-color: var(--accent-color);
    color: black;
}

.primary-btn:hover {
    background-color: var(--accent-hover);
}

/* Sleep Timer Styles */
#sleep-timer-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    margin-right: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s;
}

#sleep-timer-btn:hover {
    color: var(--accent-color);
}

#timer-display {
    font-size: 0.75rem;
    font-weight: bold;
}

.timer-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.timer-options button {
    padding: 10px;
    background-color: var(--bg-highlight);
    border: 1px solid #333;
    border-radius: 4px;
    color: white;
    cursor: pointer;
}

.timer-options button:hover {
    background-color: #3e3e3e;
    border-color: var(--accent-color);
}

.custom-timer {
    margin-bottom: 20px;
}

.custom-timer p {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Tooltip Highlight Effect */
[title] {
    position: relative;
}

/* Standard tooltips are fine, but let's make icons feel more 'highlighted' on hover */
.control-buttons button:hover i,
.volume-controls i:hover,
#sleep-timer-btn:hover i,
.favorite-btn:hover i {
    text-shadow: 0 0 8px var(--accent-color);
}


/* Playlist View */
.playlist-view-header {
    margin-bottom: 30px;
    padding: 40px;
    background: linear-gradient(to bottom, #333, transparent);
    border-radius: 8px;
}

.playlist-info h1 {
    font-size: 4rem;
    margin-bottom: 10px;
}

.playlist-info p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.danger-btn {
    background-color: #e91e63;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.danger-btn:hover {
    background-color: #c2185b;
}

.favorite-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    margin-left: 15px;
}

.favorite-btn:hover {
    transform: scale(1.2);
    color: var(--accent-color);
}

.artist-group h3 {
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.hidden {
    display: none !important;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Better touch targets for mobile */
@media (max-width: 768px) {
    .control-buttons {
        gap: 30px !important;
    }

    .control-buttons button {
        padding: 10px;
        font-size: 1.3rem !important;
    }

    .main-play {
        width: 70px !important;
        height: 70px !important;
        font-size: 2rem !important;
        margin: 0 10px;
    }

    button,
    .playlist-item,
    .song-card {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .sidebar {
        display: none;
    }

    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        height: 100vh;
        overflow: hidden;
    }

    .main-content {
        height: calc(100vh - 120px) !important;
        padding-bottom: 110px !important;
        overflow-y: auto !important;
    }

    /* Floating Premium Player Bar */
    .player-bar {
        position: fixed !important;
        bottom: 75px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        height: 85px !important;
        background: rgba(24, 24, 24, 0.95) !important;
        backdrop-filter: blur(15px) !important;
        border-radius: 20px !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 0 16px !important;
        gap: 10px !important;
        z-index: 99999 !important;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8) !important;
    }

    .now-playing {
        flex: 1.2 !important;
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        min-width: 0 !important;
    }

    #player-img {
        width: 50px !important;
        height: 50px !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
    }

    .song-info {
        flex: 1 !important;
        min-width: 0 !important;
    }

    .song-info .title {
        font-size: 0.9rem !important;
        font-weight: 700 !important;
        color: #fff !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .song-info .artist {
        font-size: 0.75rem !important;
        color: #b3b3b3 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .player-controls {
        flex: 1 !important;
        display: flex !important;
        justify-content: flex-end !important;
    }

    .control-buttons {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    #prev-btn,
    #next-btn,
    .favorite-btn {
        width: 42px !important;
        height: 42px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: #fff !important;
        font-size: 1.2rem !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: none !important;
        border-radius: 50% !important;
    }

    #play-pause-btn {
        width: 65px !important;
        height: 65px !important;
        background: #fff !important;
        color: #000 !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.8rem !important;
        box-shadow: 0 4px 20px rgba(255, 255, 255, 0.3) !important;
        border: none !important;
        z-index: 999999 !important;
        transition: transform 0.1s !important;
    }

    /* Bottom Nav */
    .mobile-nav {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 65px !important;
        background: #000 !important;
        display: flex !important;
        justify-content: space-around !important;
        align-items: center !important;
        border-top: 1px solid #1a1a1a !important;
        z-index: 100000 !important;
    }

    .mobile-nav a {
        color: #b3b3b3 !important;
        font-size: 0.7rem !important;
        text-decoration: none !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 5px !important;
    }

    .mobile-nav a.active {
        color: #fff !important;
    }

    .mobile-nav i {
        font-size: 1.2rem !important;
    }

    /* Hide redundant elements on mobile */
    #shuffle-btn,
    #repeat-btn,
    .progress-container,
    .volume-controls {
        display: none !important;
    }

    .hero h1 {
        font-size: 1.8rem;
    }
}