/**
* TOP & BOTTOM NAVIGATION 2026
* Modern navigation bars following 2026 best practices
* Top bar for desktop, bottom bar for mobile
*/

/* ============================================
  TOP NAVIGATION BAR (Desktop)
  ============================================ */

/* Enhanced sticky behavior - Hide on scroll down, show on scroll up */
.navbar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                background-color 0.3s ease,
                padding 0.3s ease;
}

.navbar.hidden {
    transform: translateY(-100%);
}

.navbar.visible {
    transform: translateY(0);
}

/* Partially sticky - appears when scrolling up */
.navbar.scroll-up {
    transform: translateY(0);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.navbar.scroll-down {
    transform: translateY(-100%);
}

/* Enhanced top bar styling */
.navbar {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background-color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark-mode .navbar {
    background-color: rgba(34, 34, 34, 0.85);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
  BOTTOM NAVIGATION BAR (Mobile 2026)
  ============================================ */

.bottom-nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 1000;
    display: none; /* Hidden by default, shown on mobile */
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
}

/* Show bottom nav on mobile */
@media (max-width: 768px) {
    .bottom-nav-bar {
        display: flex !important;
    }
}

body.dark-mode .bottom-nav-bar {
    background: rgba(34, 34, 34, 0.98);
    border-top-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.3);
}

.bottom-nav-bar.show {
    display: flex;
}

.bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    max-width: 100%;
    padding: 0 8px;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 8px 4px;
    text-decoration: none;
    color: var(--text-color-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.7rem;
    gap: 4px;
    min-height: 60px; /* Thumb zone optimized */
    min-width: 60px;
    position: relative;
    border-radius: 12px;
    margin: 0 2px;
}

.bottom-nav-item i {
    font-size: 1.4rem;
    transition: transform 0.3s ease;
}

.bottom-nav-item span {
    font-weight: 500;
    font-size: 0.7rem;
    line-height: 1;
}

/* Active state */
.bottom-nav-item.active {
    color: var(--primary-color);
    background-color: rgba(102, 126, 234, 0.1);
}

.bottom-nav-item.active i {
    transform: scale(1.1);
}

/* Hover/Active states */
.bottom-nav-item:active {
    transform: scale(0.95);
    background-color: rgba(102, 126, 234, 0.15);
}

/* Badge/Notification indicator */
.bottom-nav-item .nav-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: #ef4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

body.dark-mode .bottom-nav-item .nav-badge {
    border-color: var(--dark-background-color);
}

/* Dot indicator (for notifications without count) */
.bottom-nav-item .nav-dot {
    position: absolute;
    top: 6px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

body.dark-mode .bottom-nav-item .nav-dot {
    border-color: var(--dark-background-color);
}

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

/* Show bottom nav on mobile, hide on desktop */
@media (max-width: 768px) {
    .bottom-nav-bar {
        display: flex;
    }

    /* Hide top nav links on mobile when bottom nav is visible */
    .navbar .nav-links {
        display: none;
    }

    /* Ensure content doesn't hide behind bottom nav */
    body {
        padding-bottom: 70px;
    }

    main {
        padding-bottom: 70px;
    }
}

/* Desktop: Show top nav, hide bottom nav */
@media (min-width: 769px) {
    .bottom-nav-bar {
        display: none !important;
    }

    .navbar .nav-links {
        display: flex;
    }
}

/* Tablet: Show both but adjust */
@media (min-width: 769px) and (max-width: 1024px) {
    .bottom-nav-bar {
        display: none;
    }
}

/* ============================================
  SCROLL BEHAVIOR (2026 Best Practices)
  ============================================ */

/* Hide bottom nav when scrolling down, show when scrolling up */
.bottom-nav-bar.scroll-down {
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav-bar.scroll-up {
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
  ACCESSIBILITY (WCAG 2.1+)
  ============================================ */

.bottom-nav-item {
    /* Minimum touch target: 44x44px (WCAG requirement) */
    min-height: 44px;
    min-width: 44px;
}

.bottom-nav-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 8px;
}

/* ARIA labels are handled via HTML attributes - no CSS needed */

/* ============================================
  ANIMATIONS & TRANSITIONS
  ============================================ */

.bottom-nav-item {
    will-change: transform, background-color;
}

.bottom-nav-item i {
    will-change: transform;
}

/* Smooth transitions */
.bottom-nav-bar,
.bottom-nav-item,
.bottom-nav-item i {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
  SAFE AREA SUPPORT (iOS)
  ============================================ */

.bottom-nav-bar {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

/* ============================================
  ENHANCED TOP NAVIGATION
  ============================================ */

/* Mega menu support (for desktop) */
.navbar .nav-links .nav-link.has-dropdown {
    position: relative;
}

.navbar .nav-links .nav-link.has-dropdown::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: 4px;
    font-size: 0.7rem;
}

/* Dropdown menu */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 12px 0;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

body.dark-mode .nav-dropdown {
    background: var(--dark-background-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.nav-link:hover .nav-dropdown,
.nav-link:focus-within .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-item {
    display: block;
    padding: 10px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.nav-dropdown-item:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

body.dark-mode .nav-dropdown-item {
    color: var(--dark-text-color);
}

body.dark-mode .nav-dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
  ENHANCED STICKY BEHAVIOR
  ============================================ */

/* Smart sticky: Hide when scrolling down, show when scrolling up */
.navbar.smart-sticky {
    position: fixed;
    top: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar.smart-sticky.hidden {
    transform: translateY(-100%);
}

.navbar.smart-sticky.visible {
    transform: translateY(0);
}


/* Focus styles for accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}
