/* =====================================================
   BAITAI — FINAL POLISH
   LAST + ARTIST HERO
===================================================== */

/* ------------------------------
   LAST — mateixa escala que Àlbums
------------------------------ */

.listsScreen {
    box-sizing: border-box;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding:
        4px
        14px
        calc(
            var(--miniPlayerHeight, 54px) +
            var(--bottomMenuHeight, 50px) +
            var(--nativeBottomInset, 46px) +
            34px
        );
}

.listsScreen h1 {
    margin: 0 0 8px;
    color: #fff;
    font-family: "Montserrat", sans-serif;
    font-size: 20px;
    font-weight: 750;
    line-height: 1.1;
    text-align: left;
}

#listeningHistoryList {
    box-sizing: border-box;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#listeningHistoryList .historyItem {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 6px 0;
    display: grid;
    grid-template-columns:
        78px
        minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

#listeningHistoryList .historyCover {
    width: 78px;
    height: 78px;
    min-width: 78px;
    border-radius: 4px;
    object-fit: cover;
}

#listeningHistoryList .historyInfo {
    min-width: 0;
}

#listeningHistoryList .historyTitle {
    font-size: 15px;
    font-weight: 600;
    line-height: 19px;
}

#listeningHistoryList .historySubtitle {
    margin-top: 3px;
    font-size: 12px;
    line-height: 16px;
}

/* ------------------------------
   ARTIST — imatge a sang
------------------------------ */

#artistStickyHeader {
    box-sizing: border-box;
    width: 100vw;
    max-width: none;
    margin-left:
        calc(
            50% - 50vw
        );
}

#artistStickyHeader
#artistHeroContainer {
    box-sizing: border-box;
    width: 100vw;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#artistStickyHeader
#artistHeroImage {
    display: block;
    width: 100vw;
    max-width: none;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    object-fit: cover;
}

/* Manté les accions alineades amb la llista. */
#artistStickyHeader
#artistActions {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding-left: 14px;
    padding-right: 14px;
}

@media (max-width: 370px) {
    #listeningHistoryList .historyItem {
        grid-template-columns:
            72px
            minmax(0, 1fr);
    }

    #listeningHistoryList .historyCover {
        width: 72px;
        height: 72px;
        min-width: 72px;
    }
}

/* =====================================================
   BAITAI 3.0 — SPOTIFY-STYLE LIBRARY LANDING
===================================================== */

:root {
    --libraryHeaderHeight: 0px;
    --libraryTabsHeight: 56px;
    --libraryContentGap: 8px;
}

.libraryHeader {
    display: none !important;
}

.libraryTopRow {
    box-sizing: border-box;
    width: 100%;
    max-width: 520px;
    height: var(--libraryTabsHeight);
    margin: 0 auto;
    padding: 8px 15px 7px 18px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    align-items: center;
    gap: 10px;
    background: var(--themeBackground);
}

#topMenu {
    width: 100%;
    height: 41px !important;
    min-height: 41px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    gap: 8px !important;
    overflow: visible !important;
}

.topMenuButton {
    min-width: 0 !important;
    max-width: none !important;
    height: 31px !important;
    padding: 0 15px !important;
    border-radius: 999px !important;
    background: #292929 !important;
    color: #f2f2f2 !important;
    font-family: "Montserrat", Arial, sans-serif !important;
    font-size: 11px !important;
    font-weight: 650 !important;
    line-height: 31px !important;
}

.topMenuButton.active {
    background: var(--mainTheme) !important;
    color: #071014 !important;
}

#librarySettingsButton {
    position: static !important;
    inset: auto !important;
    width: 36px !important;
    height: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #fff !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#librarySettingsButton .svgIcon,
#librarySettingsButton svg {
    width: 29px !important;
    height: 29px !important;
    margin: 0 !important;
    color: currentColor;
    fill: currentColor;
}

#homeSettingsMenu {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    z-index: 200450 !important;
}

#appTopChrome::after {
    height: var(--libraryContentGap) !important;
}

body:has(#appTopChrome:not(.hidden)) .container-main,
body:has(#appTopChrome:not(.hidden)) .filter-container {
    transform: translateY(
        calc(
            var(--nativeTopInset) +
            var(--libraryTabsHeight) +
            var(--libraryContentGap)
        )
    ) !important;
}

body:has(#globalSearchWrap.open) .container-main,
body:has(#globalSearchWrap.open) .filter-container {
    transform: translateY(
        calc(
            var(--nativeTopInset) +
            var(--libraryTabsHeight) +
            var(--libraryContentGap) +
            52px
        )
    ) !important;
}

/* El menú inferior queda exactament amb Biblioteca, Cerca i Enrere. */
#bottomMenu .menuButton {
    width: 33.3333% !important;
    flex: 1 1 33.3333% !important;
}

body.library-home-mode #bottomMenu #menuLibrary {
    color: var(--mainTheme) !important;
    --icon: var(--mainTheme) !important;
}

/* Portada de Biblioteca. */
.libraryLandingScreen {
    box-sizing: border-box;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding:
        0 16px
        calc(
            var(--miniPlayerHeight, 54px) +
            var(--bottomMenuHeight, 50px) +
            var(--nativeBottomInset, 46px) +
            60px
        );
    color: #fff;
}

.homeRecentGrid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 9px;
}

.homeRecentCard {
    box-sizing: border-box;
    min-width: 0;
    height: 48px;
    margin: 0;
    padding: 0 8px 0 0;
    border: 0;
    border-radius: 5px;
    background: #282828;
    color: #fff;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}

.homeRecentCard:active {
    transform: scale(.985);
    background: #323232;
}

.homeRecentCover {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: cover;
    background: #1c1c1c;
}

.homeRecentTitle {
    min-width: 0;
    display: -webkit-box;
    overflow: hidden;
    color: #fff;
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.homeRecentEmpty {
    grid-column: 1 / -1;
    min-height: 102px;
    padding: 18px;
    border-radius: 8px;
    background: #1d1d1d;
    color: rgba(255,255,255,.58);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 17px;
    text-align: center;
}

.homeRecommendation {
    box-sizing: border-box;
    width: 100%;
    margin-top: 22px;
    padding: 9px;
    border-radius: 17px;
    background: #282828;
}

.homeRecommendationHero {
    height: clamp(136px, 38vw, 150px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 11px;
    background: #171717;
    overflow: hidden;
    cursor: pointer;
}

.homeRecommendationHero img {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    object-fit: contain;
    object-position: center;
}

.homeRecommendationFooter {
    min-height: 48px;
    padding: 6px 3px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.homeRecommendationArtist {
    min-width: 0;
    overflow: hidden;
    color: #fff;
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#homeRecommendationPlay {
    flex: 0 0 auto;
    min-width: 104px;
    height: 33px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #111;
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
}

#homeRecommendationPlay:active {
    transform: scale(.96);
}

/* Llistes arrel: preservem Crea sense ocupar el menú dissenyat. */
.personalListsToolbar {
    width: 100%;
    margin: 0 0 9px;
    display: flex;
    justify-content: flex-end;
}

#libraryCreateButton {
    min-width: 0 !important;
    height: 32px !important;
    padding: 0 13px !important;
}

/* Música i pòdcasts: escala i informació de la maqueta. */
.libraryArtistRow,
.podcastLibraryRow {
    grid-template-columns: 96px minmax(0, 1fr) auto !important;
    gap: 14px !important;
    padding: 7px 0 !important;
}

.libraryArtistRowImage,
.podcastLibraryRowImage {
    width: 96px !important;
    height: 96px !important;
    border-radius: 5px !important;
}

.libraryArtistRowName,
.podcastLibraryRowTitle {
    font-size: 17px !important;
    font-weight: 500 !important;
    line-height: 21px !important;
}

.libraryArtistRowMeta,
.podcastLibraryRowSubtitle {
    margin-top: 3px;
    color: rgba(255,255,255,.78) !important;
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 12px !important;
    font-weight: 450;
    line-height: 16px !important;
}

.personalListRow {
    grid-template-columns: 82px minmax(0, 1fr) !important;
    gap: 14px !important;
}

.personalListArtwork {
    width: 82px !important;
    height: 82px !important;
}

#continueTitle {
    display: block;
}

body:has(#playerScreen) #continueTitle {
    display: none;
}

@media (max-width: 370px) {
    .libraryTopRow {
        padding-right: 10px;
        padding-left: 12px;
        gap: 6px;
    }

    #topMenu {
        gap: 6px !important;
    }

    .topMenuButton {
        padding: 0 11px !important;
        font-size: 10px !important;
    }

    .libraryLandingScreen {
        padding-right: 12px;
        padding-left: 12px;
    }

    .homeRecentGrid {
        gap: 6px;
    }

    .homeRecentCard {
        height: 46px;
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 7px;
    }

    .homeRecentCover {
        width: 46px;
        height: 46px;
    }

    .homeRecentTitle {
        font-size: 11px;
        line-height: 15px;
    }

    .homeRecommendation {
        margin-top: 24px;
    }

    .libraryArtistRow,
    .podcastLibraryRow {
        grid-template-columns: 88px minmax(0, 1fr) auto !important;
    }

    .libraryArtistRowImage,
    .podcastLibraryRowImage {
        width: 88px !important;
        height: 88px !important;
    }
}

/* =====================================================
   ALBUM TRACKS — TRACK NUMBER + LIVE ACTIVE TRACK
===================================================== */

.spotifyAlbumTrackCompact {
    grid-template-columns:
        24px
        minmax(0, 1fr)
        auto
        36px
        32px !important;
    gap: 8px !important;
}

.spotifyAlbumTrackNumber {
    width: 24px;
    justify-self: start;

    color: rgba(255, 255, 255, .56);
    font-family: "Montserrat", sans-serif;
    font-size: 14px;
    font-weight: 430;
    line-height: 18px;
    text-align: left;
}

.spotifyAlbumTrack.playing
.spotifyAlbumTrackNumber {
    color: var(--mainTheme);
}

.spotifyAlbumTrack.playing
.spotifyAlbumTrackTitle {
    color: var(--mainTheme) !important;
}

@media (max-width: 370px) {
    .spotifyAlbumTrackCompact {
        grid-template-columns:
            21px
            minmax(0, 1fr)
            auto
            34px
            30px !important;
        gap: 7px !important;
    }

    .spotifyAlbumTrackNumber {
        width: 21px;
        font-size: 13px;
    }
}

/* =====================================================
   BAITAI 3.1 — SETTINGS TRANSITION + TAB ALIGNMENT
===================================================== */

.topMenuButton {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    text-align: center !important;
}

.homeRecommendation {
    transform-origin: center center;
    transition:
        opacity .28s ease,
        transform .42s cubic-bezier(.2,.85,.25,1),
        filter .32s ease;
}

body.library-settings-open .homeRecommendation {
    opacity: 0;
    filter: blur(7px);
    transform:
        translateY(18px)
        scale(.78);
    pointer-events: none;
}

body.library-home-mode #homeSettingsMenu {
    box-sizing: border-box;
    width: min(338px, calc(100vw - 52px)) !important;
    height: 220px !important;
    padding: 25px 22px !important;
    border: 1px solid rgba(255,255,255,.045);
    border-radius: 17px;
    background: #282828;
    box-shadow: 0 18px 46px rgba(0,0,0,.42);
    overflow: visible;
    transition:
        opacity .28s ease,
        transform .42s cubic-bezier(.2,.85,.25,1) !important;
}

body.library-home-mode #homeSettingsMenu.closed {
    opacity: 0;
    transform:
        translate(-50%, -42%)
        scale(.76) !important;
}

body.library-home-mode #homeSettingsMenu.open {
    opacity: 1;
    transform:
        translate(-50%, -50%)
        scale(1) !important;
    transition-delay: .08s !important;
}

body.library-home-mode #settingsReload {
    top: 26px;
}

body.library-home-mode #settingsTheme {
    top: 125px;
}

body.library-home-mode #homeSettingsMenu .settingsOption span {
    display: block !important;
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
}

body.library-home-mode #homeSettingsMenu .settingsOption .svgIcon,
body.library-home-mode #homeSettingsMenu .settingsOption svg {
    width: 32px;
    height: 32px;
}

body.library-home-mode #homeSettingsMenu.theme-mode #settingsTheme {
    top: 24px;
}

body.library-home-mode #themeMenu {
    top: 70px;
}

body.library-home-mode #reloadMenu {
    top: 48px;
}

@media (prefers-reduced-motion: reduce) {
    .homeRecommendation,
    body.library-home-mode #homeSettingsMenu {
        transition-duration: .01ms !important;
    }
}

/* =====================================================
   BAITAI 3.2 — CONTINUE LISTENING FADE
===================================================== */

#continueTitle {
    box-sizing: border-box;
    height: 52px;
    bottom: calc(
        var(--nativeBottomInset, 46px) +
        var(--bottomMenuHeight, 50px) +
        var(--miniPlayerHeight, 54px)
    ) !important;
    padding: 27px 12px 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0) 0%,
        rgba(0,0,0,.58) 43%,
        #000 78%,
        #000 100%
    );
    display: flex;
    align-items: flex-start;
    justify-content: center;
    line-height: 18px;
    text-shadow: 0 1px 8px #000;
    z-index: 100001 !important;
}

#nowPlaying::before {
    display: none !important;
}

.libraryArtistsSection,
.podcastLibrarySection,
.personalListsScreen,
.libraryLandingScreen {
    padding-bottom: calc(
        var(--miniPlayerHeight, 54px) +
        var(--bottomMenuHeight, 50px) +
        var(--nativeBottomInset, 46px) +
        78px
    ) !important;
}

/* =====================================================
   BAITAI 4.0 — STANDALONE SETTINGS SCREEN
===================================================== */

.standaloneSettingsScreen {
    box-sizing: border-box;
    width: 100%;
    max-width: 520px;
    min-height: 100vh;
    margin: 0 auto;
    padding:
        calc(var(--nativeTopInset, 54px) + 28px)
        18px
        calc(
            var(--miniPlayerHeight, 54px) +
            var(--bottomMenuHeight, 50px) +
            var(--nativeBottomInset, 46px) +
            78px
        );
    color: #fff;
    animation: standaloneSettingsIn .32s cubic-bezier(.2,.8,.2,1) both;
}

.standaloneSettingsScreen > h1 {
    margin: 0 0 34px;
    color: #fff;
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 25px;
    font-weight: 750;
    line-height: 1;
    letter-spacing: 3px;
    text-align: center;
}

.standaloneSettingsCard {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid rgba(255,255,255,.045);
    border-radius: 17px;
    background: #242424;
    box-shadow: 0 14px 32px rgba(0,0,0,.28);
}

.standaloneReloadCard {
    min-height: 112px;
    padding: 19px 14px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.standaloneSettingsIcon {
    width: 44px;
    height: 44px;
    color: var(--mainTheme);
    display: flex;
    align-items: center;
    justify-content: center;
}

.standaloneSettingsIcon .svgIcon,
.standaloneSettingsIcon svg {
    width: 38px;
    height: 38px;
    margin: 0;
    color: currentColor;
    fill: currentColor;
}

.standaloneSettingsCopy {
    min-width: 0;
}

.standaloneSettingsCard h2 {
    margin: 0;
    color: #fff;
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 17px;
    font-weight: 650;
    line-height: 21px;
}

.standaloneSettingsCard p {
    margin: 7px 0 0;
    color: rgba(255,255,255,.64);
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 11px;
    font-weight: 420;
    line-height: 16px;
}

.standaloneSettingsAction {
    min-width: 102px;
    height: 39px;
    padding: 0 15px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #111;
    font-family: "Montserrat", Arial, sans-serif;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.standaloneSettingsAction:active {
    transform: scale(.96);
}

.standaloneSettingsAction:disabled {
    opacity: .62;
}

.standaloneThemeCard {
    min-height: 158px;
    margin-top: 15px;
    padding: 24px 22px 22px;
}

.standaloneThemeSwatches {
    width: 100%;
    margin-top: 23px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    align-items: center;
    gap: 10px;
}

.standaloneThemeSwatch.themeColorButton {
    width: 34px;
    height: 34px;
    margin: 0 auto;
    border-radius: 50%;
    box-shadow: none;
}

.standaloneThemeSwatch.themeColorButton.active {
    box-shadow:
        0 0 0 2px #242424,
        0 0 0 4px #fff;
}

@keyframes standaloneSettingsIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.985);
    }

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

@media (max-width: 370px) {
    .standaloneSettingsScreen {
        padding-right: 14px;
        padding-left: 14px;
    }

    .standaloneSettingsScreen > h1 {
        margin-bottom: 28px;
        font-size: 22px;
        letter-spacing: 2.5px;
    }

    .standaloneReloadCard {
        padding-right: 12px;
        padding-left: 12px;
        grid-template-columns: 38px minmax(0, 1fr) auto;
        gap: 9px;
    }

    .standaloneSettingsIcon {
        width: 38px;
        height: 38px;
    }

    .standaloneSettingsIcon .svgIcon,
    .standaloneSettingsIcon svg {
        width: 34px;
        height: 34px;
    }

    .standaloneSettingsCard h2 {
        font-size: 15px;
        line-height: 19px;
    }

    .standaloneSettingsCard p {
        font-size: 10px;
        line-height: 14px;
    }

    .standaloneSettingsAction {
        min-width: 88px;
        padding: 0 11px;
        font-size: 10px;
    }

    .standaloneThemeCard {
        padding-right: 18px;
        padding-left: 18px;
    }

    .standaloneThemeSwatches {
        gap: 7px;
    }

    .standaloneThemeSwatch.themeColorButton {
        width: 30px;
        height: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .standaloneSettingsScreen {
        animation-duration: .01ms;
    }
}

/* =====================================================
   BAITAI 4.5 — FULL-WIDTH RECOMMENDATION CARD
===================================================== */

body.library-home-mode .homeRecommendation {
    width: 100% !important;
    margin: 18px auto 0 !important;
    padding: 9px !important;
    border-radius: 17px !important;
    background: #282828 !important;
}

body.library-home-mode .homeRecommendationHero {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 auto !important;
    display: block !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    background: transparent !important;
}

body.library-home-mode .homeRecommendationHero img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center !important;
    border-radius: 10px !important;
}

body.library-home-mode .homeRecommendationFooter {
    width: 100% !important;
    min-height: 43px !important;
    margin: 0 auto !important;
    padding: 6px 3px 0 !important;
}

body.library-home-mode .homeRecommendationArtist {
    font-size: 12px !important;
    line-height: 16px !important;
    font-weight: 500 !important;
}

body.library-home-mode #homeRecommendationPlay {
    min-width: 90px !important;
    height: 29px !important;
    padding: 0 12px !important;
    font-size: 10px !important;
}
