/* ═══════════════════════════════════════════════════════
   Category Hierarchy – Mega-Menu Dropdown Styles
   ═══════════════════════════════════════════════════════ */

/* ── Desktop: Parent items with sub-menu ── */
.category-parent-item {
    position: relative;
}

.category-parent-item>.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 20px;
    font-weight: 500;
    color: #2c1810;
    transition: all 0.25s ease;
}

.category-parent-item>.dropdown-item i.cat-icon {
    width: 18px;
    text-align: center;
    color: #4d2600;
    font-size: 13px;
    opacity: 0.7;
    transition: opacity 0.25s;
}

.category-parent-item>.dropdown-item .cat-arrow {
    font-size: 10px;
    color: #999;
    transition: transform 0.25s ease, color 0.25s ease;
    margin-left: auto;
}

.category-parent-item:hover>.dropdown-item,
.category-parent-item:focus-within>.dropdown-item {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.06), rgba(196, 105, 8, 0.06));
    color: #4d2600;
}

.category-parent-item:hover>.dropdown-item i.cat-icon {
    opacity: 1;
}

.category-parent-item:hover>.dropdown-item .cat-arrow {
    transform: rotate(-90deg) translateX(2px);
    color: #4d2600;
}

/* ── Sub-menu (dropdown-submenu) ── */
.dropdown-submenu {
    position: absolute;
    top: -8px;
    left: 100%;
    min-width: 220px;
    background: #ffffff;
    border: none;
    border-radius: 10px;
    box-shadow: 0 12px 36px rgba(44, 24, 16, 0.15), 0 0 0 1px rgba(139, 69, 19, 0.06);
    padding: 8px 0;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(8px) scale(0.96);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2010;
    pointer-events: none;
}

.dropdown-submenu::before {
    content: '';
    position: absolute;
    top: 16px;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #ffffff;
    filter: drop-shadow(-3px 0 3px rgba(0, 0, 0, 0.05));
}

.category-parent-item:hover>.dropdown-submenu,
.category-parent-item:focus-within>.dropdown-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) scale(1);
    pointer-events: auto;
}

/* Sub-menu header */
.submenu-header {
    padding: 10px 18px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #4d2600;
    opacity: 0.65;
    border-bottom: 1px solid rgba(139, 69, 19, 0.08);
    margin-bottom: 4px;
}

/* Sub-menu items */
.dropdown-submenu .dropdown-item {
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 400;
    color: #444;
    transition: all 0.2s ease;
    position: relative;
}

.dropdown-submenu .dropdown-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: #4d2600;
    border-radius: 0 4px 4px 0;
    transition: height 0.2s ease;
}

.dropdown-submenu .dropdown-item:hover {
    background: rgba(139, 69, 19, 0.05);
    color: #4d2600;
    padding-left: 22px;
}

.dropdown-submenu .dropdown-item:hover::before {
    height: 18px;
}

/* "View All" link inside sub-menu */
.dropdown-submenu .submenu-view-all {
    margin-top: 4px;
    border-top: 1px solid rgba(139, 69, 19, 0.08);
    padding-top: 10px;
}

.dropdown-submenu .submenu-view-all .dropdown-item {
    font-weight: 600;
    color: #4d2600;
    font-size: 13px;
}

.dropdown-submenu .submenu-view-all .dropdown-item:hover {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.08), rgba(196, 105, 8, 0.08));
}

/* ── Main dropdown improvements ── */
#dynamicCategoryMenu {
    min-width: 240px;
    padding: 8px 0;
    border-radius: 12px;
    border: none;
    box-shadow: 0 12px 40px rgba(44, 24, 16, 0.16), 0 0 0 1px rgba(139, 69, 19, 0.05);
    max-height: 70vh;
    overflow-y: auto;
}

#dynamicCategoryMenu::-webkit-scrollbar {
    width: 4px;
}

#dynamicCategoryMenu::-webkit-scrollbar-track {
    background: transparent;
}

#dynamicCategoryMenu::-webkit-scrollbar-thumb {
    background: rgba(139, 69, 19, 0.2);
    border-radius: 10px;
}

/* Divider styling */
#dynamicCategoryMenu .dropdown-divider {
    margin: 6px 14px;
    border-color: rgba(139, 69, 19, 0.08);
}

/* ── Mobile sidebar: parent-child collapsible ── */
.sidebar-category-parent {
    position: relative;
}

.sidebar-category-parent>.sidebar-submenu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.sidebar-category-parent>.sidebar-submenu-link .sidebar-cat-arrow {
    font-size: 10px;
    color: #ccc;
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.3s ease, color 0.3s ease;
}

.sidebar-category-parent.open>.sidebar-submenu-link .sidebar-cat-arrow {
    transform: rotate(90deg);
    color: #ff6030;
}

.sidebar-subcategory-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-category-parent.open>.sidebar-subcategory-list {
    max-height: 500px;
}

.sidebar-subcategory-list li a {
    display: block;
    padding: 8px 16px 8px 36px;
    font-size: 13px;
    color: #666;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.sidebar-subcategory-list li a:hover,
.sidebar-subcategory-list li a.active {
    color: #4d2600;
    background: rgba(139, 69, 19, 0.04);
    border-left-color: #4d2600;
    padding-left: 40px;
}

/* ── Responsive overrides ── */
@media (max-width: 991.98px) {
    .dropdown-submenu {
        display: none !important;
    }
}

/* ── Animation: staggered sub-menu items entrance ── */
.dropdown-submenu .dropdown-item {
    opacity: 0;
    transform: translateX(6px);
    animation: none;
}

.category-parent-item:hover>.dropdown-submenu .dropdown-item {
    animation: submenuItemIn 0.25s ease forwards;
}

.category-parent-item:hover>.dropdown-submenu .dropdown-item:nth-child(1) {
    animation-delay: 0.02s;
}

.category-parent-item:hover>.dropdown-submenu .dropdown-item:nth-child(2) {
    animation-delay: 0.04s;
}

.category-parent-item:hover>.dropdown-submenu .dropdown-item:nth-child(3) {
    animation-delay: 0.06s;
}

.category-parent-item:hover>.dropdown-submenu .dropdown-item:nth-child(4) {
    animation-delay: 0.08s;
}

.category-parent-item:hover>.dropdown-submenu .dropdown-item:nth-child(5) {
    animation-delay: 0.10s;
}

.category-parent-item:hover>.dropdown-submenu .dropdown-item:nth-child(6) {
    animation-delay: 0.12s;
}

.category-parent-item:hover>.dropdown-submenu .dropdown-item:nth-child(7) {
    animation-delay: 0.14s;
}

.category-parent-item:hover>.dropdown-submenu .dropdown-item:nth-child(8) {
    animation-delay: 0.16s;
}

/* The header and view-all shouldn't be hidden */
.dropdown-submenu .submenu-header,
.dropdown-submenu .submenu-view-all .dropdown-item {
    opacity: 1;
    transform: none;
    animation: none;
}

@keyframes submenuItemIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Top nav: Mega-menu (ShopperStop-like) ── */
.sh-mega-nav {
    position: relative;
}

.sh-mega-nav>.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Turn the bootstrap dropdown menu into a mega panel */
.sh-mega-nav #dynamicCategoryMenu.sh-mega-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    width: min(980px, calc(100vw - 40px));
    padding: 18px 18px 16px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 22px 56px rgba(44, 24, 16, 0.18), 0 0 0 1px rgba(139, 69, 19, 0.05);
    border: none;
    display: block;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 3000;
}

.sh-mega-nav:hover #dynamicCategoryMenu.sh-mega-menu,
.sh-mega-nav:focus-within #dynamicCategoryMenu.sh-mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.sh-mega-nav #dynamicCategoryMenu.sh-mega-menu .dropdown-divider {
    margin: 12px 0;
}

.sh-mega-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px 22px;
}

.sh-mega-col-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
    color: #2c1810;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}

.sh-mega-col-title i {
    color: #4d2600;
    opacity: 0.9;
    font-size: 13px;
}

.sh-mega-links {
    display: grid;
    gap: 8px;
}

.sh-mega-links a {
    text-decoration: none;
    color: #6b4d3f;
    font-size: 13px;
    line-height: 1.2;
    padding: 4px 2px;
    border-radius: 8px;
    transition: background 0.18s ease, color 0.18s ease, padding 0.18s ease;
}

.sh-mega-links a:hover,
.sh-mega-links a:focus {
    background: rgba(139, 69, 19, 0.06);
    color: #4d2600;
    padding-left: 8px;
}

.sh-mega-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(139, 69, 19, 0.08);
}

.sh-mega-footer a {
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    color: #4d2600;
}

.sh-mega-footer a:hover {
    color: #4d2600;
}

@media (max-width: 991.98px) {
    .sh-mega-nav #dynamicCategoryMenu.sh-mega-menu {
        display: none;
    }
}

@media (max-width: 1199.98px) {
    .sh-mega-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .sh-mega-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .mega-menu-dropdown {
        bottom: 0;
        max-height: none;
    }
}