/* --- ROOT VARIABLES --- */
:root {
    --bg-dark: #050505;
    --primary: #4b7f00;
    --primary-glow: rgba(75, 127, 0, 0.15);
    --glass: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-sub: rgba(255, 255, 255, 0.5);
    --sidebar-width: 260px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

#bell-container {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: 0.3s;
}

/* --- GLASS NOTIFICATIONS POPUP --- */
.notif-dropdown {
    position: absolute;
    top: 60px;
    right: 0;
    width: 320px;
    max-height: 450px;
    background: rgba(10, 10, 10, 0.9);
    /* Solid enough to read, translucent for glass effect */
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
    display: none;
    /* Controlled by JS toggle */
    flex-direction: column;
    z-index: 10005;
    overflow: hidden;
    animation: glassSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-header {
    padding: 18px;
    font-weight: 700;
    font-size: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: white;
}

.notif-list {
    overflow-y: auto;
    flex: 1;
}

.notif-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    transition: 0.2s;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.notif-content {
    font-size: 13px;
    line-height: 1.4;
    color: #bbb;
}

.notif-content b {
    color: #fff;
}

.notif-time {
    display: block;
    font-size: 11px;
    color: var(--primary);
    margin-top: 4px;
}

#bell-container:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary);
    display: none;
    /* Controlled via JS when new notifications arrive */
}

/* --- BASE STYLES --- */
/* --- CLEAN ACCENT SCROLLBAR --- */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) rgba(255, 255, 255, 0.02);
}

body {
    background-color: var(--bg-dark);
    background: radial-gradient(circle at top right, rgba(75, 127, 0, 0.15), transparent 50%),
        radial-gradient(circle at bottom left, rgba(75, 127, 0, 0.1), transparent 50%),
        var(--bg-dark);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* --- NAV BAR --- */
.nav-bar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(25px);
    z-index: 1001;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff 20%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

/* --- SEARCH BAR --- */
.search-container {
    flex: 0 1 450px;
    /* Expands to 450px, shrinks on smaller screens */
    position: relative;
    margin: 0 30px;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-sub);
    pointer-events: none;
    font-size: 14px;
}

@keyframes slideInNotif {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutNotif {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

#nav-search {
    width: 100%;
    padding: 12px 20px 12px 48px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

#nav-search:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

#nav-search::placeholder {
    color: var(--text-sub);
    opacity: 0.6;
}

/* --- LAYOUT WRAPPER --- */
.main-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    padding-bottom: 100px;
    /* Added room for player bar */
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    padding: 24px 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-right: 1px solid var(--glass-border);
}

.side-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 18px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text-sub);
    transition: 0.3s;
}

.side-link:hover {
    color: white;
    background: var(--glass);
}

.side-link.active {
    color: var(--primary);
    background: rgba(75, 127, 0, 0.05);
    border-right: 3px solid var(--primary);
}

/* --- CONTENT AREA --- */
.content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 80px;
}

.section-container {
    margin-top: 40px;
}

.section-header {
    padding: 0 40px;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 28px;
    margin: 0;
}

.horizontal-scroller {
    display: flex;
    gap: 20px;
    overflow-x: auto; /* Keeps scrolling enabled */
    overflow-y: hidden; /* Prevents vertical jitter */
    padding: 0 40px 20px 40px;

    /* Forces items to stay in one long line instead of wrapping */
    flex-wrap: nowrap; 

    /* This is critical: tells the browser how to handle overflow behavior */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}



.horizontal-scroller::-webkit-scrollbar {
    display: none;
}

/* --- SONG & PLAYLIST CARDS --- */
.thumb-container {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--glass-border);
}

.thumb-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s ease;
}

.song-card:hover .thumb-container img {
    transform: scale(1.1);
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s ease;
    cursor: pointer;
}

.thumb-container:hover .play-overlay {
    opacity: 1;
}

.play-btn-main {
    font-size: 45px;
    color: white;
    transition: 0.2s;
}

.play-btn-main:hover {
    transform: scale(1.1);
    color: var(--primary);
}

.song-card {
    width: 180px;
    min-width: 180px;
    cursor: pointer;
}

/* --- PLAYER BAR --- */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 95px;
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(25px);
    border-top: 1px solid var(--glass-border);
    display: none;
    /* Shown via JS */
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 10000;
    box-sizing: border-box;
}

.p-info {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 30%;
}

.p-info img {
    width: 55px;
    height: 55px;
    border-radius: 6px;
    object-fit: cover;
}

.p-text {
    overflow: hidden;
}

.p-title {
    color: white;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.p-artist {
    color: var(--text-sub);
    font-size: 13px;
}

.p-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40%;
    gap: 8px;
}

.p-btns {
    display: flex;
    align-items: center;
    gap: 25px;
    color: white;
    font-size: 18px;
}

.p-play-toggle {
    font-size: 38px;
    cursor: pointer;
    transition: 0.2s;
}

.p-play-toggle:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.p-progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-sub);
    font-size: 11px;
    font-family: monospace;
}

.p-progress-bg {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.p-progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    border-radius: 2px;
}

/* --- TOP 100 OVERLAY --- */
#top100Overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 5, 5, 0.98);
    backdrop-filter: blur(30px);
    z-index: 9999;
    display: none;
    flex-direction: column;
    color: white;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(1.02);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.track-row {
    display: grid;
    grid-template-columns: 50px 50px 60px 2fr 1fr 100px 100px;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    border-radius: 8px;
    transition: 0.2s;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.track-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* --- COMMENT PANEL --- */
.comment-panel {
    position: absolute;
    right: -400px;
    top: 0;
    width: 380px;
    height: 100%;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(40px);
    border-left: 1px solid var(--glass-border);
    z-index: 2000;
    transition: 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.comment-panel.open {
    right: 0;
}

/* If the icon is a pause icon, keep the overlay visible even when not hovering */
.thumb-container:has(.fa-pause-circle) .play-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.3);
    /* Lighter dim so you can still see the art */
}

.fa-pause-circle {
    color: var(--primary) !important;
    /* Make pause icon stand out */
}

/* ============================================================
   UPDATED MOBILE STYLING (Fixed Search Width & Position)
   ============================================================ */

@media (max-width: 768px) {

    /* 1. NAV BAR: Small Logo + Shifted/Shrunken Search */
    .nav-bar {
        padding: 0 10px;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        /* Keeps logo to the left */
        gap: 5px;
        /* Minimum gap between elements */
    }

    .logo {
        font-size: 16px !important;
        /* Slightly smaller to save space */
        min-width: fit-content;
        flex-shrink: 0;
        /* Prevents logo from being squished */
    }

    .search-container {
        /* SHRINKING LOGIC */
        flex: 0 1 180px;
        /* Base width of 180px, but can shrink if needed */
        margin-left: 5px;
        /* Moves search bar a bit more left */
        position: relative;
        min-width: 0;
    }

    #nav-search {
        width: 100%;
        padding: 6px 10px 6px 30px;
        /* Tighter padding for mobile */
        font-size: 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--glass-border);
        border-radius: 8px;
    }

    .search-icon {
        left: 8px;
        font-size: 10px;
        color: var(--text-sub);
    }

    /* Adjust Bell & Profile to fit on the far right */
    .nav-bar .user-profile,
    .nav-bar i.fa-bell {
        margin-left: auto;
        /* Pushes the bell/profile to the far right */
        scale: 0.8;
    }

    /* 2. BOTTOM NAV & MINI-PLAYER (YouTube Style) */
    .main-wrapper {
        flex-direction: column;
        padding-bottom: 130px;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        background: rgba(5, 5, 5, 0.98);
        border-top: 1px solid var(--glass-border);
        z-index: 10001;
    }

    .side-link {
        flex-direction: column;
        font-size: 10px;
        padding: 5px;
        flex: 1;
        background: transparent !important;
    }

    .side-link i {
        font-size: 18px;
    }

    .player-bar {
        position: fixed;
        bottom: 68px;
        left: 8px;
        right: 8px;
        width: calc(100% - 16px);
        height: 55px;
        border-radius: 8px;
        background: rgba(15, 15, 15, 0.95);
        border: 1px solid var(--glass-border);
        padding: 0 10px;
    }

    /* Hide desktop parts for cleaner mobile player */
    .p-progress-container,
    .p-btns i:not(.p-play-toggle),
    #p-like-icon {
        display: none !important;
    }

    .p-info {
        width: 70%;
    }

    .p-info img {
        width: 38px;
        height: 38px;
    }

    .p-title {
        font-size: 12px;
    }

    .p-play-toggle {
        font-size: 24px !important;
    }
}

/* --- USER MENU STYLES --- */
.user-menu-wrapper {
    position: relative;
}

#user-pfp-container {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
}

#user-pfp-container:hover {
    border-color: var(--primary);
}

#nav-user-pfp {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 220px;
    background: var(--bg-glass);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: none;
    /* Controlled by JS */
    flex-direction: column;
    z-index: 10002;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: glassSlide 0.2s ease-out;
}

.dropdown-header {
    padding: 15px;
    font-weight: 700;
    color: white;
    font-size: 14px;
}

.dropdown-item {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #eee;
    text-decoration: none;
    font-size: 13.5px;
    transition: 0.2s;
}

.dropdown-item:hover {
    background: rgba(75, 127, 0, 0.2);
    color: var(--primary);
}

.dropdown-item i {
    width: 20px;
    font-size: 14px;
    color: var(--text-sub);
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 5px 0;
}

.sign-out:hover {
    color: #ff4d4d !important;
}


/* --- CLEAN ACCENT SCROLLBAR --- */

/* 1. Define the width of the scrollbar */
::-webkit-scrollbar {
    width: 8px;
    /* Vertical scrollbar width */
    height: 8px;
    /* Horizontal scrollbar height */
}

/* 2. Track (The background of the scrollbar) */
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    /* Very subtle transparent dark */
    border-radius: 10px;
}

/* 3. Thumb (The draggable part) */
::-webkit-scrollbar-thumb {
    background: var(--primary);
    background: linear-gradient(to bottom, var(--primary), #345900);
    /* Slight gradient for depth */
    border-radius: 10px;
    border: 2px solid transparent;
    /* Creates a "floating" effect */
    background-clip: content-box;
    /* Makes the thumb look slimmer than the track */
}

/* 4. Thumb Hover state */
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
    filter: brightness(1.2);
    background-clip: content-box;
}

/* --- FIREFOX SUPPORT --- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) rgba(255, 255, 255, 0.02);
}

/* --- OPTIONAL: Target specific areas for a "hidden" look --- */
/* If you want the horizontal scrollers to stay hidden but functional */
.horizontal-scroller::-webkit-scrollbar {
    display: none;
}

/* Style for Shuffle/Loop active states */
.p-control-btn.active {
    color: var(--primary) !important;
    filter: drop-shadow(0 0 5px var(--primary-glow));
}

#loopContainer {
    width: 24px;
    height: 24px;
    transition: 0.2s;
}

#loopContainer:hover .p-control-btn,
#shuffleBtn:hover {
    color: white !important;
}


.logo {
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff 20%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.nav-bar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(25px);
    z-index: 1001;
    border-bottom: 1px solid var(--glass-border);
}

/* --- USER MENU --- */
.user-menu-wrapper {
    position: relative;
}

#user-pfp-container {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}

#user-pfp-container:hover {
    border-color: var(--accent);
}

#nav-user-pfp {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    width: 220px;
    background: var(--bg-glass);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: none;
    flex-direction: column;
    z-index: 10002;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: glassSlide 0.2s ease-out;
}

.dropdown-header {
    padding: 15px;
    font-weight: 700;
    color: white;
    font-size: 14px;
}

.dropdown-item {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #eee;
    text-decoration: none;
    font-size: 13.5px;
    transition: 0.2s;
}

.dropdown-item:hover {
    background: rgba(var(--accent-rgb), 0.2);
    color: var(--accent);
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 5px 0;
}

/* --- NOTIFICATIONS --- */
.notification-wrapper {
    position: relative;
}

.notif-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    width: 280px;
    background: var(--bg-glass);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: none;
    flex-direction: column;
    z-index: 10002;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    animation: glassSlide 0.2s ease-out;
}

.notif-header {
    padding: 15px;
    border-bottom: 1px solid var(--glass-border);
    font-weight: 700;
}

.notif-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-sub);
    font-size: 13px;
}

.notification-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    display: none;
}

/* --- PLAYER BAR --- */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 95px;
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(25px);
    border-top: 1px solid var(--glass-border);
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 10000;
    box-sizing: border-box;
}

.p-info {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 30%;
}

.p-info img {
    width: 55px;
    height: 55px;
    border-radius: 6px;
    object-fit: cover;
}

.p-text {
    overflow: hidden;
    margin-right: 15px;
}

.p-title {
    color: white;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.p-artist {
    color: var(--text-sub);
    font-size: 13px;
}

.p-like-btn {
    font-size: 20px;
    color: var(--text-sub);
    cursor: pointer;
    transition: 0.2s;
}

.p-like-btn.active {
    color: var(--accent) !important;
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
}

.p-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40%;
    gap: 8px;
}

.p-btns {
    display: flex;
    align-items: center;
    gap: 25px;
    color: white;
    font-size: 18px;
}

.p-play-toggle {
    font-size: 38px;
    cursor: pointer;
    transition: 0.2s;
}

@keyframes glassSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .nav-bar {
        padding: 0 10px;
        height: 60px;
    }

    .logo {
        font-size: 20px;
    }

    .player-bar {
        height: 75px;
        padding: 0 15px;
    }

    .p-info {
        width: 60%;
    }

    .p-vol-container {
        display: none !important;
    }
}