/* Bazarestan multi-mode integration layer: shop / music / download */
:root{--bz-cm-player-safe-bottom:74px;--bz-cm-header-safe-top:72px;--bz-cm-accent:#0a84ff;--bz-cm-bg:#f5f7fb;--bz-cm-card:#fff;--bz-cm-text:#111827;--bz-cm-muted:#667085;}
body.bazarestan-content-mode-compat{font-family:inherit;}
body.bazarestan-content-mode-compat .ha-mp-page,
body.bazarestan-content-mode-compat .ha-mp-app,
body.bazarestan-content-mode-compat .ha-mp-global-player,
body.bazarestan-content-mode-compat .ha-mp-modal,
body.bazarestan-content-mode-compat .ha-mp-toast,
body.bazarestan-content-mode-compat .bbfi-font-page,
body.bazarestan-content-mode-compat .bbfi-download-box,
body.bazarestan-content-mode-compat .bbfi-fonts-grid,
body.bazarestan-content-mode-compat .type-befont_font{font-family:inherit!important;}

/* Hide storefront/cart chrome only outside shop mode. */
body.bazarestan-site-mode-music a[href*="/cart"],
body.bazarestan-site-mode-music a[href*="/checkout"],
body.bazarestan-site-mode-music .cart-items,
body.bazarestan-site-mode-music .actions li:has(.cart-items),
body.bazarestan-site-mode-music .actions li:has(a[href*="/cart"]),
body.bazarestan-site-mode-music .actions li:has(a[href*="/checkout"]),
body.bazarestan-site-mode-music .bottom-navigation a[href*="/cart"],
body.bazarestan-site-mode-music .bottom-navigation a[href*="/checkout"],
body.bazarestan-site-mode-download a[href*="/cart"],
body.bazarestan-site-mode-download a[href*="/checkout"],
body.bazarestan-site-mode-download .cart-items,
body.bazarestan-site-mode-download .actions li:has(.cart-items),
body.bazarestan-site-mode-download .actions li:has(a[href*="/cart"]),
body.bazarestan-site-mode-download .actions li:has(a[href*="/checkout"]),
body.bazarestan-site-mode-download .bottom-navigation a[href*="/cart"],
body.bazarestan-site-mode-download .bottom-navigation a[href*="/checkout"]{display:none!important;visibility:hidden!important;pointer-events:none!important;}

/* Native/plugin content stage inside the SSR chrome. */
#bz-content-spa-stage{direction:rtl;width:100%;min-height:50vh;box-sizing:border-box;}
#bz-content-spa-stage[hidden]{display:none!important;}
body.bz-content-spa-native #app{display:block!important;visibility:visible!important;}
body.bz-content-spa-native #app[hidden]{display:block!important;visibility:visible!important;}
body.bz-content-spa-native #app .base-layout>main,
body.bazarestan-content-native #app .base-layout>main{display:block!important;min-height:54vh;}
body.bz-content-spa-native #app .base-layout>main>*:not(#bz-content-spa-stage),
body.bazarestan-content-native #app .base-layout>main>*:not(#bz-content-spa-stage){display:none!important;}
#app .base-layout>main>#bz-content-spa-stage{display:block;}
body.bazarestan-content-native #bz-content-spa-stage{display:block!important;visibility:visible!important;}
body.bz-content-spa-native #bz-content-spa-stage .ha-mp-page,
body.bz-content-spa-native #bz-content-spa-stage .bbfi-font-page,
body.bz-content-spa-native #bz-content-spa-stage .site-main{margin-top:0;}
body.bazarestan-content-native>main.ha-mp-page,
body.bazarestan-content-native>div.ha-mp-page,
body.bazarestan-content-native>main.site-main{max-width:none;}
body.bazarestan-content-mode-compat .ha-mp-page{padding-top:clamp(12px,2vw,24px);}
body.bazarestan-content-mode-compat .ha-mp-container,
body.bazarestan-content-mode-compat .bbfi-font-page,
body.bazarestan-content-mode-compat #bz-content-spa-stage>main.site-main{width:min(1180px,100% - 24px);margin-inline:auto;}

/* Keep the music player above theme bottom navigation. */
body.bazarestan-site-mode-music{--ha-mp-bottom-offset:16px;}
body.bazarestan-site-mode-music.ha-mp-has-global-player .ha-mp-global-player,
body.bazarestan-site-mode-music .ha-mp-global-player{z-index:99970!important;bottom:calc(var(--bz-cm-player-safe-bottom,74px) + env(safe-area-inset-bottom,0px))!important;}
@media(min-width:993px){body.bazarestan-site-mode-music .ha-mp-global-player{bottom:18px!important;}}
@media(max-width:992px){body.bazarestan-site-mode-music .bottom-navigation{z-index:99920!important;}body.bazarestan-site-mode-music.ha-mp-has-global-player{padding-bottom:calc(var(--bz-cm-player-safe-bottom,74px) + 104px + env(safe-area-inset-bottom,0px))!important;}}


/* Non-shop bottom navigation: after removing the cart item, keep the remaining 3 icons perfectly centered. */
@media(max-width:992px){
  body.bazarestan-site-mode-music .bottom-navigation ul,
  body.bazarestan-site-mode-download .bottom-navigation ul{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    justify-content:initial!important;
    justify-items:center!important;
    align-items:center!important;
    width:100%!important;
  }
  body.bazarestan-site-mode-music .bottom-navigation ul>li,
  body.bazarestan-site-mode-download .bottom-navigation ul>li{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:100%!important;
    min-width:0!important;
  }
  body.bazarestan-site-mode-music .bottom-navigation ul>li:nth-child(4),
  body.bazarestan-site-mode-download .bottom-navigation ul>li:nth-child(4),
  body.bazarestan-site-mode-music .bottom-navigation ul>li.bz-cm-bottom-cart-item,
  body.bazarestan-site-mode-download .bottom-navigation ul>li.bz-cm-bottom-cart-item,
  body.bazarestan-site-mode-music .bottom-navigation ul>li:has(a[href*="/cart"]),
  body.bazarestan-site-mode-music .bottom-navigation ul>li:has(a[href*="/checkout"]),
  body.bazarestan-site-mode-download .bottom-navigation ul>li:has(a[href*="/cart"]),
  body.bazarestan-site-mode-download .bottom-navigation ul>li:has(a[href*="/checkout"]){
    display:none!important;
  }
  body.bazarestan-site-mode-music .bottom-navigation ul>li a,
  body.bazarestan-site-mode-music .bottom-navigation ul>li button,
  body.bazarestan-site-mode-download .bottom-navigation ul>li a,
  body.bazarestan-site-mode-download .bottom-navigation ul>li button{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    margin:0!important;
  }
}

/* SPA/native route loading uses the theme full-page loader. */
body.bz-content-spa-loading{cursor:progress;}

/* Latest playlists/fonts on home. */
.bz-cm-home-section{max-width:1180px;margin:28px auto 42px;padding:0 16px;direction:rtl;font-family:inherit;}
.bz-cm-home-section__head{display:flex;align-items:end;justify-content:space-between;gap:16px;margin-bottom:16px;}
.bz-cm-home-section__head h2{font-size:clamp(20px,3vw,28px);line-height:1.45;margin:0;font-weight:850;color:var(--bz-cm-text);}
.bz-cm-home-section__head p{margin:4px 0 0;color:var(--bz-cm-muted);font-size:13px;line-height:1.8;}
.bz-cm-home-section__head a{display:inline-flex;align-items:center;justify-content:center;height:38px;padding:0 14px;border-radius:999px;background:rgba(10,132,255,.09);color:#0759a8;text-decoration:none;font-weight:800;font-size:13px;white-space:nowrap;}
.bz-cm-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;}
.bz-cm-card{display:flex;flex-direction:column;min-width:0;text-decoration:none;color:inherit;background:var(--bz-cm-card);border:1px solid rgba(15,23,42,.08);border-radius:22px;overflow:hidden;box-shadow:0 14px 40px rgba(15,23,42,.055);transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease;}
.bz-cm-card:hover{transform:translateY(-2px);border-color:rgba(10,132,255,.22);box-shadow:0 18px 52px rgba(15,23,42,.08);}
.bz-cm-card__thumb{display:flex;align-items:center;justify-content:center;aspect-ratio:1/1;background:linear-gradient(145deg,#eef4ff,#f8fafc);overflow:hidden;font-weight:900;color:rgba(15,23,42,.45);}
.bz-cm-card__thumb img{width:100%;height:100%;object-fit:cover;display:block;}
.bz-cm-card__thumb span{font-size:36px;opacity:.65;}
.bz-cm-card__body{padding:12px 13px 14px;display:flex;flex-direction:column;gap:7px;}
.bz-cm-card__body strong{font-size:14px;font-weight:800;line-height:1.75;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
.bz-cm-card__meta{font-size:12px;line-height:1.6;color:var(--bz-cm-muted);}
@media(max-width:900px){.bz-cm-grid{grid-template-columns:repeat(3,minmax(0,1fr));}.bz-cm-home-section{margin-top:20px;}}
@media(max-width:640px){.bz-cm-home-section{padding:0 12px;margin-bottom:30px;}.bz-cm-home-section__head{align-items:flex-start;}.bz-cm-home-section__head p{display:none;}.bz-cm-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}.bz-cm-card{border-radius:17px;}.bz-cm-card__body{padding:10px;}.bz-cm-card__body strong{font-size:12.8px;}}

/* Header/live search overlay. */
.bz-cm-search-host{position:relative!important;}
.bz-cm-search-results{position:absolute;z-index:99990;top:calc(100% + 8px);right:0;left:0;background:rgba(255,255,255,.96);backdrop-filter:blur(18px);border:1px solid rgba(15,23,42,.10);box-shadow:0 18px 55px rgba(15,23,42,.16);border-radius:18px;padding:8px;direction:rtl;max-height:min(70vh,520px);overflow:auto;}
.bz-cm-search-results.is-empty{padding:14px;color:var(--bz-cm-muted);font-size:13px;}
.bz-cm-search-item{display:grid;grid-template-columns:46px minmax(0,1fr) auto;align-items:center;gap:10px;padding:8px;border-radius:13px;text-decoration:none;color:inherit;}
.bz-cm-search-item:hover{background:rgba(15,23,42,.045);}
.bz-cm-search-item__img{width:46px;height:46px;border-radius:12px;background:#eef2f7;overflow:hidden;display:flex;align-items:center;justify-content:center;font-weight:900;color:rgba(15,23,42,.45);}
.bz-cm-search-item__img img{width:100%;height:100%;object-fit:cover;display:block;}
.bz-cm-search-item__body{min-width:0;display:flex;flex-direction:column;gap:2px;}
.bz-cm-search-item__body strong{font-size:13px;line-height:1.65;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.bz-cm-search-item__body span{font-size:11.5px;color:var(--bz-cm-muted);line-height:1.5;}
.bz-cm-search-item__kind{font-size:11px;font-weight:800;color:#0759a8;background:rgba(10,132,255,.09);border-radius:999px;padding:5px 8px;white-space:nowrap;}

/* Backwards-compatible aliases for the previous HA Music integration CSS names. */
.bz-ha-home-playlists{max-width:1180px;margin:28px auto 42px;padding:0 16px;direction:rtl;font-family:inherit;}
.bz-ha-search-host{position:relative!important;}

/* Direct-load native pages and account/favorite integrations. */
body.bazarestan-content-native > main.bazarestan-native-plugin-page{max-width:none;}
body.bazarestan-content-mode-compat .bazarestan-native-plugin-page{font-family:inherit!important;}
.bz-cm-favorite-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:42px;border:0;border-radius:999px;background:rgba(239,68,68,.10);color:#b91c1c;font-weight:850;padding:0 16px;margin:0 0 14px;cursor:pointer;transition:.18s ease;font-family:inherit;}
.bz-cm-favorite-button:before{content:'♡';font-size:18px;line-height:1;}
.bz-cm-favorite-button.is-active{background:rgba(239,68,68,.16);color:#dc2626;}
.bz-cm-favorite-button.is-active:before{content:'♥';}
.bz-cm-favorite-button:disabled{opacity:.65;cursor:wait;}
.bz-cm-hidden-shop-account-item{display:none!important;}
.bz-cm-account-downloads{position:relative;direction:rtl;}
.bz-cm-account-downloads h3{position:relative;z-index:1;margin:0 0 18px;font-size:24px;font-weight:850;color:#111827;}
.bz-cm-account-downloads .head-bg{position:absolute;top:-18px;right:0;font-size:54px;line-height:1;font-weight:900;color:rgba(15,23,42,.045);pointer-events:none;}
.bz-cm-account-downloads__body{display:grid;gap:12px;position:relative;z-index:1;}
.bz-cm-account-download-card{display:grid;grid-template-columns:86px minmax(0,1fr);gap:13px;align-items:center;background:#fff;border:1px solid rgba(15,23,42,.08);border-radius:18px;padding:10px;box-shadow:0 12px 32px rgba(15,23,42,.055);}
.bz-cm-account-download-card__img{width:86px;height:86px;border-radius:15px;overflow:hidden;background:#eef2f7;display:flex;align-items:center;justify-content:center;text-decoration:none;color:#64748b;font-weight:900;}
.bz-cm-account-download-card__img img{width:100%;height:100%;object-fit:cover;display:block;}
.bz-cm-account-download-card h4{margin:0 0 5px;font-size:15px;line-height:1.7;font-weight:850;}
.bz-cm-account-download-card h4 a{text-decoration:none;color:inherit;}
.bz-cm-account-download-card p{margin:0 0 9px;color:#64748b;font-size:12.5px;line-height:1.75;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
.bz-cm-account-download-card__btn{display:inline-flex;align-items:center;justify-content:center;min-height:36px;border-radius:999px;background:#111827;color:#fff!important;text-decoration:none!important;font-size:12.5px;font-weight:850;padding:0 14px;}
.bz-cm-empty-box{background:#fff;border:1px dashed rgba(15,23,42,.18);border-radius:18px;padding:22px;text-align:center;color:#64748b;}
.bz-cm-account-downloads-icon{display:inline-grid;place-items:center;width:22px;height:22px;border-radius:999px;background:rgba(10,132,255,.10);color:#0759a8;font-weight:900;margin-left:6px;}
@media(max-width:640px){.bz-cm-account-download-card{grid-template-columns:64px minmax(0,1fr);}.bz-cm-account-download-card__img{width:64px;height:64px}.bz-cm-account-downloads .head-bg{font-size:38px;}}

/* Use Bazarestan's own full-page loader for managed music/download route changes. */
.loading-full-div.bazarestan-content-route-loader{position:fixed;left:0;right:0;bottom:0;top:0;display:flex;justify-content:center;align-items:center;background-color:rgba(255,255,255,.43);z-index:2147482800;}
html.dark .loading-full-div.bazarestan-content-route-loader{background-color:rgba(0,0,0,.43);}
.bazarestan-content-route-loader .sk-folding-cube{width:40px;height:40px;position:relative;transform:rotateZ(45deg);}
.bazarestan-content-route-loader .sk-folding-cube .sk-cube{float:left;width:50%;height:50%;position:relative;transform:scale(1.1);}
.bazarestan-content-route-loader .sk-folding-cube .sk-cube:before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:#a9a9a9;animation:sk-foldCubeAngle 2.4s infinite linear both;transform-origin:100% 100%;}
.bazarestan-content-route-loader .sk-folding-cube .sk-cube2{transform:scale(1.1) rotateZ(90deg);}
.bazarestan-content-route-loader .sk-folding-cube .sk-cube3{transform:scale(1.1) rotateZ(180deg);}
.bazarestan-content-route-loader .sk-folding-cube .sk-cube4{transform:scale(1.1) rotateZ(270deg);}
.bazarestan-content-route-loader .sk-folding-cube .sk-cube2:before{animation-delay:.3s;}
.bazarestan-content-route-loader .sk-folding-cube .sk-cube3:before{animation-delay:.6s;}
.bazarestan-content-route-loader .sk-folding-cube .sk-cube4:before{animation-delay:.9s;}
@keyframes sk-foldCubeAngle{0%,10%{transform:perspective(140px) rotateX(-180deg);opacity:0;}25%,75%{transform:perspective(140px) rotateX(0deg);opacity:1;}90%,100%{transform:perspective(140px) rotateY(180deg);opacity:0;}}
