/* =========================================================
   eMEGA Main Menu - Amazon Style
========================================================= */

.emega-main-menu {
    background: var(--color-primary);
    width: 100%;
    height: 39px;
    overflow: hidden;
    display: block;
}

.emega-main-menu .menu-group {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.emega-main-menu .nav.navbar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    height: 100%;
    width: 100%;
    margin: 0;
    padding-left: 11px;
    list-style: none;
    overflow: hidden;
}

.emega-main-menu .nav-item {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
}

.emega-main-menu .nav-item.is-hidden-by-fit {
    display: none !important;
}

.emega-main-menu .emega-main-menu__desktop-div {
    display: flex;
    align-items: center;
    align-self: stretch;
    margin: 1px 0;
    border: 1px solid transparent;
    border-radius: 2px;
    box-sizing: border-box;
}

.emega-main-menu .nav-item:hover .emega-main-menu__desktop-div,
.emega-main-menu .nav-item:focus-within .emega-main-menu__desktop-div {
    border-color: #fff;
}

.emega-main-menu .emega-main-menu__desktop-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 5px;
    margin: 5px 0 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    line-height: 1;
    box-sizing: border-box;
}

.emega-main-menu .emega-main-menu__desktop-link:hover,
.emega-main-menu .emega-main-menu__desktop-link:focus,
.emega-main-menu .emega-main-menu__desktop-link:active {
    color: #fff;
    background: transparent;
    text-decoration: none;
    box-shadow: none;
    outline: none;
}

.emega-main-menu .emega-main-menu__desktop-link#open-all-menu {
    font-weight: 700;
}

@media (max-width: 767px) {
    .emega-main-menu {
        display: none;
    }
}

/* =========================================================
   MOBILE MENU DRAWER — slides in from right
   top/bottom are set dynamically by JS to sit between
   the header search bar and the bottom nav
========================================================= */

/* -- Overlay -- */
.emega-mobile-menu__overlay {
    position: fixed;
    inset: 0; /* JS overrides top/bottom on open */
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 0.28s ease,
        visibility 0.28s ease;
    z-index: 10000;
}

.emega-mobile-menu__overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* -- Drawer shell -- */
.emega-mobile-menu__drawer {
    position: fixed;
    top: 0; /* overridden by JS on open */
    bottom: 0; /* overridden by JS on open */
    right: 0;
    left: auto;
    width: 88%;
    max-width: 390px;
    height: auto; /* controlled by top + bottom */
    background: #fff;
    transform: translateX(100%); /* off-screen to the right */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10002; /* above overlay (10000) and bottom nav (9999) */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: none;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}

.emega-mobile-menu__drawer.is-open {
    transform: translateX(0);
    pointer-events: auto;
}

/* -- Header bar -- */
.emega-mobile-menu__header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 4px;
    height: 52px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

/* -- Title -- */
.emega-mobile-menu__header-title {
    flex: 1;
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
}

/* -- Close button (left) -- */
.emega-mobile-menu__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #111827;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

/* -- Back button (right, hidden on L1) -- */
.emega-mobile-menu__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #111827;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.emega-mobile-menu__back.is-hidden {
    visibility: hidden;
    pointer-events: none;
}

/* -- Slide viewport -- */
.emega-mobile-menu__viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

/* -- Panels -- */
.emega-mobile-menu__panel {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
}

.emega-mobile-menu__panel--hidden {
    display: none;
}

/* -- List -- */
.emega-mobile-menu__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* -- Items -- */
.emega-mobile-menu__item {
    border-bottom: 1px solid #f1f5f9;
}

.emega-mobile-menu__item--view-all {
    background: #f8fafc;
    border-bottom: 2px solid #e5e7eb;
}

/* -- Links and slide-in buttons -- */
.emega-mobile-menu__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    padding: 14px 20px;
    font-size: 15px;
    line-height: 1.3;
    color: #111827;
    text-decoration: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-align: left;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.emega-mobile-menu__link:active {
    background: #f1f5f9;
}

.emega-mobile-menu__link--view-all {
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    min-height: 48px;
    padding: 12px 20px;
}

.emega-mobile-menu__link--has-sub {
    font-weight: 500;
}

/* -- Arrow -- */
.emega-mobile-menu__arrow {
    flex-shrink: 0;
    color: #9ca3af;
    margin-left: 8px;
}

/* -- Body scroll lock -- */
body.mobile-menu-open {
    overflow: hidden;
}

/* -- Desktop: hide drawer completely -- */
@media (min-width: 768px) {
    .emega-mobile-menu__overlay,
    .emega-mobile-menu__drawer {
        display: none !important;
    }
}
