/* PMD Sidebar Logo Last + Toggle Fix v55
   Tiny patch on top of v50-v54.
   - Moves LOGO cycle button to the end of the side menu
   - Makes it small: icon + current number only
   - Fixes sidebar open/close arrow position so it does not sit over LOGO/Dashboard
   - Does not touch dashboards, data, routes, or role dashboards */

/* LOGO switcher as last compact icon button */
html body.page.pmd-admin-theme-v1 .pmd-logo-cycle-nav-item-v38 {
  order: 99 !important;
  width: 100% !important;
  margin: 10px auto 0 !important;
  padding: 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

/* Keep it available in closed mode too; earlier fixes hid it */
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-logo-cycle-nav-item-v38 {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
  margin-top: 9px !important;
  margin-bottom: 0 !important;
}

/* Compact button: no LOGO text, just icon + 3/6 */
html body.page.pmd-admin-theme-v1 .pmd-logo-cycle-btn-v38 {
  width: 74px !important;
  min-width: 74px !important;
  max-width: 74px !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 0 10px !important;
  margin: 0 auto !important;
  border-radius: 18px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  background: rgba(255,248,226,.10) !important;
  border: 1px solid rgba(255,248,226,.20) !important;
  color: #fff7dd !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  overflow: hidden !important;
}

html body.page.pmd-admin-theme-v1 .pmd-logo-cycle-btn-v38::before {
  content: "↔" !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 16px !important;
  height: 16px !important;
  font-size: 17px !important;
  line-height: 16px !important;
  color: #d6a849 !important;
  font-weight: 900 !important;
}

/* Hide LOGO word */
html body.page.pmd-admin-theme-v1 .pmd-logo-cycle-btn-v38 > span {
  display: none !important;
}

/* Show only number e.g. 3/6 */
html body.page.pmd-admin-theme-v1 .pmd-logo-cycle-btn-v38 > small {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  color: #d6a849 !important;
  font-size: 12px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  letter-spacing: .04em !important;
}

/* Closed mode: smaller icon-only button, still showing logo number */
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-logo-cycle-btn-v38 {
  width: 56px !important;
  min-width: 56px !important;
  max-width: 56px !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  padding: 0 6px !important;
  border-radius: 16px !important;
  gap: 4px !important;
}

html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-logo-cycle-btn-v38::before {
  width: 14px !important;
  height: 14px !important;
  font-size: 15px !important;
}

html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-logo-cycle-btn-v38 > small {
  font-size: 10px !important;
}

/* If #side-nav-menu supports flex, keep LOGO at the end visually */
html body.page.pmd-admin-theme-v1 #side-nav-menu {
  display: flex !important;
  flex-direction: column !important;
}

/* Sidebar toggle: one correct edge position, controlled by JS variable */
html body.page.pmd-admin-theme-v1 .pmd-sidebar-icons-toggle {
  position: absolute !important;
  top: var(--pmd-sidebar-toggle-top-v55, 136px) !important;
  right: -17px !important;
  left: auto !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 999px !important;
  border: 1px solid rgba(200,155,74,.76) !important;
  background: #fff4dc !important;
  color: #063b34 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 10px 22px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.72) !important;
  z-index: 12000 !important;
  cursor: pointer !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Make the arrow icon visually centered */
html body.page.pmd-admin-theme-v1 .pmd-sidebar-icons-toggle i,
html body.page.pmd-admin-theme-v1 .pmd-sidebar-icons-toggle .fa {
  font-size: 18px !important;
  line-height: 18px !important;
  height: 18px !important;
  width: 18px !important;
  margin: 0 !important;
  display: block !important;
  text-align: center !important;
  color: currentColor !important;
  transform: translateY(1px) !important;
}

/* Keep closed rail spacing after logo button becomes last */
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu {
  margin-top: 14px !important;
}
