/* =========================================
   1. RESET & FONT BASE
   ========================================= */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Inter', sans-serif; 
}

body { 
    background-color: #000000; 
    color: #ffffff; 
    height: 100vh; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
}

/* =========================================
   2. LAYOUT UTAMA (DESKTOP FIRST)
   ========================================= */
.app-container { 
    display: flex; 
    flex: 1; 
    overflow: hidden; 
    padding-bottom: 90px; 
}

/* Sidebar Kiri */
.sidebar { 
    width: 240px; 
    background-color: #121212; 
    padding: 24px; 
    display: flex;
    flex-direction: column;
}
.sidebar-top h2 { 
    margin-bottom: 30px; 
    font-weight: 800; 
    color: #1db954; 
}
.sidebar-top ul { list-style: none; }
.sidebar-top li { 
    margin-bottom: 16px; 
    color: #b3b3b3; 
    cursor: pointer; 
    font-weight: 600;
    transition: color 0.3s ease, transform 0.2s ease; 
}
.sidebar-top li:hover { 
    color: #ffffff; 
    transform: translateX(5px); 
}

/* Tombol Logout Desktop */
#logout-btn {
    margin-top: auto; /* Otomatis mentok ke bawah */
    padding: 12px; 
    background: transparent;
    color: #ff4d4d; 
    border: 1px solid #ff4d4d; 
    border-radius: 30px; 
    cursor: pointer;
    font-weight: bold; 
    width: 100%;
    transition: all 0.3s ease;
}
#logout-btn:hover {
    background: #ff4d4d;
    color: white;
}

/* Area Konten Utama */
.main-content { 
    flex: 1; 
    background: linear-gradient(to bottom, #2a2a2a, #121212); 
    padding: 30px; 
    overflow-y: auto; 
    scroll-behavior: smooth;
}

/* Input Section */
.input-section { 
    margin-bottom: 40px; 
    display: flex; 
    gap: 15px; 
    flex-wrap: wrap; 
}
.input-section input { 
    flex: 1; 
    min-width: 200px; 
    padding: 14px 20px; 
    border-radius: 30px; 
    border: 2px solid transparent; 
    background: #333; 
    color: white; 
    font-size: 1rem;
    outline: none; 
    transition: all 0.3s ease;
}
.input-section input:focus {
    border-color: #1db954; 
    background: #444;
}
.input-section button { 
    padding: 14px 28px; 
    border-radius: 30px; 
    border: none; 
    background: #1db954; 
    color: #000; 
    font-weight: 800; 
    font-size: 1rem;
    cursor: pointer; 
    transition: all 0.2s ease; 
}
.input-section button:hover {
    background: #1ed760;
    transform: scale(1.05); 
}
.input-section button:active { 
    transform: scale(0.95); 
}

/* Daftar Lagu (Playlist) */
.song-list-header { 
    display: flex; 
    justify-content: space-between; 
    color: #b3b3b3; 
    border-bottom: 1px solid #333; 
    padding-bottom: 10px; 
    margin-bottom: 15px; 
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.playlist-container { list-style: none; }
.song-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 12px 15px; 
    border-radius: 8px; 
    transition: background 0.3s ease; 
}
.song-item:hover { 
    background-color: rgba(255, 255, 255, 0.1); 
}
.song-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}
.play-btn { 
    background: transparent; 
    border: 1px solid #fff; 
    color: #fff; 
    padding: 6px 18px; 
    border-radius: 20px; 
    cursor: pointer; 
    font-weight: 600;
    transition: all 0.3s ease; 
}
.play-btn:hover { 
    background: #fff; 
    color: #000; 
}

/* =========================================
   3. PLAYER BAR (BAWAH)
   ========================================= */
.player-bar { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    height: 90px; 
    background-color: #181818; 
    border-top: 1px solid #282828; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0 30px; 
    z-index: 100; 
}
.now-playing { 
    width: 30%; 
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.controls { 
    width: 40%; 
    display: flex; 
    justify-content: center; 
    align-items: center;
    gap: 25px; 
}
.controls button { 
    background: none; 
    border: none; 
    color: #b3b3b3; 
    font-size: 20px; 
    cursor: pointer; 
    transition: all 0.2s ease; 
}
.controls button:hover {
    color: #fff;
    transform: scale(1.1);
}
.controls button:active {
    transform: scale(0.9); 
    transition: none; 
}
#play-pause-btn { 
    font-size: 35px; 
    color: #fff;
}
#play-pause-btn:hover {
    transform: scale(1.15);
}

/* =========================================
   4. RESPONSIVE DESIGN (MOBILE / HP)
   ========================================= */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }

    /* Sidebar Header HP */
    .sidebar { 
        width: 100%; 
        padding: 15px 20px; 
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #282828;
    }
    .sidebar-top {
        display: flex;
        align-items: center;
        gap: 20px;
        width: 100%;
    }
    .sidebar-top h2 { margin-bottom: 0; font-size: 1.2rem; }
    .sidebar-top ul { display: flex; gap: 15px; margin-bottom: 0; }
    .sidebar-top li { margin-bottom: 0; font-size: 0.85rem; }
    .sidebar-top li:hover { transform: translateY(-2px); }

    /* Tombol Logout versi HP (Mengecil & di Kanan) */
    #logout-btn {
        margin-top: 0;
        width: auto;
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    /* Area Utama */
    .main-content { padding: 20px; padding-bottom: 120px; }
    .input-section { flex-direction: column; gap: 15px; }
    .input-section button { width: 100%; }

    /* Player Bar HP */
    .player-bar { padding: 0 15px; height: 85px; }
    .now-playing { width: 45%; font-size: 0.85rem; }
    .controls { width: 55%; gap: 15px; justify-content: flex-end; }
    #play-pause-btn { font-size: 30px; }
    .song-title { max-width: 50%; font-size: 0.9rem; }
    .play-btn { padding: 5px 12px; font-size: 0.8rem; }
}

/* =========================================
   5. AUTH (LOGIN / REGISTER SCREEN)
   ========================================= */
.auth-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background: linear-gradient(135deg, #000000, #1a1a1a);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999;
}
.auth-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 40px; border-radius: 15px;
    width: 90%; max-width: 400px;
    text-align: center; border: 1px solid rgba(255,255,255,0.1);
}
.auth-input {
    width: 100%; padding: 15px; margin-bottom: 15px;
    border-radius: 8px; border: none; background: #222;
    color: white; font-size: 1rem; outline: none;
}
.auth-input:focus { border: 1px solid #1db954; }
.auth-buttons { display: flex; gap: 10px; }
.btn-primary {
    flex: 1; padding: 15px; border-radius: 8px; border: none;
    background: #1db954; color: black; font-weight: bold; cursor: pointer;
    transition: background 0.2s;
}
.btn-secondary {
    flex: 1; padding: 15px; border-radius: 8px; border: 1px solid #1db954;
    background: transparent; color: #1db954; font-weight: bold; cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: #1ed760; }
.btn-secondary:hover { background: rgba(29, 185, 84, 0.1); }

/* =========================================
   6. PREMIUM UI: TOMBOL LAGU & LIBRARY GRID
   ========================================= */
.song-actions { 
    display: flex; 
    gap: 8px; 
}
.action-btn { 
    padding: 6px 14px; 
    border-radius: 20px; 
    font-size: 0.8rem; 
    font-weight: 600; 
    cursor: pointer; 
    border: 1px solid transparent; 
    background: transparent;
    transition: all 0.2s ease; 
}
.play-btn { color: #1db954; border-color: #1db954; }
.play-btn:hover { background: #1db954; color: black; transform: scale(1.05); }

.add-btn { color: #b3b3b3; border-color: #b3b3b3; }
.add-btn:hover { background: #b3b3b3; color: black; transform: scale(1.05); }

.del-btn { color: #ff4d4d; border-color: #ff4d4d; }
.del-btn:hover { background: #ff4d4d; color: white; transform: scale(1.05); }

/* Grid Card untuk "Your Library" */
#playlist-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 
    gap: 20px; 
    margin-top: 20px;
}
.playlist-card { 
    background: #181818; 
    border: 1px solid #282828; 
    border-radius: 8px; 
    padding: 20px; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    text-align: center;
}
.playlist-card:hover { 
    background: #282828; 
    transform: translateY(-5px); 
    border-color: #1db954;
}

/* Modal Pop-up Playlist */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center; z-index: 10000;
}
.modal-content {
    background: #1a1a1a; padding: 30px; border-radius: 15px;
    width: 90%; max-width: 350px; border: 1px solid #333; text-align: center;
}
.modal-list { list-style: none; max-height: 200px; overflow-y: auto; padding: 0; }
.modal-list li {
    padding: 12px; margin-bottom: 10px; background: #222; border-radius: 8px;
    cursor: pointer; transition: background 0.2s; font-weight: 600;
}
.modal-list li:hover { background: #1db954; color: black; }

/* =========================================
   7. CUSTOM SWEETALERT (PREMIUM MODALS)
   ========================================= */
.sweet-box {
    transform: scale(0.7);
    opacity: 0;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    to { transform: scale(1); opacity: 1; }
}

.sweet-icon {
    font-size: 40px;
    margin-bottom: 15px;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}