/* ------------------------
   NAVBAR
------------------------ */
/* Set fixed navbar height CSS variable */
:root {
    --nav-height: 80px;
}

/* Navbar is always visible since it's inline HTML */
#nav-container .navbar {
    visibility: visible;
    opacity: 1;
}

.navbar {
    background: white !important;
    z-index: 9999 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    min-height: 80px;
    height: auto;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    transition: none !important;
    animation: none !important;
    will-change: auto;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    contain: layout style paint;
    /* Prevent any reflows */
    display: block;
    box-sizing: border-box;
    overflow: visible;
}

#nav-container {
    min-height: 80px;
    height: auto;
    position: relative;
    width: 100%;
    display: block;
    visibility: visible;
    margin: 0;
    padding: 0;
    overflow: visible;
    contain: none;
    z-index: 9999;
}

#mainNav {
    background: #003580 !important;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    flex-wrap: nowrap;
}

#mainNav .nav-link {
    color: white !important;
    font-weight: 500;
    position: relative;
    padding-left: 55px;
    text-align: center;
    white-space: nowrap;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
}

#mainNav .nav-link::before {
    content: '';
    background-image: url('../images/Menu_star.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 12px;
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    height: 16px;
    width: 16px;
    display: inline-block;
    vertical-align: middle;
}

#mainNav .nav-link.active {
    color: #00b4ff !important;
}

#mainNav .nav-link.active::before {
    content: '';
    background-image: url('../images/Menu_star.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: inline-block;
    height: 16px;
    width: 16px;
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 12px;
}

.navbar-brand img {
    max-height: 60px;
}

.navbar-toggler {
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 4px 8px;
    z-index: 10001;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba%280, 0, 0, 0.7%29' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
    display: block;
    width: 1.5em;
    height: 1.5em;
}

/* Prevent Bootstrap collapse transitions from causing layout shifts */
.navbar-collapse {
    transition: none !important;
    animation: none !important;
}

.navbar-collapse.collapsing {
    transition: none !important;
    animation: none !important;
    display: block !important;
    overflow: hidden;
}

.navbar-collapse.show {
    transition: none !important;
    animation: none !important;
}

/* Prevent any layout shifts during navbar operations */
.navbar,
.navbar *,
#nav-container,
#nav-container * {
    box-sizing: border-box;
}

.navbar-brand {
    flex-shrink: 0;
}

.navbar-brand img {
    display: block;
    width: auto;
    height: 60px;
    max-height: 60px;
    object-fit: contain;
}

/* ------------------------
   MOBILE RESPONSIVE
------------------------ */
@media (max-width: 1200px) {
    /* Allow navbar to expand to show dropdown */
    .navbar {
        height: auto !important;
        min-height: 80px;
        overflow: visible !important;
    }
    
    .navbar .container {
        overflow: visible !important;
        height: auto !important;
    }
    
    /* Ensure navbar collapse is visible and properly positioned */
    .navbar-collapse {
        position: relative;
        z-index: 10000;
        background: #003580;
        margin-top: 10px;
        padding: 10px 0;
        border-radius: 8px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        max-height: none;
        overflow: visible;
        width: 100%;
        flex-basis: 100%;
        flex-grow: 1;
    }
    
    .navbar-collapse.show {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        max-height: none !important;
    }
    
    .navbar-collapse:not(.show):not(.collapsing) {
        display: none !important;
    }
    
    .navbar-collapse.collapsing {
        display: flex !important;
        height: auto !important;
        overflow: hidden;
        max-height: none !important;
    }
    
    #mainNav {
        flex-direction: column;
        align-items: center;
        min-height: auto;
        background: #003580 !important;
        width: auto;
        max-width: 100%;
        padding: 10px 15px;
        margin: 0 auto;
        border-radius: 8px;
    }
    
    #mainNav .nav-item {
        width: 100%;
        text-align: left;
    }

    #mainNav .nav-link {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        padding: 8px 12px;
        padding-left: 12px;
        text-align: left;
        text-decoration: none;
        padding-bottom: 8px;
        margin-bottom: 4px;
        box-sizing: border-box;
        min-height: 28px;
        line-height: 1.5;
        background-color: transparent;
        color: white !important;
    }
    
    #mainNav .nav-link:hover,
    #mainNav .nav-link:focus {
        text-decoration: underline;
        text-decoration-color: #f6a300;
        text-decoration-thickness: 2px;
        text-underline-offset: 4px;
    }

    #mainNav .nav-link::before {
        content: '';
        background-image: url('../images/Menu_star.png');
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        position: static;
        transform: none;
        margin: 0;
        width: 24px;
        height: 24px;
        margin-right: 12px;
        text-align: center;
        flex-shrink: 0;
        display: inline-block;
        vertical-align: middle;
    }

    #mainNav .nav-link.active {
        color: #00b4ff !important;
        text-decoration: underline;
        text-decoration-color: #f6a300;
        text-decoration-thickness: 2px;
        text-underline-offset: 4px;
        margin-bottom: 0;
        padding-bottom: 8px;
        background-color: transparent;
    }
    
    #mainNav .nav-link.active::before {
        content: '';
        background-image: url('../images/Menu_star.png');
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        display: inline-block;
        width: 24px;
        height: 24px;
        position: static;
        transform: none;
        margin: 0;
        margin-right: 12px;
    }
}