:root {
    /* Base */
    --color-bg: #121212;
    --color-text: #ffffff;

    /* Surfaces */
    --color-surface: #181818;
    --color-surface-alt: #000000;
    --color-border: #333333;

    /* Accent */
    --color-accent: #514164;
    --color-accent-soft: #b3b3b3;

    /* Buttons */
    --color-btn-bg: #000000;
    --color-btn-bg-hover: #514164;

    /* Player */
    --color-player-bg: #181818;

    /* Popups */
    --color-popup-bg: #181818ee;
    --color-overlay: rgba(0, 0, 0, 0.6);

    /* Status */
    --color-danger: #d9534f;
    --color-danger-hover: #c9302c;
    --color-muted: #aaaaaa;
    --color-muted-hover: #888888;
}

/* ==================================================
   GLOBAL
================================================== */
body {
    margin: 0;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
}

img,
.album-image-small img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}


/* ==================================================
   TOP NAVIGATION - UPDATED
================================================== */

#dropdown-nav {
    margin-right: 20px;
    gap: 10px;
}

.top-nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 60px;
    background-color: #181818;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    z-index: 100;
    gap: 20px;
}

/* When there's no search bar, push nav to the right */
.top-nav:not(:has(.top-bar)) {
    justify-content: flex-end;
}

.top-nav button {
    background: #000;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.top-nav button:hover {
    background-color: #514164;
}

.nav-btn {
    background-color: #181818;
    font-weight: bold;
}

/* Dropdown */

.dropdown {
    position: relative;
    display: inline-block;
    padding-right: 8px;
}

#dropdown-nav a {
    text-decoration: none;
    color: white;
    font-size: 14px;
}

#dropdown-nav a:hover {
    color: #514164;
    background-color: #181818;
}

.dropdown-toggle {
    background: #000;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    background-color: #181818;
    border: 1px solid #333;
    min-width: 120px;
    border-radius: 6px;
    padding: 8px 0;
    z-index: 999;
}

.dropdown-menu a {
    display: block;
    padding: 10px 15px;
    color: white;
    text-decoration: none;
    font-size: 14px;
}

.dropdown:hover .dropdown-menu {
    display: block;
}


/* ==================================================
   SEARCH BAR
================================================== */

.top-bar {
    flex: 1;
    max-width: 600px;
    display: flex;
    justify-content: flex-start;
    margin-left: 20px;
}

.top-search-form {
    width: 100%;
    display: flex;
    justify-content: left;
    gap: 5px;
}

.top-bar input {
    width: 100%;
    padding: 8px;
    background-color: #222;
    border: none;
    color: white;
    border-radius: 4px;
}

.top-bar input:focus {
    outline: 2px solid #514164;
}


/* ==================================================
   SIDEBAR
================================================== */

.sidebar {
    width: 215px;
    background-color: var(--color-surface-alt);
    padding: 20px;
    flex-shrink: 0;
}

.logo {
    color: var(--color-text);
    font-size: 24px;
    margin-bottom: 30px;
    position: fixed;
    width: 200px;
}

.nav-links {
    position: fixed;
    padding: 0;
    margin: 0;
    margin-top: 70px;
    width: 200px;
}

.nav-links li {
    color: var(--color-text);
    list-style: none; 
    margin: 7px 0; 
    cursor: pointer; 
    opacity: 0.8; 
    text-align: left; 
    padding: 10px 16px; 
    width: 100%; 
    box-sizing: border-box; 
    transition: background 0.2s; 
} 

.nav-links li a {
    color: white;
    text-decoration: none;
    display: block;
    width: 100%;
}

.nav-links li:hover {
    opacity: 1;
    background-color: var(--color-surface);
}

.nav-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Library dropdown */
.library-dropdown {
    position: relative;
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.library-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.library-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    list-style: none;
    padding: 0;
    margin: 0;
}

.library-dropdown:hover .library-submenu {
    max-height: 200px;
    opacity: 1;
}

.library-submenu li {
    padding: 8px 16px 8px 32px;
    margin: 4px 0;
    font-size: 14px;
    opacity: 0.7;
}

.library-submenu li:hover {
    opacity: 1;
    background-color: #282828;
}

.library-submenu li a {
    width: 100%;
    display: block;
}


/* ==================================================
   MAIN CONTENT
================================================== */

.page {
    display: flex;
    margin-top: 60px;
    min-height: calc(100vh - 140px);
}

.page .content {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    padding: 20px;
    padding-bottom: 140px;
}


/* ==================================================
   PLAYLISTS & ALBUMS
================================================== */

.playlist-section {
    padding: 20px 40px;
    margin-top: 20px;
}

.playlist-section h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.playlist-grid,
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 25px;
}

/* Playlist cards */

.playlist-card,
.album-card {
    background-color: var(--color-surface);
    padding: 15px;
    border-radius: 10px;
    transition: transform 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
}

.playlist-card:hover,
.album-card:hover {
    transform: scale(1.05);
    background-color: #222;
}

.playlist-card img,
.album-card img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.playlist-card p,
.album-card p {
    margin: 5px 0 0;
    font-size: 13px;
    color: var(--color-accent-soft);
}


/* ==================================================
   PLAYER BAR
================================================== */

.album-image-small img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.player-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-direction: row;
    flex-wrap: nowrap;
    z-index: 100;
    position: fixed;
}

.player-song {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.cover-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.album-image-small {
    max-width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    cursor: pointer;
    z-index: 200;
}

.album-image-small img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    transform-origin: bottom left;
    transform: scale(1);
    transition: transform 0.25s ease, filter 0.25s ease;
}

.album-image-small .expand {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 20px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    z-index: 105;
    transition: opacity 0.2s ease;
}

.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background-color: var(--color-player-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-top: 1px solid var(--color-border);
    z-index: 10;
    flex-direction: row;
    overflow: visible;
}

.album-cover-wrapper {
    position: static;
}

.album-image-small:hover .expand {
    opacity: 1;
}

.cover-toggle:checked+.album-image-small {
    position: absolute;
    bottom: 70px;
    left: -10px;
    z-index: 105;
}

.cover-toggle:checked+.album-image-small img {
    transform: scale(4);
    filter: brightness(0.85);
}

.song-info {
    color: var(--color-accent-soft);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.player-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0px;
    padding: 0% 18% 0% 26%;
    flex-direction: row;
}

audio {
    width: 100%;
}

/* ==================================================
   POPUPS
================================================== */

.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-overlay);
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
    z-index: 1;
}

.popup:target {
    opacity: 1;
    visibility: visible;
}

.popup.show {
    display: flex !important;
}

.popup-content {
    width: 550px;
    max-width: 90vw;
    margin: 5% auto;
    padding: 25px 30px;
    background: var(--color-popup-bg);
    border-radius: 12px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 25px;
    color: #444;
    text-decoration: none;
}

.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.popup-content input[type="text"],
.popup-content input[type="email"],
.popup-content input[type="password"],
.popup-content input[type="number"] {
    width: 100%;
    padding: 10px;
    margin: 8px 0 15px;
    border-radius: 6px;
    border: 1px solid var(--color-muted);
}


/* Logout popup */

.popup-buttons {
    display: flex;
    justify-content: space-around;
    gap: 40px;
    margin-top: 20px;
}

.confirm-btn {
    background: var(--color-danger);
    color: var(--color-text);
    padding: 10px 15px;
    border-radius: 6px;
    border: none;
}

.cancel-btn {
    background: var(--color-muted);
    color: var(--color-text);
    padding: 10px 15px;
    border-radius: 6px;
    text-decoration: none;
}

.confirm-btn:hover {
    background: var(--color-danger-hover);
}

.cancel-btn:hover {
    background: var(--color-muted-hover);
}