/*
 * The standalone product console frame.
 *
 * Every product console (Waitlist, Group Enquiries, Guest Feedback, Membership,
 * Products, Tee Sheet) draws the same page: the rail, the workspace header, the
 * signed-out access card and the venue picker, around a root its venue controller
 * mounts into. `renderAdminConsolePage` in `@golfkit/admin-access/page` writes the
 * markup; these rules lay it out, so no console restates them. A product's own
 * stylesheet holds only what is its own and loads after this one.
 *
 * Load order: tokens-shared.css, admin-foundation.css, admin-shell-layout.css, this
 * file, the product's stylesheets, admin-module-utilities.css.
 *
 * Core's tenant and super admin use the shared shell directly. All signed-in
 * workspaces fill the canvas.
 */
:root {
  --admin-console-card-width: 34rem;
}

body {
  min-width: 320px;
}

/* The skip link waits off screen until it takes focus. */
.gk-skip-link:not(:focus) {
  position: absolute;
  left: -9999px;
}

/* Signed out, the rail is gone and the card sits in a centred column. */
body.admin-shell-auth-prompt .admin-body {
  --admin-shell-rail-reserve: 0px;
  grid-template-columns: 0 minmax(0, 1fr);
}

.admin-main {
  max-width: none;
  margin: 0;
}

body.admin-shell-auth-prompt .admin-main {
  margin: auto;
}

/* Every signed-in workspace fills the canvas, matching the tenant admin. */
#venue-root {
  width: 100%;
  min-width: 0;
}

/* `main` is focusable so the skip link can land on it, and draws no ring of its own. */
#page:focus {
  outline: none;
}

.admin-header-right {
  margin-inline-start: auto;
  min-width: 0;
  flex: 0 1 auto;
}

.admin-header-right gk-button {
  white-space: nowrap;
}

#auth-message {
  display: block;
  margin: 0 0 var(--space-xl);
}

.au-screen {
  /* The signed-out card fills the window below the header and inside the canvas's own vertical padding (admin-shell-layout.css),
   * so the page never scrolls. The canvas has none at the phone width. */
  min-height: calc(100dvh - var(--admin-header-h) - 2 * var(--admin-page-gutter));
}

.auth-card {
  width: min(100%, var(--admin-console-card-width));
  max-width: var(--admin-console-card-width);
  margin: 0;
  text-align: center;
}

.auth-actions {
  display: grid;
  gap: var(--space-md);
  text-align: left;
}

.auth-card .au-venue-list {
  max-width: none;
  margin-bottom: var(--space-xl);
}

#venue-limit {
  color: var(--text-muted);
}

.auth-card > gk-button:not([hidden]) {
  display: block;
  width: max-content;
  margin: var(--space-md) auto 0;
}

/* Signed-in choosers and access refusals keep a route to Apps while their rail is hidden. */
.admin-apps-access-link { display: none; align-items: center; justify-content: center; min-height: 44px; margin-top: var(--space-md); }
.auth-card:has(> #sign-out:not([hidden])) .admin-apps-access-link,
.auth-card:has(> #accessSignOutBtn:not([hidden])) .admin-apps-access-link { display: flex; }

/* The one phone width of the admin breakpoint set (breakpoints.mjs), where the shell's rail becomes a drawer. */
@media (max-width: 720px) {
  .admin-header-right gk-button {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #auth-message {
    margin-inline: var(--space-2xl);
  }

  .au-screen {
    min-height: calc(100dvh - var(--admin-header-h));
    padding-inline: var(--space-2xl);
  }
}
