/**
 * شريط التنقّل السفلي — الهاتف والتابلت (الشريط الجانبي يبدأ من min-width: 1024px في الصفحات)
 * المواصفات: ارتفاع لا يقل عن 64px، padding عمودي 8px، أيقونات 24px، نص 12px
 *
 * مهم: لا تُفرض display:flex !important على #more-btn-mobile / #more-btn-desktop / حسابي
 * لأن ذلك يُلغي Tailwind (hidden، md:hidden، lg:flex) حتى مع ملف CSS لاحق.
 */
@media (max-width: 1023px) {
  nav.fixed.bottom-0 {
    box-sizing: border-box !important;
    min-height: 64px !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding-top: 8px !important;
    /* مساحة إضافية فوق شريط التنقّل المنزلي على آيفون */
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    align-items: center !important;
  }

  nav.fixed.bottom-0 > div {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 72rem !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
  }

  /*
   * صف الأيقونات: عرض كامل الشريط، توزيع متساوٍ بين العناصر الظاهرة فقط.
   */
  nav.fixed.bottom-0 > div > div {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    gap: 0 !important;
    justify-content: space-between !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
  }

  /* كل زر/رابط يأخذ نفس الحصة من العرض (مع احترام العناصر المخفية من Tailwind) */
  nav.fixed.bottom-0 > div > div > a,
  nav.fixed.bottom-0 > div > div > button {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  /* استثناء أزرار المزيد/الحساب حتى تعمل أصناف Tailwind للإظهار/الإخفاء */
  nav.fixed.bottom-0 .nav-item:not(#more-btn-mobile):not(#more-btn-desktop):not([data-nav="account"]) {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 0 0.1rem !important;
    row-gap: 2px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }

  nav.fixed.bottom-0 .nav-item .icon-img-lg,
  nav.fixed.bottom-0 img.icon-img-lg {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    object-fit: contain !important;
    margin: 0 0 2px 0 !important;
  }

  /* Font Awesome / أيقونات خط — تغلب على style="font-size: 2rem" داخل الشريط */
  nav.fixed.bottom-0 .nav-item i[class*="fa-"],
  nav.fixed.bottom-0 .nav-item i.icon-img-lg {
    font-size: 24px !important;
    line-height: 1 !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 0 2px 0 !important;
  }

  nav.fixed.bottom-0 .nav-item svg {
    width: 24px !important;
    height: 24px !important;
    flex-shrink: 0 !important;
    margin: 0 0 2px 0 !important;
  }

  nav.fixed.bottom-0 .nav-item span {
    font-size: 12px !important;
    line-height: 1.15 !important;
    max-width: 100% !important;
    text-align: center !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    overflow: hidden !important;
    word-break: break-word !important;
  }

  /* شاشات ضيقة جداً مع عدد كبير من الأزرار */
  @media (max-width: 380px) {
    nav.fixed.bottom-0 .nav-item span {
      font-size: 10px !important;
      -webkit-line-clamp: 2 !important;
    }
  }
}

/*
 * حاسوب (1024px+): إلغاء توزيع الهاتف على كامل العرض — عمود جانبي كالسابق،
 * يكمّل أنماط الصفحة (style داخلي) ولا يغيّر موضع الشريط نفسه.
 */
@media (min-width: 1024px) {
  nav.fixed.bottom-0 > div {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  nav.fixed.bottom-0 > div > div {
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 1.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  nav.fixed.bottom-0 > div > div > a,
  nav.fixed.bottom-0 > div > div > button {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  nav.fixed.bottom-0 .nav-item:not(#more-btn-mobile):not(#more-btn-desktop):not([data-nav="account"]) {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}
