:root {
    --bg-color: #121212;
    --card-bg: #181818;
    --card-hover: #282828;
    --primary-color: #1db954;
    /* Green accent like Spotify */
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --nav-bg: rgba(18, 18, 18, 0.95);
    --sidebar-bg: #000000;
    --player-bg: #181818;
    --border-color: #282828;
    --nav-height: 60px;
    --player-height: 90px;
    --font-main: 'Outfit', sans-serif;
    --transition: 0.3s ease;
}

.light-mode {
    --bg-color: #ffffff;
    --card-bg: #f4f4f4;
    --card-hover: #e0e0e0;
    --primary-color: #1db954;
    --text-primary: #121212;
    --text-secondary: #555555;
    --nav-bg: rgba(255, 255, 255, 0.95);
    --sidebar-bg: #f9f9f9;
    --player-bg: #ffffff;
    --border-color: #dadada;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden;
    /* Prevent body scroll, handle in main */
    height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Muted Notification Helper */
#mute-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-weight: 500;
    animation: slideInDown 0.5s ease-out, pulse 2s infinite;
    cursor: pointer;
}

@keyframes slideInDown {
    from {
        transform: translate(-50%, -100px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: translate(-50%, 0) scale(1);
    }

    50% {
        transform: translate(-50%, 0) scale(1.05);
    }

    100% {
        transform: translate(-50%, 0) scale(1);
    }
}

.flex {
    display: flex;
}

.grid {
    display: grid;
}

/* App Layout */
#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: calc(var(--player-height) + var(--nav-height) + 20px);
    /* Space for fixed elements */
    scrollbar-width: thin;
    scrollbar-color: var(--card-hover) var(--bg-color);
}

/* Views */
.view {
    padding: 20px;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
    display: none;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Scroll Containers */
.horizontal-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-behavior: smooth;
}

.vertical-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Typography & Headers */
h1 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.section-title {
    margin: 24px 0 16px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Components: Chips */
.categories-scroll {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.chip {
    background: var(--card-bg);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: var(--transition);
}

.chip.active {
    background: var(--text-primary);
    color: var(--bg-color);
    font-weight: 500;
}

/* Components: Cards */
.card {
    background: var(--card-bg);
    min-width: 150px;
    padding: 16px;
    border-radius: 8px;
    transition: var(--transition);
    cursor: pointer;
}

.card:hover {
    background: var(--card-hover);
}

.card img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Row Layout for Vertical Lists (Trending/Library) */
.vertical-list .card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 10px;
    min-width: auto;
    /* Reset min-width */
}

.vertical-list .card img {
    width: 60px;
    height: 60px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.vertical-list .card h3 {
    margin-bottom: 4px;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Search */
.search-header {
    margin-bottom: 20px;
}

.search-box {
    background: var(--card-bg);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 4px;
    gap: 10px;
    border: 1px solid var(--border-color);
}

.search-box input {
    border: none;
    outline: none;
    font-size: 1rem;
    width: 100%;
    background: transparent;
    color: var(--text-primary);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

/* Player Bar */
.player-bar {
    position: fixed;
    bottom: var(--nav-height);
    left: 0;
    right: 0;
    height: var(--player-height);
    background: var(--player-bg);
    border-top: 1px solid var(--border-color);
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(10px);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.player-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 15px;
    /* Smaller gap for mobile */
}

.track-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    /* Flexible on mobile */
    min-width: 0;
    /* Allow shrinking */
    overflow: hidden;
}

.track-info img {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    flex-shrink: 0;
}

.track-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.track-text h4 {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress bar at the top on Mobile */
.progress-container-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    /* Still small on mobile top */
    padding: 0;
    display: flex;
    align-items: center;
}

#time-current,
#time-duration {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: none;
    /* Hidden on mobile top bar for simplicity */
}

.progress-container {
    height: 100%;
    background: rgba(85, 85, 85, 0.3);
    width: 100%;
    position: relative;
    cursor: pointer;
}

.controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
    order: 2;
    /* Put controls on the right */
}

.icon-btn i {
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.icon-btn:hover i {
    color: var(--text-primary);
}

.play-main {
    background: var(--text-primary);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-main i {
    color: var(--bg-color);
    font-size: 1rem;
    margin-left: 2px;
    /* Visual center fix */
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    /* Use primary color for progress */
    width: 0%;
    transition: width 0.1s linear;
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 80px;
}

.volume-control i {
    font-size: 0.9rem;
    color: var(--text-secondary);
    width: 16px;
}

.volume-slider-container {
    flex: 1;
    height: 4px;
    background: rgba(100, 100, 100, 0.3);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.volume-slider-fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: 2px;
    width: 100%;
    position: relative;
}

.volume-slider-fill::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.volume-control:hover .volume-slider-fill::after {
    opacity: 1;
}

@media (max-width: 480px) {
    .volume-control {
        display: none;
        /* Hide on very small screens to save space */
    }
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: var(--nav-height);
    background: var(--nav-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-color);
    z-index: 100;
    backdrop-filter: blur(10px);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    gap: 4px;
    width: 100%;
    height: 100%;
    justify-content: center;
    transition: color 0.2s;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item span {
    font-size: 0.7rem;
}

.nav-item.active {
    color: var(--text-primary);
}

/* Responsive */
@media (min-width: 768px) {
    #app {
        flex-direction: row;
        /* Sidebar on left, Content on right */
    }

    .bottom-nav {
        position: relative;
        /* Not fixed/static alone, part of flex flow */
        width: 240px;
        height: 100vh;
        /* Full height */
        background: var(--sidebar-bg);
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 40px;
        align-items: flex-start;
        border-right: 1px solid var(--border-color);
        border-top: none;
        order: -1;
        /* Move to start (left) */
        flex-shrink: 0;
        transition: background 0.3s ease, border-color 0.3s ease;
    }

    .nav-item {
        flex-direction: row;
        width: 100%;
        height: 50px;
        padding: 0 24px;
        justify-content: flex-start;
        gap: 16px;
        border-radius: 4px;
        /* Hover effect feel */
        margin: 0 10px;
        /* Little spacing side */
        width: calc(100% - 20px);
    }

    .nav-item:hover {
        background-color: var(--card-hover);
        color: var(--text-primary);
    }

    .nav-item span {
        font-size: 1rem;
        font-weight: 700;
    }

    /* Player Bar needs to stay fixed at bottom right */
    .player-bar {
        left: 240px;
        /* Start after sidebar */
        width: calc(100% - 240px);
        bottom: 0;
    }

    .content {
        flex: 1;
        height: 100vh;
        overflow-y: auto;
        padding-bottom: 100px;
        /* Player height + buffer */
    }

    /* Progress bar in the center only on Desktop */
    .progress-container-wrapper {
        position: static;
        flex: 1;
        padding: 0 30px;
        height: auto;
        display: flex;
        gap: 12px;
    }

    #time-current,
    #time-duration {
        display: block;
        min-width: 35px;
    }

    .progress-container {
        height: 6px;
        border-radius: 3px;
    }

    .track-info {
        flex: 0 0 250px;
    }
}

/* Full Player Overlay */
.full-player-overlay {
    position: fixed;
    top: 100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f0b08;
    background: linear-gradient(180deg, #1d140e 0%, #000000 100%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transition: top 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    color: #fff;
    overflow: hidden;
}

.full-player-overlay.active {
    top: 0;
}

.player-bar {
    cursor: pointer;
    /* Indicar que é clicável */
    transition: background 0.2s;
}

.player-bar:hover {
    background: var(--nav-bg);
}

.full-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
}

.player-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2px;
}

.toggle-btn {
    padding: 6px 16px;
    border-radius: 18px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ccc;
    background: transparent;
    border: none;
    cursor: pointer;
}

.toggle-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.full-player-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    /* Empurra os itens para as extremidades */
    padding: 20px 25px 40px;
    /* Padding no topo e base */
    overflow-y: auto;
}

.artwork-container {
    width: 100%;
    max-width: 450px;
    /* Aumentado de 400px */
    aspect-ratio: 1;
    margin: 0;
    /* Removido margem para usar o justify-content */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (min-width: 992px) {
    .artwork-container {
        max-width: 800px;
        /* Mais largo no Desktop */
    }
}

.artwork-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#youtube-player {
    width: 100%;
    height: 100%;
    display: none;
}

.artwork-container.video-active {
    max-width: 80%;
    /* Diminuído de 90% */
    aspect-ratio: 4/3;
    /* Mais alto (era 16/9) */
}

.artwork-container.video-active img {
    display: none;
}

.artwork-container.video-active #youtube-player {
    display: block;
}

.metadata-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.track-details h1 {
    font-size: 1.4rem;
    margin-bottom: 4px;
    font-weight: 700;
}

.track-details p {
    font-size: 1rem;
    color: #aaa;
}


.progress-section {
    width: 100%;
    margin-bottom: 30px;
}

.progress-bar-container {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 0%;
}

.progress-knob {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    left: 0%;
}

.progress-times {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #aaa;
}

.playback-controls {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    /* Margem reduzida */
}

.play-trigger {
    width: 70px;
    height: 70px;
    background: #fff;
    color: #000;
    border-radius: 50%;
    border: none;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.play-trigger:active {
    transform: scale(0.9);
}

.playback-controls .icon-btn.large {
    font-size: 2rem;
}


.full-volume-control {
    width: 100%;
    max-width: 280px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.full-volume-control .volume-slider-container {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.full-volume-control .volume-fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 60%;
}

.full-volume-control i {
    color: #aaa;
    font-size: 0.9rem;
    cursor: pointer;
}

.track-info {
    flex: 0 0 250px;
}