/* --- 1. VARIABLES & THEME CONFIG --- */
:root {
    /* Brand Colors */
    --primary: #FFD028;
    --primary-hover: #EBC024;
    --on-primary: #1a1a1a;    
    
    /* Light Mode Palette */
    --bg-outside: #eef1f5;
    --bg-app: #ffffff;
    --bg-surface: #f8f9fa;
    --bg-lyrics: #ffffff;
    
    --text-main: #18181b;
    --text-muted: #71717a;
    --border: #e4e4e7;
    
    /* Dimensions */
    --max-w: 700px;           
    --header-h: 64px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    /* Typography: ONLY Google Sans now */
    --font-main: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* --- 2. DARK MODE --- */
body.dark-mode {
    --bg-outside: #000000;
    --bg-app: #121212;
    --bg-surface: #1e1e1e;
    --bg-lyrics: #1e1e1e;
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --border: #27272a;
}

/* --- 3. GLOBAL RESET --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { height: auto; min-height: 100%; }

body {
    margin: 0; padding: 0; width: 100%; min-height: 100vh;
    font-family: var(--font-main);
    background-color: var(--bg-outside);
    color: var(--text-main);
    line-height: 1.6;
    display: flex; justify-content: center; align-items: flex-start; 
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }
a:hover { color: var(--primary); }

/* --- 4. APP SHELL --- */
#app-shell {
    width: 100%; max-width: var(--max-w); background-color: var(--bg-app);
    min-height: 100vh; height: auto; position: relative;
    display: flex; flex-direction: column;
    border-left: 1px solid var(--border); border-right: 1px solid var(--border);
}

/* --- 5. HEADER (De-congested) --- */
.app-header {
    height: var(--header-h);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; /* Slightly less padding on edges */
    position: sticky; top: 0; z-index: 100;
}
body.dark-mode .app-header { background: rgba(18, 18, 18, 0.9); }

.logo { font-weight: 700; font-size: 1.3rem; letter-spacing: -0.5px; color: var(--text-main); display: flex; align-items: center; gap: 10px; }
.logo-icon { background: var(--primary); color: var(--on-primary); width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }

/* Responsive Utilities for Header */
.desktop-only { display: flex; }
.mobile-menu-trigger { display: none; }

@media (max-width: 500px) {
    .desktop-only { display: none; } /* Hide Login button on mobile header */
    .mobile-menu-trigger { display: flex; }
    .app-header { padding: 0 16px; }
}

/* --- 6. BUTTONS --- */
.icon-btn { background: transparent; border: none; color: var(--text-main); font-size: 1.4rem; cursor: pointer; padding: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.icon-btn:hover { background-color: var(--bg-surface); }

.btn-primary { background-color: var(--primary); color: var(--on-primary); font-weight: 600; padding: 10px 24px; border-radius: var(--radius-sm); border: none; display: inline-block; font-size: 0.95rem; cursor: pointer; transition: 0.2s; }
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-outline-secondary { background-color: transparent; color: var(--text-main); border: 1px solid var(--border); padding: 8px 20px; border-radius: 50px; font-size: 0.9rem; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; transition: 0.2s; }
.btn-outline-secondary:hover { background-color: var(--bg-surface); border-color: var(--text-muted); }
.btn-sm { font-size: 0.85rem; padding: 6px 16px; }

/* --- 7. CONTENT & SEARCH --- */
.app-content { flex: 1 0 auto; padding: 24px; width: 100%; }
.search-wrapper { position: relative; margin-bottom: 32px; }
.search-input { width: 100%; padding: 14px 16px 14px 48px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-main); font-size: 1rem; font-family: inherit; outline: none; transition: 0.2s; }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255, 208, 40, 0.15); }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1.2rem; }

/* --- 8. CARDS & LISTS --- */
.section-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; color: var(--text-main); }

.song-card { display: flex; align-items: center; width: 100%; background: var(--bg-app); border: 1px solid var(--border); padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 12px; transition: 0.2s; text-decoration: none; gap: 16px; }
.song-card:hover { border-color: var(--text-muted); background-color: var(--bg-surface); }
.song-icon { width: 44px; height: 44px; background: var(--bg-surface); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 1.3rem; flex-shrink: 0; }
.song-info { display: flex; flex-direction: column; justify-content: center; flex-grow: 1; min-width: 0; overflow: hidden; }
.song-title { font-weight: 700; color: var(--text-main); font-size: 1rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.song-artist { font-size: 0.9rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.song-meta { margin-left: auto; text-align: right; white-space: nowrap; flex-shrink: 0; display: flex; align-items: center; gap: 4px; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }

.artist-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 32px; scrollbar-width: thin; }
.artist-scroll::-webkit-scrollbar { height: 6px; }
.artist-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.artist-chip { flex: 0 0 auto; background: var(--bg-surface); padding: 10px 20px; border-radius: 50px; border: 1px solid transparent; color: var(--text-main); font-weight: 600; font-size: 0.95rem; transition: 0.2s; }
.artist-chip:hover { background: #e4e4e7; border-color: var(--border); }

/* --- 9. AUDIO & LYRICS --- */
.audio-player-card { background: var(--bg-app); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.player-controls { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.play-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: var(--on-primary); border: none; font-size: 1.5rem; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.track-info { flex: 1; overflow: hidden; }
.track-title { font-weight: 700; font-size: 1rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time-display { font-size: 0.8rem; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.progress-container { position: relative; height: 6px; width: 100%; background: var(--bg-surface); border-radius: 10px; cursor: pointer; }
.progress-fill { position: absolute; top: 0; left: 0; bottom: 0; background: var(--primary); width: 0%; border-radius: 10px; pointer-events: none; }
input[type=range] { position: absolute; top: -5px; left: 0; width: 100%; height: 15px; opacity: 0; cursor: pointer; margin: 0; z-index: 2; }

.lyrics-wrapper { width: 100%; box-sizing: border-box; }
#lyrics-content { font-family: var(--font-main); font-size: 1.15rem; line-height: 1.8; color: var(--text-main); white-space: pre-wrap; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; text-align: left; margin-bottom: 2rem; }
#toast { visibility: hidden; min-width: 200px; background: #333; color: #fff; text-align: center; border-radius: 8px; padding: 10px; position: fixed; z-index: 999; left: 50%; bottom: 30px; transform: translateX(-50%); font-size: 0.9rem; opacity: 0; transition: 0.3s; }
#toast.show { visibility: visible; opacity: 1; }

.footer-links { text-align: center; padding: 32px; color: var(--text-muted); font-size: 0.85rem; border-top: 1px solid var(--border); background: var(--bg-surface); margin-top: auto; width: 100%; }

@media (max-width: 500px) {
    .app-content { padding: 16px; }
    .logo { font-size: 1.25rem; }
    .section-title { font-size: 1.1rem; }
}