.if-header {
    background: #0c1731;
    backdrop-filter: blur(8px);
    padding: 8px 0;
    font-family: 'Inter', 'Poppins', sans-serif;
    box-shadow: 0 8px 24px rgba(2, 8, 23, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    position: sticky;
    top: 0;
    z-index: 1000;
    overflow: visible;
}

.if-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, rgba(218, 139, 43, 0) 0%, rgba(218, 139, 43, 0.55) 35%, rgba(59, 130, 246, 0.55) 65%, rgba(59, 130, 246, 0) 100%);
    pointer-events: none;
}

.if-header-container {
    display: flex;
    height: 70px;
    align-items: center;
    max-width: 1400px;
    margin: auto;
    padding: 0 20px;
    gap: 14px;
    overflow: visible;
    flex-wrap: nowrap;
}

.if-logo { flex-shrink: 0; }

.if-logo img {
    height: 80px;
    margin-right: 10px;
    border-radius: 0px;
    padding: 3px 8px;
}

.if-nav-toggle {
    width: 44px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
}

.if-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 2px;
}

.if-auth-menu {
    flex-shrink: 0;
    position: relative;
}

.if-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

/* Login beside logo */
.if-header .if-logo + .if-auth-menu {
    margin-left: 6px;
}

.if-nav-collapse {
    flex: 1 1 auto;
    min-width: 0;
}

.if-header .dropdown {
    position: relative;
}

.if-login-btn {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #dbeafe !important;
    border-radius: 9999px;
    padding: 7px 16px;
    font-weight: 700;
    font-size: 13px;
    margin-right: 4px;
    max-width: 230px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.if-user-icon {
    margin-right: 8px;
}

.if-nav {
    display: flex;
    gap: 20px;
    list-style: none;
    flex-grow: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    flex-wrap: nowrap;
}

.if-nav-item {
    position: relative;
    flex-shrink: 0;
}

.if-nav-link {
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    position: relative;
    border-radius: 9999px;
    border: 1px solid transparent;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.if-nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 24px rgba(2, 8, 23, 0.18);
}

/* Keep dropdown toggles highlighted while menu is open */
.if-nav-item.dropdown:hover > .if-nav-link,
.if-nav-item.dropdown.show > .if-nav-link {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 24px rgba(2, 8, 23, 0.18);
}

.if-nav-link::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 6px;
    width: 0;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, #da8b2b, #3b82f6);
    transition: width 0.22s ease;
    opacity: 0.95;
}

.if-nav-link:hover::after {
    width: calc(100% - 24px);
}

/* If dropdown is open, show the same underline */
.if-nav-item.dropdown:hover > .if-nav-link::after,
.if-nav-item.dropdown.show > .if-nav-link::after {
    width: calc(100% - 24px);
}

/* Prevent global Bootstrap/custom caret from appearing in header */
.if-header .dropdown-toggle::after {
    display: none !important;
}

.if-nav-link:focus-visible {
    outline: 2px solid rgba(218, 139, 43, 0.55);
    outline-offset: 4px;
    border-radius: 8px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(2, 8, 23, 0.25);
    padding: 10px 0;
    border: 1px solid #dbeafe;
    z-index: 2000;
}

/* ------------------------------------------------------------------
   HARD OVERRIDES (Header only)
   custom.css ships global rules for .mega_menu/.mega-menu/.dropdown-menu
   that make dropdowns full-width/static and break header alignment.
   Keep fixes scoped to .if-header to avoid affecting other pages.
   ------------------------------------------------------------------ */
.if-header .dropdown-menu {
    margin-top: 8px !important;
    animation: none !important;
}

.if-header .if-nav-item.dropdown,
.if-header .dropdown.if-auth-menu {
    position: relative !important;
}

/* Undo custom.css: .mega_menu { position: static !important; } */
.if-header .if-nav-item.mega_menu {
    position: relative !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

.dropdown-item {
    padding: 10px 20px;
    font-size: 14px;
    color: #1e293b;
    text-decoration: none;
    display: block;
    transition: background 0.18s ease, color 0.18s ease;
}

.dropdown-item:hover {
    background: #eff6ff;
    color: #0b4aa2;
}

.dropdown-item i {
    color: #3b82f6;
    transition: color 0.18s ease;
}

.dropdown-item:hover i {
    color: #0b4aa2;
}

.if-nav-item.dropdown:hover .dropdown-menu,
.dropdown:hover > .dropdown-menu {
    display: block;
}

/* --------------------------------------------------------------
   Make category dropdowns look like Startup dropdown (boxed list)
   Applies to: Taxation & Accounting, Registration, Compliance, MCA,
   Income Tax, GST (DB-driven category dropdowns).
   -------------------------------------------------------------- */
.if-header .dropdown-menu.mega-menu {
    /* same "box" look */
    min-width: 340px;
    max-width: 520px;
    width: max-content;
    padding: 12px 0;
    border-radius: 22px;
    border: 1px solid rgba(219, 234, 254, 0.95);
    box-shadow: 0 24px 60px rgba(2, 8, 23, 0.22);
    overflow: hidden;
    /* critical: prevent custom.css full-width mega menu */
    position: absolute !important;
    left: 0 !important;
    right: auto !important;
    top: calc(100% + 6px) !important;
}

/* Match Startup item spacing/typography */
.if-header .dropdown-menu.mega-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Strong override: remove custom.css "grey card" look in mega-menu */
.if-header .dropdown-menu.mega-menu a.dropdown-item {
    /* override custom.css mega-menu card style */
    margin: 0 !important;
    background: transparent !important;
    border-left: 0 !important;
    transform: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 16px 22px !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    display: flex !important;
    align-items: center !important;
    gap: 0;
}

.if-header .dropdown-menu.mega-menu .dropdown-item i {
    font-size: 18px;
    margin-right: 14px !important;
    color: #3b82f6 !important;
}

.if-header .dropdown-menu.mega-menu .dropdown-item:hover {
    background: #eff6ff !important;
    color: #0b4aa2 !important;
    padding-left: 22px !important;
    border-left: 0 !important;
    transform: none !important;
    box-shadow: none !important;
}

.if-right-nav {
    display: flex;
    gap: 14px;
    margin-left: auto;
    align-items: center;
    flex-shrink: 0;
}

.if-right-nav .if-nav-link {
    white-space: nowrap;
    /* Keep identical hover behavior as main nav */
    font-size: 13px;
    padding: 10px 0;
    color: rgba(255, 255, 255, 0.88);
}

.cart-wrapper {
    position: relative;
    color: #dbeafe;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
}

@media (max-width: 1280px) {
    .if-right-nav .if-nav-link {
        font-size: 12px;
    }
}

@media (max-width: 1080px) {
    .if-right-nav {
        display: none;
    }

    .if-login-btn {
        max-width: 180px;
    }
}

@media (max-width: 820px) {
    .if-header-container {
        padding: 0 12px;
        gap: 10px;
    }

    .if-logo img {
        height: 34px;
    }

    .if-login-btn {
        font-size: 12px;
        padding: 7px 12px;
        max-width: 140px;
    }

    .if-nav { gap: 14px; }

    .if-nav-link {
        font-size: 12px;
        padding: 8px 10px;
    }
}

@media (max-width: 991.98px) {
    .if-header-container {
        flex-wrap: wrap;
    }

    .if-header-right {
        margin-left: auto;
        order: 3;
    }

    .if-logo { order: 1; }
    .if-auth-menu { order: 2; }
    .if-nav-toggle { order: 4; }

    .if-nav-collapse {
        flex-basis: 100%;
        order: 10;
    }

    .if-nav-collapse {
        width: 100%;
        margin-top: 10px;
        padding: 10px 12px;
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.16);
        background: rgba(12, 23, 49, 0.88);
        box-shadow: 0 18px 40px rgba(2, 8, 23, 0.35);
    }

    .if-nav {
        flex-wrap: wrap;
        gap: 14px;
    }

    .dropdown-menu {
        position: static;
        display: none;
        box-shadow: none;
        border-radius: 14px;
        margin-top: 6px;
    }

    .if-nav-item.dropdown.show .dropdown-menu {
        display: block;
    }
}

@media (min-width: 992px) {
    /* Ensure header links are visible on desktop */
    .if-nav-collapse.collapse:not(.show) {
        display: block !important;
        height: auto !important;
        visibility: visible !important;
    }
}
