:root {
    --bg-dark: #09090b;
    --bg-panel: #121215;
    --bg-card: #18181c;
    --bg-card-hover: #222228;
    --border-subtle: #27272e;
    --primary: #1db954;
    --primary-hover: #1ed760;
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #000000;
    border-right: 1px solid var(--border-subtle);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    padding: 0 8px 24px;
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: var(--primary);
    color: #000;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.brand strong {
    color: var(--primary);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px 14px;
    border-radius: 8px;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--text-main);
    background: var(--bg-card);
}

.nav-item.active {
    background: var(--bg-card-hover);
    color: var(--text-main);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 10px;
    background: var(--bg-panel);
    border-radius: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #eab308;
}

.dot.online {
    background: var(--primary);
}

/* Main Content */
.main-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #16161d 0%, var(--bg-dark) 35%);
    overflow-y: auto;
}

.topbar {
    padding: 20px 32px;
    position: sticky;
    top: 0;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(12px);
    z-index: 10;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.search-bar {
    display: flex;
    max-width: 560px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 4px 6px 4px 18px;
    transition: border-color 0.2s;
}

.search-bar:focus-within {
    border-color: var(--primary);
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
}

.search-bar button {
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 999px;
    padding: 9px 22px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.search-bar button:hover {
    background: var(--primary-hover);
}

.search-bar button:active {
    transform: scale(0.97);
}

.content-section {
    padding: 28px 32px 60px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.badge-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Grid de Músicas */
.tracks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 20px;
}

.track-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.track-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-3px);
}

.track-card.playing {
    border: 1px solid var(--primary);
}

.thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #101014;
}

.thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-play-overlay {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #000;
    display: grid;
    place-items: center;
    font-weight: bold;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.2s;
}

.track-card:hover .card-play-overlay,
.track-card.playing .card-play-overlay {
    opacity: 1;
    transform: translateY(0);
}

.duration-tag {
    position: absolute;
    left: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, 0.75);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-artist {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loader */
.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
    gap: 14px;
    color: var(--text-muted);
}

.loader.hidden {
    display: none;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Player Inferior */
.player-bar {
    height: 88px;
    background: #0d0d10;
    border-top: 1px solid var(--border-subtle);
    padding: 0 24px;
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    align-items: center;
    gap: 16px;
}

.player-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.player-left img {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
}

.track-info {
    min-width: 0;
    flex: 1;
}

.track-title {
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    transition: color 0.2s;
}

.icon-btn:hover:not(:disabled) {
    color: var(--text-main);
}

.icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.icon-btn.liked {
    color: var(--primary);
}

.player-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 20px;
}

.play-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--text-main);
    color: #000;
    border: none;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.15s, background 0.15s;
}

.play-circle:hover {
    transform: scale(1.06);
    background: var(--primary);
}

.progress-container {
    width: 100%;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

input[type="range"] {
    accent-color: var(--primary);
    cursor: pointer;
    height: 4px;
}

#seek-slider {
    flex: 1;
}

.player-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

#volume-slider {
    width: 100px;
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .player-bar {
        grid-template-columns: 1fr 1fr;
    }
    .player-right {
        display: none;
    }
}