/* APK Dark Sidebar Menu Final 2027
   Loaded last. Fixes white submenu cards / invisible submenu text in dark mode. */

html[data-apk-theme="dark"] #sidebar,
html[data-apk-theme="dark"] .sidebar-wrapper,
html[data-apk-theme="dark"] .sidebar-wrapper.active,
html[data-apk-theme="dark"] #sidebar.active,
html[data-apk-theme="dark"] .apk-menu-shell,
body[data-apk-theme="dark"] #sidebar,
body[data-apk-theme="dark"] .sidebar-wrapper,
body[data-apk-theme="dark"] .apk-menu-shell{
  background:#0d1b2f!important;
  color:#eef6ff!important;
  border-color:rgba(148,163,184,.24)!important;
}

html[data-apk-theme="dark"] #sidebar .menu,
html[data-apk-theme="dark"] .sidebar-wrapper .menu,
html[data-apk-theme="dark"] #sidebar .sidebar-menu,
html[data-apk-theme="dark"] #sidebar .sidebar-content,
body[data-apk-theme="dark"] #sidebar .menu,
body[data-apk-theme="dark"] .sidebar-wrapper .menu{
  background:transparent!important;
  color:#eef6ff!important;
}

/* Parent menu rows */
html[data-apk-theme="dark"] #sidebar .sidebar-link,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .sidebar-link,
body[data-apk-theme="dark"] #sidebar .sidebar-link,
body[data-apk-theme="dark"] .sidebar-wrapper .menu .sidebar-link{
  background:transparent!important;
  color:#f8fbff!important;
  -webkit-text-fill-color:#f8fbff!important;
  border:1px solid transparent!important;
  box-shadow:none!important;
}
html[data-apk-theme="dark"] #sidebar .sidebar-link span,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .sidebar-link span,
body[data-apk-theme="dark"] #sidebar .sidebar-link span,
body[data-apk-theme="dark"] .sidebar-wrapper .menu .sidebar-link span{
  color:#f8fbff!important;
  -webkit-text-fill-color:#f8fbff!important;
  opacity:1!important;
}
html[data-apk-theme="dark"] #sidebar .sidebar-link i,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .sidebar-link i,
html[data-apk-theme="dark"] #sidebar .sidebar-link svg,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .sidebar-link svg,
body[data-apk-theme="dark"] #sidebar .sidebar-link i,
body[data-apk-theme="dark"] .sidebar-wrapper .menu .sidebar-link i{
  background:linear-gradient(135deg,#1e3354,#2a4167)!important;
  color:#dbeafe!important;
  fill:#dbeafe!important;
  border:1px solid rgba(148,163,184,.20)!important;
}
html[data-apk-theme="dark"] #sidebar .sidebar-link:hover,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .sidebar-link:hover,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .sidebar-item.active>.sidebar-link,
body[data-apk-theme="dark"] #sidebar .sidebar-link:hover,
body[data-apk-theme="dark"] .sidebar-wrapper .menu .sidebar-item.active>.sidebar-link{
  background:linear-gradient(135deg,rgba(37,99,235,.20),rgba(124,58,237,.18))!important;
  color:#ffffff!important;
  -webkit-text-fill-color:#ffffff!important;
  border-color:rgba(96,165,250,.30)!important;
  box-shadow:0 10px 24px rgba(0,0,0,.22)!important;
}

/* Submenu card: prevent legacy white background in dark mode */
html[data-apk-theme="dark"] #sidebar .submenu,
html[data-apk-theme="dark"] #sidebar ul.submenu,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu.active,
html[data-apk-theme="dark"] .apk-menu-shell .submenu,
html[data-apk-theme="dark"] .apk-menu-shell ul.submenu,
body[data-apk-theme="dark"] #sidebar .submenu,
body[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu,
body[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu.active{
  background:linear-gradient(135deg,#101f35 0%,#14243d 100%)!important;
  color:#eef6ff!important;
  border:1px solid rgba(96,165,250,.22)!important;
  border-radius:20px!important;
  box-shadow:0 18px 42px rgba(0,0,0,.28),0 0 0 1px rgba(255,255,255,.03) inset!important;
  opacity:1!important;
  -webkit-text-fill-color:initial!important;
}

/* Submenu items and text */
html[data-apk-theme="dark"] #sidebar .submenu li,
html[data-apk-theme="dark"] #sidebar .submenu .submenu-item,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu li,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu .submenu-item,
body[data-apk-theme="dark"] #sidebar .submenu li,
body[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu li{
  background:transparent!important;
  color:#eef6ff!important;
  -webkit-text-fill-color:#eef6ff!important;
  opacity:1!important;
}
html[data-apk-theme="dark"] #sidebar .submenu a,
html[data-apk-theme="dark"] #sidebar .submenu .submenu-item a,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu a,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu .submenu-item a,
body[data-apk-theme="dark"] #sidebar .submenu a,
body[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu a{
  display:block!important;
  background:transparent!important;
  color:#dbeafe!important;
  -webkit-text-fill-color:#dbeafe!important;
  opacity:1!important;
  font-weight:800!important;
  text-shadow:none!important;
  border-radius:14px!important;
}
html[data-apk-theme="dark"] #sidebar .submenu a:hover,
html[data-apk-theme="dark"] #sidebar .submenu .submenu-item.active>a,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu a:hover,
html[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu .submenu-item.active>a,
body[data-apk-theme="dark"] #sidebar .submenu a:hover,
body[data-apk-theme="dark"] .sidebar-wrapper .menu .submenu a:hover{
  background:linear-gradient(135deg,rgba(37,99,235,.26),rgba(236,72,153,.18))!important;
  color:#ffffff!important;
  -webkit-text-fill-color:#ffffff!important;
}

/* Sidebar pills/cards in dark mode */
html[data-apk-theme="dark"] #sidebar .apk-user-card,
html[data-apk-theme="dark"] #sidebar .apk-user-card-link,
html[data-apk-theme="dark"] #sidebar .apk-system-badge,
html[data-apk-theme="dark"] #sidebar .brand-pill,
html[data-apk-theme="dark"] #sidebar .apk-pill,
body[data-apk-theme="dark"] #sidebar .apk-user-card,
body[data-apk-theme="dark"] #sidebar .apk-system-badge{
  background:linear-gradient(135deg,#101f35,#152845)!important;
  border-color:rgba(96,165,250,.25)!important;
  color:#eef6ff!important;
  -webkit-text-fill-color:initial!important;
}
html[data-apk-theme="dark"] #sidebar .apk-user-card *,
html[data-apk-theme="dark"] #sidebar .apk-system-badge *,
html[data-apk-theme="dark"] #sidebar .brand-pill *,
html[data-apk-theme="dark"] #sidebar .apk-pill *,
body[data-apk-theme="dark"] #sidebar .apk-user-card *,
body[data-apk-theme="dark"] #sidebar .apk-system-badge *{
  color:#eef6ff!important;
  -webkit-text-fill-color:#eef6ff!important;
  opacity:1!important;
}
html[data-apk-theme="dark"] #sidebar .apk-page-label,
html[data-apk-theme="dark"] #sidebar .brand-pill,
html[data-apk-theme="dark"] #sidebar .apk-system-badge{
  color:#ff7abd!important;
  -webkit-text-fill-color:#ff7abd!important;
}

/* Light mode safety: keep submenu readable too */
html[data-apk-theme="light"] #sidebar .submenu,
html[data-apk-theme="light"] .sidebar-wrapper .menu .submenu{
  background:#ffffff!important;
  color:#172033!important;
  border-color:#dbe7fb!important;
}
html[data-apk-theme="light"] #sidebar .submenu a,
html[data-apk-theme="light"] .sidebar-wrapper .menu .submenu a{
  color:#334155!important;
  -webkit-text-fill-color:#334155!important;
  opacity:1!important;
}
