/* Bottom Navigation Component - Material Design 3 */

.bottom-navigation {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--md-bottom-nav-height, 80px);
  z-index: 1000;
  background-color: var(--md-sys-color-surface-container, var(--mat-sys-surface-container));
  border-top: 1px solid var(--md-sys-color-outline-variant, var(--mat-sys-outline-variant));
  display: flex;
  flex-direction: column;
  box-shadow: var(--md-sys-elevation-3dp);
}

.bottom-nav-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  padding: var(--md-spacing-2) var(--md-spacing-4);
  gap: var(--md-spacing-1);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 120px;
}

.bottom-nav-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 64px;
  border: none;
  border-radius: var(--md-spacing-4); /* 16px Material Design 3 container shape */
  background-color: transparent;
  cursor: pointer;
  transition: all var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
  padding: var(--md-spacing-2) var(--md-spacing-1);

  /* Focus indicator */
  outline: none;

  /* State layer container */
  overflow: hidden;
}

/* ===== MATERIAL DESIGN 3 STATE LAYERS ===== */

/* State layer base setup */
.bottom-nav-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background-color: var(--md-sys-color-on-surface, var(--mat-sys-on-surface));
  opacity: 0;
  transition: opacity var(--md-sys-state-transition-duration) var(--md-sys-state-transition-easing);
  pointer-events: none;
  z-index: 1;
}

/* Hover state layer */
.bottom-nav-button:hover::before {
  opacity: var(--md-sys-state-hover-opacity);
}

/* Focus state layer and ring */
.bottom-nav-button:focus-visible::before {
  opacity: var(--md-sys-state-focus-opacity);
}

.bottom-nav-button:focus-visible {
  outline: var(--md-sys-state-focus-ring-width, 2px) solid var(--md-sys-color-primary, var(--mat-sys-primary));
  outline-offset: var(--md-sys-state-focus-ring-offset, 2px);
}

/* Pressed state layer */
.bottom-nav-button:active::before {
  opacity: var(--md-sys-state-pressed-opacity);
}

/* Selected/Active state layer */
.bottom-nav-button[aria-expanded="true"]::before,
.bottom-nav-button.active::before {
  background-color: var(--md-sys-color-on-secondary-container, var(--mat-sys-on-secondary-container));
  opacity: var(--md-sys-state-selected-opacity);
}

.bottom-nav-button-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--md-spacing-1);
  z-index: 2;
}

.bottom-nav-icon {
  font-size: var(--md-sys-typescale-title-medium-font-size);
  width: 24px;
  height: 24px;
  color: var(--md-sys-color-on-surface-variant, var(--mat-sys-on-surface-variant));
  transition: color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.bottom-nav-label {
  font-family: var(--md-sys-typescale-font-family-plain);
  font-size: var(--md-sys-typescale-label-small-font-size);
  font-weight: var(--md-sys-typescale-label-small-font-weight);
  line-height: var(--md-sys-typescale-label-small-line-height);
  letter-spacing: var(--md-sys-typescale-label-small-letter-spacing);
  color: var(--md-sys-color-on-surface-variant, var(--mat-sys-on-surface-variant));
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status indicator colors - using semantic tokens */
.status-green {
  color: var(--md-sys-color-chat-connected, #4ade80);
}

.status-red {
  color: var(--md-sys-color-chat-disconnected, #f87171);
}

.status-orange {
  color: var(--md-sys-color-chat-pending, #fbbf24);
}

/* Selected/Active state (when sidenav is open) */
.bottom-nav-button[aria-expanded="true"],
.bottom-nav-button.active {
  background-color: var(--md-sys-color-secondary-container, var(--mat-sys-secondary-container));
}

.bottom-nav-button[aria-expanded="true"] .bottom-nav-icon,
.bottom-nav-button.active .bottom-nav-icon {
  color: var(--md-sys-color-on-secondary-container, var(--mat-sys-on-secondary-container));
}

.bottom-nav-button[aria-expanded="true"] .bottom-nav-label,
.bottom-nav-button.active .bottom-nav-label {
  color: var(--md-sys-color-on-secondary-container, var(--mat-sys-on-secondary-container));
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== RESPONSIVE BEHAVIOR ===== */

/* Hide on medium screens and up (show navigation rail instead) */
@media (min-width: 600px) {
  .bottom-navigation {
    display: none;
  }
}

/* Compact mobile layout adjustments */
@media (max-width: 480px) {
  .bottom-nav-container {
    padding: var(--md-spacing-1) var(--md-spacing-2);
    gap: var(--md-spacing-half);
  }

  .bottom-nav-button {
    min-height: 56px;
    padding: var(--md-spacing-1);
  }

  .bottom-nav-icon {
    width: 20px;
    height: 20px;
    font-size: var(--md-sys-typescale-title-small-font-size);
  }

  .bottom-nav-label {
    font-size: var(--md-sys-typescale-label-small-font-size);
    line-height: 10px;
  }

}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
  .bottom-nav-label,
  .bottom-nav-icon {
    color: var(--md-sys-color-on-surface);
  }

  .bottom-navigation {
    border-top-color: var(--md-sys-color-outline);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .bottom-navigation {
    border-top-width: 2px;
  }

  .bottom-nav-button:focus-visible {
    box-shadow: 0 0 0 3px var(--md-sys-color-primary, var(--mat-sys-primary));
  }

}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .bottom-nav-button,
  .bottom-nav-icon,
  .bottom-nav-button::before {
    transition: none;
  }
}