/* ============================================
   Navigation Fix - Top Bar & Bottom Nav
   All Conditions, All Environments
   ============================================ */

/* Footer visibility - Hide on mobile, show on desktop */
.footer {
    display: none;
}

@media (min-width: 768px) {
    .footer {
        display: block;
    }
}

/* ============================================
   TOP BAR FIXES
   ============================================ */

/* Ensure top bar is always sticky and visible */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

/* Hide top bar in PDF fullscreen mode */
body.pdf-fullscreen .top-bar {
    transform: translateY(-100%);
}

/* Top bar content layout */
.top-bar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 48px;
}

/* Logo styling */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    white-space: nowrap;
}

.logo i {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Search container */
.search-container {
    flex: 1;
    max-width: 500px;
}

.desktop-search {
    display: none;
}

@media (min-width: 768px) {
    .desktop-search {
        display: block;
    }
}

/* Mobile search icon */
.mobile-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    color: #6b7280;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mobile-search-icon:hover {
    background: #e5e7eb;
}

@media (min-width: 768px) {
    .mobile-search-icon {
        display: none !important;
    }
}

/* Top bar actions */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Login button - Pill style */
.btn-login {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Hide Login button on mobile */
@media (max-width: 767px) {
    .btn-login {
        display: none !important;
    }
}

/* User menu */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #2d3748;
    transition: all 0.2s ease;
}

.user-menu-btn:hover {
    background: #e5e7eb;
}

.user-menu-btn i {
    font-size: 1.5rem;
    color: #667eea;
}

.username {
    display: none;
    font-weight: 600;
}

@media (min-width: 768px) {
    .username {
        display: inline;
    }
}

/* User dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: #2d3748;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.user-dropdown a:first-child {
    border-radius: 12px 12px 0 0;
}

.user-dropdown a:last-child {
    border-radius: 0 0 12px 12px;
}

.user-dropdown a:hover {
    background: #f3f4f6;
}

.user-dropdown a i {
    width: 20px;
    color: #667eea;
}

/* Bottom Navigation styles handled in bottom-nav.css */

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Small screens */
@media (max-width: 375px) {
    .top-bar {
        padding: 0.625rem 0;
    }

    .logo {
        font-size: 1.1rem;
    }

    .logo i {
        font-size: 1.25rem;
    }

    .btn-login {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Nav items styles removed */
}

/* Landscape mode */
/* Landscape nav styles removed */

/* ============================================
   SAFE AREA SUPPORT (iOS/Android Notches)
   ============================================ */

/* Safe area styles handled in bottom-nav.css implicitly or removed */

/* ============================================
   ACCESSIBILITY
   ============================================ */

.nav-item-modern:focus,
.btn-login:focus,
.user-menu-btn:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {

    .top-bar,
    .bottom-nav-modern,
    .nav-item-modern,
    .fab-button,
    .user-dropdown {
        transition: none;
    }
}

/* ============================================
   PREVENT LAYOUT SHIFT
   ============================================ */

/* Ensure consistent heights */
.top-bar-content {
    min-height: 48px;
}

/* Prevent flash of unstyled content */
.top-bar,
.bottom-nav-modern {
    will-change: transform;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .top-bar {
        background: #1f2937;
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    /* Dark mode nav styles removed */

    .user-menu-btn {
        background: #374151;
        color: #e5e7eb;
    }

    .user-dropdown {
        background: #1f2937;
    }

    .user-dropdown a {
        color: #e5e7eb;
    }

    .user-dropdown a:hover {
        background: #374151;
    }
}