:root {
    --primary-color: #1DB954;
    --primary-hover-color: #1ED760;
    --background-color: #121212;
    --surface-color: #181818;
    --surface-highlight-color: #282828;
    --text-color: #FFFFFF;
    --text-secondary-color: #b3b3b3;
    --border-color: #333;
    --player-height: 100px;
    --top-bar-height: 70px;
    --nav-bar-height: 55px;
    --search-bar-height: 70px;
    --total-sticky-height-desktop: calc(var(--top-bar-height) + var(--search-bar-height) + var(--nav-bar-height));
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
    height: 100%;
    overflow: hidden; 
}
body {
    font-family: 'Poppins', sans-serif;
    background: var(--background-color); color: var(--text-color);
    display: flex; flex-direction: column;
    padding: 0; 
}
#app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    padding-top: var(--total-sticky-height-desktop);
    padding-bottom: var(--player-height);
}
header { background: rgba(18, 18, 18, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: white; padding: 0 25px; box-shadow: 0 2px 10px rgba(0,0,0,0.3); position: fixed; top: 0; width: 100%; z-index: 1001; height: var(--top-bar-height); display: flex; align-items: center; }
.logo-container { display: flex; align-items: center; gap: 15px; }
.logo-image { height: 40px; width: auto; }
header h1 { font-size: 1.7em; font-weight: 700; }
.search-container { padding: 10px 25px; background: rgba(24, 24, 24, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; gap: 10px; align-items: center; position: fixed; top: var(--top-bar-height); width: 100%; z-index: 1000; height: var(--search-bar-height); border-bottom: 1px solid var(--border-color); }
.search-container input[type="text"] { flex-grow: 1; padding: 12px 20px; border: 1px solid var(--border-color); border-radius: 50px; background-color: var(--surface-highlight-color); color: var(--text-color); font-size: 1em; outline: none; transition: all 0.3s ease; }
.search-container input[type="text"]:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.4); }
.search-container button { padding: 12px 25px; background-color: var(--primary-color); color: white; border: none; border-radius: 50px; cursor: pointer; font-size: 1em; font-weight: 600; transition: background-color 0.2s ease; }
.search-container button:hover { background-color: var(--primary-hover-color); }
nav { background: rgba(18, 18, 18, 0.7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 0 20px; position: fixed; top: calc(var(--top-bar-height) + var(--search-bar-height)); z-index: 999; width: 100%; height: var(--nav-bar-height); display: flex; justify-content: flex-start; align-items: center; gap: 10px; border-bottom: 1px solid #2a2a2a; }
nav button { background-color: transparent; color: var(--text-secondary-color); border: none; padding: 8px 18px; cursor: pointer; font-size: 0.9em; font-weight: 500; border-radius: 20px; transition: background-color 0.3s ease, color 0.3s ease; display: flex; align-items: center; gap: 8px; }
nav button .icon { width: 18px; height: 18px; stroke-width: 2.5; }
nav button:hover { background-color: var(--surface-highlight-color); color: var(--text-color); }
nav button.active { background-color: var(--primary-color); color: white; }
.main-content { flex-grow: 1; overflow-y: auto; padding: 25px; background-color: var(--background-color); -ms-overflow-style: none; scrollbar-width: none; }
.main-content::-webkit-scrollbar { display: none; }
.main-content h3 { font-size: 1.8em; font-weight: 700; margin-bottom: 25px; color: var(--text-color); }
.main-content h4 { font-size: 1.5em; font-weight: 600; margin-bottom: 20px; }

.song-list { list-style: none; }
.song-item { display: flex; align-items: center; padding: 12px; transition: background-color 0.2s ease; border-radius: 8px; margin-bottom: 8px; cursor: pointer; position: relative; }
.song-item:hover { background-color: var(--surface-highlight-color); }
.song-item.playing { background-color: var(--primary-color); }
.song-item.playing .song-title, .song-item.playing .song-channel { color: #000; font-weight: 600; }
.song-thumbnail { width: 50px; height: 50px; object-fit: cover; margin-right: 15px; border-radius: 6px; flex-shrink: 0; }
.song-info { flex-grow: 1; overflow: hidden; }
.song-title { font-weight: 500; font-size: 1em; color: var(--text-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.song-channel { font-size: 0.85em; color: var(--text-secondary-color); }

.home-grid {
    display: grid;
    margin-bottom: 30px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.home-item {
    background-color: var(--surface-color); border-radius: 12px; padding: 15px; cursor: pointer;
    transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    overflow: hidden; position: relative;
}
.home-item:hover { background-color: var(--surface-highlight-color); transform: translateY(-5px); }
.home-item.playing { box-shadow: 0 0 15px var(--primary-color); border: 1px solid var(--primary-color); }
.home-item-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; margin-bottom: 15px; display: block; }
.play-icon-overlay { position: absolute; right: 25px; bottom: calc(45px + 15px + 15px); width: 50px; height: 50px; background-color: var(--primary-color); border-radius: 50%; display: flex; justify-content: center; align-items: center; box-shadow: 0 4px 10px rgba(0,0,0,0.4); opacity: 0; transform: translateY(10px); transition: all 0.3s ease; pointer-events: none; }
.home-item:hover .play-icon-overlay { opacity: 1; transform: translateY(0); }
.play-icon-overlay .icon { width: 24px; height: 24px; color: white; }
.home-item-title { font-size: 1em; font-weight: 600; color: var(--text-color); margin-bottom: 5px; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-item-subtitle { font-size: 0.85em; color: var(--text-secondary-color); }

#player-container { position: fixed; bottom: 0; left: 0; width: 100%; background: rgba(24, 24, 24, 0.8); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); padding: 10px 25px; box-shadow: 0 -5px 20px rgba(0,0,0,0.4); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1002; height: var(--player-height); border-top: 1px solid var(--border-color); }
#player-info {
    font-size: 0.95em; font-weight: 500;
    color: var(--text-color);
    width: 100%; max-width: 600px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-time-container { display: flex; align-items: center; width: 100%; max-width: 600px; gap: 15px; margin-bottom: 10px; }
#current-time, #total-duration { font-size: 0.8em; color: var(--text-secondary-color); }
#progress-bar-container { flex-grow: 1; height: 5px; background-color: #555; border-radius: 5px; cursor: pointer; position: relative; }
#progress-bar { height: 100%; width: 0%; background-color: var(--primary-color); border-radius: 5px; transition: width 0.1s linear; position: relative; }
#progress-bar::after { content: ''; position: absolute; right: -6px; top: 50%; width: 12px; height: 12px; background-color: white; border-radius: 50%; transform: translateY(-50%) scale(0); transition: transform 0.2s ease; }
#progress-bar-container:hover #progress-bar::after { transform: translateY(-50%) scale(1); }
#progress-bar-container:hover #progress-bar { background-color: var(--primary-hover-color); }
#player-controls { display: flex; align-items: center; gap: 20px; }
#player-controls button { background-color: transparent; color: var(--text-secondary-color); border: none; cursor: pointer; transition: all 0.2s ease; }
#player-controls button:hover { color: var(--text-color); transform: scale(1.1); }
#play-pause-btn { background-color: var(--primary-color); color: white; width: 45px; height: 45px; border-radius: 50%; display: flex; justify-content: center; align-items: center; }
#play-pause-btn:hover { background-color: var(--primary-hover-color); transform: scale(1.05); }
#player-controls .icon { width: 24px; height: 24px; }
#play-pause-btn .icon { width: 22px; height: 22px; }

.hidden { display: none; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.loader { border: 4px solid #555; border-radius: 50%; border-top: 4px solid var(--primary-color); width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 40px auto; }
.no-results-message { text-align:center; color: var(--text-secondary-color); padding: 40px 20px; list-style-type: none; grid-column: 1 / -1; }

#developer-profile { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 20px; }
.profile-pic { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; border: 4px solid var(--surface-highlight-color); box-shadow: 0 5px 20px rgba(0,0,0,0.3); margin-bottom: 20px; }
.profile-name { font-size: 2em; font-weight: 700; margin-bottom: 10px; }
.profile-bio { color: var(--text-secondary-color); max-width: 600px; font-size: 1.1em; line-height: 1.6; margin-bottom: 30px; }
.social-links { display: flex; gap: 20px; }
.social-links a { color: var(--text-secondary-color); text-decoration: none; transition: all 0.3s ease; }
.social-links a:hover { color: var(--primary-color); transform: translateY(-3px); }
.social-links .icon { width: 28px; height: 28px; }

.item-menu-btn { position: absolute; top: 8px; right: 8px; background-color: rgba(0,0,0,0.4); border: none; border-radius: 50%; width: 32px; height: 32px; display: flex; justify-content: center; align-items: center; cursor: pointer; z-index: 5; color: var(--text-color); opacity: 0.8; transition: all 0.2s ease; }
.home-item:hover .item-menu-btn { opacity: 1; transform: scale(1.1); }
.item-menu-btn .icon { width: 20px; height: 20px; fill: currentColor; }
.item-menu-btn:hover { background-color: rgba(0,0,0,0.8); }

#item-context-menu { position: fixed; background-color: var(--surface-highlight-color); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); padding: 5px; z-index: 2001; min-width: 180px; border: 1px solid rgba(255, 255, 255, 0.1); transition: opacity 0.15s ease, transform 0.15s ease; transform-origin: top left; }
#item-context-menu.hidden { opacity: 0; transform: scale(0.95); pointer-events: none; }
.context-menu-option { padding: 10px 12px; cursor: pointer; background: none; border: none; width: 100%; text-align: left; color: var(--text-color); font-size: 0.9em; font-weight: 500; display: flex; align-items: center; gap: 12px; border-radius: 4px; transition: background-color 0.2s ease; }
.context-menu-option:hover { background-color: var(--surface-color); }
.context-menu-option .icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: flex; justify-content: center; align-items: center; z-index: 2000; opacity: 1; transition: opacity 0.3s ease; }
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-content { background-color: var(--surface-highlight-color); padding: 25px; border-radius: 12px; width: 90%; max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); position: relative; display: flex; flex-direction: column; gap: 15px; transform: scale(0.95); animation: modal-fade-in 0.3s ease forwards; }
@keyframes modal-fade-in { to { transform: scale(1); opacity: 1; } }
.modal-title { font-size: 1.4em; font-weight: 600; margin-bottom: 5px; text-align: center; }
.close-modal-btn { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 2em; color: var(--text-secondary-color); cursor: pointer; line-height: 1; transition: color 0.2s ease; }
.close-modal-btn:hover { color: var(--text-color); }
#existing-playlists-list { max-height: 200px; overflow-y: auto; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); margin: 0 -25px; padding: 10px 0; }
.existing-playlist-item { padding: 12px 25px; cursor: pointer; transition: background-color 0.2s ease; font-weight: 500; }
.existing-playlist-item:hover { background-color: var(--surface-color); }
.no-playlists-message { padding: 15px 25px; color: var(--text-secondary-color); text-align: center; font-size: 0.9em; }
.new-playlist-section { display: flex; flex-direction: column; gap: 10px; }
#new-playlist-name { width: 100%; padding: 12px 15px; border: 1px solid var(--border-color); border-radius: 8px; background-color: var(--surface-color); color: var(--text-color); font-size: 1em; outline: none; transition: all 0.3s ease; }
#new-playlist-name:focus { border-color: var(--primary-color); }
#create-playlist-btn { padding: 12px 20px; background-color: var(--primary-color); color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 1em; font-weight: 600; transition: background-color 0.2s ease; }
#create-playlist-btn:hover { background-color: var(--primary-hover-color); }

.playlist-header { display: flex; align-items: center; gap: 20px; margin-bottom: 25px; }
#back-to-playlists-btn { background-color: var(--surface-highlight-color); color: var(--text-color); border: none; padding: 8px 15px; cursor: pointer; font-size: 0.9em; font-weight: 500; border-radius: 20px; transition: background-color 0.3s ease; display: flex; align-items: center; gap: 8px; }
#back-to-playlists-btn:hover { background-color: var(--border-color); }
.playlist-header h3 { margin-bottom: 0; }
.remove-btn { background: none; border: none; color: var(--text-secondary-color); cursor: pointer; padding: 0 10px; transition: color 0.2s ease; flex-shrink: 0; margin-left: auto; }
.remove-btn:hover { color: #f44336; }
.remove-btn .icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.remove-from-playlist-btn { background: none; border: none; color: var(--text-secondary-color); font-size: 1.8em; line-height: 1; cursor: pointer; padding: 0 10px; transition: color 0.2s ease; flex-shrink: 0; }
.remove-from-playlist-btn:hover { color: #f44336; }

@media (max-width: 767px) {
    .home-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 600px) { 
    :root { --top-bar-height: 60px; --search-bar-height: 110px; --nav-bar-height: 50px; } 
    #app-wrapper { padding-top: calc(var(--top-bar-height) + var(--search-bar-height) + var(--nav-bar-height) - 20px); }
    header { padding: 0 15px; } .logo-image { height: 35px; } header h1 { font-size: 1.4em; } 
    .search-container { flex-direction: column; gap: 8px; align-items: stretch; padding: 10px 15px; } 
    .search-container input[type="text"], .search-container button { width: 100%; font-size: 0.95em; } 
    nav { justify-content: center; gap: 5px; padding: 0 10px; } 
    nav button { font-size: 0.85em; padding: 6px 12px; } 
    nav button .nav-text { display: none; } 
    .play-icon-overlay { width: 40px; height: 40px; right: 15px; bottom: 65px; } 
    .play-icon-overlay .icon { width: 20px; height: 20px; } 
}