/* =============================================================
   BG Menu — Frontend Styles
   Version: 1.0.0
   ============================================================= */

/* ── Resets inside widget ───────────────────────────────────── */
.bg-menu-wrap *,
.bg-menu-wrap *::before,
.bg-menu-wrap *::after { box-sizing: border-box; }

.bg-menu-nav,
.bg-menu-dropdown {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── Wrapper ────────────────────────────────────────────────── */
.bg-menu-wrap { position: relative; }

/* ── Desktop nav ────────────────────────────────────────────── */
.bg-menu-desktop { display: block; }

.bg-menu-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

/* ── Menu items ─────────────────────────────────────────────── */
.bg-menu-item { position: relative; }

.bg-menu-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
    transition: color .2s ease, background-color .2s ease;
    cursor: pointer;
    color: inherit;
    background: none;
    border: none;
    font: inherit;
    width: 100%;
}

.bg-menu-top-link {
    padding: 15px;
}

.bg-menu-link-text { display: inline-block; }

/* Disabled menu item link/label */
.bg-menu-link-disabled {
    cursor: default;
}

.bg-menu-item.has-dropdown > .bg-menu-link-disabled {
    cursor: pointer;
}

/* ── Arrow icon ─────────────────────────────────────────────── */
.bg-menu-arrow {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    transition: transform .2s ease;
    flex-shrink: 0;
}

/* ── Hover effects ──────────────────────────────────────────── */

/* Underline */
.bg-menu-hover-underline .bg-menu-top-link .bg-menu-link-text {
    position: relative;
    padding-bottom: 2px;
}
.bg-menu-hover-underline .bg-menu-top-link .bg-menu-link-text::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 0; height: 2px;
    background: currentColor;
    transition: width .25s ease;
}
.bg-menu-hover-underline .bg-menu-top-link:hover .bg-menu-link-text::after { width: 100%; }

/* Overline */
.bg-menu-hover-overline .bg-menu-top-link .bg-menu-link-text {
    position: relative;
    padding-top: 2px;
}
.bg-menu-hover-overline .bg-menu-top-link .bg-menu-link-text::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 2px;
    background: currentColor;
    transition: width .25s ease;
}
.bg-menu-hover-overline .bg-menu-top-link:hover .bg-menu-link-text::before { width: 100%; }

/* Highlight */
.bg-menu-hover-highlight .bg-menu-top-link {
    transition: color .2s ease, background-color .2s ease, border-radius .2s ease;
    border-radius: 4px;
}

/* ── Dropdown (desktop) ─────────────────────────────────────── */
.bg-menu-desktop .bg-menu-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 200px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
    border-radius: 4px;
    z-index: 9999;

    /* hidden state */
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
    pointer-events: none;
}

/* Sub-sub dropdown: opens to the right */
.bg-menu-desktop .bg-menu-dropdown .bg-menu-dropdown {
    top: 0;
    left: 100%;
}

.bg-menu-desktop .bg-menu-dropdown .bg-menu-link {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.bg-menu-desktop .bg-menu-dropdown .bg-menu-arrow {
    margin-left: auto;
    transform: rotate(-90deg);
}

/* Show on hover */
.bg-menu-desktop .bg-menu-item.has-dropdown:hover > .bg-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Rotate top-level arrow when open */
.bg-menu-desktop .bg-menu-nav > .bg-menu-item.has-dropdown:hover > .bg-menu-top-link .bg-menu-arrow {
    transform: rotate(180deg);
}

/* ── Trigger button (hamburger) ─────────────────────────────── */
.bg-menu-trigger,
.bg-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    line-height: 1;
    color: inherit;
}

/* Hidden until breakpoint fires */
.bg-menu-trigger { display: none; }

/* ── Overlay ────────────────────────────────────────────────── */
.bg-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .50);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}

.bg-menu-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* ── Off-canvas panel ───────────────────────────────────────── */
.bg-menu-offcanvas {
    position: fixed;
    top: 0; left: 0;
    width: 300px;
    height: 100%;
    background: #fff;
    z-index: 99999;
    transform: translateX(-100%);
    transition: transform .3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.bg-menu-offcanvas.is-active { transform: translateX(0); }

.bg-menu-offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 1;
}

.bg-menu-offcanvas-nav {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Off-canvas nav list — vertical stack */
.bg-menu-offcanvas .bg-menu-nav {
    flex-direction: column;
    align-items: stretch;
}

.bg-menu-offcanvas .bg-menu-link {
    padding: 13px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, .05);
    color: inherit;
}

.bg-menu-offcanvas .bg-menu-link:hover { background: rgba(0,0,0,.04); }

/* Mobile dropdown — accordion style */
.bg-menu-offcanvas .bg-menu-dropdown {
    position: static;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border-radius: 0;
    background: rgba(0, 0, 0, .03);
    pointer-events: auto;
    min-width: auto;
}

.bg-menu-offcanvas .bg-menu-dropdown.is-open { display: block; }

/* Indent nested levels */
.bg-menu-offcanvas .bg-menu-dropdown .bg-menu-link { padding-left: 36px; }
.bg-menu-offcanvas .bg-menu-dropdown .bg-menu-dropdown .bg-menu-link { padding-left: 52px; }

/* Arrow states in offcanvas */
.bg-menu-offcanvas .bg-menu-item.has-dropdown > .bg-menu-link .bg-menu-arrow {
    transition: transform .2s ease;
    margin-left: auto;
}
.bg-menu-offcanvas .bg-menu-item.has-dropdown.is-open > .bg-menu-link .bg-menu-arrow {
    transform: rotate(180deg);
}

/* ── Body scroll lock ───────────────────────────────────────── */
body.bg-menu-locked { overflow: hidden; }

/* ── Breakpoint rules ───────────────────────────────────────── */

/* MOBILE — collapse below 768 px */
@media (max-width: 767px) {
    .bg-menu-bp-mobile .bg-menu-desktop  { display: none; }
    .bg-menu-bp-mobile .bg-menu-trigger  { display: inline-flex; }
}

/* TABLET — collapse below 1024 px */
@media (max-width: 1023px) {
    .bg-menu-bp-tablet .bg-menu-desktop  { display: none; }
    .bg-menu-bp-tablet .bg-menu-trigger  { display: inline-flex; }
}

/* ── Show All sentinel item ─────────────────────────────────── */

/*
 * Hidden by default in CSS too; JS will toggle display
 * based on whether the limit is actually exceeded.
 * aria-hidden="true" is set in the walker so screen readers
 * skip it until JS makes it visible.
 */
.bg-menu-show-all {
    display: none; /* JS controls visibility */
    border-top: 1px solid rgba(0, 0, 0, .08);
    margin-top: 4px;
}

.bg-menu-show-all-link {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Small arrow pointing right to hint "see more" */
.bg-menu-show-all-link::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    margin-bottom: 1px;
    flex-shrink: 0;
}

/* ── Elementor editor empty state ───────────────────────────── */
.bg-menu-empty {
    padding: 20px;
    background: #f5f5f5;
    text-align: center;
    color: #aaa;
    border: 1px dashed #ccc;
    border-radius: 4px;
    font-size: 14px;
}
