/* =============================================================================
   MGM Framework – MG Nav Bar Widget
   Scoped to .mgmfw-nbw so it never collides with the classic .mgmfw-navbar
   ============================================================================= */

/* ── Widget container ─────────────────────────────────────────────────────── */
.mgmfw-nbw {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* clips background image */
    z-index: 9900;
    display: flex;
    align-items: center; /* vertically centers __inner when container_height > nav_height */
}

/* Background image layer (set via PHP inline style) */
.mgmfw-nbw__bg-img {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    /* opacity controlled via Elementor slider → inline style */
}

/* Sticky: start state */
.mgmfw-nbw--sticky-init {
    position: relative; /* stays in flow until JS kicks */
}

/* Sticky: stuck state (JS adds this class) */
.mgmfw-nbw--stuck {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9990 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,.6);
}

/* Sticky animations */
.mgmfw-nbw--stuck.mgmfw-nbw--anim-slide {
    animation: mgmfw-nbw-slide-in 0.22s ease;
}
.mgmfw-nbw--stuck.mgmfw-nbw--anim-fade {
    animation: mgmfw-nbw-fade-in 0.22s ease;
}

@keyframes mgmfw-nbw-slide-in {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
@keyframes mgmfw-nbw-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Spacer div inserted by JS to prevent page-jump when bar becomes fixed */
.mgmfw-nbw-spacer {
    display: block;
    width: 100%;
}

/* ── Inner ────────────────────────────────────────────────────────────────── */
.mgmfw-nbw__inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
    height: 60px; /* overridden by Elementor responsive slider */
}

/* ── Logo ─────────────────────────────────────────────────────────────────── */
.mgmfw-nbw__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 20px;
    text-decoration: none;
}
.mgmfw-nbw__logo-img {
    height: 40px;
    width: auto;
    display: block;
}

/* ── Menu wrap ────────────────────────────────────────────────────────────── */
.mgmfw-nbw__menu-wrap {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.mgmfw-nbw__no-menu {
    color: #888;
    font-size: 0.8rem;
    font-style: italic;
    margin: 0;
    padding: 0 8px;
}

/* ── Menu list ────────────────────────────────────────────────────────────── */
ul.mgmfw-nbw__menu {
    display: flex;
    align-items: stretch;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 60px; /* synced with inner */
    gap: 4px;     /* overridden by Elementor spacing slider */
    flex: 1;
    justify-content: flex-start; /* default; overridden by data-menu-align below */
}

/* Menu alignment — driven from PHP data-attr, no Elementor CSS cache needed */
.mgmfw-nbw[data-menu-align="center"] ul.mgmfw-nbw__menu {
    justify-content: center;
}
.mgmfw-nbw[data-menu-align="flex-end"] ul.mgmfw-nbw__menu {
    justify-content: flex-end;
}

/* ── Top-level items ──────────────────────────────────────────────────────── */
.mgmfw-nbw__item {
    position: relative;
    display: flex;
    align-items: stretch;
    margin: 0;
    padding: 0;
}

/* ── Top-level link ───────────────────────────────────────────────────────── */
.mgmfw-nbw__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 14px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.775rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #c8c8c8;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    height: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    transition: color .14s, border-color .14s, opacity .14s, background .14s;
    cursor: pointer;
}

.mgmfw-nbw__link:hover,
.mgmfw-nbw__item:hover > .mgmfw-nbw__link,
.mgmfw-nbw__item.is-open > .mgmfw-nbw__link {
    color: #fff;
    border-bottom-color: #cc2222;
    text-decoration: none;
}

.mgmfw-nbw__link--active {
    color: #fff;
    border-bottom-color: #cc2222;
}

/* ── Button image modes ───────────────────────────────────────────────────── */

/* "behind" mode: the image is the background of the link */
.mgmfw-nbw__link--img-behind {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    text-shadow: 0 1px 4px rgba(0,0,0,.8);
    padding: 0 18px;
}

/* "replace" mode: image fills the button, no visible text outside img */
.mgmfw-nbw__link--img-replace {
    padding: 4px 8px;
    border-bottom: none; /* image IS the button */
}
.mgmfw-nbw__link--img-replace:hover,
.mgmfw-nbw__item:hover > .mgmfw-nbw__link--img-replace {
    border-bottom: none;
}

/* "icon_left" / "icon_right" modes */
.mgmfw-nbw__link--img-icon_left,
.mgmfw-nbw__link--img-icon_right {
    gap: 8px;
}

/* Button image element */
.mgmfw-nbw__btn-img {
    display: block;
    max-width: 100%;
    transition: opacity .14s;
}

/* Icon image element */
.mgmfw-nbw__btn-icon {
    flex-shrink: 0;
    transition: opacity .14s;
}

/* Hover opacity on button images (controlled by JS using data from widget) */
.mgmfw-nbw__item:hover > .mgmfw-nbw__link .mgmfw-nbw__btn-img,
.mgmfw-nbw__item:hover > .mgmfw-nbw__link .mgmfw-nbw__btn-icon {
    /* opacity set via JS per-widget config */
}

/* Auto-scale: when enabled all img buttons get equal widths via CSS flex */
ul.mgmfw-nbw__menu.mgmfw-nbw--auto-scale > .mgmfw-nbw__item {
    flex: 1 1 0;
}
ul.mgmfw-nbw__menu.mgmfw-nbw--auto-scale > .mgmfw-nbw__item .mgmfw-nbw__link {
    width: 100%;
    justify-content: center;
}
ul.mgmfw-nbw__menu.mgmfw-nbw--auto-scale > .mgmfw-nbw__item .mgmfw-nbw__btn-img {
    width: 100%;
    height: auto;
}

/* ── Caret ────────────────────────────────────────────────────────────────── */
.mgmfw-nbw__caret {
    display: inline-flex;
    align-items: center;
    opacity: .55;
    pointer-events: none;
    transition: transform .2s, opacity .2s;
    flex-shrink: 0;
}
.mgmfw-nbw__item--has-dd:hover > .mgmfw-nbw__link .mgmfw-nbw__caret,
.mgmfw-nbw__item--has-dd.is-open > .mgmfw-nbw__link .mgmfw-nbw__caret {
    transform: rotate(180deg);
    opacity: 1;
}

/* ── Dropdown ─────────────────────────────────────────────────────────────── */
ul.mgmfw-nbw__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    min-width: 210px;
    background: #1e1e1e;
    border: 1px solid #2d2d2d;
    border-top: 2px solid #cc2222;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 10px 36px rgba(0,0,0,.65);
    list-style: none;
    margin: 0;
    padding: 6px 0;
    z-index: 9901;
    animation: mgmfw-nbw-dd-in .15s ease;
}

@keyframes mgmfw-nbw-dd-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mgmfw-nbw__item--has-dd:hover > ul.mgmfw-nbw__dropdown,
.mgmfw-nbw__item--has-dd.is-open > ul.mgmfw-nbw__dropdown {
    display: block;
}

/* Dropdown link */
.mgmfw-nbw__dd-item {
    display: block;
    margin: 0;
    padding: 0;
    position: relative;
}

.mgmfw-nbw__dd-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 18px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #c8c8c8;
    text-decoration: none;
    white-space: nowrap;
    transition: color .12s, background .12s;
}

.mgmfw-nbw__dd-link:hover {
    color: #fff;
    background: rgba(255,255,255,.05);
    text-decoration: none;
}

/* Sub-menu (flyout) */
ul.mgmfw-nbw__sub {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 190px;
    background: #1e1e1e;
    border: 1px solid #2d2d2d;
    border-top: 2px solid #cc2222;
    border-radius: 0 4px 4px 4px;
    box-shadow: 0 10px 36px rgba(0,0,0,.65);
    list-style: none;
    margin: 0;
    padding: 6px 0;
    z-index: 9902;
    animation: mgmfw-nbw-dd-in .15s ease;
}

.mgmfw-nbw__dd-item--has-sub:hover > ul.mgmfw-nbw__sub,
.mgmfw-nbw__dd-item--has-sub.is-open > ul.mgmfw-nbw__sub {
    display: block;
}

.mgmfw-nbw__dd-arrow {
    opacity: .6;
    font-size: 1.1em;
    margin-left: 6px;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .mgmfw-nbw__menu-wrap {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: inherit;
        z-index: 9990;
        border-top: 1px solid rgba(255,255,255,.08);
        box-shadow: 0 10px 30px rgba(0,0,0,.5);
    }

    .mgmfw-nbw__menu-wrap.is-open {
        display: block;
    }

    ul.mgmfw-nbw__menu {
        flex-direction: column;
        height: auto;
        padding: 8px 0;
        gap: 0;
    }

    .mgmfw-nbw__item {
        display: block;
    }

    .mgmfw-nbw__link {
        height: 44px;
        width: 100%;
        justify-content: flex-start;
        padding: 0 20px;
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .mgmfw-nbw__link:hover,
    .mgmfw-nbw__item:hover > .mgmfw-nbw__link,
    .mgmfw-nbw__item.is-open > .mgmfw-nbw__link {
        border-bottom: none;
        border-left-color: #cc2222;
    }

    ul.mgmfw-nbw__dropdown {
        position: static;
        border: none;
        border-top: 1px solid rgba(255,255,255,.07);
        border-radius: 0;
        box-shadow: none;
        animation: none;
        background: rgba(0,0,0,.2);
        padding: 0;
        min-width: 0;
    }

    .mgmfw-nbw__dd-link {
        padding-left: 36px;
    }

    /* Mobile burger */
    .mgmfw-nbw__burger {
        display: flex;
        flex-direction: column;
        gap: 5px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 8px;
        margin-left: auto;
    }

    .mgmfw-nbw__burger-bar {
        display: block;
        width: 22px;
        height: 2px;
        background: #c8c8c8;
        border-radius: 1px;
        transition: transform .22s, opacity .22s;
    }

    .mgmfw-nbw__burger[aria-expanded="true"] .mgmfw-nbw__burger-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .mgmfw-nbw__burger[aria-expanded="true"] .mgmfw-nbw__burger-bar:nth-child(2) {
        opacity: 0;
    }
    .mgmfw-nbw__burger[aria-expanded="true"] .mgmfw-nbw__burger-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Hide auto-scale in mobile column layout */
    ul.mgmfw-nbw__menu.mgmfw-nbw--auto-scale > .mgmfw-nbw__item {
        flex: none;
    }
}

@media (min-width: 769px) {
    .mgmfw-nbw__burger { display: none; }
    .mgmfw-nbw__menu-wrap { display: flex !important; }
}
