/* ==========================================================================
   Navigation Mobile (Bottom Bar)
   ========================================================================== */

.mobile-nav,
.mobile-menu-panel,
.mobile-impersonation-banner {
  display: none;
}

@media (max-width: 480px) {
  /* Show Mobile Nav */
  .mobile-nav {
    display: flex;
    height: var(--size-mobile-touch-lg);
    width: 100%;
    background-color: var(--np-color-surface);
    border-block-start: var(--border-normal) var(--np-color-inverse-surface);
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 0; /* User requirement: No padding */
    order: 2;
    z-index: 100;
  }

  /* Icons in mobile nav should be larger (24px) */
  .mobile-nav .material-symbols-outlined {
    font-size: var(--size-icon-md);
    font-variation-settings: "OPSZ" 24; /* Verify if this is needed based on setup, usually good for optical sizing */
    width: var(--size-icon-md); /* Ensure layout footprint matches */
    height: var(--size-icon-md);
    overflow: hidden; /* Prevent spill */
  }

  /* Profile Container (Left) */
  .mobile-nav__item--profile {
    height: 100%;
    /* Hug contents, width determined by children + aspect ratio */
    width: auto;
    display: flex;
    align-items: stretch; /* Extra container needs full height */
    justify-content: flex-start;
    padding: 0;
    gap: 0;
    border-inline-end: var(--border-normal) var(--np-color-inverse-surface);
  }

  /* Sub-container 1: Avatar */
  .mobile-nav__sub-avatar {
    height: 100%;
    aspect-ratio: 1 / 1; /* Force square based on available height */
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    flex-shrink: 0;
  }

  /* Avatar centering - .avatar component handles sizing */
  .mobile-nav__sub-avatar .avatar {
    flex-shrink: 0;
  }

  /* Sub-container 2: Extra Icon */
  .mobile-nav__sub-extra {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-inline-start: var(--space-1);
    padding-inline-end: var(--space-3);
    /* No border here, border is on parent end */
  }

  .mobile-nav__action-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--np-color-on-surface);
    text-decoration: none;
    height: 100%; /* Fill sub-container height */
  }

  /* Add Rec Container (Right) */
  .mobile-nav__item--action {
    height: 100%;
    aspect-ratio: 1 / 1; /* Force square */
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-inline-start: var(--border-normal) var(--np-color-inverse-surface);
    box-sizing: border-box;
  }

  .mobile-nav__add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: none;
    border: none;
    padding: 0;
    color: var(--np-color-on-surface);
  }

  .mobile-nav__add-btn .material-symbols-outlined {
    font-size: 40px;
    width: 40px;
    height: 40px;
  }

  .mobile-nav__item--center {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Split the two children */
    padding: 0;
    gap: 0;
    overflow: hidden; /* Handle long titles? */
  }

  /* Page Info: Icon + Title - matches .mobile-menu-item styling */
  .mobile-nav__page-info {
    flex-grow: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding-inline: var(--space-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: var(--text-nav-button-size);
    line-height: var(--text-nav-button-line-height);
    color: var(--np-color-on-surface);
    transition: opacity var(--transition-normal);
  }

  /* Icon container - matches .mobile-menu-item__icon */
  .mobile-nav__page-info .material-symbols-outlined {
    height: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
  }

  .mobile-nav__page-info.fade-out {
    opacity: 0;
  }

  /* Expand Trigger: Icon */
  .mobile-nav__expand-trigger {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-inline: var(--space-2);
    color: var(--np-color-on-surface-variant);
  }

  /* Icon rotation with fade for mobile nav toggle */
  .mobile-nav__expand-trigger .material-symbols-outlined {
    transform: rotate(0deg);
  }

  .mobile-nav__item--center.active
    .mobile-nav__expand-trigger
    .material-symbols-outlined {
    transform: rotate(180deg);
  }

  /* Fade animation - only plays when .animating class is present */
  .mobile-nav__item--center.animating
    .mobile-nav__expand-trigger
    .material-symbols-outlined {
    animation: fade-flip var(--transition-normal);
  }

  @keyframes fade-flip {
    0% {
      opacity: 1;
    }
    50% {
      opacity: 0;
    }
    100% {
      opacity: 1;
    }
  }

  /* Impersonation Banner */
  .mobile-impersonation-banner {
    display: flex; /* Override default hidden state */
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    order: 3; /* Below Nav */
    width: 100%;
    background-color: var(--np-color-inverse-surface); /* Match desktop banner bg */
    color: var(--np-color-inverse-on-surface);
  }

  .mobile-banner-label {
    text-transform: uppercase;
    font-size: var(--text-nav-label-size);
    font-weight: var(--text-nav-label-weight);
    letter-spacing: var(--text-nav-label-letter-spacing);
  }

  /* Mobile Header Adaptation */
  .mobile-nav .nav-header {
    height: 100%; /* Fill mobile nav */
    width: 100%; /* Fill parent container */
    border-block-end: none; /* Mobile nav handles border */
  }

  .mobile-nav .nav-header__logo {
    width: auto; /* Allow width to scale */
    aspect-ratio: 1 / 1; /* Keep proportional square */
    /* Keep border-inline-end from desktop */
  }

  .mobile-nav .nav-header__title {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
