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

/* ================= BODY ================= */
body {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a2e 100%);
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
}

body.light {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
}

/* Header luôn nổi trên */
header {
    position: relative;
    z-index: 1000;
    isolation: isolate;
}

/* Navigation */
nav {
    position: relative;
    z-index: 1000;
    overflow: visible;
}

/* Main content nằm dưới */
main {
    position: relative;
    z-index: 1;
}

/* Center content KHÔNG tạo stacking context */
.center-content {
    position: relative;
    z-index: 1;
    transform: none !important;
    filter: none !important;
}


/* ================= LIGHT MODE FIX ================= */
.light .bg-gray-900 { background: #fff; color: #333; }
.light .text-gray-400 { color: #666; }
.light .bg-white\/5 { background: #f0f0f0; color: #333; }
.light .genre-card { background: #ffffff; border-color: #ddd; }
.light .player-bar { background: linear-gradient(to top, #e0e0e0, #f0f0f0); color: #333; }
.light .music-item:hover { background: #e0e0e0; color: #333; }
.light .progress-bar { background: #ddd; }
.light .progress-bar-fill { background: linear-gradient(90deg, #4a90e2 0%, #9013fe 100%); }

/* ================= ROOT ================= */
:root {
    --equalizer-color: #9b5de5;
}

#equalizer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* ================= DROPDOWN (FIXED - SINGLE SOURCE) ================= */
.dropdown {
    position: relative;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    margin-top: 8px;

    background: linear-gradient(135deg, rgba(31,41,55,0.98), rgba(17,24,39,0.98));
    border-radius: 12px;
    border: 1px solid rgba(139,92,246,.35);
    box-shadow: 0 15px 40px rgba(0,0,0,.6);

    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all .25s ease;

    z-index: 9999;

    max-height: 380px;
    overflow-y: auto;
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-content a {
    display: block;
    padding: 12px 18px;
    color: #e5e7eb;
    text-decoration: none;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: all .2s ease;
}

.dropdown-content a:hover {
    background: linear-gradient(90deg, rgba(139,92,246,.25), transparent);
    color: #a78bfa;
    border-left-color: #a78bfa;
    padding-left: 22px;
}

/* Arrow */
.dropdown > a {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dropdown > a i.fa-chevron-down {
    font-size: .8rem;
    transition: transform .25s ease;
}

.dropdown:hover > a i.fa-chevron-down {
    transform: rotate(180deg);
}

/* Scrollbar */
.dropdown-content::-webkit-scrollbar {
    width: 6px;
}

.dropdown-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,.25);
    border-radius: 10px;
}

.dropdown-content::-webkit-scrollbar-thumb {
    background: rgba(139,92,246,.55);
    border-radius: 10px;
}

.dropdown-content::-webkit-scrollbar-thumb:hover {
    background: rgba(139,92,246,.8);
}

/* Light mode dropdown */
body.light .dropdown-content {
    background: #ffffff;
    color: #333;
    border-color: #ddd;
}

body.light .dropdown-content a {
    color: #333;
}

body.light .dropdown-content a:hover {
    background: #f0f0f0;
    color: #6d28d9;
}

/* ================= MUSIC ITEM ================= */
.music-item {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    margin: 5px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.music-item:hover {
    background: rgba(255,255,255,0.1);
    transform: translateX(5px);
}

/* ================= NEWS TICKER ================= */
.news-ticker {
    height: 300px;
    overflow: hidden;
    position: relative;
}

.news-ticker-content {
    animation: scroll-up 30s linear infinite;
}

@keyframes scroll-up {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

/* ================= PLAYER BAR ================= */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, #1a1a2e, #2a2a3e);
    padding: 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
    z-index: 1000;
}

.progress-bar {
    background: rgba(255,255,255,0.2);
    height: 4px;
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.progress-bar-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s;
}

/* ================= GENRE CARD ================= */
.genre-card {
    background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
    .main-content { flex-direction: column; }
    .sidebar-left,
    .sidebar-right,
    .center-content { width: 100% !important; }
}

/* ================= LYRICS ================= */
#lyricsContent {
    position: relative;
    transition: all 0.5s ease-in-out;
}

#lyricsContent.collapsed {
    max-height: 150px;
    overflow: hidden;
}

#lyricsContent.expanded {
    max-height: none;
    overflow: visible;
}

#lyricsContent.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, rgba(31,41,55,0.95));
    pointer-events: none;
}

#lyricsContent.expanded::after {
    display: none;
}

/* For Mobile */

@media (max-width: 768px) {
    /* Overlay khi dropdown mở */
    .dropdown.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .dropdown-content {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 90%;
        z-index: 10000;
    }
}