.simple-category-mode {
    --simple-menu-dark: #07142f;
}

/*
 * منوی بلند باید همراه سند حرکت کند تا انتهای زیرشاخه‌ها با اسکرول صفحه
 * قابل دسترسی باشد؛ sticky بودن نوار اصلی، بخش پایینی منو را حبس می‌کرد.
 */
.simple-category-menu-host {
    position: relative;
    top: auto;
    overflow: visible;
}

.simple-category-menu-host .container-fluid,
.simple-category-menu-host .top-menu-parent,
.simple-category-menu-host .header-mega-pos,
.simple-category-menu-host .top-menu-menu,
.simple-category-menu-host .navbar-nav,
.simple-category-mode,
.simple-category-mode .custom-mega-grid,
.simple-category-mode .custom-mega-sidebar,
.simple-category-mode .custom-mega-categories {
    overflow: visible;
}

.simple-category-mode .simple-category-trigger {
    min-width: 215px;
    min-height: 48px;
    justify-content: center;
    background: var(--simple-menu-dark) !important;
    border: 1px solid var(--simple-menu-dark) !important;
    color: #fff !important;
    box-shadow: 0 8px 22px rgba(7, 20, 47, .16);
}

.simple-category-mode .simple-category-trigger:hover,
.simple-category-mode .simple-category-trigger:focus {
    background: #0d2149 !important;
    color: #fff !important;
}

.simple-category-trigger__arrow {
    margin-right: auto;
    font-size: 12px;
    transition: transform .2s ease;
}

.simple-category-mode:hover .simple-category-trigger__arrow {
    transform: rotate(180deg);
}

.simple-category-mode .simple-category-dropdown {
    top: calc(100% + 6px);
    right: 0;
    width: 310px;
    max-width: 310px;
    margin-top: 0;
    border: 0;
    border-radius: 14px;
    box-shadow: 0 16px 45px rgba(15, 23, 42, .18);
    overflow: visible;
}

/* پل نامرئی، فاصله ظاهری دکمه تا پنل را بدون قطع شدن hover پر می‌کند. */
.simple-category-mode .simple-category-dropdown::before {
    position: absolute;
    right: 0;
    bottom: 100%;
    width: 100%;
    height: 8px;
    content: "";
}

.simple-category-mode .custom-mega-grid {
    display: block;
    min-height: 0;
}

.simple-category-mode .custom-mega-sidebar {
    height: auto;
    max-height: none;
    overflow: visible;
    border: 0;
}

.simple-category-mode .custom-mega-categories {
    padding: 8px;
}

.simple-category-mode .custom-mega-category {
    position: relative;
    height: 32px;
    min-height: 32px;
    margin: 0 !important;
    padding: 0;
    background: transparent;
    border-radius: 9px;
}

/* پشتیبان HTML کش‌شده؛ بعد از Restart مقدار inline جایگزین همین مقادیر می‌شود. */
.simple-category-mode .custom-mega-category:nth-child(1) { --category-index: 0; }
.simple-category-mode .custom-mega-category:nth-child(2) { --category-index: 1; }
.simple-category-mode .custom-mega-category:nth-child(3) { --category-index: 2; }
.simple-category-mode .custom-mega-category:nth-child(4) { --category-index: 3; }
.simple-category-mode .custom-mega-category:nth-child(5) { --category-index: 4; }
.simple-category-mode .custom-mega-category:nth-child(6) { --category-index: 5; }
.simple-category-mode .custom-mega-category:nth-child(7) { --category-index: 6; }
.simple-category-mode .custom-mega-category:nth-child(8) { --category-index: 7; }
.simple-category-mode .custom-mega-category:nth-child(9) { --category-index: 8; }
.simple-category-mode .custom-mega-category:nth-child(10) { --category-index: 9; }
.simple-category-mode .custom-mega-category:nth-child(11) { --category-index: 10; }
.simple-category-mode .custom-mega-category:nth-child(12) { --category-index: 11; }

.simple-category-mode .custom-mega-category-link {
    height: 32px;
    min-height: 32px;
    padding: 3px 10px;
    border-radius: 9px;
    color: #1f2937;
    line-height: 1.2;
}

.simple-category-mode .custom-mega-category-link:hover,
.simple-category-mode .custom-mega-category:hover > .custom-mega-category-link {
    background: #f3f5f8;
    color: #b3001b;
}

.simple-category-mode .custom-mega-category-content {
    gap: 7px;
}

.simple-category-mode .custom-mega-category-content > i,
.simple-category-mode .custom-mega-category-link > i {
    font-size: 14px;
}

.simple-category-mode .custom-mega-category-content p {
    margin: 0;
    font-size: 15px;
    
    white-space: nowrap;
}

.simple-category-mode .custom-mega-main {
    display: none !important;
}

.top-menu-menu .simple-category-mode ul.simple-category-submenu {
    position: absolute;
    top: -8px;
    right: calc(100% - 2px);
    left: auto;
    z-index: 1060;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1px;
    width: 320px;
    max-height: none;
    height: auto;
    margin: 0;
    padding: 8px;
    list-style: none;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 45px rgba(15, 23, 42, .18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    flex: none;
    flex-flow: initial;
    align-content: initial;
    align-items: initial;
    transition: opacity .16s ease, visibility .16s ease, transform .16s ease;
    transform: translateX(6px);
}

/*
 * همه پنل‌های سطح دوم از بالای فهرست اصلی باز می‌شوند. به این ترتیب موقع
 * رفتن روی دسته‌های انتهایی، ابتدای زیرمنو بیرون viewport قرار نمی‌گیرد.
 */
.top-menu-menu .simple-category-mode .custom-mega-category > ul.simple-category-submenu {
    top: calc(-8px - (var(--category-index, 0) * 32px));
    max-height: none;
    overflow: visible;
}

.top-menu-menu .simple-category-mode ul.simple-category-submenu--nested {
    top: -8px;
    right: calc(100% - 2px);
    left: auto;
}

.top-menu-menu .simple-category-mode .custom-mega-category:hover > ul.simple-category-submenu,
.top-menu-menu .simple-category-mode .simple-category-submenu__item:hover > ul.simple-category-submenu,
.top-menu-menu .simple-category-mode .custom-mega-category:focus-within > ul.simple-category-submenu,
.top-menu-menu .simple-category-mode .simple-category-submenu__item:focus-within > ul.simple-category-submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}

.top-menu-menu .simple-category-mode ul.simple-category-submenu > li.simple-category-submenu__item {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 8px;
}

.top-menu-menu .simple-category-mode ul.simple-category-submenu > li.simple-category-submenu__item > .simple-category-submenu__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 35px;
    margin: 0;
    padding: 5px 10px;
    border-radius: 8px;
    color: #374151;
    font-size: 14px;
    
    line-height: 1.35;
    text-decoration: none;
}

.top-menu-menu .simple-category-mode ul.simple-category-submenu > li.simple-category-submenu__item > .simple-category-submenu__link:hover {
    color: #b3001b;
    background: #f3f5f8;
    transform: none;
}

.simple-category-view-all {
    margin-top: 5px;
    padding-top: 6px;
    border-top: 1px solid #edf0f4;
}

.simple-category-view-all a {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #b3001b;
    font-size: 13px;
    font-weight: 800;
}

@media (max-width: 1399.98px) {
    .simple-category-mode .simple-category-dropdown {
        width: 285px;
        max-width: 285px;
    }

    .top-menu-menu .simple-category-mode ul.simple-category-submenu {
        width: 300px;
    }
}
