// ============================================================================
// Nav Rail — Desktop/Kiosk Navigation
// Per CUB-27 spec breakpoints:
//   Compact  (0–599px):  Hidden — bottom nav takes over
//   Medium   (600–1023px): Collapsed (72px), icon-only
//   Expanded (≥1024px):  Expandable (72px collapsed / 256px expanded on hover)
// Section 5.4: Spacing & Grid
// ============================================================================

.nav-rail {
  display: none; // Hidden by default (mobile-first)
  flex-direction: column;
  width: var(--cc-nav-rail-collapsed-width);
  min-height: 100vh;
  background-color: var(--cc-surface-container-high);
  border-right: 1px solid var(--cc-outline);
  transition: width 200ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  z-index: 10;

  &--expanded {
    width: var(--cc-nav-rail-expanded-width);
  }
}

.nav-rail__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 12px;
  min-height: 64px;
  border-bottom: 1px solid var(--cc-outline);
}

.nav-rail__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  min-width: 48px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--cc-on-surface);
  cursor: pointer;
  transition: background-color 150ms ease;

  &:hover {
    background-color: rgba(255, 255, 255, 0.08);
  }

  &:focus-visible {
    outline: 3px solid var(--status-active);
    outline-offset: 2px;
  }
}

.nav-rail__brand {
  font-size: 18px;
  font-weight: 600;
  color: var(--status-active);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.nav-rail__nav {
  flex: 1;
  padding-top: 8px;

  // Override Angular Material list item styles for compact nav rail items
  --mat-list-list-item-one-line-vertical-gap: 4px;
}

.nav-rail__item {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 0 12px;
  border-radius: 28px;
  margin: 2px 12px;
  color: var(--cc-on-surface-variant);
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;

  &:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--cc-on-surface);
  }

  &--active {
    background-color: var(--status-active-bg);
    color: var(--status-active);

    .nav-rail__label {
      font-weight: 500;
    }
  }
}

.nav-rail__label {
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

// ---------------------------------------------------------------------------
// Medium (600–1023px): Show collapsed nav rail (icon-only)
// ---------------------------------------------------------------------------
@media (min-width: 600px) and (max-width: 1023px) {
  .nav-rail {
    display: flex;
    width: var(--cc-nav-rail-collapsed-width);
  }

  // Always collapsed on medium — hide labels
  .nav-rail__brand,
  .nav-rail__label {
    display: none;
  }

  .nav-rail__header {
    justify-content: center;
    padding: 16px 0;
  }

  .nav-rail__item {
    justify-content: center;
    padding: 0;
    margin: 2px 8px;
  }

  // Disable expand on medium
  .nav-rail--expanded {
    width: var(--cc-nav-rail-collapsed-width);
  }
}

// ---------------------------------------------------------------------------
// Expanded (≥1024px): Full expandable nav rail
// ---------------------------------------------------------------------------
@media (min-width: 1024px) {
  .nav-rail {
    display: flex;
  }
}

// ---------------------------------------------------------------------------
// Accessibility: Reduced Motion
// ---------------------------------------------------------------------------
@media (prefers-reduced-motion: reduce) {
  .nav-rail {
    transition: none;
  }
}