/* ============================================
   Elementor Mega Menu Replacer - Complete CSS
   Version: 1.1.5
============================================ */

/* Hide default submenu by default (desktop) */
.emmr-mega-container + .sub-menu {
  display: none;
}
/* control the direct child a to emmr-mega-container to inherit the font size from finexpert theme*/
.emmr-mega-container .emmr-mega-parent {
  font-size: inherit !important;
}
/* ===== Desktop Menu: Shrink mega menu font only for large screens ===== */
@media only screen and (max-width: 1400px) {
  /* Target only the desktop header menu */
  .header-navbar .emmr-mega-container .emmr-mega-parent {
    font-size: 10px !important;
    font-weight: inherit !important; /* preserve weight from theme */
  }
}

/* ===== Mobile Menu: Inherit Finexpert mobile menu font ===== */
@media only screen and (max-width: 1400px) {
  /* Target only the mobile menu floating container */
  .mobile-menu-floating .emmr-mega-container .emmr-mega-parent {
    font-size: inherit !important;
    font-weight: inherit !important;
    padding: inherit !important;
  }
}




/* Mega menu parent container */
.emmr-mega-parent {
  position: relative;
  display: inline-block;
  text-decoration: none;
  color: inherit;
}

.emmr-mega-parent:hover,
.emmr-mega-parent:focus {
  text-decoration: none;
}

.emmr-mega-container {
  position: relative;
  display: inline-block;
}

/* Show mega menu on hover (desktop) */
.emmr-mega-container:hover .emmr-mega-menu {
  display: block;
  opacity: 1;
  visibility: visible;
}

.emmr-mega-parent.emmr-open {
  color: var(--e-global-color-secondary);
}

/* The mega menu */
.emmr-mega-menu {
  display: none;
  opacity: 0;
  visibility: hidden;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  width: 1100px;
  max-width: calc(100vw - 40px);
  min-width: 300px;
  box-sizing: border-box;
  background: #fff;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  padding: 20px;
  border-radius: 4px;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;

  /* Prevent overflow issues */
  overflow: visible;
}

/* Arrow indicator for mega menu */
/* .emmr-mega-menu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid #fff;
  z-index: 100000;
} */

/* Adjust arrow when menu is positioned differently */
/* .emmr-mega-menu.emmr-left-aligned::before {
  left: 20px;
} */

/* .emmr-mega-menu.emmr-right-aligned::before {
  left: auto;
  right: 20px;
} */

/* .emmr-mega-menu.emmr-above::before {
  top: auto;
  bottom: -10px;
  border-bottom: none;
  border-top: 10px solid #fff;
} */

/* Position classes for jQuery adjustment */
.emmr-mega-menu.emmr-left-aligned {
  left: 0;
  transform: translateX(0);
}

.emmr-mega-menu.emmr-right-aligned {
  left: auto;
  right: 0;
  transform: translateX(0);
}

/* Ensure Elementor content fits properly */
.emmr-mega-menu .elementor-section,
.emmr-mega-menu .elementor-container,
.emmr-mega-menu .elementor-column,
.emmr-mega-menu .elementor-widget-wrap {
  max-width: 100% !important;
}

.emmr-mega-menu .elementor-widget {
  max-width: 100%;
  overflow: hidden;
}

/* Fix for Elementor image widgets */
.emmr-mega-menu .elementor-image img {
  max-width: 100%;
  height: auto;
}

/* Mobile/Tablet Responsive Styles */
@media (max-width: 991px) {
  /* Hide mega menu completely on mobile */
  .emmr-mega-menu {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  .emmr-mega-container:hover .emmr-mega-menu,
  .emmr-mega-container:focus .emmr-mega-menu {
    display: none !important;
  }

  /* Show the default submenu */
  .emmr-mega-container + .sub-menu {
    /* display: block !important; */
    position: static;
    box-shadow: none;
    background: transparent;
    width: 100%;
    padding-left: 15px;
  }

  /* Ensure proper spacing for mobile submenus */
  .emmr-mega-container + .sub-menu li {
    width: 100%;
  }

  .emmr-mega-container + .sub-menu a {
    display: block;
    padding: 10px 15px;
    color: inherit;
  }

  /* Stack mega container items vertically on mobile */
  .emmr-mega-container {
    display: block;
    width: 100%;
  }

  .emmr-mega-parent {
    display: block;
    /* padding: 10px 15px; */
    width: 100%;
    box-sizing: border-box;
  }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
  .emmr-mega-container + .sub-menu {
    padding-left: 10px;
  }

  .emmr-mega-parent {
    padding: 8px 10px;
  }
}

/* Menu children grid - shortcode styles */
.menu-children-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  width: 100%;
}

@media (max-width: 768px) {
  .menu-children-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .menu-children-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.menu-grid-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 4px;
  transition: all 0.3s ease;
  min-height: 80px;
  box-sizing: border-box;
}
/* prevent theme overwrite */
.menu-grid-item,
.emmr-mega-menu {
  text-transform: none !important;
}

.menu-grid-item:hover,
.menu-grid-item:focus-within {
  background: #e9ecef;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.menu-grid-item:hover *,
.menu-grid-item:focus-within * {
  color: var(--e-global-color-secondary) !important;
}

.menu-grid-item .menu-abbr {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 5px;
  text-transform: uppercase;
  color: #333;
  letter-spacing: 0.5px;
}

.menu-grid-item .menu-full {
  font-weight: 500;
  font-size: 0.72rem;
  color: #555;
  line-height: 1.3;
  margin-bottom: 0;
}

.menu-grid-item a.menu-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  text-decoration: none;
  z-index: 2;
  background: transparent;
  border: none;
  cursor: pointer;
}

.menu-grid-item a.menu-link:focus {
  outline: 2px solid var(--e-global-color-secondary);
  outline-offset: 2px;
}

/* Animation for mega menu */
@keyframes emmrFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.emmr-mega-menu.emmr-left-aligned {
  animation: emmrFadeInLeft 0.3s ease;
}

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

.emmr-mega-menu.emmr-right-aligned {
  animation: emmrFadeInRight 0.3s ease;
}

@keyframes emmrFadeInRight {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Print styles */
@media print {
  .emmr-mega-menu {
    display: none !important;
  }

  .emmr-mega-container + .sub-menu {
    display: block !important;
    position: static !important;
    box-shadow: none !important;
  }

  .menu-children-grid {
    break-inside: avoid;
  }
}

/* Accessibility improvements */
.emmr-mega-parent:focus-visible {
  outline: 2px solid var(--e-global-color-secondary);
  outline-offset: 2px;
}

.emmr-mega-menu:focus-visible {
  outline: 2px solid var(--e-global-color-secondary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .emmr-mega-menu {
    border: 2px solid #000;
  }

  .menu-grid-item {
    border: 1px solid #000;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .emmr-mega-menu,
  .menu-grid-item {
    transition: none;
  }

  @keyframes emmrFadeIn {
    from {
      opacity: 1;
    }
    to {
      opacity: 1;
    }
  }

  @keyframes emmrFadeInLeft {
    from {
      opacity: 1;
    }
    to {
      opacity: 1;
    }
  }

  @keyframes emmrFadeInRight {
    from {
      opacity: 1;
    }
    to {
      opacity: 1;
    }
  }
}

/* Fix for Elementor button widgets in mega menu */
.emmr-mega-menu .elementor-button {
  white-space: normal;
  word-wrap: break-word;
}

/* Ensure text readability in mega menu */
.emmr-mega-menu {
  color: #333;
  line-height: 1.5;
}

.emmr-mega-menu h1,
.emmr-mega-menu h2,
.emmr-mega-menu h3,
.emmr-mega-menu h4,
.emmr-mega-menu h5,
.emmr-mega-menu h6 {
  color: #222;
  margin-top: 0;
  margin-bottom: 15px;
}

.emmr-mega-menu p {
  margin-bottom: 15px;
}

.emmr-mega-menu a:not(.menu-link) {
  color: var(--e-global-color-secondary, #0073aa);
  text-decoration: none;
}

.emmr-mega-menu a:not(.menu-link):hover {
  text-decoration: underline;
}

/* Container max-width fallback for older browsers */
.emmr-mega-menu {
  max-width: 1100px;
}

/* Fix for RTL languages */
html[dir="rtl"] .emmr-mega-menu {
  left: auto;
  right: 50%;
  transform: translateX(50%);
}

html[dir="rtl"] .emmr-mega-menu::before {
  left: auto;
  right: 50%;
  transform: translateX(50%);
}

html[dir="rtl"] .emmr-mega-menu.emmr-left-aligned {
  left: auto;
  right: 0;
  transform: translateX(0);
}

html[dir="rtl"] .emmr-mega-menu.emmr-right-aligned {
  left: 0;
  right: auto;
  transform: translateX(0);
}

html[dir="rtl"] .menu-grid-item {
  align-items: flex-end;
}

html[dir="rtl"] .menu-children-grid {
  direction: rtl;
}
