@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-color: #121212;
    --surface-color: rgba(30, 30, 30, 0.6);
    --surface-hover: rgba(50, 50, 50, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --accent-color: #1db954;
    --accent-hover: #1ed760;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(16px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    padding-bottom: 140px;
    background: radial-gradient(circle at top left, #2a2a2a 0%, #121212 100%);
    min-height: 100vh;
}

/* Header & Search */
header {
    position: sticky; top: 0; z-index: 10; padding: 20px 16px;
    background: rgba(18, 18, 18, 0.8); backdrop-filter: var(--glass-blur); border-bottom: 1px solid var(--border-color);
}
h1 {
    font-size: 24px; font-weight: 700; margin-bottom: 16px;
    background: linear-gradient(90deg, #fff, #aaa); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.search-container { position: relative; display: flex; align-items: center; }
.search-container input {
    width: 100%; padding: 12px 16px; padding-left: 40px; border-radius: 20px;
    border: 1px solid var(--border-color); background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary); font-size: 16px; font-family: 'Inter', sans-serif; outline: none; transition: 0.3s;
}
.search-container input:focus { border-color: var(--accent-color); background: rgba(255, 255, 255, 0.1); }
.search-icon { position: absolute; left: 14px; color: var(--text-secondary); }

/* Loader */
.loader { display: none; text-align: center; padding: 20px; color: var(--accent-color); }
.loader.active { display: block; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* Tracks */
.track-list { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.track-item {
    display: flex; align-items: center; padding: 10px; border-radius: 12px;
    background: rgba(255, 255, 255, 0.02); transition: 0.2s; cursor: pointer;
}
.track-item:hover, .track-item:active { background: var(--surface-hover); transform: scale(0.98); }
.track-item.playing { background: rgba(29, 185, 84, 0.1); border: 1px solid rgba(29, 185, 84, 0.3); }
.track-thumb { width: 50px; height: 50px; border-radius: 8px; object-fit: cover; margin-right: 14px; background: #333; }
.track-info { flex: 1; overflow: hidden; }
.track-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.track-item.playing .track-title { color: var(--accent-color); }
.track-artist { font-size: 14px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-actions { display: flex; align-items: center; gap: 10px; }
.add-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 8px; }
.add-btn:hover { color: var(--accent-color); }

/* Bottom Navigation */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: 60px;
    background: rgba(18, 18, 18, 0.95); backdrop-filter: blur(20px);
    display: flex; justify-content: space-around; align-items: center; z-index: 90; border-top: 1px solid var(--border-color);
}
.nav-item { display: flex; flex-direction: column; align-items: center; color: var(--text-secondary); text-decoration: none; font-size: 11px; gap: 4px; flex: 1; }
.nav-item.active { color: var(--text-primary); }
.nav-item.active i { color: var(--text-primary); }

/* Tabs */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Library */
.library-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; }
.btn-primary {
    background: var(--accent-color); color: #fff; border: none; padding: 8px 16px;
    border-radius: 20px; font-weight: 600; display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.btn-primary:active { transform: scale(0.95); }
.playlist-list { padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
.playlist-item {
    padding: 16px; background: rgba(255,255,255,0.05); border-radius: 12px;
    cursor: pointer; display: flex; align-items: center; gap: 16px;
}
.playlist-icon { width: 48px; height: 48px; background: #333; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.btn-text { background: none; border: none; color: var(--text-primary); display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 16px; }

/* Modal */
.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-content { background: #1e1e1e; padding: 24px; border-radius: 16px; width: 90%; max-width: 400px; }
.modal-content h3 { margin-bottom: 16px; }
.modal-list { max-height: 250px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.modal-playlist-item { padding: 12px; background: rgba(255,255,255,0.05); border-radius: 8px; cursor: pointer; }

/* Mini Player */
.mini-player {
    position: fixed; bottom: 60px; left: 0; right: 0; padding: 12px 16px;
    background: rgba(30, 30, 30, 0.95); backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color); display: flex; align-items: center;
    transform: translateY(200%); transition: 0.3s; z-index: 95; cursor: pointer;
}
.mini-player.visible { transform: translateY(0); }
.mini-thumb { width: 44px; height: 44px; border-radius: 6px; margin-right: 12px; }
.mini-info { flex: 1; overflow: hidden; margin-right: 10px; }
.mini-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-artist { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Controls */
.player-controls { display: flex; align-items: center; gap: 16px; }
.control-btn { background: none; border: none; color: var(--text-primary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.control-btn:active { transform: scale(0.9); }
.control-btn.play-pause { width: 40px; height: 40px; border-radius: 50%; background: var(--text-primary); color: var(--bg-color); }
.control-btn.secondary.active { color: var(--accent-color); }

/* Progress Bar */
.progress-container { position: absolute; top: -2px; left: 0; right: 0; height: 2px; background: rgba(255,255,255,0.1); }
.progress-bar { height: 100%; background: var(--accent-color); width: 0%; transition: width 0.1s linear; }

/* Fullscreen Player */
.full-player {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, #3a3a3a 0%, #121212 100%);
    z-index: 200; display: flex; flex-direction: column; padding: 20px;
    transform: translateY(100%); visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.4s;
}
.full-player.visible { transform: translateY(0); visibility: visible; }

.full-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.full-cover-container { flex: 1; display: flex; align-items: center; justify-content: center; max-height: 40vh; margin-bottom: 30px; }
.full-thumb { height: 100%; width: auto; max-width: 100%; max-height: 320px; aspect-ratio: 1/1; object-fit: cover; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }

.full-info { margin-bottom: 24px; text-align: center; }
.full-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.full-artist { font-size: 16px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.full-progress { margin-bottom: 30px; }
.progress-bar-container { width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; cursor: pointer; position: relative; }
.time-info { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-top: 8px; }

.full-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.control-btn.main { color: #fff; }
.control-btn.secondary { color: var(--text-secondary); }
.control-btn.play-pause.big { width: 64px; height: 64px; }

.full-volume { display: flex; align-items: center; gap: 12px; color: var(--text-secondary); width: 100%; justify-content: center;}
.full-volume input { width: 70%; max-width: 200px; }

input[type=range] { -webkit-appearance: none; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text-primary); cursor: pointer; }

/* Utility classes */
.hidden { display: none !important; }

/* Artist View */
.clickable-artist { cursor: pointer; transition: 0.2s; position: relative; display: inline-block; }
.clickable-artist:hover { color: var(--accent-color); text-decoration: underline; }
.artist-header { padding: 30px 16px; text-align: center; background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(18,18,18,0) 100%); }
.artist-header h2 { font-size: 28px; margin-top: 16px; margin-bottom: 8px; }

/* Lyrics Overlay */
.lyrics-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(18,18,18,0.95); backdrop-filter: blur(20px); z-index: 300;
    display: flex; flex-direction: column; padding: 20px; transition: 0.3s;
}
.lyrics-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.lyrics-content { flex: 1; overflow-y: auto; text-align: center; font-size: 18px; line-height: 1.8; color: var(--text-primary); font-weight: 500; white-space: pre-wrap; padding-bottom: 40px; }

/* Lyrics Overlay (Karaoke) */
.lyric-line { opacity: 0.4; transition: all 0.3s ease; padding: 4px 0; cursor: pointer; }
.lyric-line.active { opacity: 1; transform: scale(1.05); color: var(--accent-color); font-weight: 700; }

/* Delete Buttons */
.delete-btn { background: none; border: none; color: #ff4444; cursor: pointer; padding: 8px; }
.delete-btn:hover { color: #ff7777; }

/* Queue */
.queue-content { flex: 1; overflow-y: auto; padding-bottom: 40px; }
.queue-item { display: flex; align-items: center; padding: 10px; background: rgba(255,255,255,0.05); margin-bottom: 8px; border-radius: 8px; cursor: pointer;}
.queue-item.active { background: rgba(29, 185, 84, 0.1); border: 1px solid rgba(29, 185, 84, 0.3); }
.queue-info { flex: 1; overflow: hidden; margin-left: 12px; text-align: left;}
.queue-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.queue-artist { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-actions { display: flex; align-items: center; gap: 8px; }
.queue-action-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; }
.queue-action-btn:hover { color: var(--text-primary); }

/* Heart Active */
.heart-active { color: #ff4b4b !important; fill: #ff4b4b !important; transform: scale(1.1); transition: 0.2s; }

/* Visualizer */
.visualizer-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    height: 100%;
    width: 100%;
    max-width: 320px;
    max-height: 320px;
    aspect-ratio: 1/1;
    background: linear-gradient(135deg, rgba(29, 185, 84, 0.15), rgba(0, 0, 0, 0.4));
    border-radius: 12px;
    padding: 20px;
    box-shadow: inset 0 0 50px rgba(29, 185, 84, 0.1), 0 10px 30px rgba(0,0,0,0.5);
}
.visualizer-container .bar {
    width: 12px;
    background: var(--accent-color);
    border-radius: 6px 6px 0 0;
    transform-origin: bottom;
    animation: bounce 0.6s infinite ease-in-out alternate;
    box-shadow: 0 0 10px var(--accent-color);
}
.visualizer-container.paused .bar {
    animation-play-state: paused;
}
.visualizer-container .bar:nth-child(1) { height: 20%; animation-delay: -0.2s; }
.visualizer-container .bar:nth-child(2) { height: 40%; animation-delay: -0.5s; }
.visualizer-container .bar:nth-child(3) { height: 60%; animation-delay: -0.1s; }
.visualizer-container .bar:nth-child(4) { height: 80%; animation-delay: -0.8s; }
.visualizer-container .bar:nth-child(5) { height: 30%; animation-delay: -0.4s; }
.visualizer-container .bar:nth-child(6) { height: 70%; animation-delay: -0.6s; }
.visualizer-container .bar:nth-child(7) { height: 50%; animation-delay: -0.3s; }
.visualizer-container .bar:nth-child(8) { height: 90%; animation-delay: -0.7s; }
.visualizer-container .bar:nth-child(9) { height: 40%; animation-delay: -0.9s; }
.visualizer-container .bar:nth-child(10){ height: 20%; animation-delay: -0.2s; }

@keyframes bounce {
    0% { transform: scaleY(0.1); opacity: 0.5; filter: hue-rotate(0deg); }
    100% { transform: scaleY(1); opacity: 1; filter: hue-rotate(20deg); }
}
