/* ===== NAVIGATION BAR OVERRIDE - LOADS AFTER MUD BLAZOR ===== */
/* This file ensures consistent navigation bar styling across ALL pages */
/* Loads after MudBlazor.min.css to override any default MudBlazor styles */

/* Base navigation bar styles - maximum specificity to override MudBlazor */
.mud-appbar,
.mud-appbar.custom-header-bar,
body .mud-appbar,
body .mud-appbar.custom-header-bar,
html body .mud-appbar,
html body .mud-appbar.custom-header-bar,
#app .mud-appbar,
#app .mud-appbar.custom-header-bar,
body #app .mud-appbar,
body #app .mud-appbar.custom-header-bar {
    z-index: 1100 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background-color: white !important;
    border-bottom: 1px solid #e0e0e0 !important;
    min-height: 72px !important;
    height: 72px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-shadow: none !important;
    overflow: visible !important;
    width: 100% !important;
}

/* Navigation bar toolbar wrapper */
.mud-appbar.custom-header-bar,
.mud-appbar.custom-header-bar > .mud-appbar-toolbar,
.mud-appbar.custom-header-bar > div,
body .mud-appbar.custom-header-bar,
body .mud-appbar.custom-header-bar > .mud-appbar-toolbar,
body .mud-appbar.custom-header-bar > div,
html body .mud-appbar.custom-header-bar,
html body .mud-appbar.custom-header-bar > .mud-appbar-toolbar,
html body .mud-appbar.custom-header-bar > div,
#app .mud-appbar.custom-header-bar,
#app .mud-appbar.custom-header-bar > .mud-appbar-toolbar,
#app .mud-appbar.custom-header-bar > div {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

/* Left side elements (burger menu, page title) */
.mud-appbar.custom-header-bar > div > div:first-child,
body .mud-appbar.custom-header-bar > div > div:first-child,
html body .mud-appbar.custom-header-bar > div > div:first-child,
#app .mud-appbar.custom-header-bar > div > div:first-child {
    display: flex !important;
    align-items: center !important;
    margin-right: auto !important;
    flex-shrink: 0 !important;
}

/* Right side elements (notifications, username) */
.mud-appbar.custom-header-bar > div > div:last-child,
body .mud-appbar.custom-header-bar > div > div:last-child,
html body .mud-appbar.custom-header-bar > div > div:last-child,
#app .mud-appbar.custom-header-bar > div > div:last-child {
    display: flex !important;
    align-items: center !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
    overflow: visible !important;
    white-space: nowrap !important;
}

/* Mobile - increase hamburger icon size */
@media (max-width: 640.98px) {
    /* Increase hamburger menu icon size on mobile */
    .hamburger-menu-wrapper .hamburger-menu-icon,
    .hamburger-menu-wrapper .mud-icon-button,
    .mud-appbar .hamburger-menu-wrapper .mud-icon-button,
    .mud-appbar .hamburger-menu-icon,
    .mud-appbar.custom-header-bar .hamburger-menu-icon,
    body .hamburger-menu-wrapper .mud-icon-button,
    body .mud-appbar .hamburger-menu-icon,
    html body .hamburger-menu-wrapper .mud-icon-button,
    html body .mud-appbar .hamburger-menu-icon,
    #app .hamburger-menu-wrapper .mud-icon-button,
    #app .mud-appbar .hamburger-menu-icon {
        min-width: 48px !important;
        min-height: 48px !important;
        width: 48px !important;
        height: 48px !important;
        padding: 10px !important;
        font-size: 1.5rem !important;
    }
}

/* Tablet and Desktop - align with sidebar */
@media (min-width: 641px) {
    .mud-appbar,
    .mud-appbar.custom-header-bar,
    body .mud-appbar,
    body .mud-appbar.custom-header-bar,
    html body .mud-appbar,
    html body .mud-appbar.custom-header-bar,
    #app .mud-appbar,
    #app .mud-appbar.custom-header-bar,
    body #app .mud-appbar,
    body #app .mud-appbar.custom-header-bar {
        left: 300px !important;
        right: 0 !important;
        width: calc(100vw - 300px) !important;
        max-width: calc(100vw - 300px) !important;
        padding-right: 0 !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }
}

/* Desktop specific adjustments */
@media (min-width: 992px) {
    /* Reorder header elements on desktop: notifications/username first (left), then burger/title (center) */
    .mud-appbar.custom-header-bar,
    .mud-appbar {
        display: flex !important;
        flex-direction: row !important;
    }
    
    /* Force header-right to be visible on desktop - POSITIONED ON FAR RIGHT */
    .mud-appbar.custom-header-bar .header-right,
    .mud-appbar .header-right,
    .mud-appbar.custom-header-bar > div > div:last-child,
    .mud-appbar > div > div:last-child,
    .mud-appbar.custom-header-bar > .mud-appbar-toolbar > div:last-child,
    .mud-appbar > .mud-appbar-toolbar > div:last-child,
    .mud-appbar.custom-header-bar > div > .mud-appbar-toolbar > div:last-child,
    .mud-appbar > div > .mud-appbar-toolbar > div:last-child,
    body .mud-appbar.custom-header-bar .header-right,
    body .mud-appbar .header-right,
    html body .mud-appbar.custom-header-bar .header-right,
    html body .mud-appbar .header-right,
    #app .mud-appbar.custom-header-bar .header-right,
    #app .mud-appbar .header-right,
    body #app .mud-appbar.custom-header-bar .header-right,
    body #app .mud-appbar .header-right {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
        margin-right: 0 !important;
        order: 3 !important;
        position: relative !important;
        z-index: 1000 !important;
        overflow: visible !important;
        width: auto !important;
        max-width: none !important;
        min-width: 200px !important;
    }
    
    /* Center the burger icon and page title on desktop */
    .mud-appbar.custom-header-bar .header-left,
    .mud-appbar .header-left,
    .mud-appbar.custom-header-bar > div > div:first-child,
    .mud-appbar > div > div:first-child,
    .mud-appbar.custom-header-bar > .mud-appbar-toolbar > div:first-child,
    .mud-appbar > .mud-appbar-toolbar > div:first-child {
        order: 2 !important;
        flex: 1 !important;
        justify-content: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Ensure ALL children of header-right are visible - use universal selector */
    .mud-appbar.custom-header-bar .header-right *,
    .mud-appbar .header-right *,
    .mud-appbar.custom-header-bar > div > div:last-child *,
    .mud-appbar > div > div:last-child * {
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Notification icon and badge - ALL selectors */
    .mud-appbar.custom-header-bar .header-right .mud-icon-button,
    .mud-appbar .header-right .mud-icon-button,
    .mud-appbar.custom-header-bar .header-right .mud-badge,
    .mud-appbar .header-right .mud-badge,
    .mud-appbar.custom-header-bar > div > div:last-child .mud-icon-button,
    .mud-appbar > div > div:last-child .mud-icon-button,
    .mud-appbar.custom-header-bar > div > div:last-child .mud-badge,
    .mud-appbar > div > div:last-child .mud-badge,
    .mud-appbar.custom-header-bar > div > div:last-child > .mud-icon-button,
    .mud-appbar > div > div:last-child > .mud-icon-button,
    .mud-appbar.custom-header-bar > div > div:last-child > .mud-badge,
    .mud-appbar > div > div:last-child > .mud-badge {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-shrink: 0 !important;
    }

    /* User profile container - ALL selectors */
    .mud-appbar.custom-header-bar .header-right .user-profile-container,
    .mud-appbar .header-right .user-profile-container,
    .mud-appbar.custom-header-bar > div > div:last-child .user-profile-container,
    .mud-appbar > div > div:last-child .user-profile-container,
    .mud-appbar.custom-header-bar > div > div:last-child > div,
    .mud-appbar > div > div:last-child > div {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-shrink: 0 !important;
    }

    /* Username text - ALL selectors */
    .mud-appbar.custom-header-bar .header-right .username-text,
    .mud-appbar .header-right .username-text,
    .mud-appbar.custom-header-bar > div > div:last-child .username-text,
    .mud-appbar > div > div:last-child .username-text,
    .mud-appbar.custom-header-bar > div > div:last-child > div > span,
    .mud-appbar > div > div:last-child > div > span,
    .mud-appbar.custom-header-bar .username-text,
    .mud-appbar .username-text {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-shrink: 0 !important;
    }

    /* Menu dropdown - ALL selectors */
    .mud-appbar.custom-header-bar .header-right .mud-menu,
    .mud-appbar .header-right .mud-menu,
    .mud-appbar.custom-header-bar > div > div:last-child .mud-menu,
    .mud-appbar > div > div:last-child .mud-menu,
    .mud-appbar.custom-header-bar > div > div:last-child > div > .mud-menu,
    .mud-appbar > div > div:last-child > div > .mud-menu {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-shrink: 0 !important;
    }

    /* Page title left alignment */
    .mud-appbar.custom-header-bar .header-left,
    .mud-appbar .header-left,
    .mud-appbar.custom-header-bar > div > div:first-child,
    .mud-appbar > div > div:first-child {
        justify-content: flex-start !important;
        text-align: left !important;
    }

    .mud-appbar.custom-header-bar .page-title-text,
    .mud-appbar .page-title-text,
    .mud-appbar.custom-header-bar .header-left .mud-text,
    .mud-appbar .header-left .mud-text {
        text-align: left !important;
        justify-content: flex-start !important;
    }

    /* Hide hamburger menu wrapper on desktop - make invisible but maintain spacing */
    .hamburger-menu-wrapper,
    .mud-appbar .hamburger-menu-wrapper,
    .mud-appbar.custom-header-bar .hamburger-menu-wrapper,
    .header-left .hamburger-menu-wrapper,
    .mud-appbar > div > div:first-child .hamburger-menu-wrapper,
    .mud-appbar.custom-header-bar > div > div:first-child .hamburger-menu-wrapper,
    .mud-appbar > .mud-appbar-toolbar > div:first-child .hamburger-menu-wrapper,
    .mud-appbar.custom-header-bar > .mud-appbar-toolbar > div:first-child .hamburger-menu-wrapper,
    body .hamburger-menu-wrapper,
    body .mud-appbar .hamburger-menu-wrapper,
    body .mud-appbar.custom-header-bar .hamburger-menu-wrapper,
    html body .hamburger-menu-wrapper,
    html body .mud-appbar .hamburger-menu-wrapper,
    html body .mud-appbar.custom-header-bar .hamburger-menu-wrapper,
    #app .hamburger-menu-wrapper,
    #app .mud-appbar .hamburger-menu-wrapper,
    #app .mud-appbar.custom-header-bar .hamburger-menu-wrapper,
    body #app .hamburger-menu-wrapper,
    body #app .mud-appbar .hamburger-menu-wrapper,
    body #app .mud-appbar.custom-header-bar .hamburger-menu-wrapper,
    html body #app .hamburger-menu-wrapper,
    html body #app .mud-appbar .hamburger-menu-wrapper,
    html body #app .mud-appbar.custom-header-bar .hamburger-menu-wrapper {
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        /* Keep width and margin to maintain spacing for page title position */
        width: auto !important;
        min-width: 72px !important; /* Approximate width of icon + padding + margin */
    }
    
    /* Hide the icon inside the wrapper */
    .hamburger-menu-wrapper .hamburger-menu-icon,
    .hamburger-menu-wrapper .mud-icon-button {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    /* Also hide the icon itself as backup */
    .hamburger-menu-icon,
    .mud-appbar .hamburger-menu-icon,
    .mud-appbar.custom-header-bar .hamburger-menu-icon,
    .header-left .hamburger-menu-icon {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    /* Ensure page title maintains its original position when hamburger is hidden */
    .page-title-text,
    .mud-appbar .page-title-text,
    .mud-appbar.custom-header-bar .page-title-text,
    .header-left .page-title-text,
    body .page-title-text,
    body .mud-appbar .page-title-text,
    body .mud-appbar.custom-header-bar .page-title-text,
    html body .page-title-text,
    html body .mud-appbar .page-title-text,
    html body .mud-appbar.custom-header-bar .page-title-text,
    #app .page-title-text,
    #app .mud-appbar .page-title-text,
    #app .mud-appbar.custom-header-bar .page-title-text {
        margin-left: 0 !important;
        padding-left: 0 !important;
    }
    
    /* Keep header-left alignment as it was - title should stay in same visual position */
    .header-left,
    .mud-appbar .header-left,
    .mud-appbar.custom-header-bar .header-left {
        padding-left: 0 !important;
        margin-left: 0 !important;
    }

    /* ULTIMATE FALLBACK: Target by class name directly - highest priority */
    .header-right {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
        position: relative !important;
        z-index: 1000 !important;
        overflow: visible !important;
        width: auto !important;
        max-width: none !important;
        min-width: 200px !important;
    }

    .header-right * {
        visibility: visible !important;
        opacity: 1 !important;
    }

    .header-right .mud-icon-button,
    .header-right .mud-badge,
    .header-right .user-profile-container,
    .header-right .username-text,
    .header-right .mud-menu {
        display: inherit !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .user-profile-container {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .username-text {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .mud-appbar.custom-header-bar > div > div:last-child,
    body .mud-appbar.custom-header-bar > div > div:last-child,
    html body .mud-appbar.custom-header-bar > div > div:last-child,
    #app .mud-appbar.custom-header-bar > div > div:last-child {
        display: flex !important;
        align-items: center !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: auto !important;
        max-width: none !important;
        flex-shrink: 0 !important;
    }

    .mud-appbar.custom-header-bar > div > div:last-child > div:last-child,
    body .mud-appbar.custom-header-bar > div > div:last-child > div:last-child,
    html body .mud-appbar.custom-header-bar > div > div:last-child > div:last-child,
    #app .mud-appbar.custom-header-bar > div > div:last-child > div:last-child {
        display: flex !important;
        align-items: center !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin-left: 0.5rem !important;
        width: auto !important;
        max-width: none !important;
        flex-shrink: 0 !important;
    }

    .mud-appbar .username-text,
    body .mud-appbar .username-text,
    html body .mud-appbar .username-text,
    #app .mud-appbar .username-text {
        display: inline-block !important;
        visibility: visible !important;
        color: #212529 !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }
}

