.custom-navbar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translate(-50%, -20px);
    /* start slightly above */
    width: 90%;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(8px);
    border-radius: 15px;
    padding: 4px 10px;
    /* padding: 10px 20px; */
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 999;
    opacity: 0;
    /* start invisible */
    transition: transform 0.6s ease, opacity 0.6s ease;
    /* smoother animation */
}

/* When navbar is shown (on page load fade-in) */
.custom-navbar.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* When navbar is hidden while scrolling down */
.custom-navbar.hidden {
    transform: translate(-50%, -100%);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.navbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* image height and nav*/

.logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

/* Desktop Menu */
.desktop-menu {
    display: flex;
    gap: 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    font-display: swap;
}

.desktop-menu a {
    font-weight: 500;
    color: #333;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
}

.emsyne-blog-icon-mobile {
    font-size: 1em;
    vertical-align: middle;
}

.desktop-menu a:hover {
    color: #002a74;
}

.desktop-menu a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    left: 0;
    bottom: -4px;
    background-color: #002a74;
    transition: width 0.3s ease;
}

.desktop-menu a:hover::after {
    width: 100%;
}

/* Hamburger Icon */
.hamburger-icon {
    display: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease-in-out;
}

.hamburger-icon:hover {
    transform: scale(1.1);
}

.bar {
    width: 25px;
    height: 3px;
    background-color: black;
    border-radius: 2px;
    transition: all 0.4s ease;
}

.hamburger-icon.active .bar1 {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-icon.active .bar2 {
    opacity: 0;
}

.hamburger-icon.active .bar3 {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu */
#nav {
    display: none;
    position: absolute;
    top: 64px;
    right: 0px;
    background: #ffffff;
    width: 220px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 998;
}

#nav.active {
    display: block;
}

#nav ul {
    list-style: none;
    padding: 10px;
    margin: 0;
}

#nav ul li {
    margin: 8px 0;
}

#nav ul li a {
    text-decoration: none;
    font-size: 16px;
    color: #3173dc;
    font-weight: 500;
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

#nav ul li a:hover {
    background: #3173dc;
    color: #fff;
}

/* Overlay */
.dark-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 500;
    transition: opacity 0.3s ease;
}

.dark-overlay.active {
    display: block;
    opacity: 0.9;
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: rgba(255, 255, 255, 0.6) !important;
    backdrop-filter: blur(15px) !important;
    box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    padding: 8px 0 !important;

    width: auto !important;
    /* remove fixed width */
    min-width: max-content !important;
    /* fit text exactly */

    z-index: 1;
}

.dropdown:hover .dropdown-menu,
.dropdown .dropdown-toggle:focus+.dropdown-menu {
    display: block !important;
}

/* Adjust hover effect for dropdown items */
.dropdown-menu a {
    color: #333 !important;
    /* Darker text for better readability */
    padding: 4px 0 !important;
    /* Reduced padding to minimize space */
    margin: 0 !important;
    /* Remove any default margins */
    text-decoration: none !important;
    display: inline-block !important;
    /* Ensure the hover effect fits the text */
    font-size: 12px !important;
    /* Professional font size */
    box-sizing: border-box !important;
    /* Ensure padding and borders are included in width */
    white-space: nowrap !important;
    /* Prevent text wrapping and remove extra space */
    position: relative;
    /* Ensure underline alignment */
}

.dropdown-menu a:hover,
.dropdown-menu a:active,
.dropdown-menu a:focus {
    background-color: transparent !important;
    color: #002a74 !important;
    /* Remove background color on hover/click, match text color to desktop nav links */
}

/* Also override Bootstrap's dropdown-item wrapper active/focus styles */
.dropdown-menu .dropdown-item:active,
.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
    background-color: transparent !important;
}

.dropdown-menu a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    /* Single thin blue line */
    background-color: #002a74;
    transition: width 0.3s ease;
}

.dropdown-menu a:hover::after {
    width: 100%;
    /* Expand underline on hover */
}

.dropdown-toggle {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    appearance: none !important;
}

.dropdown-toggle::after {
    content: none !important;
}

/* Responsive */
@media (max-width: 992px) {
    .desktop-menu {
        display: none !important;
    }

    .hamburger-icon {
        display: flex !important;
    }

    .custom-navbar {
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        padding: 0;
        top: 10px;
    }

    .logo-img {
        display: block !important;
        height: 40px;
        width: auto;
        object-fit: contain;
    }

    /* Mobile Dropdown styles */
    .mobile-dropdown-menu {
        display: none;
        list-style: none;
        padding-left: 25px !important;
        margin: 0;
        background: transparent;
    }

    .mobile-dropdown-menu.active {
        display: block;
    }

    .mobile-dropdown-menu li {
        margin: 0 0 2px 0 !important;
    }

    .mobile-dropdown-menu li a {
        padding: 6px 12px !important;
        font-size: 15px !important;
        background: transparent !important;
        color: #3173dc !important;
    }

    .mobile-dropdown-menu li a:hover,
    .mobile-dropdown-menu li a:focus,
    .mobile-dropdown-menu li a:active {
        background: transparent !important;
        color: #3173dc !important;
        /* Prevent text color from turning white */
    }

    .mobile-dropdown-toggle {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-dropdown-toggle::after {
        content: '▼';
        font-size: 10px;
        margin-left: 5px;
    }
}

* {
    font-family: 'Poppins', sans-serif !important;
}