/* =========================================================
   VARIABEL WARNA & TEMA (SPOTIFY PREMIUM DARK MODE)
   ========================================================= */
:root {
    --bg-dark: #121212;
    --bg-panel: #181818;
    --bg-hover: #282828;
    --text-light: #ffffff;
    --text-muted: #a7a7a7;
    --primary: #1db954; 
    --primary-hover: #1ed760;
    --danger: #e91429;
    
    --glass-bg: rgba(24, 24, 24, 0.85);
    --glass-border: rgba(255, 255, 255, 0.05);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* PERBAIKAN BUG OVERFLOW: Kunci layar biar nggak goyang ke samping */
html, body {
    background-color: var(--bg-dark); color: var(--text-light);
    overflow: hidden; height: 100%; width: 100%; max-width: 100vw; position: relative;
}

/* =========================================================
   BACKGROUND ORNAMEN
   ========================================================= */
.bg-shape { position: absolute; border-radius: 50%; filter: blur(120px); z-index: -1; opacity: 0.15; }
.shape-1 { width: 400px; height: 400px; background: #1db954; top: -100px; left: -100px; }
.shape-2 { width: 300px; height: 300px; background: #1db954; bottom: -50px; right: -50px; }

/* =========================================================
   LAYOUT UTAMA
   ========================================================= */
.glass-panel {
    background: var(--glass-bg); backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--glass-border);
}
.app-container { display: flex; height: calc(100% - 90px); width: 100%; overflow: hidden; }

/* SIDEBAR & NAV */
.sidebar { width: 240px; padding: 24px; background: rgba(0,0,0,0.5); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; margin-bottom: 35px; color: var(--text-light); }
.nav-menu ul { list-style: none; }
.nav-item { padding: 12px 16px; margin-bottom: 6px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; gap: 16px; color: var(--text-muted); font-weight: 600; font-size: 14px; }
.nav-item i { font-size: 20px; }
.nav-item:hover { color: var(--text-light); }
.nav-item.active { background: var(--bg-hover); color: var(--text-light); }

/* KONTEN TENGAH & TOPBAR */
/* PERBAIKAN BUG OVERFLOW: Tambahkan overflow-x hidden */
.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; padding: 24px; width: 100%; scrollbar-width: thin; scrollbar-color: var(--text-muted) transparent; }
.main-content::-webkit-scrollbar { width: 8px; }
.main-content::-webkit-scrollbar-thumb { background-color: var(--text-muted); border-radius: 10px; }

.topbar { display: flex; justify-content: flex-end; margin-bottom: 24px; position: sticky; top: 0; z-index: 10; padding-bottom: 10px; background: linear-gradient(to bottom, var(--bg-dark) 60%, transparent); }
.btn-icon-profile { background: rgba(0,0,0,0.7); color: white; padding: 8px 16px; border-radius: 50px; cursor: pointer; border: none; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; transition: 0.2s; }
.btn-icon-profile:hover { transform: scale(1.05); background: var(--bg-hover); }
.profile-display { display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,0.7); padding: 4px 12px 4px 4px; border-radius: 50px; }
.avatar-img { width: 32px; height: 32px; border-radius: 50%; }
.username-text { font-size: 14px; font-weight: 600; }
.btn-logout { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; margin-left: 6px; }
.btn-logout:hover { color: var(--text-light); }

/* UTILITY CLASSES */
.hidden { display: none !important; }
.mt-4 { margin-top: 24px; }
.btn-primary { background: var(--primary); color: black; border: none; padding: 12px 24px; border-radius: 50px; cursor: pointer; font-weight: 700; transition: 0.2s; letter-spacing: 0.5px; }
.btn-primary:hover { transform: scale(1.04); background: var(--primary-hover); }

/* FORM & SEARCH */
/* PERBAIKAN BUG OVERFLOW: Max width 100% biar gak nabrak tepi layar */
.search-box, .create-playlist-box { display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 20px; border-radius: 50px; background: var(--bg-hover); border: 1px solid var(--glass-border); margin-bottom: 20px; width: 100%; max-width: 100%; box-sizing: border-box; }
.search-box input, .create-playlist-box input { flex: 1; background: transparent; border: none; color: white; outline: none; font-size: 15px; font-weight: 500; min-width: 0; }
.search-box i { color: var(--text-muted); font-size: 18px; }

/* GRID & HORIZONTAL SCROLL */
.category-row { margin-bottom: 40px; width: 100%; }
.category-title { font-size: 22px; font-weight: 700; margin-bottom: 20px; letter-spacing: -0.5px; }
.horizontal-scroll { display: flex; gap: 20px; overflow-x: auto; padding-bottom: 15px; scroll-behavior: smooth; scrollbar-width: none; width: 100%; }
.horizontal-scroll::-webkit-scrollbar { display: none; }

.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 18px; width: 100%; }

.track-card { background: var(--bg-panel); border-radius: 8px; padding: 14px; cursor: pointer; transition: background-color 0.3s ease; width: 160px; flex-shrink: 0; position: relative; }
.grid-container .track-card { width: 100%; }
.track-card:hover { background: var(--bg-hover); }
.track-card img { width: 100%; aspect-ratio: 1/1; border-radius: 6px; object-fit: cover; margin-bottom: 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.track-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-light); }
.track-artist { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }

/* SPA VIEW SECTIONS */
.view-section { display: none; width: 100%; overflow-x: hidden; }
.view-section.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 20px; }

/* =========================================================
   MINI PLAYER BAR BAWAH
   ========================================================= */
.player-bar {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 90px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; z-index: 100; box-sizing: border-box;
}
.track-info { display: flex; align-items: center; gap: 14px; width: 30%; overflow: hidden; position: relative; }
.cover-art { width: 56px; height: 56px; border-radius: 4px; object-fit: cover; box-shadow: 0 4px 10px rgba(0,0,0,0.3); flex-shrink: 0; }
.track-text { overflow: hidden; white-space: nowrap; }
.track-text h4 { font-size: 14px; font-weight: 600; margin-bottom: 2px; text-overflow: ellipsis; overflow: hidden; }
.track-text p { font-size: 12px; color: var(--text-muted); text-overflow: ellipsis; overflow: hidden; }

.player-controls-wrapper { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.player-controls { display: flex; align-items: center; gap: 24px; }
.control-btn { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; transition: 0.2s; }
.control-btn:hover { color: var(--text-light); }
.play-btn { font-size: 36px; color: var(--text-light); transition: transform 0.2s; }
.play-btn:hover { transform: scale(1.05); }

.progress-container { width: 100%; max-width: 500px; display: flex; align-items: center; gap: 10px; }
.time-text { font-size: 12px; color: var(--text-muted); min-width: 35px; text-align: center; }
.seek-bar { flex: 1; height: 4px; -webkit-appearance: none; background: rgba(255, 255, 255, 0.3); border-radius: 4px; outline: none; cursor: pointer; transition: height 0.1s; }
.seek-bar:hover { height: 6px; }
.seek-bar::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text-light); box-shadow: 0 2px 4px rgba(0,0,0,0.5); display: none; }
.seek-bar:hover::-webkit-slider-thumb { display: block; }

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

/* =========================================================
   RESPONSIVE LAYOUT HP (ANTI GOYANG & OVERFLOW)
   ========================================================= */
@media screen and (max-width: 768px) {
    .app-container { flex-direction: column; height: calc(100% - 130px); width: 100vw; }
    
    .sidebar { position: fixed; bottom: 0; left: 0; width: 100vw; height: 65px; flex-direction: row; justify-content: space-around; align-items: center; padding: 0; background: rgba(0, 0, 0, 0.95); z-index: 90; border-top: 1px solid var(--glass-border); box-sizing: border-box; }
    .brand { display: none; }
    .nav-menu, .nav-menu ul { width: 100%; display: flex; flex-direction: row; justify-content: space-around; margin: 0; padding: 0; }
    .nav-item { flex-direction: column; gap: 4px; font-size: 10px; padding: 8px; margin: 0; border-radius: 0; background: transparent !important; color: var(--text-muted); flex: 1; justify-content: center; }
    .nav-item i { font-size: 22px; }
    .nav-item.active { color: var(--text-light); }

    .main-content { padding: 16px; width: 100%; box-sizing: border-box; overflow-x: hidden; }
    .category-title { font-size: 20px; }
    
    .player-bar { 
        bottom: 65px; 
        padding: 0 12px; 
        height: 65px; 
        background: var(--bg-panel);
        border-radius: 8px;
        width: calc(100vw - 16px);
        left: 8px;
        border: none;
        box-sizing: border-box;
    }
    
    .track-info { width: auto; max-width: 55%; }
    .cover-art { width: 40px; height: 40px; }
    .track-text h4 { font-size: 13px; }
    
    .volume-controls, .progress-container { display: none; }
    
    .player-controls-wrapper { flex: unset; width: auto; align-items: flex-end; }
    .player-controls { gap: 15px; } 
    .control-btn i { font-size: 18px; color: var(--text-light); } 
    .play-btn { font-size: 28px; }
}

/* =========================================================
   MODAL & FULL SCREEN PLAYER 
   ========================================================= */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100%; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 999; backdrop-filter: blur(5px); }
.modal-content { width: 90%; max-width: 380px; padding: 32px; position: relative; border-radius: 12px; background: var(--bg-panel); border: 1px solid var(--glass-border); box-sizing: border-box; }
.close-btn { position: absolute; top: 16px; right: 16px; background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.modal-header { margin-bottom: 24px; text-align: center; font-size: 24px; font-weight: 700; }
.input-group { display: flex; align-items: center; background: rgba(255,255,255,0.1); border-radius: 4px; padding: 14px; margin-bottom: 16px; transition: 0.2s; box-sizing: border-box; }
.input-group:focus-within { border-color: var(--text-muted); background: rgba(255,255,255,0.15); }
.input-group i { color: var(--text-muted); margin-right: 12px; font-size: 16px; }
.input-group input { background: none; border: none; color: white; width: 100%; outline: none; font-size: 15px; min-width: 0; }
.w-100 { width: 100%; }
.text-link { color: var(--text-light); cursor: pointer; font-weight: 700; text-decoration: underline; }

/* FULL SCREEN PLAYER */
.full-screen-player { position: fixed; top: 0; left: 0; width: 100vw; height: 100%; z-index: 2000; transform: translateY(100%); display: flex; flex-direction: column; overflow: hidden; background-color: var(--bg-dark); }
.fs-background { position: absolute; top: -10%; left: -10%; width: 120%; height: 120%; background-size: cover; background-position: center; filter: blur(40px) brightness(0.3); z-index: -1; transition: background-image 0.5s ease; }
.fs-header { display: flex; justify-content: space-between; align-items: center; padding: 30px 24px 20px; }
.fs-header button { background: none; border: none; color: white; font-size: 24px; cursor: pointer; padding: 10px; }
.fs-now-playing { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-light); }
.fs-main-content { flex: 1; overflow-y: auto; padding: 0 24px 40px; display: flex; flex-direction: column; align-items: center; scrollbar-width: none; overflow-x: hidden; }
.fs-main-content::-webkit-scrollbar { display: none; }
.fs-cover { width: 100%; max-width: 360px; aspect-ratio: 1/1; border-radius: 8px; object-fit: cover; box-shadow: 0 10px 40px rgba(0,0,0,0.6); margin-bottom: 40px; margin-top: 20px; }
.fs-info-row { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 360px; margin-bottom: 30px; box-sizing: border-box; }
.fs-text h2 { font-size: 26px; font-weight: 700; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.fs-text p { font-size: 16px; color: var(--text-muted); }
#btn-fs-add-playlist { background: none; border: none; color: var(--primary); font-size: 28px; cursor: pointer; transition: transform 0.2s; }
#btn-fs-add-playlist:hover { transform: scale(1.1); }
.fs-progress-container { width: 100%; max-width: 360px; margin-bottom: 24px; }
.fs-seek-bar { width: 100%; height: 4px; -webkit-appearance: none; background: rgba(255,255,255,0.2); border-radius: 4px; outline: none; margin-bottom: 12px; }
.fs-seek-bar::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: white; }
.fs-time-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); font-weight: 500; }
.fs-controls { display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 360px; margin-bottom: 50px; }
.fs-ctrl-btn { background: none; border: none; color: white; font-size: 24px; cursor: pointer; opacity: 0.7; transition: 0.2s; }
.fs-ctrl-btn:hover { opacity: 1; }
.fs-play-btn { background: white; color: black; border: none; width: 68px; height: 68px; border-radius: 50%; font-size: 28px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.2s; }
.fs-play-btn:hover { transform: scale(1.05); }
.fs-lyrics-card { width: 100%; max-width: 360px; background: rgba(0,0,0,0.5); border-radius: 12px; padding: 24px; backdrop-filter: blur(10px); margin-bottom: 40px; box-sizing: border-box; }
.lyrics-header { display: flex; justify-content: space-between; align-items: center; font-size: 18px; font-weight: 700; margin-bottom: 24px; color: white;}
.lyrics-text { font-size: 20px; line-height: 1.8; font-weight: 700; color: rgba(255,255,255,0.6); transition: color 0.3s; }
