/* PMD Sidebar Icons Only v15
   Safe ChatGPT-style collapsed sidebar.
   Uses unique class pmd-sidebar-icons-only to avoid conflict.
*/

html body.page.pmd-admin-theme-v1 {
  --pmd-sidebar-expanded-width: 188px !important;
  --pmd-sidebar-icons-width: 82px !important;
  --pmd-sidebar-offset: 14px !important;
  --pmd-sidebar-gap: 10px !important;
}

/* Base full sidebar lock */
@media (min-width: 1200px) {
  html body.page.pmd-admin-theme-v1 .sidebar {
    position: fixed !important;
    left: var(--pmd-sidebar-offset) !important;
    top: var(--pmd-sidebar-offset) !important;
    width: var(--pmd-sidebar-expanded-width) !important;
    min-width: var(--pmd-sidebar-expanded-width) !important;
    max-width: var(--pmd-sidebar-expanded-width) !important;
    height: calc(100vh - 28px) !important;
    min-height: calc(100vh - 28px) !important;
    max-height: calc(100vh - 28px) !important;
    border-radius: 28px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    background:
      radial-gradient(circle at 36% 0%, rgba(200,155,74,.10), transparent 30%),
      linear-gradient(180deg, #000000 0%, #000806 13%, #001815 40%, #022822 72%, #063A33 100%) !important;
    border: 1px solid rgba(200,155,74,.28) !important;
    box-shadow: 0 24px 52px rgba(2,31,28,.28) !important;
    transition: width .22s ease, min-width .22s ease, max-width .22s ease !important;
  }

  html body.page.pmd-admin-theme-v1 .page-wrapper {
    margin-left: calc(var(--pmd-sidebar-offset) + var(--pmd-sidebar-expanded-width) + var(--pmd-sidebar-gap)) !important;
    transition: margin-left .22s ease !important;
  }

  html body.page.pmd-admin-theme-v1 .navbar-top.navbar-fixed-top {
    left: calc(var(--pmd-sidebar-offset) + var(--pmd-sidebar-expanded-width) + var(--pmd-sidebar-gap)) !important;
    width: calc(100% - var(--pmd-sidebar-offset) - var(--pmd-sidebar-expanded-width) - var(--pmd-sidebar-gap)) !important;
    transition: left .22s ease, width .22s ease !important;
  }
}

/* Icons-only state */
@media (min-width: 1200px) {
  html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .sidebar {
    width: var(--pmd-sidebar-icons-width) !important;
    min-width: var(--pmd-sidebar-icons-width) !important;
    max-width: var(--pmd-sidebar-icons-width) !important;
    height: calc(100vh - 28px) !important;
    min-height: calc(100vh - 28px) !important;
    max-height: calc(100vh - 28px) !important;
    border-radius: 24px !important;
  }

  html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .page-wrapper {
    margin-left: calc(var(--pmd-sidebar-offset) + var(--pmd-sidebar-icons-width) + var(--pmd-sidebar-gap)) !important;
  }

  html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .navbar-top.navbar-fixed-top {
    left: calc(var(--pmd-sidebar-offset) + var(--pmd-sidebar-icons-width) + var(--pmd-sidebar-gap)) !important;
    width: calc(100% - var(--pmd-sidebar-offset) - var(--pmd-sidebar-icons-width) - var(--pmd-sidebar-gap)) !important;
  }
}

/* Toggle button inside sidebar, not outside */
html body.page.pmd-admin-theme-v1 .pmd-sidebar-icons-toggle {
  position: absolute !important;
  top: 76px !important;
  right: 8px !important;
  z-index: 9999 !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(200,155,74,.34) !important;
  background: linear-gradient(135deg, #FFF9EF 0%, #F5E8D0 100%) !important;
  color: #062F2A !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 10px 24px rgba(2,31,28,.24) !important;
  outline: none !important;
}

html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-icons-toggle {
  right: 25px !important;
  top: 82px !important;
}

/* Keep nav visible */
html body.page.pmd-admin-theme-v1 #navSidebar {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

html body.page.pmd-admin-theme-v1 #side-nav-menu {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Logo compact */
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-brand {
  height: 72px !important;
  min-height: 72px !important;
  padding: 12px 8px 6px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-brand img,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-brand .logo,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-brand .logo-svg,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-brand .pmd-sidebar-brand-img {
  width: 46px !important;
  max-width: 46px !important;
  height: 46px !important;
  object-fit: contain !important;
}

/* Icons-only menu */
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu {
  width: 100% !important;
  padding: 46px 10px 96px !important;
  margin: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  max-height: calc(100vh - 150px) !important;
}

html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item {
  display: block !important;
  width: 100% !important;
  margin: 0 0 8px !important;
  padding: 0 !important;
  visibility: visible !important;
  opacity: 1 !important;
}

html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > .nav-link {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 56px !important;
  height: 50px !important;
  min-height: 50px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  border-radius: 18px !important;
  gap: 0 !important;
  overflow: visible !important;
  position: relative !important;
}

html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > .nav-link > i.fa {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  width: 23px !important;
  min-width: 23px !important;
  height: 23px !important;
  margin: 0 !important;
  color: rgba(229,237,245,.98) !important;
}

/* Hide labels only */
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > .nav-link > .content,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > .nav-link span.content,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > .nav-link .badge,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > .nav-link:before,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > .nav-link:after {
  display: none !important;
}

/* Hide children while icon-only */
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > ul.nav,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > ul.nav.collapse,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > ul.nav.show,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > ul.nav.collapsing {
  display: none !important;
}

/* Active icon state */
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item.active > .nav-link,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item.open > .nav-link,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > .nav-link[aria-expanded="true"] {
  background: linear-gradient(135deg, #FFF9EF 0%, #F5E8D0 100%) !important;
  color: #062F2A !important;
  box-shadow:
    0 10px 20px rgba(0,0,0,.18),
    inset 0 0 0 1px rgba(200,155,74,.24) !important;
}

html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item.active > .nav-link > i.fa,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item.open > .nav-link > i.fa,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only #side-nav-menu > .nav-item > .nav-link[aria-expanded="true"] > i.fa {
  color: #062F2A !important;
}

/* Compact profile/footer */
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-profile-collapse-target {
  width: 56px !important;
  min-width: 56px !important;
  max-width: 56px !important;
  height: 56px !important;
  min-height: 56px !important;
  padding: 5px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  justify-content: center !important;
}

html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-profile-collapse-target .content,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-profile-collapse-target .media-body,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-profile-collapse-target small,
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-profile-collapse-target span:not(.pmd-keep),
html body.page.pmd-admin-theme-v1.pmd-sidebar-icons-only .pmd-sidebar-profile-collapse-target button {
  display: none !important;
}
