/* ═══════════════════════════════════════
   NAV — BASE LAYOUT
   (works with the existing .nav-bar / .nav-inner
   rules already in your stylesheet — these rules
   only add what's needed for the mega menu + the
   mobile collapse behaviour)
═══════════════════════════════════════ */

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

.nav-collapse {
    display: flex;
    align-items: center;
    gap: 30px;
}

.mm-toggler {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12) !important;
    background-image: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.mm-toggler-icon {
    position: relative;
    display: block;
    width: 20px;
    height: 2px;
    background: #ffffff !important;
    background-image: none !important;
    transition: background .15s ease;
}

.mm-toggler-icon::before,
.mm-toggler-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    background: #ffffff;
    transition: transform .2s ease, opacity .2s ease;
}

.mm-toggler-icon::before {
    top: -6px;
}

.mm-toggler-icon::after {
    top: 6px;
}

.mm-toggler.is-open .mm-toggler-icon {
    background: transparent !important;
}

.mm-toggler.is-open .mm-toggler-icon::before {
    transform: translateY(6px) rotate(45deg);
}

.mm-toggler.is-open .mm-toggler-icon::after {
    transform: translateY(-6px) rotate(-45deg);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0;
}

.menu-item {
    position: relative;
    list-style: none;
}

.nav-caret {
    margin-left: 4px;
    vertical-align: -1px;
    transition: transform .2s ease;
}

.has-megamenu.is-open .nav-caret {
    transform: rotate(180deg);
}

/* ═══════════════════════════════════════
   MEGA MENU — DESKTOP
═══════════════════════════════════════ */

@media (min-width: 992px) {

    .has-megamenu {
        position: static;
    }

    .mega-menu {
        position: absolute;
        top: calc(100% + 5px);
        left: 50%;
        transform: translateX(-50%) translateY(8px);
        width: 760px;
        max-width: calc(100vw - 40px);
        background: #ffffff;
        border-radius: 20px;
        box-shadow: 0 20px 60px rgba(10, 15, 30, 0.18);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .2s ease, transform .2s ease, visibility .2s;
        z-index: 500;
    }

    .has-megamenu.is-open .mega-menu,
    .has-megamenu:hover .mega-menu {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
    }

    .mega-menu-inner {
        display: grid;
        grid-template-columns: 230px 1fr;
    }

    .mega-col-left {
        padding: 18px 12px;
        border-right: 1px solid #eef0f4;
    }

    .mega-col-right {
        padding: 18px;
    }

    .mega-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }
}

/* ═══════════════════════════════════════
   MEGA MENU — SHARED (desktop + mobile)
═══════════════════════════════════════ */

.mega-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
}

.mega-item {
    list-style: none;
}

.mega-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    color: #111827;
    transition: background .15s ease, color .15s ease;
}

.mega-item a:hover {
    background: #f3f4f6;
}

.mega-item.is-active a {
    background: #eef4ff;
    color: #2563eb;
    font-weight: 600;
}

.mega-item-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #6b7280;
    flex-shrink: 0;
}

.mega-item.is-active .mega-item-ico,
.mega-item a:hover .mega-item-ico {
    color: #2563eb;
}

.mega-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    transition: background .15s ease;
}

.mega-card:hover {
    background: #f9fafb;
}

.mega-card-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #eef4ff;
    color: #2563eb;
    flex-shrink: 0;
    margin-top: 2px;
}

.mega-card-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mega-card-title {
    font-size: 14.5px;
    font-weight: 600;
    color: #111827;
    line-height: 1.3;
}

.mega-card-desc {
    font-size: 12.5px;
    color: #6b7280;
    line-height: 1.5;
}

/* ═══════════════════════════════════════
   RESPONSIVE — MOBILE NAV + MEGA MENU
═══════════════════════════════════════ */

@media (max-width: 991.98px) {

    .mm-toggler {
        display: flex;
    }

    .nav-collapse {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: min(340px, 86vw);
        background: #0a0f1e;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        padding: 70px 24px 30px;
        transform: translateX(100%);
        transition: transform .3s ease;
        overflow-y: auto;
        z-index: 900;
    }

    .nav-collapse.is-open {
        transform: translateX(0);
    }

    .nav-links {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        width: 100%;
        padding-left: 0;
    }

    .menu-item {
        width: 100%;
    }

    .nav-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 13px 16px !important;
        border-radius: 10px;
    }

    .nav-link:hover {
        background: rgba(255, 255, 255, 0.06);
    }

    /* Mega menu becomes an inline accordion panel */
    .mega-menu {
        max-height: 0;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.04);
        border-radius: 12px;
        transition: max-height .3s ease;
    }

    .has-megamenu.is-open .mega-menu {
        max-height: 900px;
        margin-bottom: 8px;
    }

    .mega-menu-inner {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 6px 6px 14px;
    }

    .mega-col-left {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding-bottom: 10px;
        margin-bottom: 6px;
    }

    .mega-item a {
        color: #ffffff;
    }

    .mega-item a:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .mega-item.is-active a {
        background: rgba(37, 99, 235, 0.25);
        color: #93c5fd;
    }

    .mega-item-ico {
        color: rgba(255, 255, 255, 0.55);
    }

    .mega-item.is-active .mega-item-ico,
    .mega-item a:hover .mega-item-ico {
        color: #93c5fd;
    }

    .mega-grid {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .mega-card {
        background: transparent;
    }

    .mega-card:hover {
        background: rgba(255, 255, 255, 0.06);
    }

    .mega-card-title {
        color: #ffffff;
    }

    .mega-card-desc {
        color: rgba(255, 255, 255, 0.55);
    }

    .nav-cta {
        margin-top: 18px;
    }

    .btn-nav {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    /* dim backdrop behind the open mobile menu */
    body.nav-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 800;
    }
}

/* Mobile only */
@media (max-width: 991.98px) {

    .mm-toggler {
        width: 42px;
        height: 42px;
        border: 0;
        background: transparent;
        position: relative;
        cursor: pointer;
        padding: 0;
    }

    .mm-toggler-icon,
    .mm-toggler-icon::before,
    .mm-toggler-icon::after {
        position: absolute;
        width: 26px;
        height: 2px;
        background: #FFF;
        transition: .3s ease;
        content: "";
        z-index: 9999;
    }

    .mm-toggler-icon {
        top: 20px;
    }

    .mm-toggler-icon::before {
        top: -8px;
    }

    .mm-toggler-icon::after {
        top: 8px;
    }

    /* Close icon */
    .mm-toggler.active .mm-toggler-icon {
        background: transparent;
    }

    .mm-toggler.active .mm-toggler-icon::before {
        top: 0;
        transform: rotate(45deg);
    }

    .mm-toggler.active .mm-toggler-icon::after {
        top: 0;
        transform: rotate(-45deg);
    }
}