/**
 * AccEasy AdminLTE 3 shell bridge.
 * Layout chrome uses AdminLTE 3; page content may still use AdminLTE 2 / Bootstrap helpers from vendor.css.
 */

body.adminlte3-shell {
  overflow-x: hidden;
  --alte-accent: #007bff;
  --alte-accent-soft: rgba(0, 123, 255, 0.14);
  --alte-accent-strong: #0056b3;
  --alte-sidebar-bg: #1f2d3d;
  --alte-sidebar-hover: rgba(255, 255, 255, 0.06);
  --alte-sidebar-text: rgba(255, 255, 255, 0.85);
  --alte-sidebar-muted: rgba(255, 255, 255, 0.55);
  --alte-brand-fg: #fff;
  --alte-navbar-fg: #fff;
}

/* Accent tokens — keep navbar, brand, active menu on one palette */
body.adminlte3-shell.theme-accent-primary {
  --alte-accent: #007bff;
  --alte-accent-soft: rgba(0, 123, 255, 0.16);
  --alte-accent-strong: #0056b3;
  --alte-sidebar-bg: #1a2332;
}
body.adminlte3-shell.theme-accent-navy {
  --alte-accent: #001f3f;
  --alte-accent-soft: rgba(0, 31, 63, 0.18);
  --alte-accent-strong: #00152b;
  --alte-sidebar-bg: #0f1724;
}
body.adminlte3-shell.theme-accent-purple {
  --alte-accent: #6f42c1;
  --alte-accent-soft: rgba(111, 66, 193, 0.18);
  --alte-accent-strong: #59309e;
  --alte-sidebar-bg: #1c1530;
}
body.adminlte3-shell.theme-accent-indigo {
  --alte-accent: #6610f2;
  --alte-accent-soft: rgba(102, 16, 242, 0.18);
  --alte-accent-strong: #520dc2;
  --alte-sidebar-bg: #1a1333;
}
body.adminlte3-shell.theme-accent-success {
  --alte-accent: #28a745;
  --alte-accent-soft: rgba(40, 167, 69, 0.16);
  --alte-accent-strong: #1e7e34;
  --alte-sidebar-bg: #14241a;
}
body.adminlte3-shell.theme-accent-danger {
  --alte-accent: #dc3545;
  --alte-accent-soft: rgba(220, 53, 69, 0.16);
  --alte-accent-strong: #bd2130;
  --alte-sidebar-bg: #2a1518;
}
body.adminlte3-shell.theme-accent-warning {
  --alte-accent: #ffc107;
  --alte-accent-soft: rgba(255, 193, 7, 0.2);
  --alte-accent-strong: #d39e00;
  --alte-sidebar-bg: #2a2414;
  --alte-brand-fg: #212529;
  --alte-navbar-fg: #212529;
}

/* Light tone: soft gray sidebar, white top bar, accent only for active */
body.adminlte3-shell.theme-tone-light {
  --alte-sidebar-bg: #f8f9fa;
  --alte-sidebar-hover: rgba(0, 0, 0, 0.04);
  --alte-sidebar-text: #343a40;
  --alte-sidebar-muted: #6c757d;
  --alte-brand-fg: #343a40;
  --alte-navbar-fg: #343a40;
}

/* Content area: keep AccEasy full-height scroll region under fixed navbar */
body.adminlte3-shell .content-wrapper.acceasy-content {
  /* Beat vendor.css ALTE2 margin-left:230px */
  margin-left: 250px !important;
  height: calc(100vh - 57px);
  min-height: 0 !important;
  overflow: auto;
  background-color: #f4f6f9;
  /* ALTE2 .fixed .content-wrapper { padding-top:50px } — unused class, but keep clear */
  padding-top: 0 !important;
}

body.adminlte3-shell.sidebar-mini.sidebar-collapse .content-wrapper.acceasy-content {
  margin-left: 4.6rem !important;
}

/* Collapsed icon rail — AdminLTE 3 width (do not use ALTE2 50px / width:0 or glyphs clip) */
@media (min-width: 768px) {
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .main-sidebar {
    width: 4.6rem !important;
    transform: translate(0, 0) !important; /* kill ALTE2 translate(-230px) */
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body.adminlte3-shell.sidebar-mini.sidebar-collapse .main-header,
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .content-wrapper,
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .content-wrapper.acceasy-content,
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .main-footer,
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .right-side {
    margin-left: 4.6rem !important;
  }

  body.adminlte3-shell.sidebar-mini.sidebar-collapse .brand-link .brand-text {
    display: none !important;
  }

  body.adminlte3-shell.sidebar-mini.sidebar-collapse .nav-sidebar .nav-link {
    width: calc(4.6rem - 1rem) !important;
    margin: 0.15rem auto !important;
    padding: 0.65rem 0.5rem !important;
    justify-content: center;
  }

  body.adminlte3-shell.sidebar-mini.sidebar-collapse .nav-sidebar .nav-link.active,
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .nav-sidebar .nav-item.menu-open > .nav-link {
    background-color: var(--alte-accent) !important;
  }

  body.adminlte3-shell.sidebar-mini.sidebar-collapse .nav-sidebar .nav-link p {
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.adminlte3-shell.sidebar-mini.sidebar-collapse .nav-sidebar .nav-link > .nav-icon,
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .nav-sidebar .nav-link > .fa,
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .nav-sidebar .nav-link > .fas,
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .nav-sidebar .nav-link > .far {
    display: inline-block !important;
    width: 1.6rem !important;
    margin: 0 auto !important;
    font-size: 1.15rem !important;
    text-align: center !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  body.adminlte3-shell.sidebar-mini.sidebar-collapse .nav-sidebar .nav-link > .right,
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .nav-sidebar .nav-link .fa-angle-left {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  /* Align header + content (was mismatched: content 0 at 991, header 0 only at 767) */
  body.adminlte3-shell .main-header,
  body.adminlte3-shell .content-wrapper.acceasy-content,
  body.adminlte3-shell .main-footer {
    margin-left: 0 !important;
  }
}

/* Brand + navbar — same accent family as sidebar active state */
body.adminlte3-shell .main-header {
  z-index: 1200 !important;
  border-bottom: none !important;
  /* ALTE3: navbar sits beside sidebar; do not reserve ALTE2 header-logo gap */
  margin-left: 250px !important;
  /* vendor.css .main-header { max-height:100px } clips taller navbar rows */
  max-height: none !important;
}

body.adminlte3-shell.theme-tone-dark .main-header.navbar {
  background-color: var(--alte-accent) !important;
  color: var(--alte-navbar-fg) !important;
}

body.adminlte3-shell.theme-tone-dark .main-header.navbar .nav-link,
body.adminlte3-shell.theme-tone-dark .main-header.navbar .navbar-meta-text {
  color: var(--alte-navbar-fg) !important;
}

body.adminlte3-shell.theme-tone-light .main-header.navbar {
  background-color: #fff !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
  color: var(--alte-navbar-fg) !important;
}

/*
 * Kill ALTE2 chrome leftovers from vendor.css:
 * - padding-top:50px reserved space for header .logo (removed in ALTE3)
 * - width:230px vs ALTE3 250px
 * Without this, brand-link sits below the navbar and the top-left corner is blank.
 */
body.adminlte3-shell .main-sidebar {
  z-index: 1100;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  bottom: 0 !important;
  width: 250px !important;
  height: 100vh !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
  overflow: hidden;
  background-color: var(--alte-sidebar-bg) !important;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: none !important;
}

body.adminlte3-shell .main-sidebar .sidebar {
  height: calc(100vh - 57px);
  overflow-y: auto;
  padding: 0.65rem 0.5rem 1rem;
  margin-top: 0 !important;
  background: transparent !important;
}

body.adminlte3-shell .brand-link {
  display: flex !important;
  align-items: center;
  position: relative;
  height: 57px;
  min-height: 57px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-color: var(--alte-accent) !important;
  color: var(--alte-brand-fg) !important;
  border-bottom: 0 !important;
  padding: 0 0.9rem !important;
  margin: 0 !important;
  box-sizing: border-box;
}

body.adminlte3-shell.theme-tone-light .brand-link {
  background-color: #fff !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
  color: var(--alte-brand-fg) !important;
}

body.adminlte3-shell .brand-link .brand-text {
  font-weight: 600;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit !important;
}

/* Sidebar nav — professional spacing + accent-matched active */
body.adminlte3-shell .nav-sidebar .nav-item {
  margin-bottom: 0.15rem;
}

body.adminlte3-shell .nav-sidebar .nav-link {
  border-radius: 0.4rem !important;
  color: var(--alte-sidebar-text) !important;
  padding: 0.55rem 0.75rem !important;
  transition: background-color 0.15s ease, color 0.15s ease;
}

body.adminlte3-shell .nav-sidebar .nav-link .nav-icon {
  color: var(--alte-sidebar-muted) !important;
  transition: color 0.15s ease;
}

body.adminlte3-shell .nav-sidebar .nav-link:hover {
  background-color: var(--alte-sidebar-hover) !important;
  color: var(--alte-sidebar-text) !important;
}

body.adminlte3-shell .nav-sidebar .nav-link:hover .nav-icon {
  color: var(--alte-sidebar-text) !important;
}

body.adminlte3-shell .nav-sidebar .nav-link.active,
body.adminlte3-shell .nav-sidebar .nav-item.menu-open > .nav-link {
  background-color: var(--alte-accent) !important;
  color: #fff !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

body.adminlte3-shell.theme-accent-warning .nav-sidebar .nav-link.active,
body.adminlte3-shell.theme-accent-warning .nav-sidebar .nav-item.menu-open > .nav-link {
  color: #212529 !important;
}

body.adminlte3-shell .nav-sidebar .nav-link.active .nav-icon,
body.adminlte3-shell .nav-sidebar .nav-item.menu-open > .nav-link .nav-icon,
body.adminlte3-shell .nav-sidebar .nav-link.active .right,
body.adminlte3-shell .nav-sidebar .nav-item.menu-open > .nav-link .right {
  color: inherit !important;
}

body.adminlte3-shell .nav-sidebar .nav-treeview .nav-link {
  padding-left: 1.5rem !important;
  color: var(--alte-sidebar-muted) !important;
}

body.adminlte3-shell .nav-sidebar .nav-treeview .nav-link.active {
  background-color: var(--alte-accent-soft) !important;
  color: var(--alte-sidebar-text) !important;
  box-shadow: none;
}

body.adminlte3-shell.theme-tone-dark .nav-sidebar .nav-treeview .nav-link.active {
  color: #fff !important;
  background-color: rgba(255, 255, 255, 0.12) !important;
}

body.adminlte3-shell .nav-header {
  color: var(--alte-sidebar-muted) !important;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.75rem 0.85rem 0.35rem;
}

/* Pushmenu hamburger — keep AccEasy visibility rules */
body.adminlte3-shell .main-header .nav-link[data-widget="pushmenu"],
body.adminlte3-shell .main-header .sidebar-pin-toggle {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 57px;
  padding: 0 12px !important;
  z-index: 1210;
  cursor: pointer;
}

body.adminlte3-shell .sidebar-pin-toggle.is-pinned,
body.adminlte3-shell.sidebar-pinned .sidebar-pin-toggle {
  color: #ffc107 !important;
}

body.adminlte3-shell .sidebar-pin-toggle.is-pinned .sidebar-pin-icon-on,
body.adminlte3-shell.sidebar-pinned .sidebar-pin-toggle .sidebar-pin-icon-on {
  transform: rotate(-45deg);
}

/* When pinned, keep expanded rail (override any late collapse class) */
body.adminlte3-shell.sidebar-pinned.sidebar-collapse .main-sidebar,
body.adminlte3-shell.sidebar-pinned .main-sidebar {
  margin-left: 0 !important;
}

@media (min-width: 768px) {
  body.adminlte3-shell.sidebar-pinned.sidebar-collapse .main-sidebar {
    width: 250px !important;
  }

  body.adminlte3-shell.sidebar-pinned.sidebar-collapse .main-header,
  body.adminlte3-shell.sidebar-pinned.sidebar-collapse .content-wrapper,
  body.adminlte3-shell.sidebar-pinned.sidebar-collapse .content-wrapper.acceasy-content,
  body.adminlte3-shell.sidebar-pinned.sidebar-collapse .main-footer {
    margin-left: 250px !important;
  }

  body.adminlte3-shell.sidebar-pinned.sidebar-collapse .nav-sidebar .nav-link {
    width: auto !important;
  }

  body.adminlte3-shell.sidebar-pinned.sidebar-collapse .nav-sidebar .nav-link p {
    width: auto !important;
    height: auto !important;
    opacity: 1 !important;
    overflow: visible !important;
  }

  body.adminlte3-shell.sidebar-pinned.sidebar-collapse .brand-link .brand-text {
    display: inline !important;
  }
}

body.adminlte3-shell .sidebar-toggle-bars {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 22px;
  height: 16px;
}

body.adminlte3-shell .sidebar-toggle-bars > span {
  display: block !important;
  width: 100%;
  height: 2px;
  background: currentColor !important;
  border-radius: 1px;
}

/* Navbar extras from AccEasy header */
body.adminlte3-shell .navbar-menu-search-form {
  position: relative;
  margin-left: 0.75rem;
  min-width: 220px;
  max-width: 320px;
  flex: 1 1 auto;
}

/* Search field blends into colored navbar instead of a harsh white slab */
body.adminlte3-shell.theme-tone-dark .navbar-menu-search-group .form-control,
body.adminlte3-shell.theme-tone-dark .navbar-menu-search-group .input-group-text {
  background: rgba(255, 255, 255, 0.16) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
}

body.adminlte3-shell.theme-tone-dark .navbar-menu-search-group .form-control::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

body.adminlte3-shell.theme-tone-light .navbar-menu-search-group .input-group-text {
  background: #fff;
}

body.adminlte3-shell .navbar-location-wrap {
  min-width: 160px;
  max-width: 200px;
  margin-left: 0.75rem;
}

body.adminlte3-shell .navbar-custom-menu {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 0.75rem;
}

body.adminlte3-shell .navbar-meta-text {
  color: inherit;
  white-space: nowrap;
  font-size: 0.9rem;
}

/* Menu: support both AdminLTE 3 nav-sidebar and legacy tree class aliases used by AccEasy JS */
body.adminlte3-shell .nav-sidebar .nav-link p {
  display: inline;
  margin: 0;
}

body.adminlte3-shell .nav-sidebar .nav-treeview {
  display: none;
  list-style: none;
  padding-left: 0;
}

body.adminlte3-shell .nav-sidebar .nav-item.menu-open > .nav-treeview,
body.adminlte3-shell .nav-sidebar .nav-item.menu-open > .treeview-menu {
  display: block;
}

body.adminlte3-shell .nav-sidebar .nav-link > .right,
body.adminlte3-shell .nav-sidebar .nav-link > .pull-right-container {
  position: absolute;
  right: 1rem;
  top: 0.7rem;
}

/* Preserve AccEasy leaf / search markers */
body.adminlte3-shell .nav-sidebar .sidebar-menu-leaf span,
body.adminlte3-shell .nav-sidebar .nav-link p > span {
  display: inline;
}

/* Soften conflict: AdminLTE 2 skin / logo rules in vendor.css */
body.adminlte3-shell .main-header .logo,
body.adminlte3-shell[class*="skin-"] .main-header .logo {
  display: none !important;
}

/*
 * Broader ALTE2 chrome neutralization (vendor.css still ships full ALTE2 layout).
 * Menu HTML keeps dual classes (nav-sidebar + sidebar-menu) for AccEasy JS, so
 * ALTE2 collapse-hover flyouts and 230px transforms still match unless killed here.
 */
/* Inner ALTE2 navbar only (descendant). Do NOT zero margin on nav.main-header.navbar. */
body.adminlte3-shell .main-header .navbar {
  margin-left: 0 !important;
  min-height: 57px;
}

body.adminlte3-shell .main-header.navbar {
  min-height: 57px;
}

body.adminlte3-shell .main-footer {
  margin-left: 250px !important;
}

@media (min-width: 768px) {
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .main-footer {
    margin-left: 4.6rem !important;
  }

  /* Disable ALTE2 icon-rail hover flyouts (left:50px) — menu has .sidebar-menu alias */
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .sidebar-menu > li:hover > .treeview-menu,
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .sidebar-menu > li:hover > a > span:not(.pull-right),
  body.adminlte3-shell.sidebar-mini.sidebar-collapse .sidebar-menu > li:hover > a > span {
    display: none !important;
    position: static !important;
    width: auto !important;
    left: auto !important;
    top: auto !important;
    margin-left: 0 !important;
    padding: 0 !important;
    background: transparent !important;
  }
}

@media (max-width: 767.98px) {
  /*
   * ALTE2: transform translate(±230px) + padding-top:100px
   * ALTE3 PushMenu: margin-left ±250px (no content push)
   */
  body.adminlte3-shell .main-sidebar {
    padding-top: 0 !important;
    transform: none !important;
    margin-left: -250px !important;
  }

  body.adminlte3-shell.sidebar-open .main-sidebar {
    margin-left: 0 !important;
  }

  /* Kill ALTE2 content shove when drawer opens */
  body.adminlte3-shell.sidebar-open .content-wrapper,
  body.adminlte3-shell.sidebar-open .content-wrapper.acceasy-content,
  body.adminlte3-shell.sidebar-open .main-footer {
    transform: none !important;
  }
}

/* POS / lockscreen: do not force sidebar layout */
body.adminlte3-shell.lockscreen .main-sidebar,
body.adminlte3-shell.lockscreen .content-wrapper.acceasy-content,
body.adminlte3-shell.lockscreen .main-header {
  margin-left: 0 !important;
  width: auto !important;
  transform: none !important;
}
