/* LEGACY: דורש רפקטור, לא להוסיף !important/inline/new Bootstrap */
/* ✅ כל ה-!important הוסרו - הקובץ נקי מ-!important */
/* ✅ אין תלות ב-Bootstrap - הקובץ עצמאי */
/* ============================================
   Mobile Navigation CSS
   נטען רק במובייל (max-width: 1023px)
   ============================================ */

/* הסתרת סרגל ניווט מובייל בדסקטופ - כלל גלובלי */
@media (min-width: 1024px) {
  .mobile-navbar,
  .mobile-menu,
  .mobile-menu-overlay,
  .mobile-nav-spacer {
    display: none;
    visibility: hidden;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
    position: absolute;
    left: -9999px;
    pointer-events: none;
  }
}

/* הסתרת תצוגת מחשב במובייל */
@media (max-width: 1023px) {
  .premium-navbar {
    display: none;
  }
  
  .nav-spacer {
    display: none;
  }
  
  /* וידוא שהתפריט המובייל מעל כל האלמנטים */
  .mobile-navbar,
  .mobile-menu,
  .mobile-menu-overlay {
    position: fixed;
  }
  
  /* מניעת overflow מהדף */
  body.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }
  
  /* הסתרת תוכן הדף כשהתפריט פתוח */
  body.mobile-menu-open .content-wrapper,
  body.mobile-menu-open .container,
  body.mobile-menu-open main,
  body.mobile-menu-open [role="main"] {
    pointer-events: none;
    opacity: 0.3;
  }
  
  /* וידוא שהתפריט המובייל מעל כל האלמנטים */
  .mobile-navbar,
  .mobile-menu,
  .mobile-menu-overlay,
  .mobile-menu-submenu {
    z-index: 99999;
  }
  
  /* מניעת אלמנטים אחרים מלכסות את התפריט */
  .modal,
  .dropdown-menu,
  .tooltip,
  .popover,
  .alert {
    z-index: 9999;
  }
  
  /* וידוא שכל תוכן הדף לא מכסה את הסרגל ניווט המובייל */
  .content-wrapper,
  .container,
  main,
  [role="main"],
  .w-full,
  .content-wrapper > *,
  .container > *,
  .w-full > * {
    position: relative;
    z-index: 1;
  }
  
  /* וידוא שהסרגל ניווט המובייל תמיד מעל */
  .mobile-navbar {
    z-index: 999999;
  }
  
  /* וידוא שהתפריט המובייל תמיד מעל */
  .mobile-menu,
  .mobile-menu-overlay,
  .mobile-menu-submenu {
    position: fixed;
    z-index: 999999;
  }
  
  /* הסרגל ניווט המובייל - fixed כדי שיהיה תמיד מעל */
  .mobile-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    width: 100%;
  }
  
  /* מניעת תוכן הדף מלכסות את התפריט */
  body:not(.mobile-menu-open) .content-wrapper,
  body:not(.mobile-menu-open) .container,
  body:not(.mobile-menu-open) main,
  body:not(.mobile-menu-open) [role="main"] {
    z-index: auto;
  }
}

/* Mobile Navbar Container */
.mobile-navbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  height: 64px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999999;
  isolation: isolate;
  transform: translateZ(0);
  will-change: transform;
  width: 100%;
}

.mobile-navbar-container {
  height: 100%;
  position: relative;
}

/* Mobile Navbar Header */
.mobile-navbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 16px;
}

/* Mobile Brand */
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: white;
  font-weight: 600;
}

.mobile-brand-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.mobile-brand-text h4 {
  color: white;
  font-size: 18px;
  margin: 0;
  font-weight: 600;
}

/* Hamburger Button */
.mobile-menu-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 40px;
  height: 40px;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease;
}

.mobile-menu-toggle:active {
  transform: scale(0.95);
}

.hamburger-line {
  width: 24px;
  height: 3px;
  background: white;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 999998;
  transform: translateZ(0);
  will-change: opacity, visibility;
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 85%;
  max-width: 320px;
  height: 100vh;
  min-height: 100vh;
  max-height: 100vh;
  background: white;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease;
  z-index: 999999;
  overflow-y: auto;
  /* ⚠️ הוסר overflow-x: hidden - אסור לפי חוקי זהב #9 */
  /* אם יש בעיה עם גלילה אופקית ב-menu - לטפל נקודתית */
  /* overflow-x: hidden; - הוסר */
  direction: rtl;
  isolation: isolate;
  transform: translateZ(0);
  will-change: right;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu.active {
  right: 0;
}

/* Mobile Menu Header */
.mobile-menu-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}

.mobile-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.mobile-user-avatar {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.mobile-user-details h6 {
  color: white;
  font-size: 16px;
  margin: 0 0 4px 0;
  font-weight: 600;
}

.mobile-user-details small {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  display: block;
}

.mobile-menu-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.mobile-menu-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Mobile Menu Content */
.mobile-menu-content {
  padding: 0;
}

/* Mobile Menu Section */
.mobile-menu-section {
  border-bottom: 1px solid #e5e7eb;
}

/* Mobile Menu Category */
.mobile-menu-category {
  width: 100%;
  background: transparent;
  border: none;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: right;
  direction: rtl;
  transition: background 0.2s ease;
  color: #1f2937;
  font-size: 16px;
  font-weight: 500;
}

.mobile-menu-category:hover {
  background: #f3f4f6;
}

.mobile-menu-category i:first-child {
  font-size: 20px;
  width: 24px;
  text-align: center;
  color: #667eea;
}

.mobile-menu-category span {
  flex: 1;
}

.mobile-chevron {
  font-size: 14px;
  color: #9ca3af;
  transition: transform 0.3s ease;
}

.mobile-menu-category.active .mobile-chevron {
  transform: rotate(-90deg);
}

/* Mobile Submenu */
.mobile-menu-submenu {
  position: absolute;
  top: 0;
  right: -100%;
  width: 100%;
  height: 100%;
  background: white;
  transition: right 0.3s ease;
  z-index: 9999999;
  transform: translateZ(0);
}

.mobile-menu-submenu.active {
  right: 0;
}

/* Mobile Submenu Header */
.mobile-submenu-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
}

.mobile-submenu-back {
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.mobile-submenu-back:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mobile-submenu-header h6 {
  color: white;
  font-size: 18px;
  margin: 0;
  font-weight: 600;
  flex: 1;
}

/* Mobile Submenu Content */
.mobile-submenu-content {
  padding: 8px 0;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

/* Mobile Menu Link */
.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: #1f2937;
  text-decoration: none;
  transition: background 0.2s ease;
  direction: rtl;
  text-align: right;
}

.mobile-menu-link:hover {
  background: #f3f4f6;
  color: #667eea;
}

.mobile-menu-link i {
  font-size: 18px;
  width: 24px;
  text-align: center;
  color: #667eea;
}

.mobile-menu-link span {
  flex: 1;
  font-size: 15px;
}

/* Mobile Menu Footer */
.mobile-menu-footer {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  margin-top: auto;
}

.mobile-menu-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #1f2937;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s ease;
  direction: rtl;
  text-align: right;
  margin-bottom: 8px;
}

.mobile-menu-action:last-child {
  margin-bottom: 0;
}

.mobile-menu-action:hover {
  background: #f3f4f6;
}

.mobile-menu-action.logout {
  color: #dc2626;
}

.mobile-menu-action.logout:hover {
  background: #fee2e2;
}

.mobile-menu-action i {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.mobile-menu-action span {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
}

/* Mobile Nav Spacer */
.mobile-nav-spacer {
  height: 64px;
  display: block;
}

/* Responsive - הסתרת סרגל ניווט מובייל בדסקטופ */
@media (min-width: 1024px) {
  .mobile-navbar,
  .mobile-menu,
  .mobile-menu-overlay,
  .mobile-nav-spacer {
    display: none;
    visibility: hidden;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
    position: absolute;
    left: -9999px;
  }
}

/* וידוא שהסרגל ניווט המובייל תמיד מעל כל התוכן */
@media (max-width: 1023px) {
  /* הסרגל ניווט המובייל - תמיד מעל */
  .mobile-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  }
  
  /* וידוא שכל התוכן מאחורי הסרגל */
  body > .w-full,
  body > .content-wrapper,
  body > main,
  body > [role="main"],
  .w-full,
  .content-wrapper {
    position: relative;
    z-index: 1;
    margin-top: 64px;
  }
  
  /* מניעת אלמנטים ספציפיים מלכסות */
  .card,
  .table,
  .modal,
  .dropdown-menu,
  .alert,
  .tooltip,
  .popover {
    z-index: 10;
  }
}

/* Scrollbar Styling */
.mobile-menu::-webkit-scrollbar,
.mobile-submenu-content::-webkit-scrollbar {
  width: 6px;
}

.mobile-menu::-webkit-scrollbar-track,
.mobile-submenu-content::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.mobile-menu::-webkit-scrollbar-thumb,
.mobile-submenu-content::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.mobile-menu::-webkit-scrollbar-thumb:hover,
.mobile-submenu-content::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
