:root {
    --primary: #1DB954;
    --primary-light: #1ed760;
    --dark-bg: #121212;
    --dark-surface: #181818;
    --dark-card: #282828;
    --dark-text: #FFFFFF;
    --dark-subtext: #b3b3b3;
    
    --light-bg: #F5F5F5;
    --light-surface: #FFFFFF;
    --light-card: #EFEFEF;
    --light-text: #121212;
    --light-subtext: #535353;

    --bg-color: var(--dark-bg);
    --surface-color: var(--dark-surface);
    --card-color: var(--dark-card);
    --text-color: var(--dark-text);
    --subtext-color: var(--dark-subtext);

    --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    --transition-speed: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: linear-gradient(to bottom, rgba(0,0,0,0.3), var(--bg-color) 30%);
    color: var(--text-color);
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* === Tema Terang (Light Mode) === */
body.light-theme {
    --bg-color: var(--light-bg);
    --surface-color: var(--light-surface);
    --card-color: var(--light-card);
    --text-color: var(--light-text);
    --subtext-color: var(--light-subtext);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    background-image: none;
}

/* === Tombol Tema === */
.theme-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
    background: var(--card-color);
    color: var(--subtext-color);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all var(--transition-speed);
    overflow: hidden;
}
.theme-toggle-btn:hover {
    color: var(--primary);
    transform: scale(1.1);
}
.theme-toggle-btn .fa-sun { display: none; }
.theme-toggle-btn .fa-moon { display: block; }

body.light-theme .theme-toggle-btn .fa-sun { display: block; }
body.light-theme .theme-toggle-btn .fa-moon { display: none; }

/* === Welcome Panel === */
.welcome-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--dark-bg);
    z-index: 1001;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.welcome-panel.show { opacity: 1; transform: translateY(0); }
.welcome-panel.hidden { opacity: 0; transform: translateY(-100%); pointer-events: none; }
.welcome-content {
    background-color: var(--dark-surface);
    border-radius: 12px;
    padding: 30px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}
.welcome-panel.show .welcome-content { opacity: 1; transform: scale(1); }
.welcome-logo { font-size: 32px; font-weight: bold; color: var(--primary); margin-bottom: 15px; }
.welcome-subtitle { font-size: 18px; color: var(--dark-subtext); margin-bottom: 25px; }
.welcome-about {
    text-align: left; margin: 20px 0; padding: 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px; border-left: 3px solid var(--primary);
}
.welcome-about p { margin-bottom: 10px; line-height: 1.6; color: #e0e0e0; }
.welcome-thanks { text-align: left; margin: 25px 0; }
.thanks-title { font-size: 18px; font-weight: bold; color: var(--primary); margin-bottom: 10px; border-bottom: 1px solid var(--primary-light); padding-bottom: 5px; }
.thanks-list { list-style-type: none; padding-left: 0; }
.thanks-list li { margin-bottom: 8px; color: var(--dark-subtext); padding-left: 20px; position: relative; }
.thanks-list li:before { content: "•"; color: var(--primary); font-weight: bold; position: absolute; left: 0; }
.welcome-btn {
    background-color: var(--primary); color: white; border: none; border-radius: 30px; padding: 12px 30px;
    font-size: 16px; font-weight: bold; cursor: pointer; transition: all 0.3s; margin-top: 15px;
}
.welcome-btn:hover { background-color: var(--primary-light); transform: translateY(-2px); }

/* === Kontainer Utama & Header === */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; animation: fadeIn 0.5s ease-in-out; }
.header { text-align: center; padding: 30px 0; margin-bottom: 30px; }
.logo { font-size: 42px; font-weight: 700; color: var(--primary); text-decoration: none; }
.site-description { color: var(--subtext-color); font-size: 18px; margin-top: 10px; margin-bottom: 30px; }
.search-container { width: 100%; max-width: 600px; margin: 0 auto; display: flex; gap: 10px; }
.search-input {
    flex: 1; padding: 15px 25px; border-radius: 50px; border: none;
    background-color: var(--card-color); color: var(--text-color); font-size: 16px;
    transition: all var(--transition-speed);
}
.search-input:focus { outline: none; box-shadow: 0 0 0 3px var(--primary); }
.search-btn {
    padding: 15px 30px; border-radius: 50px; border: none; background-color: var(--primary);
    color: white; font-weight: 600; cursor: pointer; transition: all var(--transition-speed);
}
.search-btn:hover { background-color: var(--primary-light); transform: scale(1.05); }

/* === Judul Section === */
.section-title {
    font-size: 28px; font-weight: 700; margin-bottom: 25px;
    color: var(--text-color); display: flex; align-items: center; gap: 15px;
}
.section-title i { color: var(--primary); }

/* === Results Section === */
.results-section { display: none; animation: fadeIn 0.5s ease; }
.results-section.active { display: block; }

/* === Kartu Lagu (Hasil) === */
.results-container {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px; padding-bottom: 100px;
}
.song-card {
    background-color: transparent;
    border-radius: 12px;
    transition: all var(--transition-speed);
    cursor: pointer;
    position: relative;
}
.song-card:hover {
    transform: translateY(-8px);
}
.song-card .song-thumbnail-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}
.song-card .song-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.song-card:hover .song-thumbnail {
    transform: scale(1.1);
}
.song-card .song-info { padding: 0 5px; }
.song-card .song-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-card .song-artist, .song-card .song-duration { font-size: 14px; color: var(--subtext-color); }
.song-card .play-overlay {
    position: absolute; bottom: 85px; right: 15px;
    width: 50px; height: 50px; background-color: var(--primary);
    border-radius: 50%; display: flex; justify-content: center; align-items: center;
    color: white; font-size: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    opacity: 0; transform: translateY(10px); transition: all var(--transition-speed); pointer-events: none;
}
.song-card:hover .play-overlay { opacity: 1; transform: translateY(0); }

/* === Riwayat (History) === */
.history-section { animation: fadeIn 0.5s ease; }
.history-list { display: flex; flex-direction: column; gap: 15px; }
.history-item {
    display: flex; align-items: center; padding: 15px; border-radius: 12px;
    background-color: var(--card-color); cursor: pointer; transition: all var(--transition-speed);
}
.history-item:hover { background-color: rgba(255, 255, 255, 0.1); transform: translateX(5px); }
body.light-theme .history-item:hover { background-color: rgba(0, 0, 0, 0.05); }
.history-thumbnail { width: 50px; height: 50px; object-fit: cover; border-radius: 8px; margin-right: 15px; }
.history-info { flex: 1; min-width: 0; }
.history-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-artist, .history-duration { font-size: 14px; color: var(--subtext-color); }

/* === Mini Player (Glassmorphism) === */
.player-minimized {
    position: fixed; bottom: 15px; left: 50%; transform: translateX(-50%);
    width: 95%; max-width: 500px;
    padding: 12px; display: flex; align-items: center; z-index: 90;
    border-radius: 12px;
    background: rgba(40, 40, 40, 0.5);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    cursor: pointer; transition: all 0.4s ease;
}
body.light-theme .player-minimized {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.1);
}
.player-minimized.hidden { display: none; }
.now-playing-mini { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.now-thumbnail-mini { width: 45px; height: 45px; border-radius: 8px; }

/* Perbaikan untuk judul di Mini Player */
.mini-title-fixed {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#miniArtist { font-size: 14px; color: var(--subtext-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-controls { display: flex; align-items: center; }
.control-btn { background: none; border: none; color: var(--text-color); font-size: 20px; cursor: pointer; padding: 10px; }

/* === Full Player === */
.player-full {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 100; display: none; flex-direction: column; align-items: center;
    padding: 30px 20px; overflow-y: auto; animation: fadeIn 0.4s ease;
    isolation: isolate;
}

.player-full::before {
    content: '';
    position: fixed;
    top: -10px; left: -10px; right: -10px; bottom: -10px;
    background-image: var(--player-bg-image, linear-gradient(to bottom, var(--dark-card), var(--dark-bg)));
    background-size: cover;
    background-position: center;
    filter: blur(30px) brightness(0.6);
    z-index: -1;
    transition: background-image 0.5s ease-in-out;
}

body.light-theme .player-full { background: linear-gradient(to bottom, var(--light-card), var(--light-bg)); }
.player-header { width: 100%; max-width: 500px; display: flex; justify-content: space-between; align-items: center; }
.back-btn { font-size: 24px; background: none; border: none; color: var(--text-color); cursor: pointer; }
.player-title { font-size: 18px; font-weight: 600; color: var(--subtext-color); }
.player-content { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: 30px; }

.now-title-large { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.now-artist-large { font-size: 16px; color: var(--subtext-color); margin-bottom: 30px; }

.progress-container-large { 
    width: 100%;
    position: relative;
}
.progress-bar-large { height: 5px; background-color: transparent; border-radius: 5px; cursor: pointer; }
body.light-theme .progress-bar-large { background-color: transparent; }
.progress-large {
    display: none;
}
.time-display { 
    display: flex; 
    justify-content: space-between; 
    font-size: 12px; 
    color: var(--subtext-color); 
    margin-top: 8px;
    position: relative;
}
#remainingTimeLarge {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-color);
    font-weight: 600;
}

.controls-large { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 30px 0; width: 100%; }
.control-btn-large { font-size: 22px; color: var(--text-color); background: none; border: none; cursor: pointer; transition: color 0.2s; }
.play-btn-large { font-size: 28px; width: 70px; height: 70px; border-radius: 50%; background-color: var(--primary); color: white; transition: background-color 0.2s; }
.play-btn-large:hover { background-color: var(--primary-light); }

.album-art-container {
    position: relative;
    width: 100%;
    max-width: 300px;
    height: 0;
    padding-bottom: 100%;
    cursor: pointer;
    margin-bottom: 30px;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.4));
    transform: translateZ(0);
}

.album-art-container > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 20px;
}

.album-art-container .now-thumbnail-large {
    object-fit: cover;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 1;
    transform: scale(1);
}

.lyrics-overlay {
    background: rgba(25, 25, 25, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0s 0.4s;
    transform: scale(0.95);
    text-align: center;
    color: var(--dark-text);
}

.lyrics-scroll-container {
    font-size: 1.1em;
    line-height: 1.7;
    white-space: pre-wrap;
    max-height: 100%;
    overflow-y: auto;
    font-weight: 600;
    color: rgba(255,255,255,0.95);
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Custom scrollbar untuk lirik */
.lyrics-scroll-container::-webkit-scrollbar { width: 5px; }
.lyrics-scroll-container::-webkit-scrollbar-track { background: transparent; }
.lyrics-scroll-container::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* State ketika lirik aktif */
.album-art-container.lyrics-active .now-thumbnail-large {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.05);
}

.album-art-container.lyrics-active .lyrics-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: scale(1);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Kontrol Volume */
.volume-container { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 250px; margin: 20px 0; }
.volume-slider { flex: 1; -webkit-appearance: none; appearance: none; width: 100%; height: 5px; background: var(--card-color); border-radius: 5px; outline: none; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 15px; height: 15px; background: var(--primary); border-radius: 50%; cursor: pointer; }
.volume-slider::-moz-range-thumb { width: 15px; height: 15px; background: var(--primary); border-radius: 50%; cursor: pointer; }

/* Tombol Ekstra (Download & Lirik) */
.extra-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}
.download-btn, .lyrics-btn {
    background-color: transparent;
    border-radius: 50px;
    padding: 12px 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
    gap: 10px;
}
.download-btn {
    border: 2px solid var(--primary);
    color: var(--primary);
}
.download-btn:hover {
    background-color: var(--primary);
    color: white;
}
.lyrics-btn {
    border: 2px solid var(--subtext-color);
    color: var(--subtext-color);
}
.lyrics-btn:hover {
    background-color: var(--subtext-color);
    border-color: var(--subtext-color);
    color: var(--bg-color);
}

#visualizerCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Antrean (Queue) */
.next-up-container { width: 100%; max-width: 500px; margin-top: 30px; text-align: left; }
.next-up-title { font-size: 18px; font-weight: 600; margin-bottom: 15px; color: var(--subtext-color); }
.next-up-list { width: 100%; }
.queue-item { display: flex; align-items: center; padding: 10px; border-radius: 8px; cursor: pointer; transition: all var(--transition-speed); }
.queue-item:hover { background-color: var(--card-color); }
.queue-thumbnail { width: 40px; height: 40px; border-radius: 6px; margin-right: 12px; }
.queue-info { flex: 1; min-width: 0; }
.queue-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.queue-artist { font-size: 12px; color: var(--subtext-color); }
.queue-duration { font-size: 12px; margin-left: auto; color: var(--subtext-color); flex-shrink: 0; }

/* === Lyrics Panel (Now Integrated) === */
.lyrics-panel {
    display: none;
}

/* === Loading & No Results === */
.loading {
    display: none; justify-content: center; align-items: center; margin: 40px 0;
}
.loader {
    width: 40px; height: 40px; border: 4px solid var(--card-color);
    border-top: 4px solid var(--primary); border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.loading-text { margin-left: 15px; color: var(--subtext-color); font-size: 16px; }
.no-results, .no-history {
    display: none; text-align: center; padding: 30px; color: var(--subtext-color);
    background-color: rgba(0, 0, 0, 0.1); border-radius: 8px;
    margin-top: 20px; border: 1px dashed var(--card-color);
    animation: fadeIn 0.5s ease;
}
.no-history { display: block; }
.no-results h3, .no-history h3 { font-size: 18px; margin-bottom: 10px; color: var(--text-color); }
.no-results p, .no-history p { font-size: 14px; }


/* === Lainnya === */
.scrolling-text { white-space: nowrap; overflow: hidden; position: relative; }
.scrolling-text-content { display: inline-block; animation: scroll-text 12s linear infinite; padding-right: 50px; }
@keyframes scroll-text { from { transform: translateX(0%); } to { transform: translateX(-100%); } }
.hidden { display: none !important; }

/* === Media Queries (Responsiveness) === */
@media (max-width: 768px) {
    .container { padding: 15px; }
    .logo { font-size: 32px; }
    .site-description { font-size: 16px; }
    .search-input { font-size: 16px; }
    .results-container { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }
    .section-title { font-size: 22px; }
    .album-art-container { max-width: 250px; }
    .now-title-large { font-size: 20px; }
    .theme-toggle-btn { top: 15px; right: 15px; }
    .lyrics-scroll-container { font-size: 16px; padding: 0 10px; }
}

@media (max-width: 480px) {
    .header { padding: 20px 0; }
    .search-container { flex-direction: column; }
    .results-container {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    .song-card .play-overlay { width: 40px; height: 40px; font-size: 16px; bottom: 70px; right: 10px; }
    .player-minimized { width: calc(100% - 20px); bottom: 10px; }
    .controls-large { gap: 15px; }
    .play-btn-large { width: 60px; height: 60px; }
    .album-art-container { max-width: 80%; }
    .extra-controls {
        flex-direction: column;
        width: 100%;
    }
}