/**
 * Floating Navigation Bar
 * Glassmorphism style navigation with animated active states
 */

.floating-nav {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(45, 55, 72, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(74, 85, 104, 0.3);
  border-radius: 50px;
  padding: 4px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  visibility: visible;
  /* Prevent flicker during navigation updates */
  will-change: opacity;
}

.floating-nav:hover {
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.15),
    0 4px 12px rgba(0, 0, 0, 0.1);
}

.floating-nav-items {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  /* Smooth transitions for content changes */
  transition: all 0.3s ease-in-out;
}

.floating-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(var(--text-primary-rgb), 0.8);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  white-space: nowrap;
  min-width: 48px;
  height: 48px;
}

.floating-nav-item:hover {
  color: var(--primary);
  transform: translateY(-1px);
}

.floating-nav-item.active {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
}

.floating-nav-item .nav-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.5;
}

.floating-nav-item .nav-text {
  display: inline;
}

/* Animated lamp effect */
.nav-lamp {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(var(--primary-rgb), 0.05);
  border-radius: 50px;
  z-index: -1;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-nav-item.active .nav-lamp {
  opacity: 1;
}

.nav-lamp::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 4px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-nav-item.active .nav-lamp::before {
  opacity: 1;
}

/* Glowing effects */
.nav-lamp::after {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 24px;
  background: radial-gradient(ellipse at center, rgba(var(--primary-rgb), 0.2) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-nav-item.active .nav-lamp::after {
  opacity: 1;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .floating-nav {
    bottom: 20px;
    top: auto;
    transform: translateX(-50%);
  }
  
  .floating-nav-item {
    padding: 12px 16px;
    min-width: 44px;
    height: 44px;
  }
  
  .floating-nav-item .nav-text {
    display: none;
  }
  
  .floating-nav-item .nav-icon {
    display: block;
  }
}

@media (min-width: 769px) {
  .floating-nav-item .nav-icon {
    display: none;
  }
}

/* Slide animation for active indicator */
.nav-active-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: rgba(var(--primary-rgb), 0.1);
  border-radius: 50px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
  pointer-events: none;
}

/* Pulse animation on load */
@keyframes navPulse {
  0% {
    transform: translateX(-50%) scale(0.95);
    opacity: 0;
  }
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}

.floating-nav.animate-in {
  animation: navPulse 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Focus states for accessibility */
.floating-nav-item:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.floating-nav-item:focus:not(:focus-visible) {
  outline: none;
}

/* Smooth morphing between states */
.floating-nav-items {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced hover effects */
.floating-nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50px;
  background: linear-gradient(135deg, 
    rgba(var(--primary-rgb), 0.1) 0%, 
    rgba(var(--primary-rgb), 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

.floating-nav-item:hover::before {
  opacity: 1;
}