/* ST Sidebar - هدر فشرده‌ی موبایل (v3)
 * فقط وقتی «هدر فشرده» از تنظیمات ماژول روشن باشد لود می‌شود و فقط وقتی کار می‌کند که <html> کلاس
 * sb-hdr-compact داشته باشد و sb-hdr-failed نداشته باشد. ارتفاع از متغیر --sbh-h (تنظیمات ماژول) می‌آید.
 * جستجو: هیچ نوار/پنجره‌ی جدیدی ساخته نمی‌شود. ذره‌بین فقط همان ردیف جستجوی ماژول stsearchbar را
 * (سر جای خودش، با همان ظاهر و رفتار قبلی) نشان می‌دهد و آن را باز می‌کند.
 * فقط موبایل (≤767px)؛ دسکتاپ و تبلت دست‌نخورده می‌مانند.
 */
@media (max-width:767px){

  /* ---------- 1) ردیف فشرده: لوگو + منو + آیکون‌ها ---------- */
  html.sb-hdr-compact:not(.sb-hdr-failed) body:not(#_) #mobile_bar{
    min-height:0!important;height:auto!important;padding-top:0!important;padding-bottom:0!important;
  }
  html.sb-hdr-compact:not(.sb-hdr-failed) body:not(#_) #mobile_bar :is(#mobile_bar_top,#mobile_bar_left,#mobile_bar_center,#mobile_bar_right){
    min-height:0!important;height:var(--sbh-h)!important;margin-top:0!important;margin-bottom:0!important;
    padding-top:0!important;padding-bottom:0!important;display:flex!important;flex-direction:row!important;align-items:center!important;flex-wrap:nowrap!important;
  }
  html.sb-hdr-compact:not(.sb-hdr-failed) body:not(#_) #mobile_bar #mobile_bar_center{justify-content:center!important}
  /* لوگو: داخل ارتفاع هدر جا بشود (هم لوگوی قالب، هم لوگوی موبایل ماژول) */
  html.sb-hdr-compact:not(.sb-hdr-failed) body:not(#_) #mobile_bar #mobile_bar_center a.mobile_logo{
    height:calc(var(--sbh-h) - 14px)!important;max-height:calc(var(--sbh-h) - 14px)!important;display:flex!important;align-items:center!important;margin:0!important;
  }
  html.sb-hdr-compact:not(.sb-hdr-failed) body:not(#_) #mobile_bar #mobile_bar_center a.mobile_logo img{
    height:calc(var(--sbh-h) - 14px)!important;max-height:calc(var(--sbh-h) - 14px)!important;width:auto;max-width:100%;
  }
  /* آیتم‌های هدر: فقط آیکون (برچسب متنی زیر آیکون ارتفاع را زیاد می‌کند) */
  html.sb-hdr-compact:not(.sb-hdr-failed) body:not(#_) #mobile_bar .mobile_bar_item{
    height:var(--sbh-h)!important;min-height:0!important;min-width:42px;margin:0!important;padding:0 6px!important;
    display:inline-flex!important;flex-direction:row!important;align-items:center!important;justify-content:center!important;line-height:1!important;
  }
  html.sb-hdr-compact:not(.sb-hdr-failed) body:not(#_) #mobile_bar .mobile_bar_item .mobile_bar_tri_text{display:none!important}
  html.sb-hdr-compact:not(.sb-hdr-failed) body:not(#_) #mobile_bar .mobile_bar_item :is(i,.icon_btn){margin:0!important}

  /* ---------- 2) ردیف جستجوی ماژول: تا لمس ذره‌بین پنهان؛ بعد با ظاهر و جای اصلی خودش ---------- */
  html.sb-hdr-compact.sb-hdr-icon:not(.sb-hdr-failed) body:not(#_) #mobile_bar_bottom{
    min-height:0!important;padding-top:0!important;padding-bottom:0!important;margin-top:0!important;margin-bottom:0!important;border:0!important;
  }
  html.sb-hdr-compact.sb-hdr-icon:not(.sb-hdr-failed):not(.sb-hdr-search-open) body:not(#_) .sb-mobile-search-row{display:none!important}
  html.sb-hdr-compact.sb-hdr-icon.sb-hdr-search-open:not(.sb-hdr-failed) body:not(#_) .sb-mobile-search-row{animation:sbHdrIn .16s ease-out}

  /* ---------- 3) دکمه‌ی ذره‌بین ---------- */
  .sb-hdr-search-btn{
    display:none;appearance:none;-webkit-appearance:none;border:0;background:transparent;margin:0;padding:0 8px;
    height:var(--sbh-h);min-width:44px;align-items:center;justify-content:center;color:#2b2f36;cursor:pointer;
    -webkit-tap-highlight-color:transparent;
  }
  html.sb-hdr-compact.sb-hdr-icon.sb-hdr-ready:not(.sb-hdr-failed) .sb-hdr-search-btn{display:inline-flex}
  .sb-hdr-search-btn svg{width:25px;height:25px;display:block;fill:none;stroke:currentColor;stroke-width:2.1;stroke-linecap:round;stroke-linejoin:round}
  .sb-hdr-search-btn:active svg{transform:scale(.9)}
  html.sb-hdr-search-open .sb-hdr-search-btn{color:#1877f2}
  .sb-hdr-search-btn:focus-visible{outline:2px solid #1877f2;outline-offset:-2px}
  @keyframes sbHdrIn{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}
}
@media (prefers-reduced-motion:reduce){
  html.sb-hdr-search-open .sb-mobile-search-row{animation:none!important}
}
/* دسکتاپ/تبلت: دکمه دیده نشود */
@media (min-width:768px){
  .sb-hdr-search-btn{display:none!important}
}
