/*
 * Admin console boot states: the held sidebar, the placeholder user cards and
 * the "Show more" control of the progressively drawn user list.
 *
 * Its own file on purpose: a rule added to style.css would arrive one visit
 * late, because the service worker serves the cached sheet first
 * (stale-while-revalidate) while the new markup that needs it is already live.
 */

/* ── Sidebar held until the account's permissions are known ─────────────────
 * Which rows exist depends on who is signed in (superadmin groups, the admin
 * sweep, tickets, billing, the plan gate). The rows stay laid out but
 * invisible until tenants.js has applied every rule, then appear once. The
 * animation is the failsafe: should the boot script never run, the rows show
 * after 15 s instead of never. */
.admin-sidebar--booting .admin-sidebar-nav {
  position: relative;
  visibility: hidden;
  animation: admin-boot-reveal 0s linear 15s forwards;
}
@keyframes admin-boot-reveal {
  to { visibility: visible; }
}
@keyframes admin-boot-conceal {
  to { visibility: hidden; }
}

.admin-sidebar-skeleton {
  display: none;
}
.admin-sidebar--booting .admin-sidebar-skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: absolute;
  inset: 8px 8px auto 8px;
  visibility: visible;
  animation: admin-boot-conceal 0s linear 15s forwards;
  pointer-events: none;
}
.admin-sidebar-skeleton > span {
  display: block;
  height: 24px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
}
.admin-sidebar-skeleton > .admin-sidebar-skeleton-label {
  width: 46%;
  height: 8px;
  margin: 8px 6px 0;
  border-radius: 4px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}
.admin-sidebar-skeleton > .admin-sidebar-skeleton-label:first-child {
  margin-top: 2px;
}

/* ── Placeholder user cards (replaced by the first load) ───────────────── */
#userList[aria-busy="true"] {
  position: relative;
}
.users-skeleton-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 8px;
  align-items: center;
  min-height: 118px;
  padding: 12px 13px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 96%, var(--surface));
  border: 1px solid var(--card-b);
  align-content: start;
}
.users-skeleton-avatar {
  grid-row: 1 / span 2;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
}
.users-skeleton-line {
  display: block;
  height: 10px;
  width: 72%;
  border-radius: 5px;
  background: color-mix(in srgb, var(--text) 9%, transparent);
}
.users-skeleton-line--short {
  width: 38%;
  height: 8px;
}
.admin-sidebar-skeleton > span,
.users-skeleton-avatar,
.users-skeleton-line {
  animation: admin-boot-pulse 1.4s ease-in-out infinite;
}
@keyframes admin-boot-pulse {
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .admin-sidebar-skeleton > span,
  .users-skeleton-avatar,
  .users-skeleton-line {
    animation: none;
  }
}

/* ── Progressive user list: the "Show more" row ────────────────────────── */
.users-more {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 6px 0 2px;
}
.users-more-btn {
  min-width: 220px;
}
