/* 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;
}

/* 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. */
@media (max-width: 1280px) 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;
}

/* 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: 1280px) {
  .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;
}
