/**
 * Navigation Styling (Production Ready)
 * Bottom navigation with glassmorphism and full accessibility
 */

.nav-bottom {
  position: fixed;
  bottom: 20px;
  bottom: max(20px, var(--safe-area-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(58, 42, 31, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(224, 179, 102, 0.2);
  border-radius: 50px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  align-items: center;
  justify-content: space-around;
  max-width: 95%;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(20px)) {
  .nav-bottom {
    background: rgba(58, 42, 31, 0.98);
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.75rem 0.875rem;
  color: #f8f4ef;
  background: transparent;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  min-width: 60px;
  font-weight: 600;
  font-size: 0.7rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.nav-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #e0b366;
  border-radius: 20px;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

.nav-item:hover,
.nav-item:focus {
  color: #f8f4ef;
}

.nav-item:active {
  transform: scale(0.95);
}

.nav-item.active {
  color: #3a2a1f;
}

.nav-item.active::before {
  opacity: 1;
  transform: scale(1);
}

.nav-item.active svg {
  transform: scale(1.15) translateY(-2px);
  color: #3a2a1f;
}

.nav-item svg {
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.nav-item span {
  transition: all 0.3s ease;
  white-space: nowrap;
}

.nav-item.active span {
  font-weight: 700;
  color: #3a2a1f;
}

/* Focus states for accessibility */
.nav-item:focus-visible {
  outline: 3px solid #e0b366;
  outline-offset: 2px;
}

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

/* Keyboard navigation highlight */
.nav-item:focus-visible::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 2px solid #e0b366;
  border-radius: 24px;
  pointer-events: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .nav-bottom {
    gap: 0.25rem;
    padding: 0.65rem 0.75rem;
    bottom: 15px;
    bottom: max(15px, var(--safe-area-bottom));
  }

  .nav-item {
    padding: 0.65rem 0.65rem;
    min-width: 55px;
    font-size: 0.65rem;
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
  }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .nav-bottom {
    gap: 0.4rem;
    padding: 0.7rem 0.9rem;
  }

  .nav-item {
    min-width: 58px;
    font-size: 0.68rem;
  }
}

/* Large screens */
@media (min-width: 1440px) {
  .nav-bottom {
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
  }

  .nav-item {
    padding: 0.85rem 1rem;
    min-width: 70px;
    font-size: 0.75rem;
  }

  .nav-item svg {
    width: 26px;
    height: 26px;
  }
}

/* RTL Support */
[dir="rtl"] .nav-bottom {
  /* No transform needed - translateX(-50%) works for both RTL and LTR */
}

/* Touch-optimized spacing */
@media (pointer: coarse) {
  .nav-item {
    min-width: 64px;
    min-height: 64px;
  }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  .nav-bottom {
    border: 2px solid #e0b366;
  }
  
  .nav-item.active {
    background: #e0b366;
  }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .nav-bottom {
    background: rgba(42, 31, 21, 0.95);
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  .nav-bottom {
    /* Ensure navigation doesn't overlap with iOS home indicator */
    padding-bottom: calc(0.75rem + var(--safe-area-bottom));
  }
}

/* Hide navigation on scroll down (optional - can be enabled via JS) */
.nav-bottom.hidden {
  transform: translateX(-50%) translateY(150%);
  opacity: 0;
  pointer-events: none;
}
