/* Top Navigation System */
/* Version: 2.0 - Contemporary Redesign Navigation */

/* ===== CRITICAL OVERRIDES ===== */
/* These ensure our navigation takes precedence over old sidebar styles */

.top-navigation {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--color-white) !important;
    border-bottom: 1px solid var(--color-ash) !important;
    box-shadow: var(--shadow-sm) !important;
    z-index: var(--z-fixed) !important;
    transition: all var(--transition-normal) !important;
    width: 100% !important;
    height: 70px !important;
    display: block !important;
}

/* Override any old sidebar styles */
.sidebar {
    display: none !important;
}

.page-layout {
    display: block !important;
    min-height: 100vh !important;
    background: var(--color-porcelain) !important;
}

/* Ensure main content is properly positioned */
.main-content-with-top-nav {
    margin-left: 0 !important;
    margin-top: 70px !important;
    padding-top: var(--space-6) !important;
    width: 100% !important;
}

/* Hide any old navigation elements that might still be present */
.nav-container-old,
.nav-old,
.old-navigation,
.sidebar-navigation {
    display: none !important;
}

/* Force our navigation to be visible */
#topNavigation {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure navigation container is properly styled */
#topNavigation .nav-container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 70px !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 0 var(--space-6) !important;
}

/* ===== TOP NAVIGATION CONTAINER ===== */

.top-navigation.scrolled {
    box-shadow: var(--shadow-md);
}

/* ===== NAVIGATION CONTENT ===== */

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

/* ===== LOGO SECTION ===== */

.nav-logo-section {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-shrink: 0;
}

.nav-logo {
    height: 40px;
    width: auto;
    transition: transform var(--transition-normal);
}

.nav-logo:hover {
    transform: scale(1.05);
}

.nav-brand {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.nav-brand-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-navy);
    margin: 0;
    line-height: 1.2;
}

.nav-brand-subtitle {
    font-size: var(--text-sm);
    color: var(--color-slate);
    margin: 0;
    line-height: 1.2;
    /* Make text responsive to logo height */
    display: flex;
    align-items: center;
    height: 100%;
}

/* ===== CENTRAL NAVIGATION ===== */

.nav-center {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    justify-content: center;
    margin: 0 var(--space-8);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu-item {
    position: relative;
}

.nav-menu-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    color: var(--color-charcoal);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    font-weight: 500;
    font-size: var(--text-sm);
    white-space: nowrap;
}

.nav-menu-link:hover {
    background: var(--color-ash);
    color: var(--color-navy);
    transform: translateY(-1px);
}

.nav-menu-link.active {
    background: var(--color-navy);
    color: var(--color-white);
}

.nav-menu-link.active:hover {
    background: #1e40af;
    transform: none;
}

/* ===== RIGHT SECTION ===== */

.nav-right {
    display: flex !important;
    align-items: center !important;
    gap: var(--space-4) !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 5 !important;
}

/* ===== SEARCH SECTION ===== */

.nav-search {
    position: relative !important;
    min-width: 300px !important;
    z-index: 1 !important;
    display: flex !important;
    align-items: center !important;
}

.nav-search-input {
    width: 100% !important;
    padding: var(--space-3) var(--space-6) !important;
    padding-right: 3rem !important;
    border: 2px solid var(--color-ash);
    border-radius: var(--radius-pill);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    transition: all var(--transition-normal);
    background: var(--color-white);
    position: relative;
    z-index: 1;
}

.nav-search-input:focus {
    outline: none;
    border-color: var(--color-navy);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
    z-index: 2;
}

.nav-search-input:hover {
    border-color: var(--color-pewter);
}

.nav-search-button {
    position: absolute;
    right: var(--space-2);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-slate);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
    z-index: 3;
}

.nav-search-button:hover {
    background: var(--color-ash);
    color: var(--color-navy);
}

/* ===== USER SECTION ===== */

.nav-user-section {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    position: relative;
    z-index: 10;
}

/* Ensure Profile and Logout have comfortable spacing */
.nav-user-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.nav-user-button {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--color-navy);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    position: relative;
    z-index: 11;
}

.nav-user-button:hover {
    background: #1e40af;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.nav-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-white);
}

/* ===== MOBILE MENU TOGGLE ===== */

.nav-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-charcoal);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
}

.nav-mobile-toggle:hover {
    background: var(--color-ash);
    color: var(--color-navy);
}

.nav-mobile-toggle .icon {
    width: 24px;
    height: 24px;
}

/* ===== MOBILE NAVIGATION ===== */

.nav-mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.nav-mobile-overlay.active {
    opacity: 1;
}

.nav-mobile-content {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background: var(--color-white);
    z-index: var(--z-modal);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    overflow-y: auto;
}

.nav-mobile-overlay.active .nav-mobile-content {
    transform: translateX(0);
}

.nav-mobile-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-ash);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-mobile-close {
    background: none;
    border: none;
    color: var(--color-charcoal);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xl);
    transition: all var(--transition-normal);
}

.nav-mobile-close:hover {
    background: var(--color-ash);
    color: var(--color-navy);
}

.nav-mobile-menu {
    padding: var(--space-6);
}

.nav-mobile-menu .nav-menu {
    flex-direction: column;
    gap: var(--space-2);
}

.nav-mobile-menu .nav-menu-link {
    padding: var(--space-4);
    font-size: var(--text-base);
    border-radius: var(--radius-md);
}

/* ===== MOBILE MENU ITEM STYLES ===== */

/* Override desktop nav-menu-link styles for mobile */
.nav-mobile-menu .nav-menu-item {
    width: 100%;
}

.nav-mobile-menu .nav-menu-link {
    display: flex !important;
    align-items: center !important;
    gap: var(--space-3) !important;
    padding: var(--space-4) var(--space-6) !important;
    color: var(--color-charcoal) !important;
    text-decoration: none !important;
    border-radius: var(--radius-md) !important;
    transition: all var(--transition-normal) !important;
    font-weight: 500 !important;
    font-size: var(--text-lg) !important;
    white-space: nowrap !important;
    background: var(--color-white) !important;
    border: 1px solid var(--color-ash) !important;
    width: 100% !important;
    justify-content: flex-start !important;
    min-height: 56px !important;
}

.nav-mobile-menu .nav-menu-link:hover {
    background: var(--color-ash) !important;
    color: var(--color-navy) !important;
    transform: none !important;
    border-color: var(--color-pewter) !important;
}

.nav-mobile-menu .nav-menu-link:active {
    background: var(--color-pewter) !important;
    transform: scale(0.98) !important;
}

/* Mobile-specific button styling for auth buttons */
.nav-mobile-menu .nav-menu-item[id*="Auth"] .nav-menu-link {
    background: var(--color-navy) !important;
    color: var(--color-white) !important;
    border-color: var(--color-navy) !important;
    justify-content: center !important;
    font-weight: 600 !important;
}

.nav-mobile-menu .nav-menu-item[id*="Auth"] .nav-menu-link:hover {
    background: #1e40af !important;
    border-color: #1e40af !important;
}

/* Mobile-specific button styling for user buttons */
.nav-mobile-menu .nav-menu-item[id*="User"] .nav-menu-link {
    background: var(--color-teal) !important;
    color: var(--color-white) !important;
    border-color: var(--color-teal) !important;
    justify-content: center !important;
    font-weight: 600 !important;
}

.nav-mobile-menu .nav-menu-item[id*="User"] .nav-menu-link:hover {
    background: #0d9488 !important;
    border-color: #0d9488 !important;
}

/* Mobile-specific button styling for Post Clock button */
.nav-mobile-menu .nav-menu-item[id*="PostClock"] .nav-menu-link {
    background: var(--color-brass) !important;
    color: var(--color-white) !important;
    border-color: var(--color-brass) !important;
    justify-content: center !important;
    font-weight: 600 !important;
}

.nav-mobile-menu .nav-menu-item[id*="PostClock"] .nav-menu-link:hover {
    background: #b45309 !important;
    border-color: #b45309 !important;
}

.nav-mobile-search {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-ash);
}

.nav-mobile-search .nav-search {
    min-width: auto;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 1024px) {
    .nav-center {
        margin: 0 var(--space-4);
    }
    
    .nav-search {
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 var(--space-4);
    }
    
    .nav-center {
        display: none;
    }
    
    .nav-search {
        display: none;
    }
    
    /* Hide user section on mobile - buttons will be in hamburger menu */
    .nav-user-section {
        display: none !important;
    }
    
    .nav-mobile-toggle {
        display: block;
    }
    
    .nav-brand-subtitle {
        display: none;
    }
    
    /* Ensure mobile menu buttons are styled as distinct buttons */
    .nav-mobile-menu .nav-menu-item {
        margin-bottom: var(--space-3);
    }
    
    .nav-mobile-menu .nav-menu-link {
        display: block !important;
        width: 100% !important;
        padding: var(--space-3) var(--space-4) !important;
        background: var(--color-primary) !important;
        color: var(--color-white) !important;
        border: 1px solid var(--color-primary) !important;
        border-radius: var(--radius-md) !important;
        text-align: center !important;
        font-weight: 500 !important;
        transition: all var(--transition-normal) !important;
        text-decoration: none !important;
    }
    
    .nav-mobile-menu .nav-menu-link:hover {
        background: var(--color-primary-dark) !important;
        border-color: var(--color-primary-dark) !important;
        transform: translateY(-1px) !important;
    }
    
    /* Special styling for logout button */
    .nav-mobile-menu .nav-logout-btn {
        background: var(--color-red) !important;
        border-color: var(--color-red) !important;
        color: var(--color-white) !important;
        cursor: pointer !important;
        width: 100% !important;
        font-family: inherit !important;
        font-size: inherit !important;
    }
    
    .nav-mobile-menu .nav-logout-btn:hover {
        background: #dc2626 !important;
        border-color: #dc2626 !important;
    }
}

@media (max-width: 640px) {
    .nav-container {
        padding: 0 var(--space-3);
    }
    
    .nav-logo-section {
        gap: var(--space-3);
    }
    
    .nav-brand-title {
        font-size: var(--text-lg);
    }
    
    .nav-user-section {
        display: none !important;
    }
    
    .nav-search {
        display: none !important;
    }
}

/* ===== MAIN CONTENT ADJUSTMENT ===== */

/* Adjust main content to account for top navigation */
.main-content-with-top-nav {
    margin-top: 70px; /* Height of top navigation */
    padding-top: var(--space-6);
    margin-left: 0 !important;
    width: 100% !important;
    max-width: none !important;
    background: transparent !important;
}

/* Ensure content is properly centered */
.main-content-with-top-nav .container-enhanced,
.main-content-with-top-nav .section-spacing {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* ===== ANIMATIONS ===== */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.top-navigation {
    animation: slideDown 0.3s ease-out;
}

/* ===== ACCESSIBILITY ===== */

.nav-menu-link:focus-visible,
.nav-search-input:focus-visible,
.nav-user-button:focus-visible {
    outline: 2px solid var(--color-navy);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .top-navigation,
    .nav-mobile-content,
    .nav-menu-link,
    .nav-user-button {
        transition: none;
    }
    
    .nav-menu-link:hover,
    .nav-user-button:hover {
        transform: none;
    }
}

/* ==========================================================================
   CSS Overrides to Ensure New Top Navigation Styles Take Precedence
   ========================================================================== */

/* Force new top navigation styles to override old styles */
.top-navigation {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--color-white) !important;
    box-shadow: var(--shadow-sm) !important;
    z-index: var(--z-fixed) !important;
    border-bottom: 1px solid var(--color-border) !important;
}

.nav-container {
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 0 var(--space-6) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 70px !important;
}

.nav-logo-section {
    display: flex !important;
    align-items: center !important;
    gap: var(--space-4) !important;
    text-decoration: none !important;
    color: inherit !important;
}

.nav-logo {
    height: 40px !important;
    width: auto !important;
}

.nav-brand-title {
    font-size: var(--text-xl) !important;
    font-weight: 600 !important;
    color: var(--color-primary) !important;
    margin: 0 !important;
}

.nav-brand-subtitle {
    font-size: var(--text-sm) !important;
    color: var(--color-text-light) !important;
    margin: 0 !important;
}

.nav-center {
    display: flex !important;
    align-items: center !important;
}

.nav-menu {
    display: flex !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: var(--space-6) !important;
}

.nav-menu-link {
    color: var(--color-text) !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    transition: color var(--transition-normal) !important;
    padding: var(--space-2) var(--space-3) !important;
    border-radius: var(--radius-md) !important;
}

.nav-menu-link:hover,
.nav-menu-link.active {
    color: var(--color-primary) !important;
    background: var(--color-primary-light) !important;
}

.nav-right {
    display: flex !important;
    align-items: center !important;
    gap: var(--space-4) !important;
}

.nav-search {
    display: flex !important;
    align-items: center !important;
    background: var(--color-background) !important;
    border-radius: var(--radius-full) !important;
    padding: var(--space-2) var(--space-4) !important;
    border: 1px solid var(--color-border) !important;
}

.nav-search-input {
    border: none !important;
    background: transparent !important;
    outline: none !important;
    font-size: var(--text-sm) !important;
    color: var(--color-text) !important;
    width: 200px !important;
}

.nav-search-input::placeholder {
    color: var(--color-text-light) !important;
}

.nav-search-button {
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    color: var(--color-text-light) !important;
    padding: var(--space-1) !important;
}

.nav-user-section {
    display: flex !important;
    align-items: center !important;
}

/* ===== AUTH BUTTONS SECTION ===== */
.nav-auth-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-direction: row; /* Ensure horizontal layout */
}

.nav-user-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-direction: row; /* Ensure horizontal layout */
}

.nav-admin-buttons {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-direction: row; /* Ensure horizontal layout */
}

.nav-user-button {
    display: flex !important;
    align-items: center !important;
    gap: var(--space-2) !important;
    padding: var(--space-3) var(--space-4) !important;
    background: var(--color-primary) !important;
    color: var(--color-white) !important;
    text-decoration: none !important;
    border-radius: var(--radius-md) !important;
    font-weight: 500 !important;
    transition: all var(--transition-normal) !important;
    white-space: nowrap !important; /* Prevent text wrapping */
}

.nav-user-button:hover {
    background: var(--color-primary-dark) !important;
    transform: translateY(-1px) !important;
}

.nav-mobile-toggle {
    display: none !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    padding: var(--space-2) !important;
    color: var(--color-text) !important;
}

/* Mobile navigation overrides */
@media (max-width: 768px) {
    .nav-center {
        display: none !important;
    }
    
    .nav-search {
        display: none !important;
    }
    
    .nav-mobile-toggle {
        display: block !important;
    }
    

}
