/* Sidebar: remove simplebar, use native scroll */
.sidebar-left {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--bs-primary-rgb), 0.4) transparent;
}
.sidebar-left::-webkit-scrollbar {
  width: 5px;
}
.sidebar-left::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-left::-webkit-scrollbar-thumb {
  background-color: rgba(var(--bs-primary-rgb), 0.4);
  border-radius: 3px;
}
.sidebar-left::-webkit-scrollbar-thumb:hover {
  background-color: rgba(var(--bs-primary-rgb), 0.6);
}
.sidebar-left .simplebar-wrapper,
.sidebar-left .simplebar-mask,
.sidebar-left .simplebar-offset,
.sidebar-left .simplebar-content-wrapper,
.sidebar-left .simplebar-content,
.sidebar-left .simplebar-track {
  display: contents !important;
}

/* =============================================
   Sidebar Dark = theme-colored background
   ============================================= */
[data-sidebar-color=dark] .sidebar-left {
  background: color-mix(in srgb, var(--bs-primary) 35%, #111) !important;
}
/* Logo box: match sidebar theme color (override template's fixed gray) */
[data-sidebar-color=dark][data-layout=vertical] #page-topbar .navbar-header .navbar-logo-box {
  background: color-mix(in srgb, var(--bs-primary) 30%, #111) !important;
}
[data-sidebar-color=dark] .navbar-logo-box,
[data-sidebar-color=dark] #page-topbar .navbar-logo-box,
[data-topbar-color=dark] .navbar-logo-box,
[data-topbar-color=dark] #page-topbar .navbar-logo-box {
  background: color-mix(in srgb, var(--bs-primary) 30%, #111) !important;
}

/* Logo box & sidebar toggle button: icon color white on dark bg */
[data-sidebar-color=dark] .navbar-logo-box .top-icon i,
[data-sidebar-color=dark] .navbar-logo-box #sidebar-btn i,
[data-topbar-color=dark] .navbar-logo-box .top-icon i,
[data-topbar-color=dark] .navbar-logo-box #sidebar-btn i {
  color: rgba(255, 255, 255, 0.8) !important;
}
[data-sidebar-color=dark] .navbar-logo-box .top-icon:hover i,
[data-topbar-color=dark] .navbar-logo-box .top-icon:hover i {
  color: #fff !important;
}

/* Topbar dark: all top-icon buttons white */
[data-topbar-color=dark] #page-topbar .top-icon i {
  color: rgba(255, 255, 255, 0.8) !important;
}
[data-topbar-color=dark] #page-topbar .top-icon:hover i {
  color: #fff !important;
}
[data-topbar-color=dark] #page-topbar .top-icon:hover,
[data-topbar-color=dark] #page-topbar .top-icon:active {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Topbar dark: user name, mdi icons, badge text white */
[data-topbar-color=dark] #page-topbar .admin-name,
[data-topbar-color=dark] #page-topbar .mdi,
[data-topbar-color=dark] #page-topbar .text-muted {
  color: rgba(255, 255, 255, 0.8) !important;
}

/* Sidebar dark: link text = white semi-transparent */
[data-sidebar-color=dark] .sidebar-left #sidebar-menu ul > li > a {
  color: rgba(255, 255, 255, 0.75);
}

/* Sidebar dark: hover */
[data-sidebar-color=dark] .sidebar-left #sidebar-menu ul > li > a:hover {
  color: #fff !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Sidebar: active indicator — right-side vertical bar (matching template pattern) */
.sidebar-left #sidebar-menu ul.left-menu > li > a:nth-of-type(1) {
  position: relative;
}
.sidebar-left #sidebar-menu ul.left-menu > li > a:nth-of-type(1)::before {
  display: block;
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 4px;
  height: 30px;
  transform: translateY(-50%);
  border-radius: 10px 0 0 10px;
  background-color: var(--bs-primary);
  transition: all 0.4s;
  opacity: 0;
  visibility: hidden;
}
.sidebar-left #sidebar-menu ul.left-menu > li > a:nth-of-type(1):hover::before {
  opacity: 0.5;
  visibility: visible;
}
.sidebar-left #sidebar-menu ul.left-menu > li > a.router-link-exact-active::before {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Sidebar dark: active item — white text + lighter bg */
[data-sidebar-color=dark] .sidebar-left #sidebar-menu ul > li > a.router-link-exact-active {
  color: #fff !important;
  background-color: rgba(255, 255, 255, 0.15) !important;
}
[data-sidebar-color=dark] .sidebar-left #sidebar-menu ul.left-menu > li > a:nth-of-type(1)::before {
  background-color: #fff;
}
[data-sidebar-color=dark] .sidebar-left #sidebar-menu ul > li > a.router-link-exact-active i,
[data-sidebar-color=dark] .sidebar-left #sidebar-menu ul > li > a.router-link-exact-active svg {
  color: #fff !important;
  fill: #fff !important;
}

/* Sidebar dark: section titles */
[data-sidebar-color=dark] .sidebar-left #sidebar-menu .menu-title {
  color: rgba(255, 255, 255, 0.45) !important;
  background-color: rgba(255, 255, 255, 0.06) !important;
  opacity: 1 !important;
}

/* =============================================
   Topbar Dark = theme-colored background
   ============================================= */
[data-topbar-color=dark] #page-topbar {
  background: color-mix(in srgb, var(--bs-primary) 30%, #111) !important;
}
[data-topbar-color=dark] #page-topbar .app-search .form-control {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
}
[data-topbar-color=dark] #page-topbar .app-search .form-control::placeholder {
  color: rgba(255, 255, 255, 0.6) !important;
}
[data-topbar-color=dark] #page-topbar .admin-user-info {
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Entity type switcher button — adapts to topbar color */
.topbar-type-btn {
  background-color: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: inherit;
}
.topbar-type-btn:hover {
  background-color: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.15);
  color: inherit;
}
[data-topbar-color=dark] #page-topbar .topbar-type-btn {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: rgba(255, 255, 255, 0.85) !important;
}
[data-topbar-color=dark] #page-topbar .topbar-type-btn:hover {
  background-color: rgba(255, 255, 255, 0.18) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #fff !important;
}
[data-topbar-color=dark] #page-topbar .topbar-type-btn .mdi,
[data-topbar-color=dark] #page-topbar .topbar-type-btn .bi {
  color: rgba(255, 255, 255, 0.85) !important;
}
/* Dark BS theme (not topbar-color) — e.g. light topbar on dark page theme */
[data-bs-theme=dark] .topbar-type-btn {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--bs-body-color);
}
[data-bs-theme=dark] .topbar-type-btn:hover {
  background-color: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Light sidebar: active item uses primary color */
.sidebar-left #sidebar-menu ul > li > a.router-link-exact-active {
  color: var(--bs-primary) !important;
  background-color: rgba(var(--bs-primary-rgb), 0.1);
}

/* =============================================
   Custom theme color overrides
   ============================================= */

/* Orange → Dark Red (暗红) */
[data-theme-colors=orange],
[data-bs-theme=light][data-theme-colors=orange] {
  --bs-primary: #b5495b;
  --bs-primary-rgb: 181, 73, 91;
  --bs-primary-bg-subtle: rgba(181, 73, 91, 0.1);
  --bs-primary-border-subtle: rgba(181, 73, 91, 0.5);
  --bs-link-color-rgb: 181, 73, 91;
  --bs-link-hover-color-rgb: 153, 55, 72;
}
[data-bs-theme=dark][data-theme-colors=orange] {
  --bs-primary: #c96b7a;
  --bs-primary-rgb: 201, 107, 122;
  --bs-primary-bg-subtle: rgba(181, 73, 91, 0.15);
  --bs-primary-border-subtle: rgba(181, 73, 91, 0.4);
  --bs-link-color-rgb: 201, 107, 122;
  --bs-link-hover-color-rgb: 218, 138, 151;
}

/* Lime → Deeper Earthy Yellow (深土黄) */
[data-theme-colors=lime],
[data-bs-theme=light][data-theme-colors=lime] {
  --bs-primary: #8a7328;
  --bs-primary-rgb: 138, 115, 40;
  --bs-primary-bg-subtle: rgba(138, 115, 40, 0.1);
  --bs-primary-border-subtle: rgba(138, 115, 40, 0.5);
  --bs-link-color-rgb: 138, 115, 40;
  --bs-link-hover-color-rgb: 112, 93, 30;
}
[data-bs-theme=dark][data-theme-colors=lime] {
  --bs-primary: #a89040;
  --bs-primary-rgb: 168, 144, 64;
  --bs-primary-bg-subtle: rgba(138, 115, 40, 0.15);
  --bs-primary-border-subtle: rgba(138, 115, 40, 0.4);
  --bs-link-color-rgb: 168, 144, 64;
  --bs-link-hover-color-rgb: 192, 168, 88;
}

/* Blue → Deeper Info Blue (深信息蓝) */
[data-theme-colors=blue],
[data-bs-theme=light][data-theme-colors=blue] {
  --bs-primary: #2874a6;
  --bs-primary-rgb: 40, 116, 166;
  --bs-primary-bg-subtle: rgba(40, 116, 166, 0.1);
  --bs-primary-border-subtle: rgba(40, 116, 166, 0.5);
  --bs-link-color-rgb: 40, 116, 166;
  --bs-link-hover-color-rgb: 30, 92, 135;
}
[data-bs-theme=dark][data-theme-colors=blue] {
  --bs-primary: #4a9ed4;
  --bs-primary-rgb: 74, 158, 212;
  --bs-primary-bg-subtle: rgba(40, 116, 166, 0.15);
  --bs-primary-border-subtle: rgba(40, 116, 166, 0.4);
  --bs-link-color-rgb: 74, 158, 212;
  --bs-link-hover-color-rgb: 108, 180, 226;
}

/* New: Dark Green (深绿) */
[data-theme-colors=darkgreen],
[data-bs-theme=light][data-theme-colors=darkgreen] {
  --bs-primary: #2d7d5f;
  --bs-primary-rgb: 45, 125, 95;
  --bs-primary-bg-subtle: rgba(45, 125, 95, 0.1);
  --bs-primary-border-subtle: rgba(45, 125, 95, 0.5);
  --bs-link-color-rgb: 45, 125, 95;
  --bs-link-hover-color-rgb: 33, 100, 74;
}
[data-bs-theme=dark][data-theme-colors=darkgreen] {
  --bs-primary: #4aa882;
  --bs-primary-rgb: 74, 168, 130;
  --bs-primary-bg-subtle: rgba(45, 125, 95, 0.15);
  --bs-primary-border-subtle: rgba(45, 125, 95, 0.4);
  --bs-link-color-rgb: 74, 168, 130;
  --bs-link-hover-color-rgb: 108, 192, 158;
}
