/* ======================= المينيو بار التلقائي ======================= */

.main-menu-bar {
  background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
  border-bottom: 1px solid rgba(138, 0, 74, 0.1);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  display: block; /* التأكد من أن المينيو ظاهر */
  min-height: 50px; /* حد أدنى للارتفاع */
  overflow: visible; /* السماح للقائمة الفرعية بالظهور */
}

.menu-items {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: visible; /* السماح للقائمة الفرعية بالظهور */
  scrollbar-width: thin;
  scrollbar-color: rgba(138, 0, 74, 0.3) transparent;
  padding: 0;
  position: relative; /* لضمان ظهور القائمة الفرعية */
}

.menu-items::-webkit-scrollbar {
  height: 4px;
}

.menu-items::-webkit-scrollbar-track {
  background: transparent;
}

.menu-items::-webkit-scrollbar-thumb {
  background: rgba(138, 0, 74, 0.3);
  border-radius: 2px;
}

.menu-item {
  position: relative;
  flex-shrink: 0;
  z-index: 1001; /* أعلى من المينيو الرئيسي */
}

.menu-item:hover .menu-dropdown,
.menu-item.active .menu-dropdown {
  display: block !important;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 20px;
  color: #333;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s ease;
  white-space: nowrap;
  position: relative;
}

.menu-link:hover {
  color: #8a004a;
  background: rgba(138, 0, 74, 0.05);
}

.menu-item.active .menu-link {
  color: #8a004a;
  background: rgba(138, 0, 74, 0.08);
}

.menu-arrow {
  font-size: 10px;
  transition: transform 0.3s ease;
  color: #666;
}

.menu-item.active .menu-arrow {
  transform: rotate(180deg);
  color: #8a004a;
}

.menu-dropdown {
  display: none;
  position: fixed; /* تغيير من absolute إلى fixed لضمان الظهور فوق كل شيء */
  background: #fff;
  min-width: 220px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 8px 0;
  z-index: 99999 !important; /* قيمة عالية جداً جداً لضمان الظهور فوق كل شيء */
  border: 1px solid rgba(138, 0, 74, 0.1);
  animation: menuFadeIn 0.3s ease;
  overflow: visible !important; /* التأكد من عدم قطع المحتوى */
  pointer-events: auto; /* السماح بالتفاعل مع القائمة */
}

@keyframes menuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.menu-sub-link {
  display: block;
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-right: 3px solid transparent;
}

.menu-sub-link:hover {
  background: rgba(138, 0, 74, 0.05);
  color: #8a004a;
  border-right-color: #8a004a;
  padding-right: 24px;
}

/* إصلاح container إذا كان يقطع القائمة */
.main-menu-bar .container {
  overflow: visible !important;
  position: relative;
  z-index: 1000;
}

/* التأكد من أن القائمة الفرعية تظهر فوق كل شيء */
.main-menu-bar {
  isolation: isolate; /* إنشاء stacking context جديد */
}

/* للجوال */
@media (max-width: 768px) {
  .main-menu-bar {
    position: relative;
  }

  .menu-items {
    gap: 2px;
    padding: 0 10px;
  }

  .menu-link {
    padding: 12px 16px;
    font-size: 14px;
  }

  .menu-dropdown {
    position: fixed;
    top: auto;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: 60vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  }

  .menu-item {
    position: static;
  }

  /* على الجوال، استخدم click بدلاً من hover */
  .menu-item.mobile-open .menu-dropdown {
    display: block;
  }
}

/* إضافة touch events للجوال */
@media (max-width: 768px) {
  .menu-link {
    cursor: pointer;
  }

  .menu-item {
    position: relative;
  }
}

