/* ============================================================
   Beaver Mega Wide Menu — v1.0.3
   Panels are rendered inline, teleported to <body> by bbmm.js.
   position:fixed + left:0 + width:100vw gives full-width dropdowns.
   ============================================================ */

/* ── Wrap & Nav ─────────────────────────────────────────────── */

.emwm-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.emwm-nav {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
}

/* ── Menu bar ───────────────────────────────────────────────── */

.emwm-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
}

.emwm-item {
    flex-shrink: 0;
}

.emwm-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s ease;
    cursor: pointer;
    background: none;
    border: none;
    font-size: inherit;
    color: #1e212c;
}

/* Active underline bar */
.emwm-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    height: 3px;
    background: transparent;
    border-radius: 2px 2px 0 0;
    transition: background 0.2s ease;
}

.emwm-item:hover > .emwm-link::after,
.emwm-item.emwm-open > .emwm-link::after,
.emwm-item.emwm-current > .emwm-link::after {
    background: #3096E4;
}

/* Dropdown indicator arrow */
.emwm-indicator {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    line-height: 1;
}

.emwm-item.emwm-open > .emwm-link .emwm-indicator {
    transform: rotate(180deg);
}

/* ── Dropdown Panel ─────────────────────────────────────────────
 *
 * Panels are output by PHP as direct <body> children (via wp_footer).
 * NO Elementor transforms between panel and viewport.
 * position:fixed + left:0 + width:100vw is therefore reliable.
 *
 * ─────────────────────────────────────────────────────────────── */

.emwm-panel {
    position: fixed;
    top: 0;              /* set by JS: nav.getBoundingClientRect().bottom */
    left: 0;
    width: 100vw;
    background: #F0F4FA;
    display: none;       /* completely out of layout — prevents white-bar above header */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 99999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
    border-top: 3px solid #3096E4;
    box-sizing: border-box;
}

/* Step 1 — JS sets display:block before triggering the opacity transition */
.emwm-panel.emwm-panel-ready {
    display: block;
}

/* Step 2 — JS adds this on the next animation frame to fade in */
.emwm-panel.emwm-panel-open {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Inner — max-width centred content */
.emwm-panel-inner {
    display: flex;
    align-items: flex-start;
    max-width: 1400px;
    margin: 0 auto;
    padding: 48px 80px;
    box-sizing: border-box;
    width: 100%;
}

/* ── Left title column ──────────────────────────────────────── */

.emwm-panel-left {
    flex: 0 0 22%;
    padding-right: 48px;
    box-sizing: border-box;
}

.emwm-panel-left-title {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #0E3D79;
    text-decoration: none;
    line-height: 1.25;
    transition: color 0.15s;
}

.emwm-panel-left-title:hover {
    color: #3096E4;
}

/* ── Right content (columns) ────────────────────────────────── */

.emwm-panel-right {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0 48px;
}

.emwm-panel-group {
    flex: 1 1 160px;
    min-width: 140px;
    max-width: 280px;
}

.emwm-group-heading {
    font-size: 13px;
    font-weight: 700;
    color: #0E3D79;
    margin: 0 0 16px;
}

.emwm-group-divider {
    height: 1px;
    background: #d0d0d0;
    margin-bottom: 16px;
}

/* ── Panel links ────────────────────────────────────────────── */

.emwm-panel-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.emwm-panel-links li {
    margin-bottom: 12px;
}

.emwm-panel-link {
    font-size: 15px;
    font-weight: 400;
    color: #444;
    text-decoration: none;
    display: block;
    transition: color 0.15s;
}

.emwm-panel-link:hover {
    color: #3096E4;
}

/* Flat links — horizontal row (Resources-style) */
.emwm-panel-links-flat {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

.emwm-panel-links-flat li {
    margin: 0 56px 12px 0;
}

.emwm-panel-links-flat li:last-child {
    margin-right: 0;
}

/* ── Editor mode — panels inside wrap, absolute positioning ── */

.emwm-editor {
    position: relative;
}

.emwm-editor-panels {
    position: absolute;
    top: 100%;
    left: -80px;       /* approximate offset to widen beyond container */
    right: -80px;
    z-index: 9999;
}

.emwm-editor .emwm-panel {
    position: static !important;
    width: auto !important;
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
}

.emwm-editor .emwm-panel.emwm-panel-open {
    display: block;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ── Column grid (set via data-cols attribute) ─────────────── */

.emwm-panel[data-cols] .emwm-panel-right {
    display: grid;
    gap: 32px 48px;
    align-items: start;
    flex-wrap: nowrap; /* override flex fallback */
}
.emwm-panel[data-cols="2"] .emwm-panel-right { grid-template-columns: repeat(2, 1fr); }
.emwm-panel[data-cols="3"] .emwm-panel-right { grid-template-columns: repeat(3, 1fr); }
.emwm-panel[data-cols="4"] .emwm-panel-right { grid-template-columns: repeat(4, 1fr); }
.emwm-panel[data-cols="5"] .emwm-panel-right { grid-template-columns: repeat(5, 1fr); }

/* ── Mobile header row (logo + close button) ────────────────── */

.emwm-mobile-header-row {
    display: none; /* hidden on desktop */
    list-style: none;
}

.emwm-mobile-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    color: #1e212c;
    flex-shrink: 0;
}

/* ── Mobile accordion sub-menu ─────────────────────────────── */

/* Always hidden — only shown inside the mobile media query below */
.emwm-mobile-sub {
    display: none;
    background: rgba(0, 0, 0, 0.03);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.emwm-mobile-sub-list {
    list-style: none;
    margin: 0;
    padding: 4px 0 8px;
}
.emwm-mobile-group-head {
    font-size: 11px;
    font-weight: 700;
    color: #3096E4;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 14px 24px 6px;
}
.emwm-mobile-sub-list li + li {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.emwm-mobile-sub-list li:first-child {
    border-top: none;
}
.emwm-mobile-link {
    display: block;
    padding: 11px 24px;
    font-size: 15px;
    color: #555;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}
.emwm-mobile-link:hover {
    color: #3096E4;
    background: rgba(0, 0, 0, 0.04);
}
.emwm-mobile-sub-item .emwm-mobile-link {
    padding-left: 36px;
    color: #666;
    font-size: 14px;
}

/* ── Hamburger toggle ───────────────────────────────────────── */

.emwm-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    padding: 0;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    margin-left: auto;
    z-index: 100000;
    flex-shrink: 0;
    color: #ffffff; /* default; overridden by Hamburger Icon Color control */
}

.emwm-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

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

/* ── Mobile backdrop ────────────────────────────────────────── */

.emwm-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99997;
    cursor: pointer;
}

.emwm-backdrop.emwm-backdrop-open {
    display: block;
}

/* ── Mobile ─────────────────────────────────────────────────── */

@media (max-width: 767px) {

    .emwm-toggle {
        display: flex;
    }

    /* Off-canvas panel — slides in from right, full width */
    .emwm-menu {
        display: flex !important;             /* always in DOM, visibility via transform */
        flex-direction: column !important;
        align-items: stretch !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        max-width: 100% !important;
        height: 100vh !important;
        background: #ffffff !important;
        z-index: 99998 !important;
        border-top: none !important;
        box-shadow: none !important;
        max-height: none !important;
        overflow-y: auto !important;
        box-sizing: border-box !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s ease !important;
        padding: 0 !important;
        margin: 0 !important;
        list-style: none !important;
    }

    .emwm-menu.emwm-mobile-open {
        transform: translateX(0) !important;
    }

    /* Header row: logo left, close-X right */
    .emwm-mobile-header-row {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 16px 20px !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
        flex-shrink: 0 !important;
        min-height: 70px !important;
        box-sizing: border-box !important;
    }

    .emwm-mobile-logo-img {
        display: block !important;
        height: auto !important;
        max-width: 100% !important;
    }

    .emwm-mobile-close {
        display: flex !important;
        color: #1e212c !important;
    }

    /* Menu items */
    .emwm-item {
        border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
        flex-shrink: 0 !important;
    }

    .emwm-link {
        padding: 16px 20px !important;
        width: 100% !important;
        justify-content: space-between !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #1e212c !important;
        box-sizing: border-box !important;
    }

    .emwm-link::after {
        display: none !important;
    }

    /* Accordion: show sub-menu when item is open (mobile only) */
    .emwm-item.emwm-open .emwm-mobile-sub {
        display: block;
    }

    /* On mobile we use the accordion (.emwm-mobile-sub) instead of full-width panels */
    .emwm-panel,
    .emwm-panel.emwm-panel-ready,
    .emwm-panel.emwm-panel-open {
        display: none !important;
        pointer-events: none !important;
    }
}
