/* nav-styles.css - Navigation Component Styles */

/* Navigation Bar Styles */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  box-sizing: border-box;
  background: var(--surface);
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color-soft);
  box-shadow: none;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  flex-shrink: 1;
}

.nav-logo {
  height: 32px;
  width: auto;
  border-radius: 6px;
  display: block;
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
  /* A flex item defaults to min-width:auto, so this REFUSED to shrink below
     its content width and painted over the profile button instead. The tiers
     below decide how the row condenses; this makes overlapping impossible
     whatever the tiers do, including when the nav grows another item. */
  min-width: 0;
  overflow: hidden;
}

/* Navigation link wrapper for dropdown */
.nav-link-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  transition:
    background-color 150ms ease-out,
    color 150ms ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-link:hover {
  background-color: var(--hover-bg);
  color: var(--text-color);
}

.nav-link.active {
  color: var(--brand);
  background-color: color-mix(in srgb, var(--brand) 10%, transparent);
  font-weight: 600;
}

/* Navigation Dropdown */
.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border-color-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 5px 0;
  min-width: 220px;
  z-index: 1001;
}

/* Show dropdown on hover of the wrapper */
.nav-link-wrapper:hover .nav-dropdown {
  display: block;
}

/* Keep dropdown visible when hovering over it */
.nav-dropdown:hover {
  display: block;
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.nav-dropdown-item:hover {
  background-color: var(--hover-bg);
}

/* Quick Page Toggle Button */
.page-toggle-button {
  position: fixed;
  top: 76px;
  right: 24px;
  background: var(--surface);
  color: var(--brand);
  border: 1px solid var(--border-color-soft);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: none; /* Hidden by default, shown on maintenance pages */
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
  transition:
    transform 150ms ease-out,
    border-color 150ms ease-out,
    box-shadow 150ms ease-out;
  z-index: 999;
  text-decoration: none;
}

.page-toggle-button:hover {
  border-color: var(--input-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.page-toggle-button.show {
  display: flex;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.profile-btn-avatar {
  display: inline-flex;
  align-items: center;
}

.profile-btn-img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.profile-menu-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color-soft);
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition:
    background-color 150ms ease-out,
    border-color 150ms ease-out,
    color 150ms ease-out;
}

.profile-menu-btn:hover {
  background: var(--hover-bg);
  border-color: var(--input-border);
  color: var(--text-color);
}

/* Profile Dropdown Menu */
.profile-dropdown {
  position: fixed;
  top: 64px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border-color-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 10px;
  min-width: 220px;
  display: none;
  z-index: 1001;
}

.profile-dropdown.show {
  display: block;
}

.profile-dropdown-item {
  padding: 12px 10px;
  color: var(--text-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-radius: 5px;
}

.profile-dropdown-item:hover {
  background-color: var(--hover-bg);
}

.profile-dropdown-divider {
  height: 1px;
  background-color: var(--border-color-soft);
  margin: 8px 0;
}

/* Location Display in Profile Dropdown */
.profile-dropdown-location {
  padding: 8px 10px;
  margin-bottom: 5px;
}

.location-display {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-color);
  font-size: 14px;
  margin-bottom: 10px;
}

.location-display i {
  color: var(--primary-color);
}

/* Location switcher: custom option rows (not a native select — its popup
   closes on any programmatic focus change, e.g. check-in's scan refocus). */
.location-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.location-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-color);
  font-size: 14px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  /* Explicitly undo app.css's global `button` pill styling (orange bg,
     margin-right, shadow) so these read as menu rows, not buttons. */
  margin: 0;
  box-shadow: none;
  transition:
    background-color 150ms ease-out,
    border-color 150ms ease-out;
}

.location-option:hover {
  background-color: var(--hover-bg);
}

.location-option:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.location-option .location-option-check {
  font-size: 11px;
  color: var(--brand);
  visibility: hidden;
}

.location-option.active {
  background-color: var(--hover-bg);
  border-color: var(--input-border);
  font-weight: 600;
}

.location-option.active .location-option-check {
  visibility: visible;
}

/* Bound long usernames so they can never push into the nav links. */
.profile-menu-btn #userName {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mid-width tier: icon-only links (title/aria-label carry the names) so the
   row condenses instead of sliding under the profile button. The hamburger
   takes over below 768px.

   1440px, not 1280px. MEASURED on the test deployment 2026-08-12: eight
   labelled links need 1108px, and with the logo, gaps and the profile button
   the row does not fit under ~1393px of viewport. At 1280 the labels stayed on
   at 1284px and overlapped the profile button by 86px — the very thing this
   tier exists to prevent. Re-measure before adding a ninth link. */
@media (max-width: 1440px) and (min-width: 769px) {
  .nav-link .nav-link-label {
    display: none;
  }

  .nav-link {
    padding: 7px 11px;
  }

  .nav-link i {
    font-size: 16px;
  }

  .profile-menu-btn #userName {
    display: none;
  }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 24px;
  cursor: pointer;
  position: relative;
}

/* Open help-request count on the Help Queue nav link. White on
   --danger-solid (#d1242f) is 5.9:1 — the deep-ink badge pairs are for
   long text chips; a 2-digit notification count uses the solid. */
.nav-count-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger-solid);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Same signal on the collapsed mobile hamburger, where the link (and its
   count) is hidden until the menu opens. A dot, not a number — the count
   is one tap away. */
.nav-count-dot {
  position: absolute;
  top: 2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger-solid);
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .nav-links.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color-soft);
    padding: 10px;
    box-shadow: var(--shadow-lg);
  }

  /* Make page toggle button more compact on mobile */
  .page-toggle-button {
    padding: 8px 12px;
    font-size: 13px;
  }

  .page-toggle-button span {
    display: none; /* Hide text on mobile, show icon only */
  }

  .page-toggle-button i {
    margin: 0;
  }
}

/* Touch devices in the icon-only tier can't summon title tooltips — give
   them the hamburger (its panel shows full labels) instead of unlabeled
   icons. Desktop pointers keep the icon row. */
@media (hover: none) and (pointer: coarse) and (min-width: 769px) and (max-width: 1440px) {
  .nav-links {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .nav-links.mobile-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color-soft);
    padding: 10px;
    box-shadow: var(--shadow-lg);
  }

  /* The panel shows full labels — undo the icon-only tier's hiding. */
  .nav-link .nav-link-label {
    display: inline;
  }

  .profile-menu-btn #userName {
    display: inline;
  }
}

/* 320-480px phones: logo + burger + profile must fit on one 56px row.
   Username hides (avatar + caret remain); paddings tighten. */
@media (max-width: 480px) {
  .nav-bar {
    padding: 0 12px;
  }

  .nav-left {
    gap: 12px;
  }

  .profile-menu-btn #userName {
    display: none;
  }

  .profile-dropdown {
    right: 12px;
    left: 12px;
    min-width: 0;
  }
}

/* Content spacing to account for fixed 56px nav */
body {
  padding-top: 56px;
}

/* Presence banner — "you are limited right now, and here is why".
   Sits directly under the nav so it is the first thing read on any page a
   gated staff member opens. Token-only: a hardcoded colour here would be
   invisible to the CI contrast gate, which only measures tokens. */
.presence-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  background: var(--warning-bg);
  color: var(--text-color);
  border-bottom: 1px solid var(--warning-color);
  font-size: 14px;
  line-height: 1.4;
}

.presence-banner i {
  color: var(--warning-color);
  margin-top: 2px;
  flex-shrink: 0;
}

/* Blocked-page panel — shown by nav-utils when the current page's id is
   denied by the effective rules (role rule or presence reduction). Replaces
   the page body, so it owns its own centring. Token-only: this renders in
   every theme. Round and soft on purpose — it's a "come back later", not an
   error. */
.presence-blocked-panel {
  display: flex;
  justify-content: center;
  padding: 56px 20px;
}
.presence-blocked-card {
  max-width: 480px;
  width: 100%;
  text-align: center;
  background: var(--surface);
  border: 1.5px solid var(--border-color-soft);
  border-radius: 28px;
  padding: 40px 32px 34px;
  box-shadow: var(--shadow-md);
}
.presence-blocked-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 14%, transparent);
}
.presence-blocked-chip i {
  font-size: 26px;
  color: var(--brand);
}
.presence-blocked-card h1 {
  font-size: 21px;
  margin: 18px 0 8px;
  color: var(--text-color);
}
.presence-blocked-card p {
  margin: 0 0 24px;
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.5;
}
.presence-blocked-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.presence-blocked-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-color);
  background: var(--surface-2, rgba(127, 127, 127, 0.12));
  border: 1.5px solid var(--border-color-soft);
  transition:
    background-color 150ms ease-out,
    transform 150ms ease-out;
}
.presence-blocked-btn:hover {
  background: var(--hover-bg);
  transform: translateY(-1px);
  text-decoration: none;
}
.presence-blocked-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.presence-blocked-btn i {
  font-size: 13px;
}
/* The filled option uses the CI-gated pair — `--brand` alone is a 3.24:1
   trap under white text (see the theme lessons). */
.presence-blocked-btn.primary {
  background: var(--brand-solid);
  border-color: var(--brand-solid);
  color: var(--on-brand, #fff);
}
.presence-blocked-btn.primary:hover {
  background: var(--brand-solid);
  filter: brightness(1.06);
}
@media (prefers-reduced-motion: reduce) {
  .presence-blocked-btn {
    transition: none;
  }
  .presence-blocked-btn:hover {
    transform: none;
  }
}
