/* =========================================================================
   CommandX · AdminLTE 4 shell branding (MainLayout)
   -------------------------------------------------------------------------
   Full-width shell (no left panel): app-header (logo, group links, user
   menu), app-main (breadcrumb line + page), app-footer. Uses AdminLTE's own
   markup/classes; this file only adapts them to the CommandX brand.
   AdminLTE CSS comes from the CDN link in App.razor and loads first.
   ========================================================================= */

/* ---------- Header logo (replaces the sidebar logo strip) ---------- */
.cx-header-brand {
  display: flex;
  align-items: center;
  margin-right: var(--cx-space-4);
  padding: 0;
}

.cx-header-brand__logo {
  width: auto;
  max-width: 170px;
  height: 38px;
  object-fit: contain;
}

/* ---------- Header ---------- */
.app-header .nav-link .material-symbols-outlined {
  font-size: 22px;
  vertical-align: middle;
}

/* Group links (Core / Support / Strategic) */
.app-header .cx-group-link {
  display: inline-flex;
  align-items: center;
  gap: var(--cx-space-2);
  font-size: var(--cx-fs-sm);
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.app-header .cx-group-link .material-symbols-outlined {
  font-size: 18px;
}

.app-header .cx-group-link.active {
  color: var(--cx-navy);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--cx-navy);
}

/* ---------- User menu ---------- */
.navbar-nav > .user-menu .user-image.cx-avatar {
  display: inline-flex;
}

.navbar-nav > .user-menu > .dropdown-menu > li.user-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 150px;
}

.navbar-nav > .user-menu > .dropdown-menu > li.user-header > p {
  margin-bottom: 0;
  font-size: var(--cx-fs-lg);
}

.navbar-nav > .user-menu > .dropdown-menu > li.user-header > p > small {
  opacity: 0.8;
}

/* Menu items under the user header: one item per line */
.navbar-nav > .user-menu > .dropdown-menu > .cx-user-menu__items {
  padding: var(--cx-space-1) 0;
  border-top: 1px solid var(--bs-border-color);
}

.cx-user-menu__item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1rem;
  font-size: var(--cx-fs-base);
}

.cx-user-menu__item .material-symbols-outlined {
  font-size: 18px;
  color: var(--cx-text-muted);
}

.cx-user-menu__item.active .material-symbols-outlined {
  color: inherit;
}

/* ---------- Avatar (initials) ---------- */
.cx-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: var(--cx-navy);
  color: #ffffff;
  font-size: var(--cx-fs-sm);
  font-weight: 700;
  box-shadow: var(--cx-shadow-xs);
}

.cx-avatar--lg {
  width: 5rem;
  height: 5rem;
  border: 3px solid rgba(255, 255, 255, 0.35);
  background-color: var(--cx-navy-dark);
  font-size: var(--cx-fs-3xl);
}

/* ---------- Content area ---------- */
/* About 60% of AdminLTE's default footer height (1rem padding, 3rem min-height)
   and of the 0.75rem gap the main area leaves above it. */
.app-main {
  padding-bottom: 0.45rem;
}

.app-footer {
  min-height: 1.8rem;
  padding: 0.6rem 1rem;
  font-size: var(--cx-fs-sm);
  color: var(--cx-text-muted);
}

/* Footer right corner: "Powered By ATULIT" + emblem (same image as the login screen) */
.cx-footer-powered {
  align-items: center;
  gap: 0.375rem;
}

.cx-footer-powered__logo {
  width: auto;
  height: 18px;
  object-fit: contain;
}

/* ---------- Sticky header + breadcrumb bar (every page) ----------
   The header has a fixed height (--cx-header-height, tokens.css) so the
   tinted breadcrumb bar can stick exactly below it while the page scrolls.
   Breadcrumb bar: about half of AdminLTE's default content-header height. */
.app-header {
  position: sticky;
  top: 0;
  height: var(--cx-header-height);
}

.app-main .app-content-header.cx-content-header--compact {
  position: sticky;
  top: var(--cx-header-height);
  z-index: 1033;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
  background-color: var(--cx-surface-tint);
  border-bottom: 1px solid var(--cx-border);
}

/* Right side of the breadcrumb bar: where the page's data comes from. */
.cx-data-source {
  flex-shrink: 0;
  font-size: var(--cx-fs-sm);
  color: var(--cx-text-muted);
}

.app-main .app-content-header.cx-content-header--compact .breadcrumb {
  font-size: var(--cx-fs-sm);
  line-height: 1.75rem;
}

/* ---------- One-viewport layouts (desktop/tablet only) ----------
   cx-app--fill (Administration) and cx-app--scroll-content (Dashboard), set by
   MainLayout. The shell is exactly one viewport tall: header, breadcrumb bar and
   footer stay put and only one inner area scrolls. On phones the page scrolls. */
@media (min-width: 768px) {
  .app-wrapper.cx-app--fill,
  .app-wrapper.cx-app--scroll-content {
    height: 100vh;
    min-height: 0;
    grid-template-rows: min-content minmax(0, 1fr) min-content;
  }

  .cx-app--fill .app-main,
  .cx-app--scroll-content .app-main {
    min-height: 0;
    overflow: hidden;
  }

  /* The bar is outside the scrolling area, so it needs no sticky positioning
     (sticky inside the non-scrolling main box would offset it over the content). */
  .cx-app--fill .app-main .app-content-header.cx-content-header--compact,
  .cx-app--scroll-content .app-main .app-content-header.cx-content-header--compact {
    position: static;
  }

  /* Fill: only .cx-fill__scroll (MasterTableCard's table body) scrolls.
     Chain: .app-content > .container-fluid > card (.cx-master) > .cx-fill__scroll */
  .cx-app--fill .app-content,
  .cx-app--fill .app-content > .container-fluid {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
  }

  .cx-app--fill .app-content > .container-fluid > .cx-master {
    flex: 1 1 auto;
    min-height: 0;
  }

  .cx-app--fill .cx-fill__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }

  /* Scroll-content: the whole content area scrolls. */
  .cx-app--scroll-content .app-content {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 0.75rem;
    overflow-y: auto;
  }
}
