/**
 * app-top-nav + موبايل فقط (max-width: 991px) — عبر media في Blade
 * - إخفاء الشريط الأفقي بالكامل
 * - زر ثلاث خطوط (يُرى هنا فقط) + ستايل الدرج ≈ سطر الميني
 * الديسكتوب: الملف غير مُفعّل — لا تغيير على الشريط/الديسكتوب
 */
@media (max-width: 991px) {
  /* إخفاء كامل للسطر الأفقي على الموبايل (منيو داخل الدرج الجانبي) */
  body.app-top-nav #bb-main-horizontal-nav,
  body.app-top-nav .bb-sneat-unified__nav,
  body.app-top-nav .bb-sneat-hshell__navrow {
    display: none !important;
  }

  /* Sneat unified shell — هيدر مضغوط صف واحد */
  body.bb-sneat-hshell .bb-sneat-unified {
    max-width: 100vw;
    overflow: hidden;
  }

  body.bb-sneat-hshell .bb-sneat-unified__top.rb-topbar {
    margin: 0 !important;
    height: auto !important;
    min-height: 3rem !important;
    padding: 0.4rem 0.65rem !important;
    border-radius: 0 !important;
    flex-wrap: nowrap !important;
    gap: 0.35rem !important;
  }

  body.bb-sneat-hshell .bb-sneat-unified .rb-topbar__left {
    flex: 0 0 auto;
    min-width: 0;
  }

  body.bb-sneat-hshell .bb-sneat-unified .rb-topbar__right {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  body.bb-sneat-hshell .bb-sneat-unified .rb-topbar__right::-webkit-scrollbar {
    display: none;
  }

  /* زر القائمة في اليسار فقط — إخفاء النسخة المكررة في الأدوات */
  body.bb-sneat-hshell .bb-sneat-unified .rb-topbar__menu-btn.bb-topnav-m-menu-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  body.bb-sneat-hshell .rb-topbar__right > button.bb-topnav-m-menu-btn {
    display: none !important;
  }

  body.bb-sneat-hshell .rb-topbar__brand-text {
    font-size: 1rem !important;
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.bb-sneat-hshell .rb-topbar__right .header-secondary-actions {
    flex-wrap: nowrap !important;
    gap: 0.35rem !important;
  }

  /* منع تمدد الصفحة أفقياً */
  body.bb-sneat-hshell.app-top-nav {
    overflow-x: hidden;
  }

  body.bb-sneat-hshell .bb-header-content-gutter,
  body.bb-sneat-hshell main,
  body.bb-sneat-hshell #scrollable-container {
    max-width: 100%;
    overflow-x: hidden;
  }

  body.bb-app-dark-bg .home-dashboard > .tw-px-5,
  body.bb-sneat-hshell .home-dashboard > .tw-px-5 {
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
  }

  /* Sneat داخل header.blade (bb-sneat-hshell-header) */
  body.bb-sneat-hshell .bb-sneat-hshell-header {
    max-width: 100vw;
    overflow: hidden;
  }

  body.bb-sneat-hshell .bb-sneat-hshell__toprow {
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0.35rem !important;
    min-height: 0 !important;
  }

  body.bb-sneat-hshell .bb-sneat-hshell__toolbar {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  body.bb-sneat-hshell .bb-sneat-hshell__toolbar::-webkit-scrollbar {
    display: none;
  }

  body.bb-sneat-hshell .bb-sneat-hshell__brand-text {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* زر القائمة: يفوق tw-hidden — يظهر فقط لأن هذا الملف يُحمّل في الشاشة الضيقة فقط */
  .bb-topnav-m-menu-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    margin-inline-end: 0.25rem;
    flex-shrink: 0;
  }

  /* طبقة أعلى من شريط الهيدر (1030) دون تغيير min-width:992+ */
  body.app-top-nav .overlay {
    z-index: 1048 !important;
  }

  body.app-top-nav .side-bar {
    z-index: 1050 !important;
    top: 3.5rem;
    height: calc(100dvh - 3.5rem);
    min-height: 0;
    max-width: min(22rem, 100vw - 1.5rem);
    width: 100% !important;
    border: 0 !important;
    border-radius: 0 1.25rem 1.25rem 0;
    box-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.35), 0 0 0 1px color-mix(in srgb, var(--bb-nav-drawer-border, #cbd5e1) 100%, transparent);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--bb-nav-drawer-accent, #6366f1) 5%, #ffffff) 0%,
        #f8fafc 2.5rem
      ),
      #f8fafc;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
  }

  body.app-top-nav #main-sidebar.side-bar,
  body.app-top-nav .side-bar {
    --bb-nav-drawer-border: #cbd5e1;
    --bb-nav-drawer-accent: #6366f1;
  }

  body.custom-theme.app-top-nav .side-bar {
    --bb-nav-drawer-accent: var(--theme-color, #6366f1);
    --bb-nav-drawer-border: color-mix(in srgb, var(--theme-color, #6366f1) 30%, #e2e8f0);
  }

  html[dir='rtl'] body.app-top-nav .side-bar {
    left: auto !important;
    right: -100% !important;
    border-radius: 1.25rem 0 0 1.25rem;
  }

  html[dir='rtl'] body.app-top-nav .side-bar.small-view-side-active {
    right: 0 !important;
    left: auto !important;
  }

  body.app-top-nav .side-bar .sidebar-brand-link {
    border-radius: 0 1rem 0 0;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--bb-nav-drawer-accent, #6366f1) 20%, #e2e8f0);
  }

  html[dir='rtl'] body.app-top-nav .side-bar .sidebar-brand-link {
    border-radius: 1rem 0 0 0;
  }

  /* منطقة التمرير: نفس تركيز السطر الناعم */
  body.app-top-nav .side-bar #side-bar {
    background: transparent;
    border: 0;
    --tw-border-opacity: 0;
  }

  /* عناصر رئيسية: كروت قريبة من سعر الميني الأفقية */
  body.app-top-nav .side-bar #side-bar > a,
  body.app-top-nav .side-bar #side-bar > div > a.drop_down {
    min-height: 2.75rem;
    border-radius: 0.75rem;
    border: 1px solid color-mix(in srgb, var(--bb-nav-drawer-accent, #6366f1) 12%, #e2e8f0) !important;
    background: #fff !important;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
    color: #0f172a !important;
    font-weight: 600 !important;
  }

  body.app-top-nav .side-bar #side-bar > a:hover,
  body.app-top-nav .side-bar #side-bar > div > a.drop_down:hover {
    background: color-mix(in srgb, var(--bb-nav-drawer-accent, #6366f1) 6%, #ffffff) !important;
  }

  body.app-top-nav .side-bar #side-bar .chiled {
    background: color-mix(in srgb, var(--bb-nav-drawer-accent, #6366f1) 3%, #f1f5f9) !important;
    border-radius: 0.75rem;
    border: 1px solid color-mix(in srgb, var(--bb-nav-drawer-accent, #6366f1) 8%, #e2e8f0) !important;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0.35rem;
  }

  /* فرع: روابط داخلية أنعم */
  body.app-top-nav .side-bar #side-bar .chiled a {
    min-height: 2.4rem;
    font-weight: 500 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: #334155 !important;
  }

  body.app-top-nav .side-bar #side-bar .chiled a:hover {
    background: color-mix(in srgb, var(--bb-nav-drawer-accent, #6366f1) 8%, #ffffff) !important;
  }

  body.app-top-nav .side-bar #side-bar .chiled > div > a.drop_down {
    min-height: 2.5rem;
    border-radius: 0.5rem;
    font-weight: 600 !important;
  }
}
