/* ============================================
   Music Player - Premium Dark Theme
   ============================================ */

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

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --bg-glass: rgba(26, 26, 36, 0.8);
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(168, 85, 247, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   Layout
   ============================================ */

.app-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    grid-template-rows: 1fr auto;
    min-height: 100vh;
    gap: 0;
}

.main-content {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.sidebar {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.player-bar {
    grid-column: 1 / -1;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* ============================================
   Header
   ============================================ */

.header {
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ============================================
   Song Grid
   ============================================ */

.song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.song-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.song-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.song-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color);
    box-shadow: var(--shadow-glow);
}

.song-card:hover::before {
    opacity: 1;
}

.song-card.active {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.song-card.active::before {
    opacity: 1;
}

.song-artwork {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.song-artwork::before {
    content: '';
    position: absolute;
    width: 60%;
    height: 60%;
    background: var(--accent-gradient);
    border-radius: 50%;
    opacity: 0.3;
    filter: blur(20px);
}

.song-artwork svg {
    width: 48px;
    height: 48px;
    color: var(--accent-primary);
    z-index: 1;
}

.song-card .play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s;
    z-index: 2;
}

.song-card:hover .play-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.play-overlay svg {
    width: 24px;
    height: 24px;
    color: white;
    margin-left: 2px;
}

.song-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   Sidebar - Recommendations
   ============================================ */

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.sidebar-header svg {
    width: 24px;
    height: 24px;
    color: var(--accent-primary);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recommendation-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.recommendation-item:hover {
    border-color: var(--border-color);
    background: rgba(99, 102, 241, 0.1);
}

.recommendation-artwork {
    width: 48px;
    height: 48px;
    background: var(--bg-secondary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.recommendation-artwork svg {
    width: 24px;
    height: 24px;
    color: var(--accent-secondary);
}

.recommendation-info {
    flex: 1;
    min-width: 0;
}

.recommendation-info h4 {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recommendation-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.similarity-badge {
    background: var(--accent-gradient);
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ============================================
   Player Bar
   ============================================ */

.now-playing {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 200px;
    max-width: 300px;
}

.now-playing-artwork {
    width: 56px;
    height: 56px;
    background: var(--bg-card);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.now-playing-artwork svg {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
}

.now-playing-info h4 {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.now-playing-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.player-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 600px;
    margin: 0 auto;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    color: var(--text-primary);
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.control-btn.play-btn {
    width: 48px;
    height: 48px;
    background: var(--accent-gradient);
    color: white;
}

.control-btn.play-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.control-btn.play-btn svg {
    width: 28px;
    height: 28px;
}

.progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.time-display {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 45px;
    text-align: center;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.progress-bar:hover {
    height: 6px;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.volume-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 150px;
}

.volume-slider {
    width: 100px;
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
}

/* ============================================
   Loading State
   ============================================ */

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-card);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto auto;
    }
    
    .sidebar {
        border-left: none;
        border-top: 1px solid var(--border-color);
        max-height: 300px;
    }
    
    .main-content {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .player-bar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .now-playing {
        width: 100%;
        max-width: none;
    }
    
    .volume-controls {
        display: none;
    }
    
    .song-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}
