/* ... Core Styles Remain ... */
/* Include previous styles here (shorthand to ensure we don't wipe them) */

:root {
    --bg-dark: #0f0f13;
    --bg-panel: #18181b;
    --bg-panel-transparent: rgba(24, 24, 27, 0.7);
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --accent: #ec4899;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --border: #27272a;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-family);
    overflow: hidden;
    height: 100vh;
}

.hidden {
    display: none !important;
}

.btn {
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-weight: 500;
    transition: var(--transition);
}

#app {
    width: 100%;
    height: 100%;
}

.view {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.view.active {
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

/* Login */
#login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1e1b4b, transparent 40%), radial-gradient(circle at bottom left, #310b28, transparent 40%);
}

.login-container {
    background: var(--bg-panel-transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo i {
    font-size: 3rem;
    color: var(--primary);
    filter: drop-shadow(0 0 10px var(--primary-glow));
    margin-bottom: 1rem;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 600;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-radius: 0.5rem;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.error-message {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 1rem;
    text-align: center;
    min-height: 1.2em;
}

/* Dashboard */
#dashboard-view {
    display: flex;
    background: var(--bg-dark);
}

.sidebar {
    width: 80px;
    height: 100%;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    z-index: 20;
}

.logo-small {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 3rem;
}

.sidebar nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.sidebar nav li {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 50px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.sidebar nav li:hover,
.sidebar nav li.active {
    color: var(--text-main);
}

.sidebar nav li.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 24px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--primary-glow);
}

.sidebar i {
    font-size: 1.2rem;
}

#logout-btn {
    margin-top: auto;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.top-bar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.search-bar {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2rem;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 300px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.search-bar:focus-within {
    background: rgba(0, 0, 0, 0.2);
    border-color: var(--border);
}

.search-bar i {
    color: var(--text-muted);
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    font-family: inherit;
}

.search-bar input:focus {
    outline: none;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

#user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

#content-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    padding-bottom: 110px;
}

/* Player Bar */
.player-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background: rgba(24, 24, 27, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 30;
}

.now-playing {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 250px;
}

.album-art {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    background: #333;
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: background-image 0.3s ease;
}

.track-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    overflow: hidden;
}

.track-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.artist-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.like-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.like-btn.active {
    color: var(--accent);
    animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
    50% {
        transform: scale(1.2);
    }
}

.player-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    max-width: 600px;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.control-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.2rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    color: var(--text-main);
}

.control-btn.big {
    width: 40px;
    height: 40px;
    background: white;
    color: black;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: transform 0.2s;
}

.control-btn.big:hover {
    transform: scale(1.1);
    color: black;
}

.progress-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.progress-bar-wrapper {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    position: relative;
    transition: height 0.2s;
    cursor: pointer;
}

.progress-bar-wrapper:hover {
    height: 6px;
}

.progress-bar {
    width: 100%;
    height: 100%;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--text-main);
    border-radius: 2px;
    position: relative;
}

.progress-bar-wrapper:hover .progress-fill {
    background: var(--primary);
}

.volume-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 150px;
    justify-content: flex-end;
}

.volume-slider-wrapper {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    cursor: pointer;
}

.volume-fill {
    height: 100%;
    background: var(--text-main);
}

/* --- New Styles for Enhanced Logic --- */

/* Tabs */
.library-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: white;
    background: var(--bg-panel);
    font-weight: 600;
}

/* Album Detail */
.album-detail {
    animation: fadeIn 0.4s ease;
}

.album-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    align-items: flex-end;
}

.album-cover-large {
    width: 220px;
    height: 220px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    object-fit: cover;
}

.album-meta h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.album-artist {
    font-size: 1.2rem;
    color: var(--text-main);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.album-year {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.album-actions {
    display: flex;
    gap: 1rem;
}

.track-list {
    display: flex;
    flex-direction: column;
}

.track-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    border-radius: 0.5rem;
    transition: var(--transition);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.track-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.track-num {
    width: 40px;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

.track-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.track-name {
    font-size: 1rem;
    color: var(--text-main);
}

.track-artist {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.track-time {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Grid reused */
.media-section {
    margin-bottom: 3rem;
    animation: fadeIn 0.5s ease backwards;
}

.media-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 2rem;
}

.media-card {
    background: var(--bg-panel);
    border-radius: 1rem;
    padding: 1rem;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.media-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.1);
}

.card-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 0.8rem;
    overflow: hidden;
    margin-bottom: 1rem;
    position: relative;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.media-card:hover .card-image img {
    transform: scale(1.05);
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.play-overlay i {
    font-size: 2rem;
    color: white;
    background: var(--primary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transform: translateY(10px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.media-card:hover .play-overlay {
    opacity: 1;
}

.media-card:hover .play-overlay i {
    transform: translateY(0);
}

.card-info h3 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Settings View */
.settings-view {
    max-width: 600px;
    margin: 0 auto;
}

.setting-item {
    background: var(--bg-panel);
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.setting-item h3 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.setting-item p {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.setting-item strong {
    color: var(--text-main);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}