/* Mobile Bottom Navigation Styles */
#mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    height: 70px;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
}

.mbn-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #555;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    height: 100%;
    margin: 0 5px;
    border-radius: 12px;
    transition: background-color 0.2s ease, color 0.2s ease;
    position: relative;
    /* For badge positioning */
}

.mbn-item svg {
    width: 36px;
    height: 36px;
    fill: currentColor;
    transition: fill 0.2s ease;
}

/* Cart Badge */
.mbn-cart-count {
    position: absolute;
    top: 6px;
    right: 30%;
    /* Closer to the icon */
    /* Adjust based on icon width/padding */
    background-color: #ff0000;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 50%;
    text-align: center;
    padding: 0 4px;
    box-sizing: border-box;
    pointer-events: none;
}

/* Adjust right position for LTR if needed, but flex center usually keeps icon in middle */
/* In RTL, right is correct relative to the item box */

/* Hover/Active State - Light Grey Box */
.mbn-item:hover,
.mbn-item:focus {
    background-color: #f0f2f5;
    color: #333;
}

.mbn-item:hover svg,
.mbn-item:focus svg {
    fill: #333;
}


/* Sidebars */
.mbn-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 85%;
    max-width: 350px;
    background: #fff;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    padding: 0;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.mbn-sidebar.left {
    left: 0;
    transform: translateX(-100%);
}

.mbn-sidebar.right {
    right: 0;
    transform: translateX(100%);
}

.mbn-sidebar.open {
    transform: translateX(0);
}

/* Overlay */
.mbn-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.mbn-overlay.active {
    display: block;
}

/* Sidebar Header - CLEAN */
.mbn-sidebar-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 2px solid #f0f0f0;
    padding: 15px 20px;
    background: #fff;
    flex-shrink: 0;
    min-height: 50px;
}

/* If LTR override */
html[dir="ltr"] .mbn-sidebar-header {
    justify-content: flex-end;
}

.mbn-close-btn {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    color: #888;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background 0.2s;
}

.mbn-close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* Sidebar Content */
.mbn-sidebar-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding: 0;
}

.mbn-sidebar-content>* {
    margin: 15px;
}

.mbn-sidebar-content>div.widget,
.mbn-sidebar-content>.woocommerce-mini-cart {
    margin: 15px;
}

/* CART WIDGET FIXES */
/* 1. Reset standard widget styling that might be causing issues, but NOT buttons */
#mbn-cart-sidebar .widget,
#mbn-cart-sidebar .widget_shopping_cart_content,
#mbn-cart-sidebar .woocommerce-mini-cart {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* 2. Fix the "Big Ellipse" / Huge Link issue */
/* The 'remove' button (x). Constrain it. */
#mbn-cart-sidebar .woocommerce-mini-cart-item .remove {
    position: absolute !important;
    top: 5px !important;
    left: 10px !important;
    width: 24px !important;
    height: 24px !important;
    line-height: 22px !important;
    font-size: 18px !important;
    border-radius: 50% !important;
    border: 1px solid #ccc !important;
    text-align: center !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #fff !important;
    color: red !important;
    padding: 0 !important;
    margin: 0 !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 5;
    clip-path: none !important;
    shape-outside: none !important;
    box-shadow: none !important;
}

#mbn-cart-sidebar .woocommerce-mini-cart-item {
    position: relative !important;
    padding-left: 40px !important;
}

/* 3. Restore Buttons (Checkout/View Cart) */
/* 3. Restore Buttons (Checkout/View Cart) & Fix Alignment */
#mbn-cart-sidebar .buttons {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

#mbn-cart-sidebar .buttons .button,
#mbn-cart-sidebar .buttons .checkout {
    display: block !important;
    width: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 12px 0 !important;
    margin: 5px 0 !important;
    /* Uniform vertical spacing */
    border-radius: 4px !important;
    text-align: center !important;
    color: #fff !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
}

#mbn-cart-sidebar .buttons .checkout {
    background-color: #333 !important;
}

/* CUSTOM MENU STYLES */
.mbn-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mbn-menu-item {
    border-bottom: 1px solid #f9f9f9;
}

/* Link Styling + Box Hover */
.mbn-link {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    justify-content: flex-start;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
}

/* Hover State for Sidebar Items (Exclude colored items: PHP helper + CSS fallback) */
.mbn-menu-item:not(.mbn-has-color):not(.navy):not([class*="navy"]):not([class*="green"]):not([class*="blue"]):not([class*="dark"]) .mbn-link:hover,
.mbn-menu-item:not(.mbn-has-color):not(.navy):not([class*="navy"]):not([class*="green"]):not([class*="blue"]):not([class*="dark"]) .mbn-link:focus {
    background-color: #f7f7f7;
    color: #000;
}

/* DARK MODE / COLORED BANNER FIXES */
/* DARK MODE / COLORED BANNER FIXES */
/* DARK MODE / COLORED BANNER FIXES (PHP + CSS Fallback) */
.mbn-menu-item.mbn-has-color .mbn-link,
.mbn-menu-item.navy .mbn-link,
.mbn-menu-item[class*="navy"] .mbn-link,
.mbn-menu-item[class*="green"] .mbn-link,
.mbn-menu-item[class*="blue"] .mbn-link,
.mbn-menu-item[class*="dark"] .mbn-link {
    color: #fff !important;
}

.mbn-menu-item.mbn-has-color .mbn-desc,
.mbn-menu-item.navy .mbn-desc,
.mbn-menu-item[class*="navy"] .mbn-desc {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Hover for Colored Banners: SUBTLEDARKENING + MOBILE FIXES */
.mbn-menu-item.mbn-has-color .mbn-link:hover,
.mbn-menu-item.mbn-has-color .mbn-link:active,
.mbn-menu-item.mbn-has-color .mbn-link:focus,
.mbn-menu-item.navy .mbn-link:hover,
.mbn-menu-item.navy .mbn-link:active,
.mbn-menu-item.navy .mbn-link:focus,
.mbn-menu-item[class*="navy"] .mbn-link:hover,
.mbn-menu-item[class*="navy"] .mbn-link:active,
.mbn-menu-item[class*="navy"] .mbn-link:focus,
.mbn-menu-item[class*="green"] .mbn-link:hover,
.mbn-menu-item[class*="green"] .mbn-link:active,
.mbn-menu-item[class*="green"] .mbn-link:focus {
    filter: brightness(0.8) !important;
    background-color: transparent !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Force Cart Widget Display even on Cart/Checkout Pages */
#mbn-cart-sidebar .widget_shopping_cart,
#mbn-cart-sidebar .woocommerce-mini-cart {
    display: block !important;
}

/* ROOT ITEMS STYLING */
.mbn-root-item>.mbn-link {
    padding: 12px 15px;
    min-height: 55px;
}

.mbn-root-item>.mbn-link .mbn-title {
    font-size: 15px;
    font-weight: 700;
}

.mbn-root-icon {
    margin-left: 10px;
    display: flex;
    align-items: center;
}

.mbn-root-icon svg {
    width: 24px;
    height: 24px;
    fill: #555;
}

.mbn-root-item>.mbn-link:hover .mbn-root-icon svg {
    fill: #000;
}

.mbn-root-item.mbn-has-color .mbn-root-icon svg {
    fill: rgba(255, 255, 255, 0.9);
}


/* Text Wrapper */
.mbn-text-wrap {
    display: flex;
    flex-direction: column;
    text-align: right;
    flex-grow: 1;
    padding: 0 10px;
    width: 100%;
}

/* Title Styling */
.mbn-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: relative;
    margin: 0;
}

/* Badge Styling */
.mbn-title .badge,
.mbn-title span[class*="badge"],
.mbn-title .menu-image-badge,
.mbn-title>span:not(.mbn-text) {
    position: static !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    min-width: 35px;
    height: auto !important;
    padding: 3px 6px !important;

    margin-right: 10px;
    margin-left: 0;

    font-size: 11px !important;
    line-height: 1.2 !important;
    font-weight: bold;
    border-radius: 4px;
}

/* Sticky Fixes */
.mbn-sidebar-content * {
    position: static !important;
}

.mbn-sidebar,
.mbn-sidebar-header,
.mbn-close-btn,
.mbn-sub-menu-wrapper {
    position: fixed !important;
}

.mbn-sidebar-content {
    position: relative !important;
}

.mbn-menu-item {
    position: relative !important;
}

/* Re-enable position for close button inside cart items? No, close button uses absolute. 
   Wait, "position: static !important" on .mbn-sidebar-content * might break the absolute remove button!
   FIX: Allow position absolute specifically for .remove */
#mbn-cart-sidebar .woocommerce-mini-cart-item .remove {
    position: absolute !important;
}


/* Description Styling - COMPACT */
.mbn-desc {
    display: block;
    font-size: 11px;
    color: inherit;
    opacity: 0.8;
    margin-top: 2px;
    font-weight: normal;
    line-height: 1.2;
}

/* Arrow Icon Handling */
.mbn-arrow-icon {
    margin-right: auto;
    display: flex;
    align-items: center;
}

.mbn-arrow-icon svg {
    width: 20px;
    height: 20px;
    fill: #999;
}

/* Ensure Arrow is Light on Dark Banners */
.mbn-menu-item[class*="navy"] .mbn-arrow-icon svg,
.mbn-menu-item[class*="blue"] .mbn-arrow-icon svg,
.mbn-menu-item[class*="dark"] .mbn-arrow-icon svg,
.mbn-menu-item[class*="green"] .mbn-arrow-icon svg {
    fill: rgba(255, 255, 255, 0.7);
}


/* Submenu Wrapper (Drill Down) */
.mbn-sub-menu-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 10;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mbn-sub-menu-wrapper.open {
    transform: translateX(0);
}

/* Back Header */
.mbn-back-header {
    padding: 15px 20px;
    background: #fff;
    border-bottom: 2px solid #f0f0f0;
    color: #333;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 14px;
    min-height: 50px;
}

.mbn-back-icon svg {
    width: 20px;
    height: 20px;
    margin-left: 10px;
    vertical-align: middle;
}

/* Submenu Lists */
.mbn-sub-menu-wrapper .mbn-menu-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Fix Horizontal Scroll for Mega Menu Content */
.mbn-menu-item img,
.mbn-menu-item video {
    max-width: 100%;
    height: auto;
}

.mbn-menu-item .widget,
.mbn-menu-item .elementor-widget {
    width: 100%;
    max-width: 100%;
}

/* Show only on Mobile */
@media (max-width: 768px) {
    #mobile-bottom-nav {
        display: flex;
    }

    body {
        padding-bottom: 70px;
    }
}