/* Completely hide the horizontal menu overlay on all screens */
.hori-overlay {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  background: transparent !important;
}

.horimenu-enabled .hori-overlay {
  display: none !important;
}

/* Fix for topnav flex-grow-1 overlay issue on mobile */
@media (max-width: 991.98px) {
  .topnav,
  .topnav.flex-grow-1,
  .topnav-menu,
  .navbar-header,
  .navbar-nav.main-menu,
  .main-menu,
  .main-menu .nav-item,
  .main-menu .nav-link {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    z-index: 1 !important;
  }
  .topnav {
    position: static !important;
    z-index: 1 !important;
  }

  /* Ensure mobile menu toggle works properly - DON'T override Bootstrap collapse */
  #topnav-menu-content {
    background: #fff !important;
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    z-index: 1003 !important;
  }

  /* Ensure dropdown menus are visible */
  .dropdown-menu {
    background: #fff !important;
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    z-index: 1004 !important;
  }

  /* Fix business manager dashboard cards - preserve gradients */
  .card {
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
  }

  /* Ensure overview cards have proper styling - preserve gradients */
  .overview-card,
  .balance-card,
  .stats-card {
    color: inherit !important;
    border: none !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
  }

  /* Ensure text is visible on cards */
  .card-body,
  .card-title,
  .card-text,
  .h4,
  .h5,
  .h6,
  p,
  span {
    color: inherit !important;
  }

  /* Fix subwallet cards specifically */
  .subwallet-card {
    /* Preserve gradient backgrounds */
  }

  /* Ensure Bootstrap collapse works */
  .collapse:not(.show) {
    display: none !important;
  }

  .collapsing {
    height: 0;
    overflow: hidden;
    transition: height 0.35s ease;
  }

  .collapse.show {
    display: block !important;
  }
}

/* CRITICAL: Mobile Menu Toggle Fix */
@media (max-width: 991.98px) {
  /* Ensure the mobile menu button is clickable */
  #horimenu-btn {
    z-index: 1005 !important;
    position: relative !important;
    background: #fff !important;
    border: 1px solid #dee2e6 !important;
  }

  /* Ensure the collapsed menu content is properly positioned */
  #topnav-menu-content.collapse:not(.show) {
    display: none !important;
  }

  #topnav-menu-content.collapse.show {
    display: block !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    background: #fff !important;
    border: 1px solid #dee2e6 !important;
    border-top: none !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    z-index: 1003 !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
  }

  /* Ensure the navbar collapse works */
  .navbar-collapse {
    flex-basis: 100% !important;
    flex-grow: 1 !important;
    align-items: center !important;
  }

  /* Fix any potential display issues */
  .navbar-nav {
    width: 100% !important;
  }

  .main-menu {
    width: 100% !important;
    flex-direction: column !important;
  }

  .main-menu .nav-item {
    width: 100% !important;
    border-bottom: 1px solid #f8f9fa !important;
  }

  .main-menu .nav-link {
    padding: 0.75rem 1rem !important;
    width: 100% !important;
    display: block !important;
  }

  /* Ensure dropdowns work in mobile menu */
  .dropdown-menu {
    position: static !important;
    float: none !important;
    width: 100% !important;
    margin-top: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #f8f9fa !important;
  }
}

/* Mobile White Overlay Fix - High Priority CSS */

/* Force remove any white overlays on mobile */
@media (max-width: 991.98px) {
  /* Target all possible overlay elements and hide them */
  .app-menu,
  .vertical-menu,
  .sidebar,
  .left-side-menu,
  .right-side-menu,
  .side-menu,
  .menu-overlay,
  .overlay,
  .modal-backdrop,
  .backdrop,
  .bg-white,
  .bg-light,
  .white-overlay,
  .overlay-white {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    background: transparent !important;
    position: absolute !important;
    z-index: -1 !important;
  }

  /* Force all main content to be visible */
  body,
  html,
  #layout-wrapper,
  .layout-wrapper,
  .wrapper,
  .main-content,
  .page-content,
  .container-fluid {
    background-color: #f8f9fa !important;
    position: relative !important;
    z-index: 1 !important;
  }

  /* Ensure content is above any overlays */
  .card,
  .card-body,
  .table,
  .table-responsive,
  .btn,
  .form-control,
  .alert,
  .row,
  .col-12,
  .col-md-12,
  .col-lg-12 {
    background: inherit !important;
    position: relative !important;
    z-index: 10 !important;
  }

  /* Remove any inline white backgrounds */
  [style*="background-color: white"],
  [style*="background-color: #fff"],
  [style*="background-color: #ffffff"],
  [style*="background: white"],
  [style*="background: #fff"],
  [style*="background: #ffffff"] {
    background: transparent !important;
  }

  /* Force navbar to be visible */
  #page-topbar {
    background-color: #fff !important;
    z-index: 1002 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
  }

  /* Ensure proper spacing */
  .main-content {
    margin-top: 60px !important;
    padding-top: 20px !important;
  }

  /* Remove any potential white backgrounds */
  .bg-white,
  .bg-light {
    background-color: transparent !important;
  }

  /* Fix any potential overflow issues */
  body {
    overflow-x: hidden !important;
  }
}
