/* ===== CSS Reset & Variables ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a28;
    --bg-card: #16161f;
    --bg-hover: #1e1e2e;
    --bg-active: #252538;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-tertiary: #6a6a80;
    --accent: #00d4ff;
    --accent-purple: #7b2fff;
    --accent-gradient: linear-gradient(135deg, #00d4ff, #7b2fff);
    --accent-glow: 0 0 20px rgba(0, 212, 255, 0.3);
    --border: rgba(255, 255, 255, 0.06);
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --player-height: 110px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: 0.2s ease;
}

html {
    font-size: 14px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 1fr var(--player-height);
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-active); }

/* ===== Sidebar ===== */
.sidebar {
    grid-row: 1 / 3;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 20px;
}

.logo-icon {
    width: 36px;
    height: 36px;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-tertiary);
    padding: 12px 14px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.92rem;
    transition: all var(--transition);
    cursor: pointer;
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar-link.active {
    color: var(--text-primary);
    background: var(--bg-active);
}

.sidebar-link.active svg {
    stroke: var(--accent);
}

.playlist-dot {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* ===== Top Bar ===== */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 32px;
    height: var(--topbar-height);
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.top-bar-left {
    display: flex;
    gap: 6px;
}

.nav-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.nav-btn:hover { background: var(--bg-active); color: var(--text-primary); }
.nav-btn svg { width: 16px; height: 16px; }

.search-bar {
    flex: 1;
    max-width: 420px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary);
    border-radius: 50px;
    padding: 0 16px;
    height: 40px;
    border: 1px solid transparent;
    transition: all var(--transition);
}

.search-bar:focus-within {
    border-color: var(--accent);
    background: var(--bg-active);
    box-shadow: var(--accent-glow);
}

.search-bar svg {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
}

.search-bar input::placeholder { color: var(--text-tertiary); }

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition);
}

.icon-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.icon-btn svg { width: 20px; height: 20px; }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}

/* User Dropdown Menu */
.user-menu {
    display: none;
    position: absolute;
    top: 44px;
    right: 0;
    width: 260px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    z-index: 5000;
    overflow: hidden;
    animation: menuSlideIn 0.15s ease-out;
}
.user-menu.open { display: block; }
@keyframes menuSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.user-menu-header {
    padding: 16px;
    background: rgba(255,255,255,0.03);
}
.user-menu-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.user-menu-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.user-menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 4px 0;
}
.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}
.user-menu-item:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}
.user-menu-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}
.user-menu-item:hover svg { opacity: 1; }
.user-menu-auth {
    color: var(--accent);
}
.user-menu-auth:hover {
    color: var(--accent);
    background: rgba(124,92,231,0.1);
}

/* ===== Main Content ===== */
.main-content {
    overflow-y: auto;
    position: relative;
    min-height: 0;
}

.page-container {
    min-height: 0;
}

.page {
    display: none;
    padding: 28px 32px 100px;
    animation: fadeIn 0.3s ease;
}

.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Back Button (detail pages) ===== */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px 8px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 16px;
}
.back-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}
.back-btn svg {
    width: 18px;
    height: 18px;
}

/* ===== Hero Banner ===== */
.hero-banner {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    height: 340px;
    margin-bottom: 40px;
    cursor: pointer;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.5);
    transition: transform 0.6s ease;
}

.hero-banner:hover .hero-bg { transform: scale(1.03); }

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10,10,15,0.95) 0%, rgba(10,10,15,0.3) 50%, transparent 100%);
}

.hero-content {
    position: absolute;
    bottom: 36px;
    left: 36px;
    right: 36px;
}

.hero-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--accent);
    color: var(--bg-primary);
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 8px;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 20px;
}

.hero-actions {
    display: flex;
    gap: 12px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 50px;
    color: var(--bg-primary);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--accent-glow); }
.btn-primary svg { width: 18px; height: 18px; }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50px;
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-secondary:hover { background: rgba(255,255,255,0.18); }

/* ===== Section Headers ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.section-link {
    color: var(--text-tertiary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    transition: color var(--transition);
}

.section-link:hover { color: var(--accent); }

.content-section { margin-bottom: 44px; }

/* ===== Card Grids ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 20px;
}

.card-grid-wide {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    group: true;
}

.card:hover {
    background: var(--bg-hover);
    transform: translateY(-4px);
}

.card-artwork {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 12px;
    background: var(--bg-tertiary);
}

.card-artwork img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-artwork-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.card-play {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.4);
}

.card-play svg { width: 20px; height: 20px; }
.card:hover .card-play { opacity: 1; transform: translateY(0); }

.card-title {
    font-weight: 600;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.card-subtitle {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Artist cards */
.card-artwork.round {
    border-radius: 50%;
}

/* ===== Track List ===== */
.track-list {
    width: 100%;
}

.track-row {
    display: grid;
    grid-template-columns: 36px 1fr 1fr 80px 50px;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    transition: background var(--transition);
    cursor: pointer;
    position: relative;
}

.track-row:hover {
    background: var(--bg-hover);
}

.track-row.playing {
    background: var(--bg-active);
}

.track-row.playing .track-num {
    color: var(--accent);
}

.track-num {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.track-row:hover .track-num-text { display: none; }
.track-play-icon { display: none; }
.track-row:hover .track-play-icon { display: block; color: var(--text-primary); }

.track-info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.track-thumb {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.track-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-meta {
    min-width: 0;
}

.track-name {
    font-weight: 500;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-row.playing .track-name { color: var(--accent); }

.track-artist-name {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.track-artist-name:hover { color: var(--text-secondary); text-decoration: underline; }

.track-album-name {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.track-album-name:hover { color: var(--text-secondary); text-decoration: underline; }

.track-duration {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.track-actions {
    display: flex;
    justify-content: flex-end;
}

.track-like-btn, .track-more-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0;
    transition: all var(--transition);
}

.track-row:hover .track-like-btn,
.track-row:hover .track-more-btn { opacity: 1; }
.track-like-btn:hover, .track-more-btn:hover { color: var(--text-primary); }
.track-like-btn.liked { color: var(--accent); opacity: 1; }
.track-like-btn svg, .track-more-btn svg { width: 16px; height: 16px; }

.track-header {
    display: grid;
    grid-template-columns: 36px 1fr 1fr 80px 50px;
    gap: 16px;
    padding: 0 16px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.track-header span {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.track-header span:last-child { text-align: right; }

/* ===== Quick Play Row ===== */
.quick-play-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.quick-play-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: background var(--transition);
    height: 64px;
}

.quick-play-item:hover { background: var(--bg-hover); }

.quick-play-art {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.quick-play-art img { width: 100%; height: 100%; object-fit: cover; }

.quick-play-title {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 14px;
}

/* ===== Album/Playlist Detail ===== */
.detail-header {
    display: flex;
    gap: 32px;
    align-items: flex-end;
    margin-bottom: 36px;
}

.detail-artwork {
    width: 240px;
    height: 240px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.detail-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info {
    flex: 1;
    min-width: 0;
}

.detail-type {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
    margin-bottom: 8px;
}

.detail-title {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 12px;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.detail-meta .dot {
    width: 4px;
    height: 4px;
    background: var(--text-tertiary);
    border-radius: 50%;
}

.detail-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.detail-actions .icon-btn {
    width: 40px;
    height: 40px;
}

/* Artist Detail */
.artist-header {
    position: relative;
    height: 360px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 36px;
}

.artist-header-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center 30%;
    filter: brightness(0.4);
}

.artist-header-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg-primary) 0%, transparent 60%);
}

.artist-header-content {
    position: absolute;
    bottom: 32px;
    left: 36px;
}

.artist-verified {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 8px;
}

.artist-verified svg { width: 18px; height: 18px; }

.artist-header-name {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 8px;
}

.artist-header-stats {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Search Page ===== */
.genre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.genre-card {
    position: relative;
    height: 120px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.genre-card:hover { transform: scale(1.03); }

.genre-card-bg {
    position: absolute;
    inset: 0;
    opacity: 0.85;
}

.genre-card-title {
    position: absolute;
    bottom: 16px;
    left: 16px;
    font-size: 1.1rem;
    font-weight: 700;
}

/* Search Results */
.search-results { display: none; }
.search-results.visible { display: block; }
.search-genres.hidden { display: none; }

/* ===== Now Playing Bar ===== */
.now-playing-bar {
    grid-column: 1 / 3;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    z-index: 100;
    overflow: hidden;
    box-sizing: border-box;
    height: var(--player-height);
}

/* Scrubber row: time - bar - time, spans full width at TOP */
.np-scrubber {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px 0;
    box-sizing: border-box;
    flex-shrink: 0;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.np-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    width: 38px;
    flex: 0 0 38px;
    white-space: nowrap;
}

.np-time:first-child { text-align: right; }
.np-time:last-child { text-align: left; }

.np-scrubber-bar {
    flex: 1 1 0%;
    min-width: 0;
    height: 4px;
    background: var(--bg-active);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    transition: height 0.15s;
}

.np-scrubber-bar:hover { height: 6px; }

.np-scrubber-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--text-primary);
    border-radius: 2px;
    width: 0%;
    max-width: 100%;
    transition: background var(--transition);
}

.np-scrubber-bar:hover .np-scrubber-fill { background: var(--accent); }

.np-scrubber-handle {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

.np-scrubber-bar:hover .np-scrubber-handle { opacity: 1; }

/* Main row: track info / controls / extras */
.np-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    padding: 4px 20px 8px;
    flex: 1 1 0%;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.np-track-info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.np-artwork {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-radius 0.3s;
}

.np-artwork:hover { border-radius: var(--radius-md); }
.np-artwork img { width: 100%; height: 100%; object-fit: cover; }
.np-artwork svg { width: 28px; height: 28px; }

.np-details {
    min-width: 0;
}

.np-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.np-title:hover { text-decoration: underline; }

.np-artist {
    color: var(--text-tertiary);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.np-artist:hover { color: var(--text-secondary); text-decoration: underline; }

.np-like { flex-shrink: 0; }
.np-like.liked svg { fill: var(--accent); stroke: var(--accent); }

.np-controls {
    display: flex;
    align-items: center;
    justify-content: center;
}

.np-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
}

.control-btn svg { width: 18px; height: 18px; }
.control-btn.active { color: var(--accent); }

.play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--text-primary);
    border: none;
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition);
}

.play-btn:hover { transform: scale(1.06); }
.play-btn svg { width: 16px; height: 16px; }

/* Old progress bar classes kept for fullscreen player compatibility */
.progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-active);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    transition: height 0.15s;
    overflow: hidden;
}

.progress-bar:hover { height: 6px; }

.progress-fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: 2px;
    width: 0%;
    max-width: 100%;
    position: relative;
    transition: background var(--transition);
}

.progress-bar:hover .progress-fill { background: var(--accent); }

.progress-handle {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

.progress-bar:hover .progress-handle { opacity: 1; }

.np-extra {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.volume-slider {
    width: 90px;
    height: 4px;
    background: var(--bg-active);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.volume-fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: 2px;
    width: 70%;
}

.volume-slider:hover .volume-fill { background: var(--accent); }

.volume-handle {
    position: absolute;
    right: 30%;
    top: 50%;
    transform: translate(50%, -50%);
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition);
}

.volume-slider:hover .volume-handle { opacity: 1; }

/* ===== Full Screen Player ===== */
.fullscreen-player {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.fullscreen-player.open {
    opacity: 1;
    pointer-events: auto;
}

.fs-close {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 10;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.fs-close:hover { background: rgba(255,255,255,0.2); }
.fs-close svg { width: 20px; height: 20px; }

.fs-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(80px) brightness(0.3) saturate(1.5);
    transform: scale(1.2);
}

.fs-content {
    position: relative;
    text-align: center;
    max-width: 420px;
    width: 100%;
    padding: 20px;
    padding-top: 60px;
    padding-bottom: 40px;
}

.fs-artwork {
    width: 320px;
    height: 320px;
    margin: 0 auto 32px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--bg-tertiary);
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
}

.fs-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fs-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.fs-artist {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 28px;
}

.fs-progress { margin-bottom: 24px; }

.fs-progress-bar {
    height: 5px;
    margin-bottom: 8px;
}

.fs-times {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.fs-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.fs-play-btn {
    width: 60px;
    height: 60px;
}

.fs-play-btn svg { width: 24px; height: 24px; }
.fs-ctrl svg { width: 24px; height: 24px; }

.fs-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    margin-top: 16px;
}

.fs-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.fs-action-btn:hover {
    background: rgba(255,255,255,0.15);
    color: var(--text-primary);
}

.fs-action-btn.liked svg {
    fill: var(--accent);
    stroke: var(--accent);
}

/* ===== Queue Panel ===== */
.queue-panel {
    position: fixed;
    top: 0;
    right: -380px;
    width: 380px;
    height: calc(100vh - var(--player-height));
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 50;
    overflow-y: auto;
    transition: right 0.3s ease;
    padding: 24px;
}

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

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.queue-header h3 { font-size: 1.2rem; font-weight: 700; }

.queue-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.queue-track {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}

.queue-track:hover { background: var(--bg-hover); }

.queue-track-art {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.queue-track-art img { width: 100%; height: 100%; object-fit: cover; }

.queue-track-info { min-width: 0; flex: 1; }

.queue-track-title {
    font-weight: 500;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-track-artist {
    color: var(--text-tertiary);
    font-size: 0.78rem;
}

.queue-now { margin-bottom: 24px; }

/* ===== Context Menu ===== */
.context-menu {
    position: fixed;
    z-index: 2000;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    min-width: 200px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: none;
}

.context-menu.visible { display: block; }

.ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.ctx-item:hover { background: var(--bg-active); color: var(--text-primary); }
.ctx-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.ctx-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ===== Playlist Picker & Create Modal ===== */
.playlist-picker-overlay,
.playlist-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.playlist-picker-overlay.open,
.playlist-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.playlist-picker,
.playlist-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    width: 100%;
    max-width: 380px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
.playlist-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.playlist-picker-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.playlist-picker-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.playlist-picker-close:hover { color: var(--text-primary); background: var(--bg-active); }
.playlist-picker-close svg { width: 18px; height: 18px; }

.playlist-picker-create {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border);
    background: none;
    color: var(--accent);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    margin-bottom: 12px;
}
.playlist-picker-create:hover { background: var(--bg-active); border-color: var(--accent); }
.playlist-picker-create svg { width: 18px; height: 18px; }

.playlist-picker-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.playlist-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    text-align: left;
}
.playlist-picker-item:hover { background: var(--bg-active); color: var(--text-primary); }
.playlist-picker-item .pp-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.playlist-picker-item .pp-info { flex: 1; min-width: 0; }
.playlist-picker-item .pp-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.playlist-picker-item .pp-count {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.playlist-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}
.playlist-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.playlist-modal-actions .btn-secondary {
    background: var(--bg-active);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all var(--transition);
}
.playlist-modal-actions .btn-secondary:hover { color: var(--text-primary); }
.playlist-modal-actions .btn-primary {
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
}

/* Playlist page create button */
.playlist-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 24px;
}
.playlist-create-btn:hover { filter: brightness(1.1); }
.playlist-create-btn svg { width: 16px; height: 16px; }

/* Sidebar playlist items */
.sidebar-playlist-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-playlist-link:hover { color: var(--text-primary); background: var(--bg-active); }
.sidebar-playlist-link.active { color: var(--accent); }
.sidebar-playlist-link svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.6; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: calc(var(--player-height) + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--accent);
    color: var(--bg-primary);
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 3000;
    white-space: nowrap;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Favorites / Playlists Pages ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-tertiary);
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-tertiary);
    max-width: 320px;
}

/* ===== Equalizer animation ===== */
.eq-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
}

.eq-bar {
    width: 3px;
    background: var(--accent);
    border-radius: 1px;
    animation: eq 0.8s ease-in-out infinite alternate;
}

.eq-bar:nth-child(1) { height: 6px; animation-delay: 0s; }
.eq-bar:nth-child(2) { height: 10px; animation-delay: 0.2s; }
.eq-bar:nth-child(3) { height: 4px; animation-delay: 0.4s; }
.eq-bar:nth-child(4) { height: 12px; animation-delay: 0.1s; }

@keyframes eq {
    0% { height: 4px; }
    100% { height: 14px; }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    body { grid-template-columns: 220px 1fr; }
    :root { --sidebar-width: 220px; }
    .detail-artwork { width: 180px; height: 180px; }
    .detail-title { font-size: 2rem; }
    .hero-banner { height: 260px; }
    .hero-title { font-size: 2rem; }
}

@media (max-width: 768px) {
    body { grid-template-columns: 1fr; grid-template-rows: 1fr; overflow: hidden; }
    .sidebar { display: none; }
    .np-extra { display: none; }
    .np-main { grid-template-columns: 1fr auto; }
    .page { padding: 20px 16px 30px; }
    .detail-header { flex-direction: column; align-items: center; text-align: center; }
    .detail-actions { justify-content: center; }
    .track-header, .track-row { grid-template-columns: 30px 1fr 60px 40px; }
    .track-album-name { display: none; }
    .fs-artwork { width: 260px; height: 260px; }
}

/* ===== Auth Modal ===== */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.auth-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.auth-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    position: relative;
    text-align: center;
}

.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal-close:hover { color: var(--text-primary); }
.auth-modal-close svg { width: 18px; height: 18px; }

.auth-modal-logo {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.auth-modal h2 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.auth-modal-subtitle {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-field input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: border-color var(--transition);
}

.auth-field input:focus {
    border-color: var(--accent);
}

.auth-field input::placeholder { color: var(--text-tertiary); }

.auth-submit { margin-top: 4px; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-social {
    display: flex;
    gap: 12px;
}

.auth-social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--transition);
}

.auth-social-btn:hover { background: var(--bg-active); }

.auth-toggle {
    margin-top: 24px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.auth-toggle a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
}

.auth-toggle a:hover { text-decoration: underline; }

/* ===== Loading skeleton ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-active) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

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

/* ===== Capacitor / Native App Safe Areas ===== */
body {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.now-playing-bar {
    padding-bottom: env(safe-area-inset-bottom);
}

.sidebar {
    padding-top: env(safe-area-inset-top);
}

/* Prevent text selection and callouts in native app */
.capacitor-app {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Allow text selection in search input */
.capacitor-app #searchInput,
.capacitor-app .auth-field input {
    -webkit-user-select: text;
    user-select: text;
}

/* Mobile bottom nav for native app (replaces sidebar on mobile) */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 2000;
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    padding: 8px 0 4px;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 12px;
    transition: color var(--transition);
}

.mobile-nav-item svg {
    width: 22px;
    height: 22px;
}

.mobile-nav-item.active {
    color: var(--accent);
}

@media (max-width: 768px) {
    .mobile-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 2000;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-nav-items {
        display: flex;
        justify-content: space-around;
        width: 100%;
    }

    /* Now-playing bar sits above the mobile nav */
    .now-playing-bar {
        position: fixed;
        bottom: 56px; /* height of mobile-nav */
        bottom: calc(56px + env(safe-area-inset-bottom));
        left: 0;
        right: 0;
        z-index: 1999;
        height: var(--player-height);
    }

    /* Main content needs padding to not be hidden behind fixed bars */
    .page {
        padding-bottom: calc(var(--player-height) + 56px + 40px + env(safe-area-inset-bottom));
    }
}

/* Prevent iOS auto-zoom on input focus */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}
