:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-color: #1db954;
    /* Example accent, can be adjusted */
    --header-height: 70px;
    --font-family: 'Inter', sans-serif;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    /* Ensure html and body take full height */
    overflow: hidden;
    /* Prevent body scroll, let containers handle it */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* Firefox scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #444 #1a1a1a;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar Styles - Dark Theme */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* Force fixed height */
    overflow: hidden;
    /* Prevent app-level scrolling */
}

/* Header Styles */
#main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid #333;
}

/* ... navbar styles ... */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text-color);
}

.nav-right {
    display: flex;
    align-items: center;
}

.search-box {
    background-color: #333;
    border: none;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    outline: none;
    font-family: inherit;
    width: 200px;
    transition: width 0.3s;
}

.search-box:focus {
    width: 250px;
    background-color: #444;
}

#content-wrapper {
    display: flex;
    flex: 1;
    height: 100%;
    /* Fill remaining space */
    margin-top: var(--header-height);
    overflow: hidden;
    /* Container shouldn't scroll */
}

#main-content {
    flex: 1;
    overflow-y: auto;
    /* Enable vertical scrolling */
    min-height: 0;
    /* Allow flex child to shrink and scroll */
    padding: 2rem;
    width: auto;
    max-width: none;
    margin: 0;
    height: 100%;
    /* Ensure it fills height to trigger scroll */
}

#resizer {
    width: 5px;
    background-color: #333;
    cursor: col-resize;
    transition: background-color 0.2s;
    z-index: 10;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#resizer:hover,
#resizer.active {
    background-color: #555;
}

.sidebar-toggle-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 60px;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-left: none;
    border-right: none;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 100;
    padding: 0;
    outline: none;
    border-radius: 4px;
}

.sidebar-toggle-btn:hover {
    background-color: #3a3a3a;
    color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

#player-sidebar {
    width: 300px;
    /* Initial width */
    min-width: 200px;
    max-width: 600px;
    background-color: #181818;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    white-space: nowrap;
    /* Prevent content wrapping during collapse */
}

#player-sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    border-left: none;
    pointer-events: none;
}

.player-header {
    padding: 0.5rem 1rem;
    /* Reduced padding */
    border-bottom: 1px solid #333;
    background-color: #1a1a1a;
    min-height: 50px;
    /* Reduced min-height */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.player-header h2 {
    font-size: 0.95rem;
    /* Smaller font */
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-header p {
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#player-content iframe,
#youtube-player {
    width: 100%;
    height: auto !important;
    /* Override YouTube's inline styles */
    aspect-ratio: 16 / 9;
    border: none;
    display: block;
}

/* Home Page Styles */
.loading,
.error {
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.genre-section {
    margin-bottom: 3rem;
}

.genre-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.carousel-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.carousel-arrow {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50px;
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    color: var(--text-color);
    font-size: 2rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.carousel-arrow:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.carousel-arrow-left {
    left: 0;
}

.carousel-arrow-right {
    right: 0;
}

.carousel {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-behavior: smooth !important;
    padding-bottom: 1rem;
    /* Space for scrollbar if visible, or to prevent clipping */
    cursor: grab;
    /* Hide scrollbar for cleaner look but allow scroll */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
    user-select: none;
    /* Prevent text selection while dragging */
}

.carousel::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.carousel.active {
    cursor: grabbing;
}

.artist-card {
    flex: 0 0 auto;
    width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s;
}

.artist-card:hover {
    transform: translateY(-5px);
}

.artist-card img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    /* Rounded rectangle */
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.artist-name {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* Standard property */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Artist Page Styles */
.artist-container {
    animation: fadeIn 0.5s ease;
}

#artist-page-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
    filter: brightness(0.3) blur(3px);
    /* Dim and blur for readability */
}

.artist-header {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 3rem;
    /* Remove background gradient as we have a full page background now, or keep it for contrast */
    background: rgba(0, 0, 0, 0.5);
    /* Semi-transparent dark background for header */
    padding: 2rem;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.artist-hero-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.artist-info h1 {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1;
}

.artist-bio {
    color: var(--text-secondary);
    /* Use full width of parent */
    max-width: 100%;
    line-height: 1.6;
}

.bio-container {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    /* Show about 4 lines initially */
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 6em;
    /* Approximate height for 4 lines */
    transition: max-height 0.2s ease;
    width: 100%;
}

.bio-container.expanded {
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

.bio-more-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    /* space below button */
    padding: 0;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.artist-details {
    margin-top: 1rem;
    /* space between button and details */
}

.bio-more-btn:hover {
    opacity: 0.8;
}

.artist-content h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 2rem;
}

.album-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.album-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.album-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.album-year {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.track-list {
    list-style: none;
}

.track-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    border-radius: 5px;
    transition: background-color 0.2s;
    cursor: pointer;
}

.track-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.track-number {
    width: 30px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.track-title {
    flex: 1;
    font-weight: 500;
}

.track-duration {
    color: var(--text-secondary);
}

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

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

@media (max-width: 768px) {
    .artist-header {
        flex-direction: column;
        text-align: center;
    }

    .artist-hero-image {
        width: 200px;
        height: 200px;
    }

    .artist-info h1 {
        font-size: 2.5rem;
    }
}

/* Album Page Styles */
.album-page-container {
    animation: fadeIn 0.5s ease;
    max-width: 1000px;
    margin: 0 auto;
}

.album-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    align-items: flex-end;
}

.album-cover-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.album-info h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.album-genres,
.album-artists {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.album-genres .label,
.album-artists .label {
    color: var(--text-color);
    font-weight: 600;
}

.album-artists a {
    color: var(--text-color);
    text-decoration: none;
}

.album-artists a:hover {
    text-decoration: underline;
}

.tracklist-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
}

.tracklist-table th,
.tracklist-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #333;
}

.tracklist-table th {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.tracklist-table tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.track-row td:first-child {
    color: var(--text-secondary);
    width: 50px;
}

@media (max-width: 768px) {
    .album-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .album-info h1 {
        font-size: 2rem;
    }
}

.album-section-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.album-artists-grid {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.mini-artist-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    width: 100px;
    transition: transform 0.2s;
}

.mini-artist-card:hover {
    transform: translateY(-5px);
}

.mini-artist-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    /* Circle for artists */
    object-fit: cover;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.mini-artist-card span {
    font-size: 0.85rem;
    text-align: center;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.track-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.action-btn img {
    width: 24px;
    height: 24px;
    filter: invert(1);
    /* Ensure icons are white if they aren't already */
}

.playlist-container {
    margin-top: 1rem;
    border-top: 1px solid #333;
    max-height: 1000px;
    overflow: hidden;
    opacity: 1;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #333;
}

.playlist-header h3 {
    font-size: 0.9rem;
    margin: 0;
    color: var(--text-secondary);
}

.clear-playlist-btn {
    background: none;
    border: 1px solid #444;
    color: var(--text-color);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background-color 0.2s;
}

.clear-playlist-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.playlist-items {
    max-height: 400px;
    overflow-y: auto;
}

.playlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #2a2a2a;
    transition: background-color 0.2s, transform 0.2s;
    gap: 0.75rem;
    cursor: grab;
    /* Show grab cursor */
}

.playlist-item:active {
    cursor: grabbing;
}

.playlist-item.dragging {
    opacity: 0.5;
    background-color: rgba(255, 255, 255, 0.1);
}

.playlist-item.drag-over {
    border-top: 2px solid var(--accent-color);
    background-color: rgba(255, 255, 255, 0.05);
}

.playlist-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.playlist-item.playing {
    background-color: rgba(29, 185, 84, 0.2);
    border-left: 3px solid var(--accent-color);
}

.playlist-index-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    /* Reduced gap */
    min-width: 60px;
    /* Reduced min-width */
}

.index-arrow {
    background: none;
    border: 1px solid #444;
    color: var(--text-color);
    cursor: pointer;
    padding: 0 0.25rem;
    /* Reduced padding */
    height: 20px;
    /* Fixed small height */
    line-height: 18px;
    border-radius: 3px;
    font-size: 0.65rem;
    /* Slightly smaller font */
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.index-arrow:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
}

.index-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.index-display {
    font-size: 0.7rem;
    /* Smaller font */
    color: var(--text-secondary);
    min-width: 25px;
    /* Reduced min-width */
    text-align: center;
    letter-spacing: -0.5px;
    /* Tighter spacing */
}

.playlist-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.playlist-song-row,
.playlist-artist-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.playlist-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.playlist-item-artist {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.playlist-remove-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.playlist-remove-btn:hover {
    color: var(--text-color);
}

/* Footer */
#main-footer {
    background: var(--surface-color);
    border-top: 1px solid #333;
    padding: 1.5rem 2rem;
    margin-top: 2rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.footer-links {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text-color);
}

.footer-separator {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.footer-copyright {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Legal Pages */
.legal-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    color: var(--text-color);
}

.legal-page h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.legal-page .last-updated {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.legal-page section {
    margin-bottom: 2.5rem;
}

.legal-page h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    border-bottom: 1px solid #333;
    padding-bottom: 0.5rem;
}

.legal-page h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.legal-page p {
    line-height: 1.8;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.legal-page ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.legal-page li {
    line-height: 1.8;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.legal-page a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

.legal-page a:hover {
    color: #1ed760;
    text-decoration: underline;
}

/* Breadcrumb Navigation */
.breadcrumb {
    padding: 1rem 2rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--text-color);
}

.breadcrumb-separator {
    color: var(--text-secondary);
    user-select: none;
}

.breadcrumb-current {
    color: var(--text-color);
    font-weight: 500;
}

/* 404 Not Found Page */
.not-found-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 2rem;
}

.not-found-content {
    text-align: center;
    max-width: 600px;
}

.not-found-title {
    font-size: 8rem;
    font-weight: 700;
    color: var(--accent-color);
    margin: 0;
    line-height: 1;
}

.not-found-subtitle {
    font-size: 2rem;
    margin: 1rem 0;
    color: var(--text-color);
}

.not-found-message {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.not-found-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.not-found-search .search-box {
    flex: 1;
}

.not-found-search .search-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0 1.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.not-found-search .search-btn:hover {
    background: #1ed760;
}

.not-found-links {
    margin-top: 2rem;
}

.not-found-link {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.not-found-link:hover {
    color: #1ed760;
    text-decoration: underline;
}

/* Lazy Loading */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.lazy-load.loaded {
    opacity: 1;
}

/* Loading States */
.loading-skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}